Ejemplo n.º 1
0
 /**
  * Use the form name to create the tpl file name.
  *
  * @return string
  */
 public function getTemplateFileName()
 {
     if ($this->_contactSubType) {
         $templateFile = "CRM/Contact/Form/Edit/SubType/{$this->_contactSubType}.tpl";
         $template = CRM_Core_Form::getTemplate();
         if ($template->template_exists($templateFile)) {
             return $templateFile;
         }
     }
     return parent::getTemplateFileName();
 }
Ejemplo n.º 2
0
 /**
  * Get template file name.
  *
  * @return null|string
  */
 public function getTemplateFileName()
 {
     $fileName = $this->checkTemplateFileExists();
     return $fileName ? $fileName : parent::getTemplateFileName();
 }
Ejemplo n.º 3
0
 /**
  * Use the form name to create the tpl file name.
  *
  * @return string
  */
 public function getTemplateFileName()
 {
     $defaultTpl = parent::getTemplateFileName();
     $template = CRM_Core_Smarty::singleton();
     if (!$template->template_exists($defaultTpl)) {
         $defaultTpl = 'CRM/Report/Form.tpl';
     }
     return $defaultTpl;
 }
Ejemplo n.º 4
0
 /**
  * @return string
  */
 public function getTemplateFileName()
 {
     if ($this->controller->getPrint() || $this->getVar('_surveyId') <= 0) {
         return parent::getTemplateFileName();
     } else {
         // hack lets suppress the form rendering for now
         self::$_template->assign('isForm', FALSE);
         return 'CRM/Campaign/Form/Survey/Tab.tpl';
     }
 }
Ejemplo n.º 5
0
 /**
  * @return string
  */
 public function getTemplateFileName()
 {
     if ($this->controller->getPrint() || $this->getVar('_id') <= 0 || $this->_action & CRM_Core_Action::DELETE || CRM_Utils_String::getClassName($this->_name) == 'AddProduct') {
         return parent::getTemplateFileName();
     } else {
         // hack lets suppress the form rendering for now
         self::$_template->assign('isForm', FALSE);
         return 'CRM/Contribute/Form/ContributionPage/Tab.tpl';
     }
 }
Ejemplo n.º 6
0
 /**
  * @return string
  */
 public function getTemplateFileName()
 {
     if (isset($this->thankyou)) {
         return 'CRM/Campaign/Page/Petition/ThankYou.tpl';
     } else {
     }
     return parent::getTemplateFileName();
 }
Ejemplo n.º 7
0
 function getTemplateFileName()
 {
     if ($this->_gid) {
         $templateFile = "CRM/Profile/Form/{$this->_gid}/{$this->_name}.tpl";
         $template =& CRM_Core_Form::getTemplate();
         if ($template->template_exists($templateFile)) {
             return $templateFile;
         }
     }
     return parent::getTemplateFileName();
 }
Ejemplo n.º 8
0
 function getTemplateFileName()
 {
     if ($this->controller->getPrint() == CRM_Core_Smarty::PRINT_NOFORM || $this->getVar('_id') <= 0 || $this->_action & CRM_Core_Action::DELETE) {
         return parent::getTemplateFileName();
     } else {
         return 'CRM/Event/Form/ManageEvent/Tab.tpl';
     }
 }
Ejemplo n.º 9
0
 /**
  * @return string
  */
 public function getTemplateFileName()
 {
     if ($this->controller->getPrint() || $this->getVar('_id') <= 0 || $this->_action & CRM_Core_Action::DELETE) {
         return parent::getTemplateFileName();
     } else {
         // hack lets suppress the form rendering for now
         self::$_template->assign('isForm', FALSE);
         return 'CRM/Event/Form/ManageEvent/Tab.tpl';
     }
 }
