示例#1
0
 /**
  * Add buttons to the view e.g. print, pdf
  *
  * @return  void
  */
 protected function _addButtons()
 {
     $input = $this->app->input;
     if ($input->get('format') === 'pdf') {
         // If we're rendering as PDF, no point showing any buttons
         $this->showEmail = false;
         $this->showPrint = false;
         $this->showPDF = false;
         return;
     }
     $fbConfig = JComponentHelper::getParams('com_fabrik');
     /** @var FabrikFEModelForm $model */
     $model = $this->getModel();
     $params = $model->getParams();
     $this->showEmail = $params->get('email', $fbConfig->get('form_email', 0));
     $this->emailLink = '';
     $this->printLink = '';
     $this->pdfLink = '';
     $this->pdfURL = '';
     $this->emailURL = '';
     $this->printURL = '';
     $this->showPrint = $params->get('print', $fbConfig->get('form_print', 0));
     if ($this->showPrint) {
         $text = FabrikHelperHTML::image('print.png');
         $this->printLink = '<a href="#" class="btn btn-default" class="printlink" onclick="window.print();return false;">' . $text . '</a>';
     }
     if ($input->get('tmpl') != 'component') {
         if ($this->showEmail) {
             $this->emailLink = FabrikHelperHTML::emailIcon($model, $params);
             $this->emailURL = FabrikHelperHTML::emailURL($model);
         }
         if ($this->showPrint) {
             $this->printLink = FabrikHelperHTML::printIcon($model, $params);
             $this->printURL = FabrikHelperHTML::printURL($model);
         }
     }
     $this->showPDF = $params->get('pdf', $fbConfig->get('form_pdf', false));
     if ($this->showPDF) {
         FabrikWorker::canPdf();
         if ($this->app->isAdmin()) {
             $this->pdfURL = 'index.php?option=com_' . $this->package . '&task=details.view&format=pdf&formid=' . $model->getId() . '&rowid=' . $model->getRowId();
         } else {
             $this->pdfURL = 'index.php?option=com_' . $this->package . '&view=details&formid=' . $model->getId() . '&rowid=' . $model->getRowId() . '&format=pdf';
         }
         $this->pdfURL = JRoute::_($this->pdfURL);
         $layout = FabrikHelperHTML::getLayout('form.fabrik-pdf-icon');
         $pdfDisplayData = new stdClass();
         $pdfDisplayData->pdfURL = $this->pdfURL;
         $pdfDisplayData->tmpl = $this->tmpl;
         $this->pdfLink = $layout->render($pdfDisplayData);
     }
 }
示例#2
0
 /**
  * Add buttons to the view e.g. print, pdf
  *
  * @return  void
  */
 protected function _addButtons()
 {
     $app = JFactory::getApplication();
     if ($app->input->get('format') === 'pdf') {
         // If we're rendering as PDF, no point showing any buttons
         $this->showEmail = false;
         $this->showPrint = false;
         $this->showPDF = false;
         return;
     }
     $fbConfig = JComponentHelper::getParams('com_fabrik');
     $package = $app->getUserState('com_fabrik.package', 'fabrik');
     $input = $app->input;
     $model = $this->getModel();
     $params = $model->getParams();
     $this->showEmail = $params->get('email', $fbConfig->get('form_email', 0));
     $this->emailLink = '';
     $this->printLink = '';
     $this->pdfLink = '';
     $this->pdfURL = '';
     $this->emailURL = '';
     $this->printURL = '';
     $this->showPrint = $params->get('print', $fbConfig->get('form_print', 0));
     if ($this->showPrint) {
         $text = FabrikHelperHTML::image('print.png');
         $this->printLink = '<a href="#" class="printlink" onclick="window.print();return false;">' . $text . '</a>';
     }
     if ($input->get('tmpl') != 'component') {
         if ($this->showEmail) {
             $this->emailLink = FabrikHelperHTML::emailIcon($model, $params);
             $this->emailURL = FabrikHelperHTML::emailURL($model);
         }
         if ($this->showPrint) {
             $this->printLink = FabrikHelperHTML::printIcon($model, $params, $model->getRowId());
             $this->printURL = FabrikHelperHTML::printURL($model);
         }
     }
     $this->showPDF = $params->get('pdf', $fbConfig->get('form_pdf', false));
     $buttonProperties = array('class' => 'fabrikTip', 'opts' => "{notice:true}", 'title' => '<span>' . FText::_('COM_FABRIK_PDF') . '</span>', 'alt' => FText::_('COM_FABRIK_PDF'));
     if ($this->showPDF) {
         FabrikWorker::canPdf();
         if ($app->isAdmin()) {
             $this->pdfURL = 'index.php?option=com_' . $package . '&task=details.view&format=pdf&formid=' . $model->getId() . '&rowid=' . $model->getRowId();
         } else {
             $this->pdfURL = 'index.php?option=com_' . $package . '&view=details&formid=' . $model->getId() . '&rowid=' . $model->getRowId() . '&format=pdf';
         }
         $this->pdfURL = JRoute::_($this->pdfURL);
         $this->pdfLink = '<a href="' . $this->pdfURL . '">' . FabrikHelperHTML::image('pdf.png', 'list', $this->tmpl, $buttonProperties) . '</a>';
     }
 }
