} } else { if ($Module->isCurrentAction('Discard')) { $pdfExport->remove(); return $Module->redirect('pdf', 'list'); } } } $tpl = eZTemplate::factory(); $tpl->setVariable('set_warning', $setWarning); // Get Classes and class attributes $classArray = eZContentClass::fetchList(); $tpl->setVariable('pdf_export', $pdfExport); $tpl->setVariable('export_type', $pdfExport->attribute('status')); $tpl->setVariable('export_class_array', $classArray); $tpl->setVariable('pdfexport_list', eZPDFExport::fetchList()); if (!$inputValidated) { $tpl->setVariable('validation', $validation); } $Result = array(); $Result['content'] = $tpl->fetch('design:pdf/edit.tpl'); $Result['path'] = array(array('url' => false, 'text' => ezpI18n::tr('pdf/edit', 'PDF Export'))); /*! \generate and output PDF data, either to file or stream \param PDF export object \param toFile, false if generate to stream, $ filename if generate to file */ function generatePDF($pdfExport, $toFile = false) {
function countGeneratingOnceExports($filename = '') { $conditions = array('version' => eZPDFExport::VERSION_VALID, 'status' => eZPDFExport::CREATE_ONCE, 'pdf_filename' => $filename); if ($filename === '' && isset($this)) { $conditions['pdf_filename'] = $this->attribute('pdf_filename'); $conditions['id'] = array('<>', $this->attribute('id')); } $queryResult = eZPersistentObject::fetchObjectList(eZPDFExport::definition(), array(), $conditions, false, null, false, null, array(array('operation' => 'count( * )', 'name' => 'count'))); if (isset($queryResult[0]['count'])) { return (int) $queryResult[0]['count']; } return 0; }
$Module = $Params['Module']; // Create new PDF Export if ($Module->isCurrentAction('NewExport')) { return $Module->redirect('pdf', 'edit'); } else { if ($Module->isCurrentAction('RemoveExport') && $Module->hasActionParameter('DeleteIDArray')) { $deleteArray = $Module->actionParameter('DeleteIDArray'); foreach ($deleteArray as $deleteID) { // remove draft if it exists: $pdfExport = eZPDFExport::fetch($deleteID, true, eZPDFExport::VERSION_DRAFT); if ($pdfExport) { $pdfExport->remove(); } // remove default version: $pdfExport = eZPDFExport::fetch($deleteID); if ($pdfExport) { $pdfExport->remove(); } } } } $exportArray = eZPDFExport::fetchList(); $exportList = array(); foreach ($exportArray as $export) { $exportList[$export->attribute('id')] = $export; } $tpl = eZTemplate::factory(); $tpl->setVariable('pdfexport_list', $exportList); $Result = array(); $Result['content'] = $tpl->fetch("design:pdf/list.tpl"); $Result['path'] = array(array('url' => 'kernel/pdf', 'text' => ezpI18n::tr('kernel/pdf', 'PDF Export')));