Merge pull request #15938 from civicrm/5.20
[civicrm-core.git] / CRM / Contribute / Form / ContributionCharts.php
index f8c10cd1ccd842bc8b10e4b411ca05cb9e80367a..3b498b6b1abfccb2c680d8a81935be45d412c496 100644 (file)
@@ -1,34 +1,18 @@
 <?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.   |
+ | Copyright CiviCRM LLC. All rights reserved.                        |
  |                                                                    |
- | 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.        |
- |                                                                    |
- | 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 {
 
@@ -66,10 +50,9 @@ class CRM_Contribute_Form_ContributionCharts extends CRM_Core_Form {
     //p3 = Three dimensional pie chart.
     //bvg = Vertical bar chart
     $this->addElement('select', 'chart_type', ts('Chart Style'), [
-        'bvg' => ts('Bar'),
-        'p3' => ts('Pie'),
-      ]
-    );
+      'bvg' => ts('Bar'),
+      'p3' => ts('Pie'),
+    ]);
     $defaultValues['chart_type'] = $this->_chartType;
     $this->setDefaults($defaultValues);
 
@@ -174,11 +157,11 @@ class CRM_Contribute_Form_ContributionCharts extends CRM_Core_Form {
         $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;
@@ -231,8 +214,8 @@ class CRM_Contribute_Form_ContributionCharts extends CRM_Core_Form {
     // 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 ?? []));
   }
 
 }