public function reportUnsubscibePDFAction()
 {
     $this->accessRights(20);
     //Accept Parent Module, Return Main Menu Lists with Active Menu Indicator
     $this->adapter = $this->getServiceLocator()->get('Zend\\Db\\Adapter\\Adapter');
     $pdf = new PdfModel();
     $pdf->setOption('filename', 'unsubscribed-report');
     // Triggers PDF download, automatically appends ".pdf"
     $pdf->setOption('paperSize', 'a4');
     // Defaults to "8x11"
     $pdf->setOption('paperOrientation', 'portrait');
     // Defaults to "portrait"
     $pdf->setTemplate('report/unsubscribed_report_pdf');
     $this->adapter = $this->getServiceLocator()->get('Zend\\Db\\Adapter\\Adapter');
     $usform = new MandrillInfoForm();
     //Get Post Data & Redirect to Filter Function
     $request = $this->getRequest();
     //Get form object
     if ($request->isPost()) {
         $from = $_POST['unsubscribe_from'];
         $to = $_POST['unsubscribe_to'];
         $usform->get('from')->setValue($from);
         $usform->get('to')->setValue($to);
         $result = $this->getUnsubscribeTable()->UnsubscribeList($this->adapter, $from, $to);
     }
     $pdf->setVariables(array('header' => 'Unsubscribed Report', 'unsubscribe_table' => $result));
     $this->downloadFile('unsubscribed-report.pdf');
     //Download File
     return $pdf;
 }
