public function sendStitky() { $items = $this->context->database->fetchAll($this->sql . $this['form']['sql']->value); $adresy = array(); foreach ($items as $item) { if ($this->type === 'riesitelia') { $nazov = "{$item['meno']} {$item['priezvisko']}"; } else { $nazov = "{$item['nazov']}"; } $adresy[] = array("{$nazov}", "{$item['ulica']}", "{$item['psc']}, {$item['mesto']}", ""); } $file = \Stitky::renderStitky($adresy, 3, 8); $response = new \Nette\Application\Responses\FileResponse($file, "stitky.pdf"); $this->sendResponse($response); unlink($file); //$this->template->result = $adresy; }
public function sendStitky() { $model = $this->createGridModel(); $items = $model->getItems(); $adresy = array(); foreach ($items as $item) { if ($item['submit'] == '0') { $adresy[] = array("{$item['meno']} {$item['priezvisko']}", "{$item['ulica']}", "{$item['psc']}, {$item['mesto']}", ""); } } $file = \Stitky::renderStitky($adresy, 3, 8); $response = new \Nette\Application\Responses\FileResponse($file, "stitky.pdf"); $this->sendResponse($response); unlink($file); }