Ejemplo n.º 10
0
 function endPostProcess(&$rows = NULL)
 {
     if ($this->_outputMode == 'print' || $this->_outputMode == 'pdf' || $this->_sendmail) {
         $templateFile = parent::getTemplateFileName();
         $url = CRM_Utils_System::url("civicrm/report/instance/{$this->_id}", "reset=1", TRUE);
         $content = $this->_formValues['report_header'] . CRM_Core_Form::$_template->fetch($templateFile) . $this->_formValues['report_footer'];
         if ($this->_sendmail) {
             $config = CRM_Core_Config::singleton();
             $attachments = array();
             if ($this->_outputMode == 'csv') {
                 $content = $this->_formValues['report_header'] . '<p>' . ts('Report URL') . ": {$url}</p>" . '<p>' . ts('The report is attached as a CSV file.') . '</p>' . $this->_formValues['report_footer'];
                 $csvFullFilename = $config->templateCompileDir . CRM_Utils_File::makeFileName('CiviReport.csv');
                 $csvContent = CRM_Report_Utils_Report::makeCsv($this, $rows);
                 file_put_contents($csvFullFilename, $csvContent);
                 $attachments[] = array('fullPath' => $csvFullFilename, 'mime_type' => 'text/csv', 'cleanName' => 'CiviReport.csv');
             }
             if ($this->_outputMode == 'pdf') {
                 // generate PDF content
                 $pdfFullFilename = $config->templateCompileDir . CRM_Utils_File::makeFileName('CiviReport.pdf');
                 file_put_contents($pdfFullFilename, CRM_Utils_PDF_Utils::html2pdf($content, "CiviReport.pdf", TRUE, array('orientation' => 'landscape')));
                 // generate Email Content
                 $content = $this->_formValues['report_header'] . '<p>' . ts('Report URL') . ": {$url}</p>" . '<p>' . ts('The report is attached as a PDF file.') . '</p>' . $this->_formValues['report_footer'];
                 $attachments[] = array('fullPath' => $pdfFullFilename, 'mime_type' => 'application/pdf', 'cleanName' => 'CiviReport.pdf');
             }
             if (CRM_Report_Utils_Report::mailReport($content, $this->_id, $this->_outputMode, $attachments)) {
                 CRM_Core_Session::setStatus(ts("Report mail has been sent."));
             } else {
                 CRM_Core_Session::setStatus(ts("Report mail could not be sent."));
             }
             CRM_Utils_System::redirect(CRM_Utils_System::url(CRM_Utils_System::currentPath(), 'reset=1'));
         } elseif ($this->_outputMode == 'print') {
             echo $content;
         } else {
             if ($chartType = CRM_Utils_Array::value('charts', $this->_params)) {
                 $config = CRM_Core_Config::singleton();
                 //get chart image name
                 $chartImg = $this->_chartId . '.png';
                 //get image url path
                 $uploadUrl = str_replace('/persist/contribute/', '/persist/', $config->imageUploadURL) . 'openFlashChart/';
                 $uploadUrl .= $chartImg;
                 //get image doc path to overwrite
                 $uploadImg = str_replace('/persist/contribute/', '/persist/', $config->imageUploadDir) . 'openFlashChart/' . $chartImg;
                 //Load the image
                 $chart = imagecreatefrompng($uploadUrl);
                 //convert it into formattd png
                 header('Content-type: image/png');
                 //overwrite with same image
                 imagepng($chart, $uploadImg);
                 //delete the object
                 imagedestroy($chart);
             }
             CRM_Utils_PDF_Utils::html2pdf($content, "CiviReport.pdf", FALSE, array('orientation' => 'landscape'));
         }
         CRM_Utils_System::civiExit();
     } elseif ($this->_outputMode == 'csv') {
         CRM_Report_Utils_Report::export2csv($this, $rows);
     } elseif ($this->_outputMode == 'group') {
         $group = $this->_params['groups'];
         $this->add2group($group);
     } elseif ($this->_instanceButtonName == $this->controller->getButtonName()) {
         CRM_Report_Form_Instance::postProcess($this);
     } elseif ($this->_createNewButtonName == $this->controller->getButtonName()) {
         $this->_createNew = TRUE;
         CRM_Report_Form_Instance::postProcess($this);
     }
 }
Ejemplo n.º 11
0
 function endPostProcess(&$rows = null)
 {
     if ($this->_outputMode == 'print' || $this->_outputMode == 'pdf' || $this->_sendmail) {
         $templateFile = parent::getTemplateFileName();
         $content = $this->_formValues['report_header'] . CRM_Core_Form::$_template->fetch($templateFile) . $this->_formValues['report_footer'];
         if ($this->_sendmail) {
             if (CRM_Report_Utils_Report::mailReport($content, $this->_id, $this->_outputMode)) {
                 CRM_Core_Session::setStatus(ts("Report mail has been sent."));
             } else {
                 CRM_Core_Session::setStatus(ts("Report mail could not be sent."));
             }
             if ($this->get('instanceId')) {
                 CRM_Utils_System::civiExit();
             }
             CRM_Utils_System::redirect(CRM_Utils_System::url(CRM_Utils_System::currentPath(), 'reset=1'));
         } else {
             if ($this->_outputMode == 'print') {
                 echo $content;
             } else {
                 if ($chartType = CRM_Utils_Array::value('charts', $this->_params)) {
                     $config =& CRM_Core_Config::singleton();
                     //get chart image name
                     $chartImg = $chartType . '_' . $this->_id . '.png';
                     //get image url path
                     $uploadUrl = str_replace('persist/contribute', 'upload/openFlashChart', $config->imageUploadURL);
                     $uploadUrl .= $chartImg;
                     //get image doc path to overwrite
                     $uploadImg = $config->uploadDir . 'openFlashChart/' . $chartImg;
                     //Load the image
                     $chart = imagecreatefrompng($uploadUrl);
                     //convert it into formattd png
                     header('Content-type: image/png');
                     //overwrite with same image
                     imagepng($chart, $uploadImg);
                     //delete the object
                     imagedestroy($chart);
                 }
                 require_once 'CRM/Utils/PDF/Utils.php';
                 CRM_Utils_PDF_Utils::html2pdf($content, "CiviReport.pdf");
             }
         }
         CRM_Utils_System::civiExit();
     } else {
         if ($this->_outputMode == 'csv') {
             CRM_Report_Utils_Report::export2csv($this, $rows);
         } else {
             if ($this->_outputMode == 'group') {
                 $group = $this->_params['groups'];
                 CRM_Report_Utils_Report::add2group($this, $group);
             } else {
                 if ($this->_instanceButtonName == $this->controller->getButtonName()) {
                     require_once 'CRM/Report/Form/Instance.php';
                     CRM_Report_Form_Instance::postProcess($this);
                 }
             }
         }
     }
 }
