Ejemplo n.º 1
0
 /**
  * Create print URL
  *
  * @param   object $formModel form model
  *
  * @since   3.0.6
  *
  * @return  string
  */
 public static function printURL($formModel)
 {
     $app = JFactory::getApplication();
     $input = $app->input;
     $form = $formModel->getForm();
     $package = $app->getUserState('com_fabrik.package', 'fabrik');
     $table = $formModel->getTable();
     if ($app->isAdmin()) {
         $url = 'index.php?option=com_' . $package . '&task=details.view&tmpl=component&formid=' . $form->id . '&listid=' . $table->id . '&rowid=' . $formModel->getRowId() . '&iframe=1&print=1';
     } else {
         //$this->pdfURL = 'index.php?option=com_' . $this->package . '&view=details&formid=' . $model->getId() . '&rowid=' . $model->getRowId() . '&format=pdf';
         $url = COM_FABRIK_LIVESITE . 'index.php?option=com_' . $package . '&view=details&tmpl=component&formid=' . $form->id . '&listid=' . $table->id . '&rowid=' . $formModel->getRowId() . '&iframe=1&print=1';
         $url .= '&Itemid=' . FabrikWorker::itemId();
     }
     /* $$$ hugh - @TODO - FIXME - if they were using rowid=-1, we don't need this, as rowid has already been transmogrified
      * to the correct (PK based) rowid.  but how to tell if original rowid was -1???
      */
     if ($input->get('usekey') !== null) {
         $url .= '&usekey=' . $input->get('usekey');
     }
     $url = JRoute::_($url);
     // $$$ rob for some reason JRoute wasn't doing this ???
     //$url            = str_replace('&', '&', $url);
     self::$printURL = $url;
     return self::$printURL;
 }
Ejemplo n.º 2
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);
     }
 }
Ejemplo n.º 3
0
 /**
  * Create print URL
  *
  * @param   object  $formModel  form model
  *
  * @since   3.0.6
  *
  * @return  string
  */
 public static function printURL($formModel)
 {
     $form = $formModel->getForm();
     $table = $formModel->getTable();
     if (isset(self::$printURL)) {
         return self::$printURL;
     }
     $url = COM_FABRIK_LIVESITE . "index.php?option=com_fabrik&tmpl=component&view=details&formid=" . $form->id . "&listid=" . $table->id . "&rowid=" . $formModel->_rowId . '&iframe=1&print=1';
     /* $$$ hugh - @TODO - FIXME - if they were using rowid=-1, we don't need this, as rowid has already been transmogrified
      * to the correct (PK based) rowid.  but how to tell if original rowid was -1???
      */
     if (JRequest::getVar('usekey') !== null) {
         $url .= "&usekey=" . JRequest::getVar('usekey');
     }
     $url = JRoute::_($url);
     // $$$ rob for some reason JRoute wasnt doing this ???
     $url = str_replace('&', '&amp;', $url);
     self::$printURL = $url;
     return self::$printURL;
 }
Ejemplo n.º 4
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>';
     }
 }
Ejemplo n.º 5
0
 /**
  * Create print URL
  *
  * @param   object  $formModel  form model
  *
  * @since   3.0.6
  *
  * @return  string
  */
 public static function printURL($formModel)
 {
     /**
      * Comment this out for now, as it causes issues with multiple forms per page.
      * We could always create a $sig for it, but that would need the info from the form and
      * table models, which are probably the most 'expensive' aprt of this function anyway.
      */
     /*
     if (isset(self::$printURL))
     {
     	return self::$printURL;
     }
     */
     $app = JFactory::getApplication();
     $input = $app->input;
     $form = $formModel->getForm();
     $package = $app->getUserState('com_fabrik.package', 'fabrik');
     $table = $formModel->getTable();
     $url = COM_FABRIK_LIVESITE . 'index.php?option=com_' . $package . '&view=details&tmpl=component&formid=' . $form->id . '&listid=' . $table->id . '&rowid=' . $formModel->getRowId() . '&iframe=1&print=1';
     $url .= '&Itemid=' . FabrikWorker::itemId();
     /* $$$ hugh - @TODO - FIXME - if they were using rowid=-1, we don't need this, as rowid has already been transmogrified
      * to the correct (PK based) rowid.  but how to tell if original rowid was -1???
      */
     if ($input->get('usekey') !== null) {
         $url .= '&usekey=' . $input->get('usekey');
     }
     $url = JRoute::_($url);
     // $$$ rob for some reason JRoute wasn't doing this ???
     $url = str_replace('&', '&amp;', $url);
     self::$printURL = $url;
     return self::$printURL;
 }
Ejemplo n.º 6
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>';
         }
     }
 }