public function render() { $template = $this->getTemplate(); $template->setFile(__DIR__ . '/templates/table.latte'); if (!$this->presenter->isAjax()) { $this->items = $this->itemFacade->generateEntireTable($this->listing); } else { $this->items = $this->itemFacade->createListingItemDecoratorsCollection($this->items); } $template->itemsCollection = $this->items; $template->workedDays = $this->workedDays; $template->totalWorkedHours = $this->totalWorkedHours; $template->isTableCaptionVisible = $this->isTableCaptionVisible; $template->showCheckBoxes = $this->showCheckBoxes; $template->showActions = $this->showActions; $template->parameters = $this->parameters; $template->listing = $this->listing; $template->numberOfDaysInMonth = $this->listing->getNumberOfDaysInMonth(); $template->render(); }
public function generatePdf(SubmitButton $button) { $values = $button->getForm()->getValues(); $template = $this->createTemplate()->setFile(__DIR__ . '/../templates/Listing/pdf.latte'); $template->itemsCollection = $this->itemFacade->generateEntireTable($this->listing); $template->listing = $this->listing; $template->username = $values['name'] == null ?: $values['name']; $template->employer = $values['employer']; $template->employeeName = $values['name']; $template->wage = $values['wage']; $template->otherHours = $values['otherHours']; $template->workedHours = $values['workedHours']; $template->lunchHours = $values['lunch']; $pdf = new \PdfResponse\PdfResponse($template); $this->presenter->sendResponse($pdf); }