本文整理汇总了PHP中CRM_Report_Form::getTemplateFileName方法的典型用法代码示例。如果您正苦于以下问题:PHP CRM_Report_Form::getTemplateFileName方法的具体用法?PHP CRM_Report_Form::getTemplateFileName怎么用?PHP CRM_Report_Form::getTemplateFileName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CRM_Report_Form
的用法示例。
在下文中一共展示了CRM_Report_Form::getTemplateFileName方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getTemplateFileName
/**
* @return string
*/
function getTemplateFileName() {
$defaultTpl = parent::getTemplateFileName();
if (in_array($this->_outputMode, array('print', 'pdf'))) {
if ($this->_params['templates']) {
$defaultTpl = 'CRM/Extendedreport/Form/Report/CustomTemplates/' . $this->_params['templates'] . '.tpl';
}
}
if (!CRM_Utils_File::isIncludable('templates/' . $defaultTpl)) {
$defaultTpl = 'CRM/Report/Form.tpl';
}
if (CRM_Utils_Array::value('templates', $this->_params) == 1) {
//
}
return $defaultTpl;
}
示例2: postProcess
public function postProcess()
{
// get the acl clauses built before we assemble the query
$this->buildACLClause($this->_aliases['civicrm_contact']);
// get ready with post process params
$this->beginPostProcess();
// build query
$sql = $this->buildQuery();
// build array of result based on column headers. This method also allows
// modifying column headers before using it to build result set i.e $rows.
$rows = array();
$this->buildRows($sql, $rows);
// format result set.
$this->formatDisplay($rows);
//call local post process for only print and pdf.
//we do need special formatted o/p only when we do have grouping
$orderBys = CRM_Utils_Array::value('order_bys', $this->_params, array());
if (in_array($this->_outputMode, array('print', 'pdf'))) {
$outPut = array();
$templateFile = parent::getTemplateFileName();
if (array_key_exists('street_name', $orderBys) || array_key_exists('street_number', $orderBys)) {
$orderByStreetName = CRM_Utils_Array::value('street_name', $orderBys);
$orderByStreetNum = CRM_Utils_Array::value('street_number', $orderBys);
$pageCnt = 0;
$dataPerPage = array();
$lastStreetName = $lastStreetNum = NULL;
foreach ($rows as $row) {
//do we need to take new page.
if ($orderByStreetName && $lastStreetName != CRM_Utils_Array::value('civicrm_address_street_name', $row)) {
$pageCnt++;
} elseif ($orderByStreetNum && $lastStreetNum != CRM_Utils_Array::value('civicrm_address_street_number', $row) % 2) {
$pageCnt++;
}
//get the data per page.
$dataPerPage[$pageCnt][] = $row;
$lastStreetName = CRM_Utils_Array::value('civicrm_address_street_name', $row);
$lastStreetNum = CRM_Utils_Array::value('civicrm_address_street_number', $row) % 2;
}
foreach ($dataPerPage as $page) {
// assign variables to templates
$this->doTemplateAssignment($page);
$outPut[] = CRM_Core_Form::$_template->fetch($templateFile);
}
} else {
$this->doTemplateAssignment($rows);
$outPut[] = CRM_Core_Form::$_template->fetch($templateFile);
}
$header = $this->_formValues['report_header'];
$footer = $this->_formValues['report_footer'];
//get the cover sheet.
$coverSheet = $this->_surveyCoverSheet();
$footerImage = preg_replace('/<\\/html>|<\\/body>|<\\/div>/i', '', $footer);
$outPut = $header . $coverSheet . "<div style=\"page-break-after: always\"></div>" . implode($footerImage . "<div style=\"page-break-after: always\"></div>", $outPut) . $footer;
if ($this->_outputMode == 'print') {
echo $outPut;
} else {
CRM_Utils_PDF_Utils::html2pdf($outPut, "CiviReport.pdf");
}
CRM_Utils_System::civiExit();
} else {
$this->doTemplateAssignment($rows);
$this->endPostProcess($rows);
}
}