HosipLan

Untitled

Jul 15th, 2012
103
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.     public function handleExportToCockatrice()
  2.     {
  3.     $template = $this->createTemplate();
  4.     $template->setFile('...');
  5.  
  6.     $cards = $this->db->table("cards");
  7.         $cardsPath = array();
  8.         foreach ($cards as $card) {
  9.             $cardsPath[$card->id] = $url . "cards/" . Nette\Utils\Strings::webalize($card->name) . ".png";
  10.         }
  11.  
  12.         $template->cardsXml = $cards;
  13.         $template->paths = $cardsPath;
  14.  
  15.     $tmpFile = $this->context->expand('%tempDir%/cardXml/' . $this->user->id '.xml');
  16.     $template->save($tmpFile);
  17.  
  18.     $this->sendResponse(new FileReponse($tmpFile));
  19.     }
Advertisement
Add Comment
Please, Sign In to add comment