<?php
/*
+--------------------------------------------------------------------+
- | CiviCRM version 4.5 |
+ | CiviCRM version 4.6 |
+--------------------------------------------------------------------+
| Copyright CiviCRM LLC (c) 2004-2014 |
+--------------------------------------------------------------------+
class CRM_Activity_Selector_Activity extends CRM_Core_Selector_Base implements CRM_Core_Selector_API {
/**
- * 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
static $_columnHeaders;
/**
- * contactId - contact id of contact whose activies are displayed
+ * ContactId - contact id of contact whose activies are displayed
*
* @var int
- * @access protected
*/
protected $_contactId;
/**
* Class constructor
*
- * @param int $contactId - contact whose activities we want to display
- * @param int $permission - the permission we have for this contact
+ * @param int $contactId
+ * Contact whose activities we want to display.
+ * @param int $permission
+ * The permission we have for this contact.
*
* @param bool $admin
* @param string $context
* @param null $activityTypeIDs
*
* @return \CRM_Activity_Selector_Activity
- @access public
+ * @access public
*/
- function __construct($contactId,
- $permission,
- $admin = FALSE,
- $context = 'activity',
- $activityTypeIDs = NULL) {
+ function __construct(
+ $contactId,
+ $permission,
+ $admin = FALSE,
+ $context = 'activity',
+ $activityTypeIDs = NULL) {
$this->_contactId = $contactId;
$this->_permission = $permission;
$this->_admin = $admin;
*
* - View
*
- * @param $activityTypeId
- * @param null $sourceRecordId
+ * @param int $activityTypeId
+ * @param int $sourceRecordId
* @param bool $accessMailingReport
- * @param null $activityId
+ * @param int $activityId
* @param null $key
* @param null $compContext
*
- * @internal param string $activityType type of activity
- *
* @return array
- * @access public
*/
- public static function actionLinks($activityTypeId,
- $sourceRecordId = NULL,
- $accessMailingReport = FALSE,
- $activityId = NULL,
- $key = NULL,
- $compContext = NULL) {
+ public static function actionLinks(
+ $activityTypeId,
+ $sourceRecordId = NULL,
+ $accessMailingReport = FALSE,
+ $activityId = NULL,
+ $key = NULL,
+ $compContext = NULL) {
static $activityActTypes = NULL;
//CRM-14277 added addtitional param to handle activity search
$extraParams = "&searchContext=activity";
$extraParams .= "&compContext={$compContext}";
}
- $showView = TRUE;
+ $showView = TRUE;
$showUpdate = $showDelete = FALSE;
$qsUpdate = NULL;
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') {
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.
$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) {
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'),
+ )
+ );
}
}
$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;
}
/**
- * 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) {
- $params['status'] = ts('Activities %%StatusMessage%%');
+ public function getPagerParams($action, &$params) {
+ $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';
}
/**
- * 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 string $output
+ * What should the result set include (web/email/csv).
*
- * @return array the column headers that need to be displayed
- * @access public
+ * @return array
+ * the column headers that need to be displayed
*/
- function &getColumnHeaders($action = NULL, $output = NULL) {
+ public function &getColumnHeaders($action = NULL, $output = NULL) {
if ($output == CRM_Core_Selector_Controller::EXPORT || $output == CRM_Core_Selector_Controller::SCREEN) {
$csvHeaders = array(ts('Activity Type'), ts('Description'), ts('Activity Date'));
foreach (self::_getColumnHeaders() as $column) {
/**
* Returns total number of rows for the query.
*
- * @param string $action - action being performed
+ * @param string $action
+ * Action being performed.
*
* @param null $case
*
- * @return int Total number of rows
- * @access public
+ * @return int
+ * Total number of rows
*/
- function getTotalCount($action, $case = NULL) {
+ public function getTotalCount($action, $case = NULL) {
$params = array(
'contact_id' => $this->_contactId,
'admin' => $this->_admin,
}
/**
- * 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 string $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 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
*/
- function &getRows($action, $offset, $rowCount, $sort, $output = NULL, $case = NULL) {
+ public function &getRows($action, $offset, $rowCount, $sort, $output = NULL, $case = NULL) {
$params = array(
'contact_id' => $this->_contactId,
'admin' => $this->_admin,
}
/**
- * 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
+ * @return string
+ * name of the file
*/
- function getExportFileName($output = 'csv') {
+ public function getExportFileName($output = 'csv') {
return ts('CiviCRM Activity');
}
/**
- * get colunmn headers for search selector
+ * Get colunmn headers for search selector
*
*
- * @return array $_columnHeaders
- * @access private
+ * @return array
*/
private static function &_getColumnHeaders() {
if (!isset(self::$_columnHeaders)) {
self::$_columnHeaders = array(
- array('name' => ts('Type'),
+ array(
+ 'name' => ts('Type'),
'sort' => 'activity_type',
'direction' => CRM_Utils_Sort::DONTCARE,
),
- array('name' => ts('Subject'),
+ array(
+ 'name' => ts('Subject'),
'sort' => 'subject',
'direction' => CRM_Utils_Sort::DONTCARE,
),
- array('name' => ts('Added By'),
+ array(
+ 'name' => ts('Added By'),
'sort' => 'source_contact_name',
'direction' => CRM_Utils_Sort::DONTCARE,
),
return self::$_columnHeaders;
}
}
-