3 +--------------------------------------------------------------------+
4 | CiviCRM version 4.7 |
5 +--------------------------------------------------------------------+
6 | Copyright CiviCRM LLC (c) 2004-2017 |
7 +--------------------------------------------------------------------+
8 | This file is a part of CiviCRM. |
10 | CiviCRM is free software; you can copy, modify, and distribute it |
11 | under the terms of the GNU Affero General Public License |
12 | Version 3, 19 November 2007 and the CiviCRM Licensing Exception. |
14 | CiviCRM is distributed in the hope that it will be useful, but |
15 | WITHOUT ANY WARRANTY; without even the implied warranty of |
16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
17 | See the GNU Affero General Public License for more details. |
19 | You should have received a copy of the GNU Affero General Public |
20 | License and the CiviCRM Licensing Exception along |
21 | with this program; if not, contact CiviCRM LLC |
22 | at info[AT]civicrm[DOT]org. If you have questions about the |
23 | GNU Affero General Public License or the licensing of CiviCRM, |
24 | see the CiviCRM license FAQ at http://civicrm.org/licensing |
25 +--------------------------------------------------------------------+
30 * @copyright CiviCRM LLC (c) 2004-2017
34 * Class to represent the actions that can be performed on a group of contacts used by the search forms.
36 class CRM_Activity_Task
{
38 DELETE_ACTIVITIES
= 1,
40 EXPORT_ACTIVITIES
= 3,
50 static $_tasks = NULL;
53 * The optional task array.
57 static $_optionalTasks = NULL;
60 * These tasks are the core set of tasks that the user can perform
61 * on a contact / group of contacts.
64 * the set of tasks for a group of contacts
66 public static function &tasks() {
67 if (!(self
::$_tasks)) {
68 self
::$_tasks = array(
70 'title' => ts('Delete activities'),
71 'class' => 'CRM_Activity_Form_Task_Delete',
75 'title' => ts('Print selected rows'),
76 'class' => 'CRM_Activity_Form_Task_Print',
80 'title' => ts('Export activities'),
82 'CRM_Export_Form_Select',
83 'CRM_Export_Form_Map',
88 'title' => ts('Update multiple activities'),
90 'CRM_Activity_Form_Task_PickProfile',
91 'CRM_Activity_Form_Task_Batch',
96 'title' => ts('Email - send now'),
98 'CRM_Activity_Form_Task_PickOption',
99 'CRM_Activity_Form_Task_Email',
104 'title' => ts('SMS - send reply'),
105 'class' => 'CRM_Activity_Form_Task_SMS',
109 'title' => ts('Tag - add to activities'),
110 'class' => 'CRM_Activity_Form_Task_AddToTag',
114 'title' => ts('Tag - remove from activities'),
115 'class' => 'CRM_Activity_Form_Task_RemoveFromTag',
120 $config = CRM_Core_Config
::singleton();
121 if (in_array('CiviCase', $config->enableComponents
)) {
122 if (CRM_Core_Permission
::check('access all cases and activities') ||
123 CRM_Core_Permission
::check('access my cases and activities')
125 self
::$_tasks[6] = array(
126 'title' => ts('File on case'),
127 'class' => 'CRM_Activity_Form_Task_FileOnCase',
133 // CRM-4418, check for delete
134 if (!CRM_Core_Permission
::check('delete activities')) {
135 unset(self
::$_tasks[1]);
138 CRM_Utils_Hook
::searchTasks('activity', self
::$_tasks);
139 asort(self
::$_tasks);
142 return self
::$_tasks;
146 * These tasks are the core set of task titles on activity.
149 * the set of task titles
151 public static function &taskTitles() {
154 foreach (self
::$_tasks as $id => $value) {
155 $titles[$id] = $value['title'];
161 * Show tasks selectively based on the permission level of the user.
163 * @param int $permission
166 * set of tasks that are valid for the user
168 public static function &permissionedTaskTitles($permission) {
170 if ($permission == CRM_Core_Permission
::EDIT
) {
171 $tasks = self
::taskTitles();
175 3 => self
::$_tasks[3]['title'],
179 if (CRM_Core_Permission
::check('delete activities')) {
180 $tasks[1] = self
::$_tasks[1]['title'];
187 * These tasks are the core set of tasks that the user can perform on activity.
192 * the set of tasks for a group of activity
194 public static function getTask($value) {
196 if (!$value ||
!CRM_Utils_Array
::value($value, self
::$_tasks)) {
197 // make the print task by default
201 self
::$_tasks[$value]['class'],
202 self
::$_tasks[$value]['result'],