Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public function handleExportToCockatrice() {
- header('Content-type: text/xml');
- header('Pragma: public');
- header('Cache-control: private');
- header('Expires: -1');
- header("Content-disposition: attachment;filename=\"cardsTcg.xml\"");
- $this->setLayout("xml");
- $cards = $this->db->table("cards");
- $cardsPath = array();
- foreach ($cards as $card) {
- $fileName = str_replace(array('ě', 'š', 'č', "ř", "ž", "ý", "á", "í", "é"), array('e', 's', 'c', "r", "z", "y", "a", "i", "e"), $card->name);
- $fileName = preg_replace('/[^a-z0-9]+/', '_', strtolower($fileName));
- $url = $this->getContext()->httpRequest->getUrl()->getBaseUrl();
- $cardsPath[$card->id] = $url . "cards/" . $fileName . ".png";
- }
- $this->template->cardsXml = $cards;
- $this->template->paths = $cardsPath;
- }
Advertisement
Add Comment
Please, Sign In to add comment