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('Print/merge Document'),
73 'class' => 'CRM_Activity_Form_Task_PDF',
77 'title' => ts('SMS - send reply'),
78 'class' => 'CRM_Activity_Form_Task_SMS',
82 'title' => ts('Tag - add to activities'),
83 'class' => 'CRM_Activity_Form_Task_AddToTag',
87 'title' => ts('Tag - remove from activities'),
88 'class' => 'CRM_Activity_Form_Task_RemoveFromTag',
93 $config = CRM_Core_Config
::singleton();
94 if (in_array('CiviCase', $config->enableComponents
)) {
95 if (CRM_Core_Permission
::check('access all cases and activities') ||
96 CRM_Core_Permission
::check('access my cases and activities')
98 self
::$_tasks[self
::TASK_SMS
] = [
99 'title' => ts('File on case'),
100 'class' => 'CRM_Activity_Form_Task_FileOnCase',
106 // CRM-4418, check for delete
107 if (!CRM_Core_Permission
::check('delete activities')) {
108 unset(self
::$_tasks[self
::TASK_DELETE
]);
114 return self
::$_tasks;
118 * Show tasks selectively based on the permission level of the user.
120 * @param int $permission
121 * @param array $params
124 * set of tasks that are valid for the user
126 public static function permissionedTaskTitles($permission, $params = []) {
127 if ($permission == CRM_Core_Permission
::EDIT
) {
128 $tasks = self
::taskTitles();
132 self
::TASK_EXPORT
=> self
::$_tasks[self
::TASK_EXPORT
]['title'],
136 if (CRM_Core_Permission
::check('delete activities')) {
137 $tasks[self
::TASK_DELETE
] = self
::$_tasks[self
::TASK_DELETE
]['title'];
141 $tasks = parent
::corePermissionedTaskTitles($tasks, $permission, $params);
146 * These tasks are the core set of tasks that the user can perform on activity.
151 * the set of tasks for a group of activity
153 public static function getTask($value) {
155 if (!$value ||
!CRM_Utils_Array
::value($value, self
::$_tasks)) {
156 // make the print task by default
157 $value = self
::TASK_PRINT
;
161 self
::$_tasks[$value]['class'],
162 self
::$_tasks[$value]['result'],