本文整理汇总了PHP中CRM_Report_Utils_Report::mailReport方法的典型用法代码示例。如果您正苦于以下问题:PHP CRM_Report_Utils_Report::mailReport方法的具体用法?PHP CRM_Report_Utils_Report::mailReport怎么用?PHP CRM_Report_Utils_Report::mailReport使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CRM_Report_Utils_Report
的用法示例。
在下文中一共展示了CRM_Report_Utils_Report::mailReport方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: endPostProcess
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);
}
}
}
}
}
示例2: endPostProcess
/**
* End post processing.
*
* @param array|null $rows
*/
public function endPostProcess(&$rows = NULL)
{
if ($this->_storeResultSet) {
$this->_resultSet = $rows;
}
if ($this->_outputMode == 'print' || $this->_outputMode == 'pdf' || $this->_sendmail) {
$content = $this->compileContent();
$url = CRM_Utils_System::url("civicrm/report/instance/{$this->_id}", "reset=1", TRUE);
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."), ts('Sent'), 'success');
} else {
CRM_Core_Session::setStatus(ts("Report mail could not be sent."), ts('Mail Error'), 'error');
}
return TRUE;
} 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 formatted png
CRM_Utils_System::setHttpHeader('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);
}
}
示例3: endPostProcess
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);
}
}
}
}
}