3 +--------------------------------------------------------------------+
4 | CiviCRM version 4.4 |
5 +--------------------------------------------------------------------+
6 | Copyright CiviCRM LLC (c) 2004-2013 |
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-2013
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(
76 1 => array('title' => ts('Delete Activities'),
77 'class' => 'CRM_Activity_Form_Task_Delete',
80 2 => array('title' => ts('Print Activities'),
81 'class' => 'CRM_Activity_Form_Task_Print',
84 3 => array('title' => ts('Export Activities'),
86 'CRM_Export_Form_Select',
87 'CRM_Export_Form_Map',
91 4 => array('title' => ts('Batch Update Activities Via Profile'),
93 'CRM_Activity_Form_Task_PickProfile',
94 'CRM_Activity_Form_Task_Batch',
98 5 => array('title' => ts('Send Email to Contacts'),
100 'CRM_Activity_Form_Task_PickOption',
101 'CRM_Activity_Form_Task_Email',
105 6 => array('title' => ts('Send Reply SMS To Contacts'),
106 'class' => 'CRM_Activity_Form_Task_SMS',
111 $config = CRM_Core_Config
::singleton();
112 if (in_array('CiviCase', $config->enableComponents
)) {
113 if ( CRM_Core_Permission
::check('access all cases and activities') ||
114 CRM_Core_Permission
::check('access my cases and activities') ) {
115 self
::$_tasks[6] = array('title' => ts('File on Case'),
116 'class' => 'CRM_Activity_Form_Task_FileOnCase',
122 //CRM-4418, check for delete
123 if (!CRM_Core_Permission
::check('delete activities')) {
124 unset(self
::$_tasks[1]);
127 CRM_Utils_Hook
::searchTasks('activity', self
::$_tasks);
128 asort(self
::$_tasks);
129 return self
::$_tasks;
133 * These tasks are the core set of task titles
136 * @return array the set of task titles
140 static function &taskTitles() {
143 foreach (self
::$_tasks as $id => $value) {
144 // skip Print Activity task
146 $titles[$id] = $value['title'];
153 * show tasks selectively based on the permission level
156 * @param int $permission
158 * @return array set of tasks that are valid for the user
161 static function &permissionedTaskTitles($permission) {
163 if ($permission == CRM_Core_Permission
::EDIT
) {
164 $tasks = self
::taskTitles();
168 3 => self
::$_tasks[3]['title'],
172 if (CRM_Core_Permission
::check('delete activities')) {
173 $tasks[1] = self
::$_tasks[1]['title'];
180 * These tasks are the core set of tasks that the user can perform
185 * @return array the set of tasks for a group of activity
189 static function getTask($value) {
191 if (!$value ||
!CRM_Utils_Array
::value($value, self
::$_tasks)) {
192 // make the print task by default
196 self
::$_tasks[$value]['class'],
197 self
::$_tasks[$value]['result'],