more comment fixes
[civicrm-core.git] / CRM / Activity / Selector / Activity.php
index 4ef5c9033fb9dadd2623c2deebf0cc1dd8023b9a..dbac346b6e75fd4641297b97e500ab2b53bcbcc8 100644 (file)
@@ -1,9 +1,9 @@
 <?php
 /*
  +--------------------------------------------------------------------+
- | CiviCRM version 4.6                                                |
+ | CiviCRM version 4.7                                                |
  +--------------------------------------------------------------------+
- | Copyright CiviCRM LLC (c) 2004-2014                                |
+ | Copyright CiviCRM LLC (c) 2004-2015                                |
  +--------------------------------------------------------------------+
  | This file is a part of CiviCRM.                                    |
  |                                                                    |
  | GNU Affero General Public License or the licensing of CiviCRM,     |
  | see the CiviCRM license FAQ at http://civicrm.org/licensing        |
  +--------------------------------------------------------------------+
-*/
+ */
 
 /**
  *
  * @package CRM
- * @copyright CiviCRM LLC (c) 2004-2014
- * $Id$
- *
+ * @copyright CiviCRM LLC (c) 2004-2015
  */
 
 /**
- * This class is used to retrieve and display activities for a contact
- *
+ * This class is used to retrieve and display activities for a contact.
  */
 class CRM_Activity_Selector_Activity extends CRM_Core_Selector_Base implements CRM_Core_Selector_API {
 
@@ -43,7 +40,6 @@ class CRM_Activity_Selector_Activity extends CRM_Core_Selector_Base implements C
    * We use desc to remind us what that column is, name is used in the tpl
    *
    * @var array
-   * @static
    */
   static $_columnHeaders;
 
@@ -63,7 +59,7 @@ class CRM_Activity_Selector_Activity extends CRM_Core_Selector_Base implements C
   protected $_viewOptions;
 
   /**
-   * Class constructor
+   * Class constructor.
    *
    * @param int $contactId
    *   Contact whose activities we want to display.
@@ -75,9 +71,8 @@ class CRM_Activity_Selector_Activity extends CRM_Core_Selector_Base implements C
    * @param null $activityTypeIDs
    *
    * @return \CRM_Activity_Selector_Activity
-  @access public
    */
-  function __construct(
+  public function __construct(
     $contactId,
     $permission,
     $admin = FALSE,
@@ -126,7 +121,7 @@ class CRM_Activity_Selector_Activity extends CRM_Core_Selector_Base implements C
       $extraParams .= "&compContext={$compContext}";
     }
 
-    $showView   = TRUE;
+    $showView = TRUE;
     $showUpdate = $showDelete = FALSE;
     $qsUpdate = NULL;
 
@@ -175,7 +170,7 @@ class CRM_Activity_Selector_Activity extends CRM_Core_Selector_Base implements C
 
       case 'Email':
       case 'Bulk Email':
-        $url    = 'civicrm/activity/view';
+        $url = 'civicrm/activity/view';
         $delUrl = 'civicrm/activity';
         $qsView = "atype={$activityTypeId}&action=view&reset=1&id=%%id%%&cid=%%cid%%&context=%%cxt%%{$extraParams}";
         if ($activityTypeName == 'Email') {
@@ -193,15 +188,15 @@ class CRM_Activity_Selector_Activity extends CRM_Core_Selector_Base implements C
       case 'Change Case Status':
       case 'Change Case Start Date':
         $showUpdate = $showDelete = FALSE;
-        $url        = 'civicrm/activity';
-        $qsView     = "atype={$activityTypeId}&action=view&reset=1&id=%%id%%&cid=%%cid%%&context=%%cxt%%{$extraParams}";
-        $qsUpdate   = "atype={$activityTypeId}&action=update&reset=1&id=%%id%%&cid=%%cid%%&context=%%cxt%%{$extraParams}";
+        $url = 'civicrm/activity';
+        $qsView = "atype={$activityTypeId}&action=view&reset=1&id=%%id%%&cid=%%cid%%&context=%%cxt%%{$extraParams}";
+        $qsUpdate = "atype={$activityTypeId}&action=update&reset=1&id=%%id%%&cid=%%cid%%&context=%%cxt%%{$extraParams}";
         break;
 
       default:
-        $url      = 'civicrm/activity';
+        $url = 'civicrm/activity';
         $showView = $showDelete = $showUpdate = TRUE;
-        $qsView   = "atype={$activityTypeId}&action=view&reset=1&id=%%id%%&cid=%%cid%%&context=%%cxt%%{$extraParams}";
+        $qsView = "atype={$activityTypeId}&action=view&reset=1&id=%%id%%&cid=%%cid%%&context=%%cxt%%{$extraParams}";
         $qsUpdate = "atype={$activityTypeId}&action=update&reset=1&id=%%id%%&cid=%%cid%%&context=%%cxt%%{$extraParams}";
 
         //when type is not available lets hide view and update.
@@ -216,13 +211,15 @@ class CRM_Activity_Selector_Activity extends CRM_Core_Selector_Base implements C
     $actionLinks = array();
 
     if ($showView) {
-      $actionLinks += array(CRM_Core_Action::
-      VIEW => array(
-      'name' => ts('View'),
-        'url' => $url,
-        'qs' => $qsView,
-        'title' => ts('View Activity'),
-      ));
+      $actionLinks += array(
+        CRM_Core_Action::
+        VIEW => array(
+          'name' => ts('View'),
+          'url' => $url,
+          'qs' => $qsView,
+          'title' => ts('View Activity'),
+        ),
+      );
     }
 
     if ($showUpdate) {
@@ -233,14 +230,16 @@ class CRM_Activity_Selector_Activity extends CRM_Core_Selector_Base implements C
       elseif ($activityTypeName == 'Print PDF Letter') {
         $updateUrl = 'civicrm/activity/pdf/add';
       }
-      if ( CRM_Activity_BAO_Activity::checkPermission($activityId, CRM_Core_Action::UPDATE) ) {
-        $actionLinks += array(CRM_Core_Action::
-        UPDATE => array(
-        'name' => ts('Edit'),
-          'url' => $updateUrl,
-          'qs' => $qsUpdate,
-          'title' => ts('Update Activity'),
-        ));
+      if (CRM_Activity_BAO_Activity::checkPermission($activityId, CRM_Core_Action::UPDATE)) {
+        $actionLinks += array(
+          CRM_Core_Action::
+          UPDATE => array(
+            'name' => ts('Edit'),
+            'url' => $updateUrl,
+            'qs' => $qsUpdate,
+            'title' => ts('Update Activity'),
+          ),
+        );
       }
     }
 
@@ -248,36 +247,42 @@ class CRM_Activity_Selector_Activity extends CRM_Core_Selector_Base implements C
       $activityTypeName &&
       CRM_Case_BAO_Case::checkPermission($activityId, 'File On Case', $activityTypeId)
     ) {
-      $actionLinks += array(CRM_Core_Action::
-      ADD => array(
-      'name' => ts('File on Case'),
-        'url' => '#',
-        'extra' => 'onclick="javascript:fileOnCase( \'file\', \'%%id%%\', null, this ); return false;"',
-        'title' => ts('File on Case'),
-      ));
+      $actionLinks += array(
+        CRM_Core_Action::
+        ADD => array(
+          'name' => ts('File on Case'),
+          'url' => '#',
+          'extra' => 'onclick="javascript:fileOnCase( \'file\', \'%%id%%\', null, this ); return false;"',
+          'title' => ts('File on Case'),
+        ),
+      );
     }
 
     if ($showDelete) {
       if (!isset($delUrl) || !$delUrl) {
         $delUrl = $url;
       }
-      $actionLinks += array(CRM_Core_Action::
-      DELETE => array(
-      'name' => ts('Delete'),
-        'url' => $delUrl,
-        'qs' => $qsDelete,
-        'title' => ts('Delete Activity'),
-      ));
+      $actionLinks += array(
+        CRM_Core_Action::
+        DELETE => array(
+          'name' => ts('Delete'),
+          'url' => $delUrl,
+          'qs' => $qsDelete,
+          'title' => ts('Delete Activity'),
+        ),
+      );
     }
 
     if ($accessMailingReport) {
-      $actionLinks += array(CRM_Core_Action::
-      BROWSE => array(
-      'name' => ts('Mailing Report'),
-        'url' => 'civicrm/mailing/report',
-        'qs' => "mid={$sourceRecordId}&reset=1&cid=%%cid%%&context=activitySelector",
-        'title' => ts('View Mailing Report'),
-      ));
+      $actionLinks += array(
+        CRM_Core_Action::
+        BROWSE => array(
+          'name' => ts('Mailing Report'),
+          'url' => 'civicrm/mailing/report',
+          'qs' => "mid={$sourceRecordId}&reset=1&cid=%%cid%%&context=activitySelector",
+          'title' => ts('View Mailing Report'),
+        ),
+      );
     }
 
     return $actionLinks;
@@ -288,12 +293,11 @@ class CRM_Activity_Selector_Activity extends CRM_Core_Selector_Base implements C
    *
    * @param $action
    * @param array $params
-   *
    */
   public function getPagerParams($action, &$params) {
-    $params['status']    = ts('Activities %%StatusMessage%%');
+    $params['status'] = ts('Activities %%StatusMessage%%');
     $params['csvString'] = NULL;
-    $params['rowCount']  = CRM_Utils_Pager::ROWCOUNT;
+    $params['rowCount'] = CRM_Utils_Pager::ROWCOUNT;
 
     $params['buttonTop'] = 'PagerTopButton';
     $params['buttonBottom'] = 'PagerBottomButton';
@@ -305,10 +309,11 @@ class CRM_Activity_Selector_Activity extends CRM_Core_Selector_Base implements C
    *
    * @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) {
     if ($output == CRM_Core_Selector_Controller::EXPORT || $output == CRM_Core_Selector_Controller::SCREEN) {
@@ -333,7 +338,8 @@ class CRM_Activity_Selector_Activity extends CRM_Core_Selector_Base implements C
    *
    * @param null $case
    *
-   * @return int Total number of rows
+   * @return int
+   *   Total number of rows
    */
   public function getTotalCount($action, $case = NULL) {
     $params = array(
@@ -350,9 +356,9 @@ class CRM_Activity_Selector_Activity 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
+   * @param string $action
    *   The action being performed.
    * @param int $offset
    *   The row number to start from.
@@ -360,12 +366,13 @@ class CRM_Activity_Selector_Activity extends CRM_Core_Selector_Base implements C
    *   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).
    *
    * @param null $case
    *
-   * @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, $case = NULL) {
     $params = array(
@@ -486,33 +493,34 @@ class CRM_Activity_Selector_Activity extends CRM_Core_Selector_Base implements C
    * @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('CiviCRM Activity');
   }
 
   /**
-   * Get colunmn headers for search selector
+   * Get colunmn headers for search selector.
    *
    *
-   * @return array $_columnHeaders
+   * @return array
    */
   private static function &_getColumnHeaders() {
     if (!isset(self::$_columnHeaders)) {
       self::$_columnHeaders = array(
         array(
-      'name' => ts('Type'),
+          'name' => ts('Type'),
           'sort' => 'activity_type',
           'direction' => CRM_Utils_Sort::DONTCARE,
         ),
         array(
-      'name' => ts('Subject'),
+          'name' => ts('Subject'),
           'sort' => 'subject',
           'direction' => CRM_Utils_Sort::DONTCARE,
         ),
         array(
-      'name' => ts('Added By'),
+          'name' => ts('Added By'),
           'sort' => 'source_contact_name',
           'direction' => CRM_Utils_Sort::DONTCARE,
         ),
@@ -534,4 +542,5 @@ class CRM_Activity_Selector_Activity extends CRM_Core_Selector_Base implements C
 
     return self::$_columnHeaders;
   }
+
 }