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
69 * @return array the set of tasks for a group of contacts
72 public static function &tasks() {
73 if (!(self
::$_tasks)) {
74 self
::$_tasks = array(
76 'title' => ts('Delete Activities'),
77 'class' => 'CRM_Activity_Form_Task_Delete',
81 'title' => ts('Print Selected Rows'),
82 'class' => 'CRM_Activity_Form_Task_Print',
86 'title' => ts('Export Activities'),
88 'CRM_Export_Form_Select',
89 'CRM_Export_Form_Map',
94 'title' => ts('Batch Update Activities Via Profile'),
96 'CRM_Activity_Form_Task_PickProfile',
97 'CRM_Activity_Form_Task_Batch',
102 'title' => ts('Send Email to Contacts'),
104 'CRM_Activity_Form_Task_PickOption',
105 'CRM_Activity_Form_Task_Email',
110 'title' => ts('Send Reply SMS To Contacts'),
111 'class' => 'CRM_Activity_Form_Task_SMS',
115 'title' => ts('Tag Activities (assign tags)'),
116 'class' => 'CRM_Activity_Form_Task_AddToTag',
120 'title' => ts('Untag Activities (remove tags)'),
121 'class' => 'CRM_Activity_Form_Task_RemoveFromTag',
126 $config = CRM_Core_Config
::singleton();
127 if (in_array('CiviCase', $config->enableComponents
)) {
128 if (CRM_Core_Permission
::check('access all cases and activities') ||
129 CRM_Core_Permission
::check('access my cases and activities')) {
130 self
::$_tasks[6] = array(
131 'title' => ts('File on Case'),
132 'class' => 'CRM_Activity_Form_Task_FileOnCase',
138 //CRM-4418, check for delete
139 if (!CRM_Core_Permission
::check('delete activities')) {
140 unset(self
::$_tasks[1]);
143 CRM_Utils_Hook
::searchTasks('activity', self
::$_tasks);
144 asort(self
::$_tasks);
145 return self
::$_tasks;
149 * These tasks are the core set of task titles
152 * @return array the set of task titles
155 public static function &taskTitles() {
158 foreach (self
::$_tasks as $id => $value) {
159 $titles[$id] = $value['title'];
165 * Show tasks selectively based on the permission level
168 * @param int $permission
170 * @return array set of tasks that are valid for the user
172 public static function &permissionedTaskTitles($permission) {
174 if ($permission == CRM_Core_Permission
::EDIT
) {
175 $tasks = self
::taskTitles();
179 3 => self
::$_tasks[3]['title'],
183 if (CRM_Core_Permission
::check('delete activities')) {
184 $tasks[1] = self
::$_tasks[1]['title'];
191 * These tasks are the core set of tasks that the user can perform
196 * @return array the set of tasks for a group of activity
199 public static function getTask($value) {
201 if (!$value ||
!CRM_Utils_Array
::value($value, self
::$_tasks)) {
202 // make the print task by default
206 self
::$_tasks[$value]['class'],
207 self
::$_tasks[$value]['result'],