INFRA-132 - CRM/Contribute - phpcbf
[civicrm-core.git] / CRM / Contribute / Selector / Search.php
index 6c96eba78e13d803dcdec2a193a37834019d360f..7ed80e6d57b73c8028e28b1052693bd0fa7e3e94 100644 (file)
@@ -1,7 +1,7 @@
 <?php
 /*
  +--------------------------------------------------------------------+
- | CiviCRM version 4.5                                                |
+ | CiviCRM version 4.6                                                |
  +--------------------------------------------------------------------+
  | Copyright CiviCRM LLC (c) 2004-2014                                |
  +--------------------------------------------------------------------+
@@ -50,7 +50,7 @@ class CRM_Contribute_Selector_Search extends CRM_Core_Selector_Base implements C
   static $_links = NULL;
 
   /**
-   * we use desc to remind us what that column is, name is used in the tpl
+   * We use desc to remind us what that column is, name is used in the tpl
    *
    * @var array
    * @static
@@ -90,51 +90,45 @@ class CRM_Contribute_Selector_Search extends CRM_Core_Selector_Base implements C
   );
 
   /**
-   * are we restricting ourselves to a single contact
+   * Are we restricting ourselves to a single contact
    *
-   * @access protected
    * @var boolean
    */
   protected $_single = FALSE;
 
   /**
-   * are we restricting ourselves to a single contact
+   * Are we restricting ourselves to a single contact
    *
-   * @access protected
    * @var boolean
    */
   protected $_limit = NULL;
 
   /**
-   * what context are we being invoked from
+   * What context are we being invoked from
    *
-   * @access protected
    * @var string
    */
   protected $_context = NULL;
 
   /**
-   * what component context are we being invoked from
+   * What component context are we being invoked from
    *
-   * @access protected
    * @var string
    */
   protected $_compContext = NULL;
 
   /**
-   * queryParams is the array returned by exportValues called on
+   * QueryParams is the array returned by exportValues called on
    * the HTML_QuickForm_Controller for that page.
    *
    * @var array
-   * @access protected
    */
   public $_queryParams;
 
   /**
-   * represent the type of selector
+   * Represent the type of selector
    *
    * @var int
-   * @access protected
    */
   protected $_action;
 
@@ -157,11 +151,15 @@ class CRM_Contribute_Selector_Search extends CRM_Core_Selector_Base implements C
   /**
    * Class constructor
    *
-   * @param array $queryParams array of parameters for query
+   * @param array $queryParams
+   *   Array of parameters for query.
    * @param \const|int $action - action of search basic or advanced.
-   * @param string $contributionClause if the caller wants to further restrict the search (used in contributions)
-   * @param boolean $single are we dealing only with one contact?
-   * @param int $limit how many contributions do we want returned
+   * @param string $contributionClause
+   *   If the caller wants to further restrict the search (used in contributions).
+   * @param bool $single
+   *   Are we dealing only with one contact?.
+   * @param int $limit
+   *   How many contributions do we want returned.
    *
    * @param string $context
    * @param null $compContext
@@ -170,12 +168,12 @@ class CRM_Contribute_Selector_Search extends CRM_Core_Selector_Base implements C
   @access public
    */
   function __construct(&$queryParams,
-    $action             = CRM_Core_Action::NONE,
+    $action = CRM_Core_Action::NONE,
     $contributionClause = NULL,
-    $single             = FALSE,
-    $limit              = NULL,
-    $context            = 'search',
-    $compContext        = NULL
+    $single = FALSE,
+    $limit = NULL,
+    $context = 'search',
+    $compContext = NULL
   ) {
 
     // submitted form values
@@ -209,7 +207,6 @@ class CRM_Contribute_Selector_Search extends CRM_Core_Selector_Base implements C
       $this->_query->_groupByComponentClause = " GROUP BY civicrm_contribution.id ";
     }
   }
-  //end of constructor
 
   /**
    * This method returns the links that are given for each search row.
@@ -218,15 +215,14 @@ class CRM_Contribute_Selector_Search extends CRM_Core_Selector_Base implements C
    * - View
    * - Edit
    *
-   * @param null $componentId
+   * @param int $componentId
    * @param null $componentAction
    * @param null $key
    * @param null $compContext
    *
    * @return array
-   * @access public
    */