示例#3
0
 /**
  * add buttons to the view e.g. print, pdf
  */
 protected function _addButtons()
 {
     $model = $this->getModel();
     $params = $model->getParams();
     $this->showEmail = $params->get('email', 0);
     $this->emailLink = '';
     $this->printLink = '';
     $this->pdfLink = '';
     $this->showPrint = $params->get('print', 0);
     if ($this->showPrint) {
         $text = JHTML::_('image.site', 'printButton.png', '/images/M_images/', NULL, NULL, JText::_('Print'));
         $this->printLink = '<a href="#" onclick="window.print();return false;">' . $text . '</a>';
     }
     if (JRequest::getVar('tmpl') != 'component') {
         if ($this->showEmail) {
             $this->emailLink = FabrikHelperHTML::emailIcon($model, $params);
         }
         if ($this->showPrint) {
             $this->printLink = FabrikHelperHTML::printIcon($model, $params, $model->_rowId);
         }
         $this->showPDF = $params->get('pdf', 0);
         if ($this->showPDF) {
             $this->pdfLink = FabrikHelperHTML::pdfIcon($model, $params, $model->_rowId);
         }
     } else {
         $this->showPDF = false;
     }
 }
示例#4
0
 /**
  * Add buttons to the view e.g. print, pdf
  *
  * @return  void
  */
 protected function _addButtons()
 {
     $fbConfig = JComponentHelper::getParams('com_fabrik');
     $model = $this->getModel();
     $params = $model->getParams();
     $this->showEmail = $params->get('email', $fbConfig->get('form_email', 0));
     $this->emailLink = '';
     $this->printLink = '';
     $this->pdfLink = '';
     $this->pdfURL = '';
     $this->emailURL = '';
     $this->printURL = '';
     $this->showPrint = $params->get('print', $fbConfig->get('form_print', 0));
     if ($this->showPrint) {
         $text = JHTML::_('image.site', 'printButton.png', '/images/', null, null, JText::_('Print'));
         $this->printLink = '<a href="#" class="printlink" onclick="window.print();return false;">' . $text . '</a>';
     }
     if (JRequest::getVar('tmpl') != 'component') {
         if ($this->showEmail) {
             $this->emailLink = FabrikHelperHTML::emailIcon($model, $params);
             $this->emailURL = FabrikHelperHTML::emailURL($model);
         }
         if ($this->showPrint) {
             $this->printLink = FabrikHelperHTML::printIcon($model, $params, $model->_rowId);
             $this->printURL = FabrikHelperHTML::printURL($model);
         }
     }
     $this->showPDF = $params->get('pdf', $fbConfig->get('form_pdf', false));
     $buttonProperties = array('class' => 'fabrikTip', 'opts' => "{notice:true}", 'title' => '<span>' . JText::_('COM_FABRIK_PDF') . '</span>', 'alt' => JText::_('COM_FABRIK_PDF'));
     if ($this->showPDF) {
         if (!FabrikWorker::canPdf()) {
             JError::raiseNotice(500, JText::_('COM_FABRIK_NOTICE_DOMPDF_NOT_FOUND'));
         } else {
             $this->pdfURL = JRoute::_('index.php?option=com_fabrik&view=details&format=pdf&formid=' . $model->getId() . '&rowid=' . $model->_rowId);
             $this->pdfLink = '<a href="' . JRoute::_('index.php?option=com_fabrik&view=details&format=pdf&formid=' . $model->getId()) . '&rowid=' . $this->rowid . '">' . FabrikHelperHTML::image('pdf.png', 'list', $this->tmpl, $buttonProperties) . '</a>';
         }
     }
 }