OXID eShop CE  4.10.5
 All Classes Namespaces Files Functions Variables Pages
invoicepdforder_overview.php
Go to the documentation of this file.
1 <?php
2 
7 {
8 
14  public function render()
15  {
16  $return = parent::render();
17 
18  $oLang = oxRegistry::getLang();
19  $this->_aViewData["alangs"] = $oLang->getLanguageNames();
20 
21  return $return;
22  }
23 
27  public function createPDF()
28  {
29  $soxId = $this->getEditObjectId();
30  if ($soxId != "-1" && isset($soxId)) {
31  // load object
32  $oOrder = oxNew("oxorder");
33  if ($oOrder->load($soxId)) {
34  $oUtils = oxRegistry::getUtils();
35  $sTrimmedBillName = trim($oOrder->oxorder__oxbilllname->getRawValue());
36  $sFilename = $oOrder->oxorder__oxordernr->value . "_" . $sTrimmedBillName . ".pdf";
37  $sFilename = $this->makeValidFileName($sFilename);
38  ob_start();
39  $oOrder->genPDF($sFilename, oxRegistry::getConfig()->getRequestParameter("pdflanguage"));
40  $sPDF = ob_get_contents();
41  ob_end_clean();
42  $oUtils->setHeader("Pragma: public");
43  $oUtils->setHeader("Cache-Control: must-revalidate, post-check=0, pre-check=0");
44  $oUtils->setHeader("Expires: 0");
45  $oUtils->setHeader("Content-type: application/pdf");
46  $oUtils->setHeader("Content-Disposition: attachment; filename=" . $sFilename);
47  oxRegistry::getUtils()->showMessageAndExit($sPDF);
48  }
49  }
50  }
51 }