3 +--------------------------------------------------------------------+
4 | Copyright CiviCRM LLC. All rights reserved. |
6 | This work is published under the GNU AGPLv3 license with some |
7 | permitted exceptions and without any warranty. For full license |
8 | and copyright information, see https://civicrm.org/licensing |
9 +--------------------------------------------------------------------+
14 * @copyright CiviCRM LLC https://civicrm.org/licensing
18 * Class to represent the actions that can be performed on a group of contacts used by the search forms.
20 class CRM_Activity_Task
extends CRM_Core_Task
{
22 public static $objectType = 'activity';
25 * These tasks are the core set of tasks that the user can perform
26 * on a contact / group of contacts.
29 * the set of tasks for a group of contacts
31 public static function tasks() {
32 if (!(self
::$_tasks)) {
34 self
::TASK_DELETE
=> [
35 'title' => ts('Delete activities'),
36 'class' => 'CRM_Activity_Form_Task_Delete',
40 'title' => ts('Print selected rows'),
41 'class' => 'CRM_Activity_Form_Task_Print',
44 self
::TASK_EXPORT
=> [
45 'title' => ts('Export activities'),
47 'CRM_Export_Form_Select',
48 'CRM_Export_Form_Map',
52 self
::BATCH_UPDATE
=> [
53 'title' => ts('Update multiple activities'),
55 'CRM_Activity_Form_Task_PickProfile',
56 'CRM_Activity_Form_Task_Batch',
61 'title' => ts('Email - send now (to %1 or less)', [
63 ->get('simple_mail_limit'),
66 'CRM_Activity_Form_Task_PickOption',
67 'CRM_Activity_Form_Task_Email',
72 'title' => ts('SMS - send reply'),
73 'class' => 'CRM_Activity_Form_Task_SMS',
77 'title' => ts('Tag - add to activities'),
78 'class' => 'CRM_Activity_Form_Task_AddToTag',
82 'title' => ts('Tag - remove from activities'),
83 'class' => 'CRM_Activity_Form_Task_RemoveFromTag',
88 $config = CRM_Core_Config
::singleton();
89 if (in_array('CiviCase', $config->enableComponents
)) {
90 if (CRM_Core_Permission
::check('access all cases and activities') ||
91 CRM_Core_Permission
::check('access my cases and activities')
93 self
::$_tasks[self
::TASK_SMS
] = [
94 'title' => ts('File on case'),
95 'class' => 'CRM_Activity_Form_Task_FileOnCase',
101 // CRM-4418, check for delete
102 if (!CRM_Core_Permission
::check('delete activities')) {
103 unset(self
::$_tasks[self
::TASK_DELETE
]);
109 return self
::$_tasks;
113 * Show tasks selectively based on the permission level of the user.
115 * @param int $permission
116 * @param array $params
119 * set of tasks that are valid for the user
121 public static function permissionedTaskTitles($permission, $params = []) {
122 if ($permission == CRM_Core_Permission
::EDIT
) {
123 $tasks = self
::taskTitles();
127 self
::TASK_EXPORT
=> self
::$_tasks[self
::TASK_EXPORT
]['title'],
131 if (CRM_Core_Permission
::check('delete activities')) {
132 $tasks[self
::TASK_DELETE
] = self
::$_tasks[self
::TASK_DELETE
]['title'];
136 $tasks = parent
::corePermissionedTaskTitles($tasks, $permission, $params);
141 * These tasks are the core set of tasks that the user can perform on activity.
146 * the set of tasks for a group of activity
148 public static function getTask($value) {
150 if (!$value ||
!CRM_Utils_Array
::value($value, self
::$_tasks)) {
151 // make the print task by default
152 $value = self
::TASK_PRINT
;
156 self
::$_tasks[$value]['class'],
157 self
::$_tasks[$value]['result'],