invoicepdforder_overview.php

Go to the documentation of this file.
00001 <?php
00002 
00006 class InvoicepdfOrder_Overview extends InvoicepdfOrder_Overview_parent
00007 {
00008 
00014     public function render()
00015     {
00016         $return = parent::render();
00017 
00018         $oLang = oxRegistry::getLang();
00019         $this->_aViewData["alangs"] = $oLang->getLanguageNames();
00020 
00021         return $return;
00022     }
00023 
00027     public function createPDF()
00028     {
00029         $soxId = $this->getEditObjectId();
00030         if ($soxId != "-1" && isset($soxId)) {
00031             // load object
00032             $oOrder = oxNew("oxorder");
00033             if ($oOrder->load($soxId)) {
00034                 $oUtils = oxRegistry::getUtils();
00035                 $sTrimmedBillName = trim($oOrder->oxorder__oxbilllname->getRawValue());
00036                 $sFilename = $oOrder->oxorder__oxordernr->value . "_" . $sTrimmedBillName . ".pdf";
00037                 $sFilename = $this->makeValidFileName($sFilename);
00038                 ob_start();
00039                 $oOrder->genPDF($sFilename, oxRegistry::getConfig()->getRequestParameter("pdflanguage"));
00040                 $sPDF = ob_get_contents();
00041                 ob_end_clean();
00042                 $oUtils->setHeader("Pragma: public");
00043                 $oUtils->setHeader("Cache-Control: must-revalidate, post-check=0, pre-check=0");
00044                 $oUtils->setHeader("Expires: 0");
00045                 $oUtils->setHeader("Content-type: application/pdf");
00046                 $oUtils->setHeader("Content-Disposition: attachment; filename=" . $sFilename);
00047                 oxRegistry::getUtils()->showMessageAndExit($sPDF);
00048             }
00049         }
00050     }
00051 }