<?php
/*
+--------------------------------------------------------------------+
- | CiviCRM version 5 |
- +--------------------------------------------------------------------+
- | Copyright CiviCRM LLC (c) 2004-2019 |
- +--------------------------------------------------------------------+
- | This file is a part of CiviCRM. |
- | |
- | CiviCRM is free software; you can copy, modify, and distribute it |
- | under the terms of the GNU Affero General Public License |
- | Version 3, 19 November 2007 and the CiviCRM Licensing Exception. |
- | |
- | CiviCRM is distributed in the hope that it will be useful, but |
- | WITHOUT ANY WARRANTY; without even the implied warranty of |
- | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
- | See the GNU Affero General Public License for more details. |
+ | Copyright CiviCRM LLC. All rights reserved. |
| |
- | You should have received a copy of the GNU Affero General Public |
- | License and the CiviCRM Licensing Exception along |
- | with this program; if not, contact CiviCRM LLC |
- | at info[AT]civicrm[DOT]org. If you have questions about the |
- | GNU Affero General Public License or the licensing of CiviCRM, |
- | see the CiviCRM license FAQ at http://civicrm.org/licensing |
+ | This work is published under the GNU AGPLv3 license with some |
+ | permitted exceptions and without any warranty. For full license |
+ | and copyright information, see https://civicrm.org/licensing |
+--------------------------------------------------------------------+
*/
/**
*
* @package CRM
- * @copyright CiviCRM LLC (c) 2004-2019
+ * @copyright CiviCRM LLC https://civicrm.org/licensing
*/
class CRM_Contribute_Form_ContributionCharts extends CRM_Core_Form {
public function buildQuickForm() {
//p3 = Three dimensional pie chart.
//bvg = Vertical bar chart
- $this->addElement('select', 'chart_type', ts('Chart Style'), array(
- 'bvg' => ts('Bar'),
- 'p3' => ts('Pie'),
- )
- );
+ $this->addElement('select', 'chart_type', ts('Chart Style'), [
+ 'bvg' => ts('Bar'),
+ 'p3' => ts('Pie'),
+ ]);
$defaultValues['chart_type'] = $this->_chartType;
$this->setDefaults($defaultValues);
//take available years from database to show in drop down
$currentYear = date('Y');
- $years = array();
+ $years = [];
if (!empty($this->_years)) {
if (!array_key_exists($currentYear, $this->_years)) {
$this->_years[$currentYear] = $currentYear;
}
$this->addElement('select', 'select_year', ts('Select Year (for monthly breakdown)'), $years);
- $this->setDefaults(array(
+ $this->setDefaults([
'select_year' => ($this->_year) ? $this->_year : $currentYear,
- ));
+ ]);
}
/**
//take contribution information monthly
$chartInfoMonthly = CRM_Contribute_BAO_Contribution_Utils::contributionChartMonthly($selectedYear);
- $chartData = $abbrMonthNames = array();
+ $chartData = $abbrMonthNames = [];
if (is_array($chartInfoMonthly)) {
for ($i = 1; $i <= 12; $i++) {
$abbrMonthNames[$i] = strftime('%b', mktime(0, 0, 0, $i, 10, 1970));
$monthlyChart = TRUE;
}
- $values['divName'] = "open_flash_chart_{$chartKey}";
+ $values['divName'] = "chart_{$chartKey}";
$funName = ($chartType == 'bvg') ? 'barChart' : 'pieChart';
// build the chart objects.
- $values['object'] = CRM_Utils_OpenFlashChart::$funName($values);
+ $values['object'] = CRM_Utils_Chart::$funName($values);
//build the urls.
$urlCnt = 0;
$urlParams = NULL;
if ($chartKey == 'by_month') {
$monthPosition = array_search($index, $abbrMonthNames);
- $startDate = CRM_Utils_Date::format(array('Y' => $selectedYear, 'M' => $monthPosition));
+ $startDate = CRM_Utils_Date::format(['Y' => $selectedYear, 'M' => $monthPosition]);
$endDate = date('Ymd', mktime(0, 0, 0, $monthPosition + 1, 0, $selectedYear));
$urlParams = "reset=1&force=1&status=1&start={$startDate}&end={$endDate}&test=0";
}
$endDate = date('Ymd', mktime(0, 0, 0, $config->fiscalYearStart['M'], $config->fiscalYearStart['d'], (substr($index, 0, 4)) + 1));
}
else {
- $startDate = CRM_Utils_Date::format(array('Y' => substr($index, 0, 4)));
+ $startDate = CRM_Utils_Date::format(['Y' => substr($index, 0, 4)]);
$endDate = date('Ymd', mktime(0, 0, 0, 13, 0, substr($index, 0, 4)));
}
$urlParams = "reset=1&force=1&status=1&start={$startDate}&end={$endDate}&test=0";
$xSize = 150;
}
}
- $values['size'] = array('xSize' => $xSize, 'ySize' => $ySize);
+ $values['size'] = ['xSize' => $xSize, 'ySize' => $ySize];
}
// finally assign this chart data to template.
$this->assign('hasYearlyChart', $yearlyChart);
$this->assign('hasByMonthChart', $monthlyChart);
- $this->assign('hasOpenFlashChart', empty($chartData) ? FALSE : TRUE);
- $this->assign('openFlashChartData', json_encode($chartData));
+ $this->assign('hasChart', empty($chartData) ? FALSE : TRUE);
+ $this->assign('chartData', json_encode($chartData ?? []));
}
}