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
73 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') ) {
131 self
::$_tasks[6] = array(
132 'title' => ts('File on Case'),
133 'class' => 'CRM_Activity_Form_Task_FileOnCase',
139 //CRM-4418, check for delete
140 if (!CRM_Core_Permission
::check('delete activities')) {
141 unset(self
::$_tasks[1]);
144 CRM_Utils_Hook
::searchTasks('activity', self
::$_tasks);
145 asort(self
::$_tasks);
146 return self
::$_tasks;
150 * These tasks are the core set of task titles
153 * @return array the set of task titles
157 static function &taskTitles() {
160 foreach (self
::$_tasks as $id => $value) {
161 $titles[$id] = $value['title'];
167 * Show tasks selectively based on the permission level
170 * @param int $permission
172 * @return array set of tasks that are valid for the user
175 static function &permissionedTaskTitles($permission) {
177 if ($permission == CRM_Core_Permission
::EDIT
) {
178 $tasks = self
::taskTitles();
182 3 => self
::$_tasks[3]['title'],
186 if (CRM_Core_Permission
::check('delete activities')) {
187 $tasks[1] = self
::$_tasks[1]['title'];
194 * These tasks are the core set of tasks that the user can perform
199 * @return array the set of tasks for a group of activity
203 static function getTask($value) {
205 if (!$value ||
!CRM_Utils_Array
::value($value, self
::$_tasks)) {
206 // make the print task by default
210 self
::$_tasks[$value]['class'],
211 self
::$_tasks[$value]['result'],