Guest User

Untitled

a guest
Jul 15th, 2012
52
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.92 KB | None | 0 0
  1.  
  2. public function handleExportToCockatrice() {
  3. header('Content-type: text/xml');
  4. header('Pragma: public');
  5. header('Cache-control: private');
  6. header('Expires: -1');
  7. header("Content-disposition: attachment;filename=\"cardsTcg.xml\"");
  8. $this->setLayout("xml");
  9.  
  10. $cards = $this->db->table("cards");
  11. $cardsPath = array();
  12. foreach ($cards as $card) {
  13. $fileName = str_replace(array('ě', 'š', 'č', "ř", "ž", "ý", "á", "í", "é"), array('e', 's', 'c', "r", "z", "y", "a", "i", "e"), $card->name);
  14. $fileName = preg_replace('/[^a-z0-9]+/', '_', strtolower($fileName));
  15. $url = $this->getContext()->httpRequest->getUrl()->getBaseUrl();
  16.  
  17. $cardsPath[$card->id] = $url . "cards/" . $fileName . ".png";
  18. }
  19.  
  20. $this->template->cardsXml = $cards;
  21. $this->template->paths = $cardsPath;
  22. }
Advertisement
Add Comment
Please, Sign In to add comment