INFRA-132 - Drupal.Classes.ClassDeclaration
[civicrm-core.git] / CRM / Contribute / Form / ContributionCharts.php
index 5de33bf21eba197787a9dece96efc3fc2330fc08..e3dcd8a7b1bf973740fa0f1fdd5c85e0a8272342 100644 (file)
@@ -48,7 +48,7 @@ class CRM_Contribute_Form_ContributionCharts extends CRM_Core_Form {
    */
   protected $_chartType = NULL;
 
-  function preProcess() {
+  public function preProcess() {
     $this->_year = CRM_Utils_Request::retrieve('year', 'Int', $this);
     $this->_chartType = CRM_Utils_Request::retrieve('type', 'String', $this);
 
@@ -64,7 +64,6 @@ class CRM_Contribute_Form_ContributionCharts extends CRM_Core_Form {
   /**
    * Build the form object
    *
-   * @access public
    *
    * @return void
    */
@@ -88,20 +87,19 @@ class CRM_Contribute_Form_ContributionCharts extends CRM_Core_Form {
         krsort($this->_years);
       }
       foreach ($this->_years as $k => $v) {
-        $years[substr($k,0,4)] = substr($k,0,4);
+        $years[substr($k, 0, 4)] = substr($k, 0, 4);
       }
     }
 
     $this->addElement('select', 'select_year', ts('Select Year (for monthly breakdown)'), $years);
     $this->setDefaults(array(
       'select_year' => ($this->_year) ? $this->_year : $currentYear,
-      ));
+    ));
   }
 
   /**
    * Process the form after the input has been submitted and validated
    *
-   * @access public
    *
    * @return void
    */
@@ -174,9 +172,10 @@ class CRM_Contribute_Form_ContributionCharts extends CRM_Core_Form {
       if ($chartKey == 'by_year') {
         $yearlyChart = TRUE;
         if (!empty($config->fiscalYearStart) && ($config->fiscalYearStart['M'] !== 1 || $config->fiscalYearStart['d'] !== 1)) {
-          $values['xLabelAngle'] = 45 ;
-        } else {
-          $values['xLabelAngle'] = 0 ;
+          $values['xLabelAngle'] = 45;
+        }
+        else {
+          $values['xLabelAngle'] = 0;
         }
       }
       if ($chartKey == 'by_month') {
@@ -195,18 +194,18 @@ class CRM_Contribute_Form_ContributionCharts extends CRM_Core_Form {
         $urlParams = NULL;
         if ($chartKey == 'by_month') {
           $monthPosition = array_search($index, $abbrMonthNames);
-          $startDate     = CRM_Utils_Date::format(array('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";
+          $startDate = CRM_Utils_Date::format(array('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";
         }
         elseif ($chartKey == 'by_year') {
           if (!empty($config->fiscalYearStart) && ($config->fiscalYearStart['M'] != 1 || $config->fiscalYearStart['d'] != 1)) {
-            $startDate = date('Ymd', mktime(0, 0, 0, $config->fiscalYearStart['M'], $config->fiscalYearStart['d'], substr($index,0,4)));
-            $endDate   = date('Ymd', mktime(0, 0, 0, $config->fiscalYearStart['M'], $config->fiscalYearStart['d'], (substr($index,0,4)) + 1));
+            $startDate = date('Ymd', mktime(0, 0, 0, $config->fiscalYearStart['M'], $config->fiscalYearStart['d'], substr($index, 0, 4)));
+            $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)));
-            $endDate   = date('Ymd', mktime(0, 0, 0, 13, 0, substr($index,0,4)));
+            $startDate = CRM_Utils_Date::format(array('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";
         }
@@ -243,5 +242,5 @@ class CRM_Contribute_Form_ContributionCharts extends CRM_Core_Form {
     $this->assign('hasOpenFlashChart', empty($chartData) ? FALSE : TRUE);
     $this->assign('openFlashChartData', json_encode($chartData));
   }
-}
 
+}