3 +--------------------------------------------------------------------+
4 | CiviCRM version 4.6 |
5 +--------------------------------------------------------------------+
6 | Copyright CiviCRM LLC (c) 2004-2014 |
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. |
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 along with this program; if not, contact CiviCRM LLC |
21 | at info[AT]civicrm[DOT]org. If you have questions about the |
22 | GNU Affero General Public License or the licensing of CiviCRM, |
23 | see the CiviCRM license FAQ at http://civicrm.org/licensing |
24 +--------------------------------------------------------------------+
30 * @copyright CiviCRM LLC (c) 2004-2014
36 * class to represent the actions that can be performed on a group of contacts
37 * used by the search forms
40 class CRM_Activity_Task
{
42 DELETE_ACTIVITIES
= 1,
44 EXPORT_ACTIVITIES
= 3,
55 static $_tasks = NULL;
58 * The optional task array
63 static $_optionalTasks = NULL;
66 * These tasks are the core set of tasks that the user can perform
67 * on a contact / group of contacts
70 * the set of tasks for a group of contacts
73 public static function &tasks() {
74 if (!(self
::$_tasks)) {
75 self
::$_tasks = array(
77 'title' => ts('Delete Activities'),
78 'class' => 'CRM_Activity_Form_Task_Delete',
82 'title' => ts('Print Selected Rows'),
83 'class' => 'CRM_Activity_Form_Task_Print',
87 'title' => ts('Export Activities'),
89 'CRM_Export_Form_Select',
90 'CRM_Export_Form_Map',
95 'title' => ts('Batch Update Activities Via Profile'),
97 'CRM_Activity_Form_Task_PickProfile',
98 'CRM_Activity_Form_Task_Batch',
103 'title' => ts('Send Email to Contacts'),
105 'CRM_Activity_Form_Task_PickOption',
106 'CRM_Activity_Form_Task_Email',
111 'title' => ts('Send Reply SMS To Contacts'),
112 'class' => 'CRM_Activity_Form_Task_SMS',
116 'title' => ts('Tag Activities (assign tags)'),
117 'class' => 'CRM_Activity_Form_Task_AddToTag',
121 'title' => ts('Untag Activities (remove tags)'),
122 'class' => 'CRM_Activity_Form_Task_RemoveFromTag',
127 $config = CRM_Core_Config
::singleton();
128 if (in_array('CiviCase', $config->enableComponents
)) {
129 if (CRM_Core_Permission
::check('access all cases and activities') ||
130 CRM_Core_Permission
::check('access my cases and activities')
132 self
::$_tasks[6] = array(
133 'title' => ts('File on Case'),
134 'class' => 'CRM_Activity_Form_Task_FileOnCase',
140 //CRM-4418, check for delete
141 if (!CRM_Core_Permission
::check('delete activities')) {
142 unset(self
::$_tasks[1]);
145 CRM_Utils_Hook
::searchTasks('activity', self
::$_tasks);
146 asort(self
::$_tasks);
147 return self
::$_tasks;
151 * These tasks are the core set of task titles
155 * the set of task titles
158 public static function &taskTitles() {
161 foreach (self
::$_tasks as $id => $value) {
162 $titles[$id] = $value['title'];
168 * Show tasks selectively based on the permission level
171 * @param int $permission
174 * set of tasks that are valid for the user
176 public static function &permissionedTaskTitles($permission) {
178 if ($permission == CRM_Core_Permission
::EDIT
) {
179 $tasks = self
::taskTitles();
183 3 => self
::$_tasks[3]['title'],
187 if (CRM_Core_Permission
::check('delete activities')) {
188 $tasks[1] = self
::$_tasks[1]['title'];
195 * These tasks are the core set of tasks that the user can perform
201 * the set of tasks for a group of activity
204 public static function getTask($value) {
206 if (!$value ||
!CRM_Utils_Array
::value($value, self
::$_tasks)) {
207 // make the print task by default
211 self
::$_tasks[$value]['class'],
212 self
::$_tasks[$value]['result'],