Beispiel #2
0
 public function testResponseHeadersWithFileName()
 {
     $model = new PdfModel();
     $model->setTemplate('basic.phtml');
     $model->setOption('filename', 'testPdfFileName');
     $this->event->setModel($model);
     $this->event->setResponse($this->response);
     $this->event->setRenderer($this->renderer);
     $this->event->setResult($this->renderer->render($model));
     $this->strategy->injectResponse($this->event);
     $headers = $this->event->getResponse()->getHeaders();
     $contentDispositionHeader = $headers->get('Content-Disposition');
     $this->assertInstanceof('Zend\\Http\\Header\\ContentDisposition', $contentDispositionHeader);
     $this->assertEquals($contentDispositionHeader->getFieldValue(), 'attachment; filename=testPdfFileName.pdf');
 }
 public function pdfAction()
 {
     $this->initializeFrontendWebsite();
     $id = $this->params()->fromRoute('id');
     $em = $this->getServiceLocator()->get('doctrine.entitymanager.orm_default');
     $helper = new ContenutiControllerHelper();
     $wrapper = $helper->recoverWrapperById(new ContenutiGetterWrapper(new ContenutiGetter($em)), array('id' => $id, 'limit' => 1), $id);
     $wrapper->setEntityManager($em);
     $records = $wrapper->addAttachmentsFromRecords($wrapper->getRecords(), array());
     if (empty($records)) {
         return $this->redirectForUnvalidAccess();
     }
     $pdf = new PdfModel();
     $pdf->setOption('filename', Slugifier::slugify($records[0]['titolo']));
     $pdf->setOption('paperSize', 'a4');
     $pdf->setOption('paperOrientation', 'landscape');
     $pdf->setVariables(array('record' => !empty($records) ? $records[0] : null, 'sitename' => $this->layout()->getVariable('sitename')));
     $pdf->setTemplate('common/export/contenuti/contenuti-single-pdf.phtml');
     return $pdf;
 }
 public function reportBuCsrPDFAction()
 {
     $this->accessRights(20);
     //Accept Parent Module, Return Main Menu Lists with Active Menu Indicator
     $pdf = new PdfModel();
     $pdf->setOption('filename', 'bu-csr-overall-report');
     // Triggers PDF download, automatically appends ".pdf"
     $pdf->setOption('paperSize', 'a4');
     // Defaults to "8x11"
     $pdf->setOption('paperOrientation', 'landscape');
     // Defaults to "portrait"
     $pdf->setTemplate('report/bu_csr_overall_pdf');
     //Get Post Data & Redirect to Filter Function
     $request = $this->getRequest();
     //Get form object
     if ($request->isPost()) {
         // To set view variables
         $pdf->setVariables(array('title' => 'BU-CSR Report: Overall Report', 'header' => 'Overall Report', 'media_value_image' => $request->getPost('media_value_image'), 'hits_image' => $request->getPost('hits_image')));
     }
     $this->downloadFile('bu-csr-overall-report.pdf');
     //Download File
     return $pdf;
 }
 public function exportProfilePdfAction()
 {
     $this->accessRights(17);
     //Accept Parent Module, Return Main Menu Lists with Active Menu Indicator
     $pdf = new PdfModel();
     $pdf->setOption('filename', 'Media-profile-pdf');
     // Triggers PDF download, automatically appends ".pdf"
     $pdf->setOption('paperSize', 'a4');
     // Defaults to "8x11"
     $pdf->setOption('paperOrientation', 'landscape');
     // Defaults to "portrait"
     $pdf->setTemplate('media-profile/media_profile_pdf');
     $id = (int) $this->params()->fromRoute('id', 0);
     //relation or friend of a specific profile
     $relation_name = $this->getMediaProfileTable()->fetchSpecificRelation($this->serviceLocator(), $id);
     //get specific media profile from table
     $media_profile = $this->getMediaProfileTable()->getMediaProfile($this->serviceLocator(), $id);
     //Get Post Data & Redirect to Filter Function
     $request = $this->getRequest();
     //Get form object
     if ($request->isPost()) {
         // To set view variables
         $pdf->setVariables(array('title' => 'Media Redbook', 'header' => 'Media Profile', 'media_profile' => $media_profile, 'media_profile_id' => $id, 'media_profile_educations' => $this->getMediaProfileTable()->getMediaProfileEducation($this->serviceLocator(), $id), 'media_profile_careers' => $this->getMediaProfileTable()->getMediaProfileCareer($this->serviceLocator(), $id), 'media_profile_latest_career' => $this->getMediaProfileTable()->getMediaProfileLatestCareer($this->serviceLocator(), $id), 'access_rights' => $this->getSubModuleAccessRights(17), 'relation_name' => $relation_name));
     }
     $this->downloadFile('media_profile.pdf');
     //Download File
     return $pdf;
 }
 public function perCompanyPDFAction()
 {
     $this->accessRights(20);
     //Accept Parent Module, Return Main Menu Lists with Active Menu Indicator
     $pdf = new PdfModel();
     $pdf->setOption('filename', 'bu_csr_report_per_company' . date('Y-m-d'));
     // Triggers PDF download, automatically appends ".pdf"
     $pdf->setOption('paperSize', 'a4');
     // Defaults to "8x11"
     $pdf->setOption('paperOrientation', 'landscape');
     // Defaults to "portrait"
     $pdf->setTemplate('report/bu_csr_per_company_pdf');
     //Get Post Data & Redirect to Filter Function
     $request = $this->getRequest();
     //Get form object
     //Date Range Function
     $date_from = $request->getPost('date_from');
     $date_to = $request->getPost('date_to');
     //Graph images
     $mv_image = $this->saveTempImg($request->getPost('mv_image'));
     $hits_image = $this->saveTempImg($request->getPost('hits_image'));
     if ($request->isPost()) {
         // To set view variables
         $pdf->setVariables(array('title' => 'BU Overall Report Per Company', 'header' => 'BU Overall Per Company', 'mv_image' => $mv_image, 'hits_image' => $hits_image, 'top_5_media_values' => $this->getBuCsrTable()->top5Values('Media Values', 0, $date_from, $date_to), 'top_5_hits' => $this->getBuCsrTable()->top5Values('Hits', 0, $date_from, $date_to), 'media_values' => $this->getBuCsrTable()->top5Details('Media Values', $date_from, $date_to, $this->getBuCsrTable()->top5Values('Media Values', 0, $date_from, $date_to)), 'hits_values' => $this->getBuCsrTable()->top5Details('Hits', $date_from, $date_to, $this->getBuCsrTable()->top5Values('Hits', 0, $date_from, $date_to))));
     }
     $this->downloadFile('bu-overall-report-per-company.pdf');
     //Download File
     return $pdf;
 }
 public function reportEventListPDFAction()
 {
     $this->accessRights(20);
     //Accept Parent Module, Return Main Menu Lists with Active Menu Indicator
     $pdf = new PdfModel();
     $pdf->setOption('filename', 'event-list-report');
     // Triggers PDF download, automatically appends ".pdf"
     $pdf->setOption('paperSize', 'a4');
     // Defaults to "8x11"
     $pdf->setOption('paperOrientation', 'landscape');
     // Defaults to "portrait"
     $pdf->setTemplate('media-report/event_list_pdf');
     $media_report = new MediaReport($this->serviceLocator());
     $event_list = $media_report->eventList();
     //Get Post Data & Redirect to Filter Function
     $request = $this->getRequest();
     //Get form object
     if ($request->isPost()) {
         // To set view variables
         $pdf->setVariables(array('title' => 'Media Redbook', 'header' => 'Event List', 'event_list_value_image' => $request->getPost('event_list_image'), 'events' => $event_list));
     }
     $this->downloadFile('event-list-report.pdf');
     //Download File
     return $pdf;
 }