Example #1
0
 /**
  * Overwriting the render method to generate a downloadable output
  *
  * @return  void (never returns)
  */
 public function render()
 {
     ob_clean();
     $outputData = parent::render();
     $this->sendHeader($this->getFilenameFromTs());
     $out = fopen('php://output', 'w');
     fwrite($out, $outputData);
     fclose($out);
     exit;
 }
Example #2
0
 /**
  * Init the configuration for CSVExport
  */
 public function initConfiguration()
 {
     parent::initConfiguration();
     if ($this->exportConfiguration->getSettings('outputEncoding')) {
         $this->outputEncoding = $this->exportConfiguration->getSettings('outputEncoding');
     }
     if ($this->exportConfiguration->getSettings('delimiter')) {
         $this->delimiter = $this->exportConfiguration->getSettings('delimiter');
     }
     if ($this->exportConfiguration->getSettings('enclosure')) {
         $this->enclosure = $this->exportConfiguration->getSettings('enclosure');
     }
 }
Example #3
0
 /**
  * Returns download for given parameters
  *
  * @return string
  * @throws Exception
  */
 public function downloadAction()
 {
     if ($this->listIdentifier == $this->exportListIdentifier || !$this->exportListIdentifier) {
         $list = $this->listFactory->createList($this->dataBackend, $this->configurationBuilder);
     } else {
         $exportListConfiguration = $this->settings['listConfig'][$this->exportListIdentifier];
         if (!is_array($exportListConfiguration)) {
             throw new Exception('No export list configuration found for listIdentifier ' . $this->exportListIdentifier, 1317116470);
         }
         $extListContext = Tx_PtExtlist_ExtlistContext_ExtlistContextFactory::getContextByCustomConfiguration($exportListConfiguration, $this->listIdentifier, false);
         $list = $extListContext->getList(true);
     }
     $this->view->setExportConfiguration($this->configurationBuilder->buildExportConfiguration());
     $this->view->initConfiguration();
     $this->view->assign('listHeader', $list->getListHeader());
     $this->view->assign('listCaptions', $list->getRenderedListHeader());
     $this->view->assign('listData', $list->getRenderedListData());
     $this->view->assign('aggregateRows', $list->getRenderedAggregateListData());
     return $this->view->render();
 }
Example #4
0
 /**
  * Overwriting the render method to generate a CSV output
  *
  * @return  void (never returns)
  */
 public function render()
 {
     $this->loadDomPDFClasses();
     $this->assign('csssFilePath', $this->cssFilePath);
     $html = parent::render();
     ob_clean();
     if ((int) \TYPO3\CMS\Core\Utility\GeneralUtility::_GET('showHTML') == 1) {
         $relativePath = str_replace($_SERVER['DOCUMENT_ROOT'], '', $this->cssFilePath);
         $html = str_replace($this->cssFilePath, $relativePath, $html);
         die($html);
     }
     $dompdf = new DOMPDF();
     $dompdf->set_paper($this->paperSize, $this->paperOrientation);
     $dompdf->load_html($html);
     $dompdf->render();
     $dompdf->stream("test" . time() . '.pdf', array("Attachment" => 0));
     exit;
 }
 /**
  * Template method that renders the html source which is converted to PDF.
  *
  * Can be overwritten in extending classes to change behaviour of HTML rendering.
  *
  * @return string
  */
 protected function renderHtml()
 {
     return parent::render();
 }