Merge pull request #4983 from colemanw/CRM-15842
[civicrm-core.git] / CRM / Mailing / Selector / Browse.php
index b973623dda7741153ce10de71027a9bedb020807..3189ce9956ce49e50cacf28a1e1010d2bc8c11ed 100644 (file)
@@ -23,7 +23,7 @@
  | GNU Affero General Public License or the licensing of CiviCRM,     |
  | see the CiviCRM license FAQ at http://civicrm.org/licensing        |
  +--------------------------------------------------------------------+
-*/
+ */
 
 /**
  *
@@ -42,7 +42,6 @@ class CRM_Mailing_Selector_Browse extends CRM_Core_Selector_Base implements CRM_
    * Array of supported links, currenly null
    *
    * @var array
-   * @static
    */
   static $_links = NULL;
 
@@ -50,7 +49,6 @@ class CRM_Mailing_Selector_Browse extends CRM_Core_Selector_Base implements CRM_
    * We use desc to remind us what that column is, name is used in the tpl
    *
    * @var array
-   * @static
    */
   static $_columnHeaders;
 
@@ -61,7 +59,6 @@ class CRM_Mailing_Selector_Browse extends CRM_Core_Selector_Base implements CRM_
    *
    *
    * @return \CRM_Mailing_Selector_Browse
-  @access public
    */
   public function __construct() {
   }
@@ -70,7 +67,6 @@ class CRM_Mailing_Selector_Browse extends CRM_Core_Selector_Base implements CRM_
    * This method returns the links that are given for each search row.
    *
    * @return array