Ejemplo n.º 12
0
 function endPostProcess(&$rows = null)
 {
     if ($this->_outputMode == 'print' || $this->_outputMode == 'pdf' || $this->_sendmail) {
         $templateFile = parent::getTemplateFileName();
         $content = $this->_formValues['report_header'] . CRM_Core_Form::$_template->fetch($templateFile) . $this->_formValues['report_footer'];
         if ($this->_sendmail) {
             if (CRM_Report_Utils_Report::mailReport($content, $this->_id, $this->_outputMode)) {
                 CRM_Core_Session::setStatus(ts("Report mail has been sent."));
             } else {
                 CRM_Core_Session::setStatus(ts("Report mail could not be sent."));
             }
             if ($this->get('instanceId')) {
                 exit;
             }
             CRM_Utils_System::redirect(CRM_Utils_System::url(CRM_Utils_System::currentPath(), 'reset=1'));
         } else {
             if ($this->_outputMode == 'print') {
                 echo $content;
             } else {
                 require_once 'CRM/Utils/PDF/Utils.php';
                 CRM_Utils_PDF_Utils::html2pdf($content, "CiviReport.pdf");
             }
         }
         exit;
     } else {
         if ($this->_outputMode == 'csv') {
             CRM_Report_Utils_Report::export2csv($this, $rows);
         } else {
             if ($this->_outputMode == 'group') {
                 $group = $this->_params['groups'];
                 CRM_Report_Utils_Report::add2group($this, $group);
             } else {
                 if ($this->_instanceButtonName == $this->controller->getButtonName()) {
                     require_once 'CRM/Report/Form/Instance.php';
                     CRM_Report_Form_Instance::postProcess($this);
                 }
             }
         }
     }
 }
Ejemplo n.º 13
0
 function getTemplateFileName()
 {
     if ($this->_eventId) {
         $templateName = $this->_name;
         if (substr($templateName, 0, 12) == 'Participant_') {
             $templateName = 'AdditionalParticipant';
         }
         $templateFile = "CRM/Event/Form/Registration/{$this->_eventId}/{$templateName}.tpl";
         $template =& CRM_Core_Form::getTemplate();
         if ($template->template_exists($templateFile)) {
             return $templateFile;
         }
     }
     return parent::getTemplateFileName();
 }
 function getTemplateFileName()
 {
     if ($this->controller->getPrint() == CRM_Core_Smarty::PRINT_NOFORM || $this->getVar('_id') <= 0 || $this->_action & CRM_Core_Action::DELETE || CRM_Utils_String::getClassName($this->_name) == 'AddProduct') {
         return parent::getTemplateFileName();
     } else {
         return 'CRM/Contribute/Form/ContributionPage/Tab.tpl';
     }
 }
Ejemplo n.º 15
0
 function getTemplateFileName()
 {
     if ($this->_gid) {
         $templateFile = "CRM/Profile/Form/{$this->_gid}/{$this->_name}.tpl";
         $template =& CRM_Core_Form::getTemplate();
         if ($template->template_exists($templateFile)) {
             return $templateFile;
         }
         // lets see if we have customized by name
         $ufGroupName = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_UFGroup', $this->_gid, 'name');
         if ($ufGroupName) {
             $templateFile = "CRM/Profile/Form/{$ufGroupName}/{$this->_name}.tpl";
             if ($template->template_exists($templateFile)) {
                 return $templateFile;
             }
         }
     }
     return parent::getTemplateFileName();
 }