a few comment fixes
[civicrm-core.git] / CRM / Report / Form / Contribute / TopDonor.php
index 79abd52203f8282d5274ccc8ec05c0abf078b047..fdb055fdc89df2f2015bd060336e5a067e1accae 100644 (file)
@@ -1,5 +1,4 @@
 <?php
-
 /*
  +--------------------------------------------------------------------+
  | CiviCRM version 4.6                                                |
@@ -24,7 +23,7 @@
  | GNU Affero General Public License or the licensing of CiviCRM,     |
  | see the CiviCRM license FAQ at http://civicrm.org/licensing        |
  +--------------------------------------------------------------------+
-*/
+ */
 
 /**
  *
@@ -46,113 +45,109 @@ class CRM_Report_Form_Contribute_TopDonor extends CRM_Report_Form {
   );
 
   /**
-   *
-   */
-  /**
-   *
    */
   public function __construct() {
     $this->_columns = array(
-        'civicrm_contact' => array(
-          'dao' => 'CRM_Contact_DAO_Contact',
-          'fields' => array(
-            'id' => array(
-              'no_display' => TRUE,
-              'required' => TRUE,
-            ),
-            'display_name' => array(
-              'title' => ts('Contact Name'),
-              'required' => TRUE,
-              'no_repeat' => TRUE,
-            ),
-            'first_name' => array(
-              'title' => ts('First Name'),
-            ),
-            'last_name' => array(
-              'title' => ts('Last Name'),
-            ),
-            'contact_type' => array(
-              'title' => ts('Contact Type'),
-            ),
-            'contact_sub_type' => array(
-              'title' => ts('Contact Subtype'),
-            ),
+      'civicrm_contact' => array(
+        'dao' => 'CRM_Contact_DAO_Contact',
+        'fields' => array(
+          'id' => array(
+            'no_display' => TRUE,
+            'required' => TRUE,
+          ),
+          'display_name' => array(
+            'title' => ts('Contact Name'),
+            'required' => TRUE,
+            'no_repeat' => TRUE,
+          ),
+          'first_name' => array(
+            'title' => ts('First Name'),
+          ),
+          'last_name' => array(
+            'title' => ts('Last Name'),
+          ),
+          'contact_type' => array(
+            'title' => ts('Contact Type'),
+          ),
+          'contact_sub_type' => array(
+            'title' => ts('Contact Subtype'),
           ),
         ),
-      )
-    + $this->getAddressColumns()
-    + array(
-        'civicrm_contribution' => array(
-          'dao' => 'CRM_Contribute_DAO_Contribution',
-          'fields' => array(
-            'total_amount' => array(
-              'title' => ts('Amount Statistics'),
-              'required' => TRUE,
-              'statistics' => array(
-                'sum' => ts('Aggregate Amount'),
-                'count' => ts('Donations'),
-                'avg' => ts('Average'),
-              ),
-            ),
-            'currency' => array(
-              'required' => TRUE,
-              'no_display' => TRUE,
+      ),
+    );
+    $this->_columns += $this->getAddressColumns();
+    $this->_columns += array(
+      'civicrm_contribution' => array(
+        'dao' => 'CRM_Contribute_DAO_Contribution',
+        'fields' => array(
+          'total_amount' => array(
+            'title' => ts('Amount Statistics'),
+            'required' => TRUE,
+            'statistics' => array(
+              'sum' => ts('Aggregate Amount'),
+              'count' => ts('Donations'),
+              'avg' => ts('Average'),
             ),
           ),
-          'filters' => array(
-            'receive_date' => array(
-              'default' => 'this.year',
-              'operatorType' => CRM_Report_Form::OP_DATE,
-            ),
-            'currency' => array(
-              'title' => 'Currency',
-              'operatorType' => CRM_Report_Form::OP_MULTISELECT,
-              'options' => CRM_Core_OptionGroup::values('currencies_enabled'),
-              'default' => NULL,
-              'type' => CRM_Utils_Type::T_STRING,
-            ),
-            'total_range' => array(
-              'title' => ts('Show no. of Top Donors'),
-              'type' => CRM_Utils_Type::T_INT,
-              'default_op' => 'eq',
-            ),
-            'financial_type_id' => array(
-              'name' => 'financial_type_id',
-              'title' => ts('Financial Type'),
-              'operatorType' => CRM_Report_Form::OP_MULTISELECT,
-              'options' => CRM_Contribute_PseudoConstant::financialType(),
-            ),
-            'contribution_status_id' => array(
-              'title' => ts('Contribution Status'),
-              'operatorType' => CRM_Report_Form::OP_MULTISELECT,
-              'options' => CRM_Contribute_PseudoConstant::contributionStatus(),
-              'default' => array(1),
-            ),
+          'currency' => array(
+            'required' => TRUE,
+            'no_display' => TRUE,
           ),
         ),
-        'civicrm_email' => array(
-          'dao' => 'CRM_Core_DAO_Email',
-          'fields' => array(
-            'email' => array(
-              'title' => ts('Email'),
-              'default' => TRUE,
-              'no_repeat' => TRUE,
-            ),
+        'filters' => array(
+          'receive_date' => array(
+            'default' => 'this.year',
+            'operatorType' => CRM_Report_Form::OP_DATE,
+          ),
+          'currency' => array(
+            'title' => 'Currency',
+            'operatorType' => CRM_Report_Form::OP_MULTISELECT,
+            'options' => CRM_Core_OptionGroup::values('currencies_enabled'),
+            'default' => NULL,
+            'type' => CRM_Utils_Type::T_STRING,
+          ),
+          'total_range' => array(
+            'title' => ts('Show no. of Top Donors'),
+            'type' => CRM_Utils_Type::T_INT,
+            'default_op' => 'eq',
+          ),
+          'financial_type_id' => array(
+            'name' => 'financial_type_id',
+            'title' => ts('Financial Type'),
+            'operatorType' => CRM_Report_Form::OP_MULTISELECT,
+            'options' => CRM_Contribute_PseudoConstant::financialType(),
+          ),
+          'contribution_status_id' => array(
+            'title' => ts('Contribution Status'),
+            'operatorType' => CRM_Report_Form::OP_MULTISELECT,
+            'options' => CRM_Contribute_PseudoConstant::contributionStatus(),
+            'default' => array(1),
           ),
-          'grouping' => 'email-fields',
         ),
-        'civicrm_phone' => array(
-          'dao' => 'CRM_Core_DAO_Phone',
-          'fields' => array(
-            'phone' => array(
-              'title' => ts('Phone'),
-              'default' => TRUE,
-              'no_repeat' => TRUE,
-            ),
+      ),
+      'civicrm_email' => array(
+        'dao' => 'CRM_Core_DAO_Email',
+        'fields' => array(
+          'email' => array(
+            'title' => ts('Email'),
+            'default' => TRUE,
+            'no_repeat' => TRUE,
+          ),
+        ),
+        'grouping' => 'email-fields',
+      ),
+      'civicrm_phone' => array(
+        'dao' => 'CRM_Core_DAO_Phone',
+        'fields' => array(
+          'phone' => array(
+            'title' => ts('Phone'),
+            'default' => TRUE,
+            'no_repeat' => TRUE,
           ),
-          'grouping' => 'phone-fields',
         ),
-      );
+        'grouping' => 'phone-fields',
+      ),
+    );
 
     $this->_groupFilter = TRUE;
     $this->_tagFilter = TRUE;
@@ -234,7 +229,7 @@ class CRM_Report_Form_Contribute_TopDonor extends CRM_Report_Form {
 
     if (!in_array($op, array(
       'eq',
-      'lte'
+      'lte',
     ))
     ) {
       $errors['total_range_op'] = ts("Please select 'Is equal to' OR 'Is Less than or equal to' operator");
@@ -422,11 +417,15 @@ ORDER BY civicrm_contribution_total_amount_sum DESC
   }
 
   /**
-   * @param $rows
+   * 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) {
-    // custom code to alter rows
-
     $entryFound = FALSE;
     $rank = 1;
     if (!empty($rows)) {
@@ -456,4 +455,5 @@ ORDER BY civicrm_contribution_total_amount_sum DESC
       }
     }
   }
+
 }