-  static function &links($componentId = NULL, $componentAction = NULL, $key = NULL, $compContext = NULL) {
+  public static function &links($componentId = NULL, $componentAction = NULL, $key = NULL, $compContext = NULL) {
     $extraParams = NULL;
     if ($componentId) {
       $extraParams = "&compId={$componentId}&compAction={$componentAction}";
@@ -262,17 +258,14 @@ class CRM_Contribute_Selector_Search extends CRM_Core_Selector_Base implements C
     }
     return self::$_links;
   }
-  //end of function
 
   /**
-   * getter for array of the parameters required for creating pager.
+   * Getter for array of the parameters required for creating pager.
    *
    * @param $action
-   * @param $params
-   * @internal param $
-   * @access public
+   * @param array $params
    */
-  function getPagerParams($action, &$params) {
+  public function getPagerParams($action, &$params) {
     $params['status'] = ts('Contribution') . ' %%StatusMessage%%';
     $params['csvString'] = NULL;
     if ($this->_limit) {
@@ -285,7 +278,6 @@ class CRM_Contribute_Selector_Search extends CRM_Core_Selector_Base implements C
     $params['buttonTop'] = 'PagerTopButton';
     $params['buttonBottom'] = 'PagerBottomButton';
   }
-  //end of function
 
   /**
    * Returns total number of rows for the query.
@@ -293,9 +285,8 @@ class CRM_Contribute_Selector_Search extends CRM_Core_Selector_Base implements C
    * @param
    *
    * @return int Total number of rows
-   * @access public
    */
-  function getTotalCount($action) {
+  public function getTotalCount($action) {
     return $this->_query->searchQuery(0, 0, NULL,
       TRUE, FALSE,
       FALSE, FALSE,
@@ -305,17 +296,22 @@ class CRM_Contribute_Selector_Search extends CRM_Core_Selector_Base implements C
   }
 
   /**
-   * returns all the rows in the given offset and rowCount
+   * Returns all the rows in the given offset and rowCount
    *
-   * @param enum   $action   the action being performed
-   * @param int    $offset   the row number to start from
-   * @param int    $rowCount the number of rows to return
-   * @param string $sort     the sql string that describes the sort order
-   * @param enum   $output   what should the result set include (web/email/csv)
+   * @param enum $action
+   *   The action being performed.
+   * @param int $offset
+   *   The row number to start from.
+   * @param int $rowCount
+   *   The number of rows to return.
+   * @param string $sort
+   *   The sql string that describes the sort order.
+   * @param enum $output
+   *   What should the result set include (web/email/csv).
    *
    * @return int   the total number of rows for this action
    */
-  function &getRows($action, $offset, $rowCount, $sort, $output = NULL) {
+  public function &getRows($action, $offset, $rowCount, $sort, $output = NULL) {
     if ($this->_includeSoftCredits) {
       // especial sort order when rows include soft credits
       $sort = "civicrm_contribution.receive_date DESC, civicrm_contribution.id, civicrm_contribution_soft.id";
@@ -363,7 +359,7 @@ class CRM_Contribute_Selector_Search extends CRM_Core_Selector_Base implements C
     //get all campaigns.
     $allCampaigns = CRM_Campaign_BAO_Campaign::getCampaigns(NULL, NULL, FALSE, FALSE, FALSE, TRUE);
 
-    While ($result->fetch()) {
+    while ($result->fetch()) {
       $row = array();
       // the columns we are interested in
       foreach (self::$_properties as $property) {
@@ -414,8 +410,7 @@ class CRM_Contribute_Selector_Search extends CRM_Core_Selector_Base implements C
         $result->contribution_id
       );
 
-      $row['contact_type'] = CRM_Contact_BAO_Contact_Utils::getImage($result->contact_sub_type ?
-          $result->contact_sub_type : $result->contact_type, FALSE, $result->contact_id
+      $row['contact_type'] = CRM_Contact_BAO_Contact_Utils::getImage($result->contact_sub_type ? $result->contact_sub_type : $result->contact_type, FALSE, $result->contact_id
       );
 
       if (!empty($row['amount_level'])) {
@@ -429,9 +424,7 @@ class CRM_Contribute_Selector_Search extends CRM_Core_Selector_Base implements C
   }
 
   /**
-   *
    * @return array   $qill         which contains an array of strings
-   * @access public
    */
 
   // the current internationalisation is bad, but should more or less work
@@ -441,14 +434,15 @@ class CRM_Contribute_Selector_Search extends CRM_Core_Selector_Base implements C
   }
 
   /**
-   * returns the column headers as an array of tuples:
+   * Returns the column headers as an array of tuples:
    * (name, sortName (key to the sort array))
    *
-   * @param string $action the action being performed
-   * @param enum   $output what should the result set include (web/email/csv)
+   * @param string $action
+   *   The action being performed.
+   * @param enum $output
+   *   What should the result set include (web/email/csv).
    *
    * @return array the column headers that need to be displayed
-   * @access public
    */
   public function &getColumnHeaders($action = NULL, $output = NULL) {
     self::$_columnHeaders = array(
@@ -548,33 +542,33 @@ class CRM_Contribute_Selector_Search extends CRM_Core_Selector_Base implements C
   /**
    * @return mixed
    */
-  function alphabetQuery() {
+  public function alphabetQuery() {
     return $this->_query->searchQuery(NULL, NULL, NULL, FALSE, FALSE, TRUE);
   }
 
   /**
    * @return string
    */
-  function &getQuery() {
+  public function &getQuery() {
     return $this->_query;
   }
 
   /**
-   * name of export file.
+   * Name of export file.
    *
-   * @param string $output type of output
+   * @param string $output
+   *   Type of output.
    *
    * @return string name of the file
    */
-  function getExportFileName($output = 'csv') {
+  public function getExportFileName($output = 'csv') {
     return ts('CiviCRM Contribution Search');
   }
 
   /**
    * @return mixed
    */
-  function getSummary() {
+  public function getSummary() {
     return $this->_query->summaryContribution($this->_context);
   }
 }
-