-   *
    */
   public static function &links() {
     return self::$_links;
@@ -81,7 +77,6 @@ class CRM_Mailing_Selector_Browse extends CRM_Core_Selector_Base implements CRM_
    *
    * @param $action
    * @param array $params
-   *
    */
   public function getPagerParams($action, &$params) {
     $params['csvString'] = NULL;
@@ -97,10 +92,11 @@ class CRM_Mailing_Selector_Browse extends CRM_Core_Selector_Base implements CRM_
    *
    * @param string $action
    *   The action being performed.
-   * @param enum $output
+   * @param string $output
    *   What should the result set include (web/email/csv).
    *
-   * @return array the column headers that need to be displayed
+   * @return array
+   *   the column headers that need to be displayed
    */
   public function &getColumnHeaders($action = NULL, $output = NULL) {
     $mailing = CRM_Mailing_BAO_Mailing::getTableName();
@@ -167,7 +163,7 @@ class CRM_Mailing_Selector_Browse extends CRM_Core_Selector_Base implements CRM_
 
       if (CRM_Campaign_BAO_Campaign::isCampaignEnable()) {
         self::$_columnHeaders[] = array(
-        'name' => ts('Campaign'),
+          'name' => ts('Campaign'),
           'sort' => 'campaign_id',
           'direction' => CRM_Utils_Sort::DONTCARE,
         );
@@ -185,11 +181,12 @@ class CRM_Mailing_Selector_Browse extends CRM_Core_Selector_Base implements CRM_
    *
    * @param
    *
-   * @return int Total number of rows
+   * @return int
+   *   Total number of rows
    */
   public function getTotalCount($action) {
-    $job        = CRM_Mailing_BAO_MailingJob::getTableName();
-    $mailing    = CRM_Mailing_BAO_Mailing::getTableName();
+    $job = CRM_Mailing_BAO_MailingJob::getTableName();
+    $mailing = CRM_Mailing_BAO_Mailing::getTableName();
     $mailingACL = CRM_Mailing_BAO_Mailing::mailingACL();
 
     //get the where clause.
@@ -211,7 +208,7 @@ LEFT JOIN  civicrm_contact scheduledContact ON ( $mailing.scheduled_id = schedul
   /**
    * Returns all the rows in the given offset and rowCount
    *
-   * @param enum $action
+   * @param string $action
    *   The action being performed.
    * @param int $offset
    *   The row number to start from.
@@ -219,16 +216,17 @@ LEFT JOIN  civicrm_contact scheduledContact ON ( $mailing.scheduled_id = schedul
    *   The number of rows to return.
    * @param string $sort
    *   The sql string that describes the sort order.
-   * @param enum $output
+   * @param string $output
    *   What should the result set include (web/email/csv).
    *
-   * @return int   the total number of rows for this action
+   * @return int
+   *   the total number of rows for this action
    */
   public function &getRows($action, $offset, $rowCount, $sort, $output = NULL) {
     static $actionLinks = NULL;
     if (empty($actionLinks)) {
-      $cancelExtra  = ts('Are you sure you want to cancel this mailing?');
-      $deleteExtra  = ts('Are you sure you want to delete this mailing?');
+      $cancelExtra = ts('Are you sure you want to cancel this mailing?');
+      $deleteExtra = ts('Are you sure you want to delete this mailing?');
       $archiveExtra = ts('Are you sure you want to archive this mailing?');
 
       $actionLinks = array(
@@ -360,7 +358,10 @@ LEFT JOIN  civicrm_contact scheduledContact ON ( $mailing.scheduled_id = schedul
           }
         }
         if (in_array($row['status'], array(
-          'Scheduled', 'Running', 'Paused'))) {
+          'Scheduled',
+          'Running',
+          'Paused',
+        ))) {
           if ($allAccess ||
             ($showApprovalLinks && $showCreateLinks && $showScheduleLinks)
           ) {
@@ -377,7 +378,8 @@ LEFT JOIN  civicrm_contact scheduledContact ON ( $mailing.scheduled_id = schedul
         }
 
         if (in_array($row['status'], array('Complete', 'Canceled')) &&
-          !$row['archived']) {
+          !$row['archived']
+        ) {
           if ($allAccess || $showCreateLinks) {
             $actionMask |= CRM_Core_Action::RENEW;
           }
@@ -424,7 +426,8 @@ LEFT JOIN  civicrm_contact scheduledContact ON ( $mailing.scheduled_id = schedul
    * @param string $output
    *   Type of output.
    *
-   * @return string name of the file
+   * @return string
+   *   name of the file
    */
   public function getExportFileName($output = 'csv') {
     return ts('CiviMail Mailings');
@@ -445,7 +448,7 @@ LEFT JOIN  civicrm_contact scheduledContact ON ( $mailing.scheduled_id = schedul
    */
   public function whereClause(&$params, $sortBy = TRUE) {
     $values = $clauses = array();
-    $isFormSubmitted   = $this->_parent->get('hidden_find_mailings');
+    $isFormSubmitted = $this->_parent->get('hidden_find_mailings');
 
     $title = $this->_parent->get('mailing_name');
     if ($title) {
@@ -480,7 +483,7 @@ LEFT JOIN  civicrm_contact scheduledContact ON ( $mailing.scheduled_id = schedul
         $dateClause1[] = 'civicrm_mailing_job.start_date <= %3';
         $dateClause2[] = 'civicrm_mailing_job.scheduled_date <= %3';
       }
-      $params[3]     = array($to, 'String');
+      $params[3] = array($to, 'String');
     }
 
     $dateClauses = array();
@@ -503,8 +506,8 @@ LEFT JOIN  civicrm_contact scheduledContact ON ( $mailing.scheduled_id = schedul
     }
 
     // get values submitted by form
-    $isDraft       = $this->_parent->get('status_unscheduled');
-    $isArchived    = $this->_parent->get('is_archived');
+    $isDraft = $this->_parent->get('status_unscheduled');
+    $isArchived = $this->_parent->get('is_archived');
     $mailingStatus = $this->_parent->get('mailing_status');
 
     if (!$isFormSubmitted && $this->_parent->get('scheduled')) {
@@ -605,4 +608,5 @@ ORDER BY LEFT(name, 1)
     $aToZBar = CRM_Utils_PagerAToZ::getAToZBar($dao, $this->_parent->_sortByCharacter, TRUE);
     $this->_parent->assign('aToZ', $aToZBar);
   }
+
 }