本文整理汇总了PHP中CRM_Core_Config::Singleton方法的典型用法代码示例。如果您正苦于以下问题:PHP CRM_Core_Config::Singleton方法的具体用法?PHP CRM_Core_Config::Singleton怎么用?PHP CRM_Core_Config::Singleton使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CRM_Core_Config
的用法示例。
在下文中一共展示了CRM_Core_Config::Singleton方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: smarty_function_help
/**
* Replace the value of an attribute in the input string. Assume
* the the attribute is well formed, of the type name="value". If
* no replacement is mentioned the value is inserted at the end of
* the form element
*
* @param array $params the function params
* @param object $smarty reference to the smarty object
*
* @return string the help html to be inserted
* @access public
*/
function smarty_function_help($params, &$smarty)
{
if (!isset($params['id']) || !isset($smarty->_tpl_vars['config'])) {
return;
}
if (isset($params['file'])) {
$file = $params['file'];
} else {
if (isset($smarty->_tpl_vars['tplFile'])) {
$file = $smarty->_tpl_vars['tplFile'];
} else {
return;
}
}
$file = str_replace('.tpl', '.hlp', $file);
$id = urlencode($params['id']);
if ($id == 'accesskeys') {
$file = 'CRM/common/accesskeys.hlp';
}
require_once 'CRM/Core/Config.php';
$config = CRM_Core_Config::Singleton();
$smarty->assign('id', $params['id']);
$help = $smarty->fetch($file);
return <<<EOT
<script type="text/javascript"> cj( function() { cj(".helpicon").toolTip(); });</script>
<div class="helpicon"> <span id="{$id}_help" style="display:none">{$help}</span></div>
EOT;
}
示例2: buildChart
/**
* @param $rows
*/
public function buildChart(&$rows)
{
$graphRows = array();
$count = 0;
$current_year = $this->_params['yid_value'];
$previous_year = $current_year - 1;
$previous_two_year = $current_year - 2;
$previous_three_year = $current_year - 3;
$upto = $current_year - 4;
$interval[$previous_year] = $previous_year;
$interval[$previous_two_year] = $previous_two_year;
$interval[$previous_three_year] = $previous_three_year;
$interval["upto_{$upto}"] = "Up To {$upto}";
foreach ($rows as $key => $row) {
$display["upto_{$upto}"] = CRM_Utils_Array::value("upto_{$upto}", $display) + CRM_Utils_Array::value("civicrm_upto_{$upto}", $row);
$display[$previous_year] = CRM_Utils_Array::value($previous_year, $display) + CRM_Utils_Array::value($previous_year, $row);
$display[$previous_two_year] = CRM_Utils_Array::value($previous_two_year, $display) + CRM_Utils_Array::value($previous_two_year, $row);
$display[$previous_three_year] = CRM_Utils_Array::value($previous_three_year, $display) + CRM_Utils_Array::value($previous_three_year, $row);
}
$graphRows['value'] = $display;
$config = CRM_Core_Config::Singleton();
$chartInfo = array('legend' => 'Sybunt Report', 'xname' => 'Year', 'yname' => "Amount ({$config->defaultCurrency})");
if ($this->_params['charts']) {
// build the chart.
CRM_Utils_OpenFlashChart::reportChart($graphRows, $this->_params['charts'], $interval, $chartInfo);
$this->assign('chartType', $this->_params['charts']);
}
}
示例3: buildChart
/**
* Build chart.
*
* @param array $rows
*/
public function buildChart(&$rows)
{
$graphRows = array();
if (!empty($this->_params['charts'])) {
if (!empty($this->_params['group_bys']['receive_date'])) {
$contrib = !empty($this->_params['fields']['total_amount']) ? TRUE : FALSE;
$softContrib = !empty($this->_params['fields']['soft_amount']) ? TRUE : FALSE;
foreach ($rows as $key => $row) {
if ($row['civicrm_contribution_receive_date_subtotal']) {
$graphRows['receive_date'][] = $row['civicrm_contribution_receive_date_start'];
$graphRows[$this->_interval][] = $row['civicrm_contribution_receive_date_interval'];
if ($softContrib && $contrib) {
// both contri & soft contri stats are present
$graphRows['multiValue'][0][] = $row['civicrm_contribution_total_amount_sum'];
$graphRows['multiValue'][1][] = $row['civicrm_contribution_soft_soft_amount_sum'];
} elseif ($softContrib) {
// only soft contributions
$graphRows['multiValue'][0][] = $row['civicrm_contribution_soft_soft_amount_sum'];
} else {
// only contributions
$graphRows['multiValue'][0][] = $row['civicrm_contribution_total_amount_sum'];
}
}
}
if ($softContrib && $contrib) {
$graphRows['barKeys'][0] = ts('Contributions');
$graphRows['barKeys'][1] = ts('Soft Credits');
$graphRows['legend'] = ts('Contributions and Soft Credits');
} elseif ($softContrib) {
$graphRows['legend'] = ts('Soft Credits');
}
// build the chart.
$config = CRM_Core_Config::Singleton();
$graphRows['xname'] = $this->_interval;
$graphRows['yname'] = "Amount ({$config->defaultCurrency})";
CRM_Utils_OpenFlashChart::chart($graphRows, $this->_params['charts'], $this->_interval);
$this->assign('chartType', $this->_params['charts']);
}
}
}
示例4: alterDisplay
/**
* Alter display of rows.
*
* Iterate through the rows retrieved via SQL and make changes for display purposes,
* such as rendering contacts as links.
*
* @param array $rows
* Rows generated by SQL, with an array for each row.
*/
public function alterDisplay(&$rows)
{
$config = CRM_Core_Config::Singleton();
$entryFound = FALSE;
foreach ($rows as $rowNum => $row) {
// If the email address has been deleted
if (array_key_exists('civicrm_email_email', $row)) {
if (empty($rows[$rowNum]['civicrm_email_email'])) {
$rows[$rowNum]['civicrm_email_email'] = '<del>Email address deleted</del>';
}
$entryFound = TRUE;
}
// make count columns point to detail report
// convert display name to links
if (array_key_exists('civicrm_contact_sort_name', $row) && array_key_exists('civicrm_contact_id', $row)) {
$url = CRM_Utils_System::url('civicrm/contact/view', 'reset=1&cid=' . $row['civicrm_contact_id'], $this->_absoluteUrl);
$rows[$rowNum]['civicrm_contact_sort_name_link'] = $url;
$rows[$rowNum]['civicrm_contact_sort_name_hover'] = ts("View Contact details for this contact.");
$entryFound = TRUE;
}
// Handle on_hold boolean display
if (array_key_exists('civicrm_email_on_hold', $row)) {
$rows[$rowNum]['civicrm_email_on_hold'] = !empty($row['civicrm_email_on_hold']) ? 'Yes' : 'No';
$entryFound = TRUE;
}
// Convert datetime values to custom date and time format
$dateFields = array('civicrm_mailing_event_bounce_time_stamp', 'civicrm_email_hold_date', 'civicrm_email_reset_date');
foreach ($dateFields as $dateField) {
if (array_key_exists($dateField, $row)) {
if (!empty($rows[$rowNum][$dateField])) {
$rows[$rowNum][$dateField] = CRM_Utils_Date::customFormat($row[$dateField], $config->dateformatDatetime);
}
$entryFound = TRUE;
}
}
// skip looking further in rows, if first row itself doesn't
// have the column we need
if (!$entryFound) {
break;
}
}
}
示例5: buildChart
function buildChart(&$rows)
{
$graphRows = array();
$count = 0;
$display = array();
$current_year = $this->_params['yid_value'];
$previous_year = $current_year - 1;
$interval[$previous_year] = $previous_year;
$interval['life_time'] = 'Life Time';
foreach ($rows as $key => $row) {
$display['life_time'] = CRM_Utils_Array::value('life_time', $display) + $row['civicrm_life_time_total'];
$display[$previous_year] = CRM_Utils_Array::value($previous_year, $display) + $row[$previous_year];
}
$config = CRM_Core_Config::Singleton();
$graphRows['value'] = $display;
$chartInfo = array('legend' => ts('Lybunt Report'), 'xname' => ts('Year'), 'yname' => ts('Amount (%1)', array(1 => $config->defaultCurrency)));
if ($this->_params['charts']) {
// build chart.
require_once 'CRM/Utils/OpenFlashChart.php';
CRM_Utils_OpenFlashChart::reportChart($graphRows, $this->_params['charts'], $interval, $chartInfo);
$this->assign('chartType', $this->_params['charts']);
}
}
示例6: buildChart
/**
* @param $rows
*/
public function buildChart(&$rows)
{
$this->_interval = 'events';
$countEvent = NULL;
if (!empty($this->_params['charts'])) {
foreach ($rows as $key => $value) {
$graphRows['totalAmount'][] = $graphRows['value'][] = CRM_Utils_Array::value('totalAmount', $rows[$key]);
$graphRows[$this->_interval][] = substr($rows[$key]['civicrm_event_title'], 0, 12) . "..(" . $rows[$key]['civicrm_event_id'] . ") ";
}
if (CRM_Utils_Array::value('totalAmount', $rows[$key]) == 0) {
$countEvent = count($rows);
}
if (!empty($rows) && $countEvent != 1) {
$config = CRM_Core_Config::Singleton();
$chartInfo = array('legend' => 'Event Summary', 'xname' => 'Event', 'yname' => "Total Amount ({$config->defaultCurrency})");
if (!empty($graphRows)) {
foreach ($graphRows[$this->_interval] as $key => $val) {
$graph[$val] = $graphRows['value'][$key];
}
$chartInfo['values'] = $graph;
$chartInfo['xLabelAngle'] = 20;
// build the chart.
CRM_Utils_OpenFlashChart::buildChart($chartInfo, $this->_params['charts']);
$this->assign('chartType', $this->_params['charts']);
}
}
}
}
示例7: buildChart
function buildChart(&$rows)
{
$graphRows = array();
$count = 0;
if (CRM_Utils_Array::value('charts', $this->_params)) {
foreach ($rows as $key => $row) {
if ($row['civicrm_contribution_receive_date_subtotal']) {
$graphRows['receive_date'][] = $row['civicrm_contribution_receive_date_start'];
$graphRows[$this->_interval][] = $row['civicrm_contribution_receive_date_interval'];
$graphRows['value'][] = $row['civicrm_contribution_total_amount_sum'];
$count++;
}
}
if (CRM_Utils_Array::value('receive_date', $this->_params['group_bys'])) {
// build the chart.
$config = CRM_Core_Config::Singleton();
$graphRows['xname'] = $this->_interval;
$graphRows['yname'] = "Amount ({$config->defaultCurrency})";
CRM_Utils_OpenFlashChart::chart($graphRows, $this->_params['charts'], $this->_interval);
$this->assign('chartType', $this->_params['charts']);
}
}
}
示例8: mulitplePieChart
function mulitplePieChart(&$rows, $graphData)
{
foreach ($rows as $index => $row) {
$graphData['xlabels'][] = $this->_params['contribution_baseline_interval_value'] . ts(" months to ") . $row['to_date'];
$graphData['end_date'][] = $row['to_date'];
foreach ($this->_statuses as $status) {
$graphData['value'][] = (int) $row[$status];
$graphData['values'][$index][$status] = (int) $row[$status];
}
}
// build the chart.
$graphData['xname'] = 'x';
$config = CRM_Core_Config::Singleton();
$graphData['yname'] = "Renewals : ";
$chartInfo = array('legend' => $this->_barChartLegend);
$chartInfo['xname'] = ts('Base contribution period');
$chartInfo['yname'] = ts("Number of Donors");
$chartData = CRM_Utils_OpenFlashChart::reportChart($graphData, 'pieChart', $this->_statuses, $chartInfo);
$this->assign('chartType', 'pieChart');
$this->assign('chartsData', $graphData['values']);
$this->assign('chartsLabels', array('status', 'no. contacts'));
$this->assign('chartInfo', $chartInfo);
}
开发者ID:eileenmcnaughton,项目名称:net.ourpowerbase.report.advancedfundraising,代码行数:23,代码来源:ContributionAggregates.php
示例9: 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 {
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");
}
}
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);
}
}
}
}
}