本文整理汇总了PHP中CRM_Utils_OpenFlashChart::chart方法的典型用法代码示例。如果您正苦于以下问题:PHP CRM_Utils_OpenFlashChart::chart方法的具体用法?PHP CRM_Utils_OpenFlashChart::chart怎么用?PHP CRM_Utils_OpenFlashChart::chart使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CRM_Utils_OpenFlashChart
的用法示例。
在下文中一共展示了CRM_Utils_OpenFlashChart::chart方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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']);
}
}
}
示例2: postProcess
function postProcess()
{
$this->_params = $this->controller->exportValues($this->_name);
if (empty($this->_params) && $this->_force) {
$this->_params = $this->_formValues;
}
$this->_formValues = $this->_params;
$this->processReportMode();
$this->select();
$this->from();
$this->where();
$this->groupBy();
$sql = "{$this->_select} {$this->_from} {$this->_where} {$this->_groupBy}";
$dao = CRM_Core_DAO::executeQuery($sql);
$rows = $graphRows = array();
$count = 0;
while ($dao->fetch()) {
$row = array();
foreach ($this->_columnHeaders as $key => $value) {
$row[$key] = $dao->{$key};
}
if (!empty($this->_params['charts']) && $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++;
}
$rows[] = $row;
}
$this->formatDisplay($rows);
$this->assign_by_ref('columnHeaders', $this->_columnHeaders);
$this->assign_by_ref('rows', $rows);
$this->assign('statistics', $this->statistics($rows));
if (!empty($this->_params['charts'])) {
foreach (array('receive_date', $this->_interval, 'value') as $ignore) {
unset($graphRows[$ignore][$count - 1]);
}
// build chart.
CRM_Utils_OpenFlashChart::chart($graphRows, $this->_params['charts'], $this->_interval);
}
parent::endPostProcess();
}
示例3: 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']);
}
}
}