*/ /** * Klasa stInvoiceFrontendActions. * * @package stInvoicePlugin * @subpackage actions */ class stOrderPrintPdfActions extends stActions { public function executeShow() { sfLoader::loadHelpers('Helper'); sfLoader::loadHelpers('Partial'); sfLoader::loadHelpers('stPartial'); $order_id = $this->getRequestParameter('id',null); $download = $this->getRequestParameter('download',false); if (!$order_id || !OrderPeer::retrieveByIdAndHashCode($order_id, $this->getRequestParameter('hash_code'))) {return $this->redirect('stOrderBackend');} $order = new stOrderPrintPdf($order_id); $response = $this->getResponse(); $response->clearHttpHeaders(); $response->setHttpHeader('Content-Type', 'application/pdf'); $response->setHttpHeader('X-Robots-Tag', 'noindex'); if ($download) { $response->setHttpHeader('Content-Disposition', 'attachment;filename="order-'.$order_id.'.pdf'); } $check_order = OrderPeer::retrieveByIdAndHashCode($order_id, $this->getRequestParameter('hash_code')); if($check_order->getSessionHash()==session_id()){ return $this->renderText($order->renderOrder()); }else{ return $this->redirect('stOrderBackend'); } } }