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
35 * Class to represent the actions that can be performed on a group of contacts
36 * used by the search forms.
38 class CRM_Activity_Task
{
40 DELETE_ACTIVITIES
= 1,
42 EXPORT_ACTIVITIES
= 3,
52 static $_tasks = NULL;
55 * The optional task array
59 static $_optionalTasks = NULL;
62 * These tasks are the core set of tasks that the user can perform
63 * on a contact / group of contacts
66 * the set of tasks for a group of contacts
68 public static function &tasks() {
69 if (!(self
::$_tasks)) {
70 self
::$_tasks = array(
72 'title' => ts('Delete Activities'),
73 'class' => 'CRM_Activity_Form_Task_Delete',
77 'title' => ts('Print Selected Rows'),
78 'class' => 'CRM_Activity_Form_Task_Print',
82 'title' => ts('Export Activities'),
84 'CRM_Export_Form_Select',
85 'CRM_Export_Form_Map',
90 'title' => ts('Batch Update Activities Via Profile'),
92 'CRM_Activity_Form_Task_PickProfile',
93 'CRM_Activity_Form_Task_Batch',
98 'title' => ts('Send Email to Contacts'),
100 'CRM_Activity_Form_Task_PickOption',
101 'CRM_Activity_Form_Task_Email',
106 'title' => ts('Send Reply SMS To Contacts'),
107 'class' => 'CRM_Activity_Form_Task_SMS',
111 'title' => ts('Tag Activities (assign tags)'),
112 'class' => 'CRM_Activity_Form_Task_AddToTag',
116 'title' => ts('Untag Activities (remove tags)'),
117 'class' => 'CRM_Activity_Form_Task_RemoveFromTag',
122 $config = CRM_Core_Config
::singleton();
123 if (in_array('CiviCase', $config->enableComponents
)) {
124 if (CRM_Core_Permission
::check('access all cases and activities') ||
125 CRM_Core_Permission
::check('access my cases and activities')
127 self
::$_tasks[6] = array(
128 'title' => ts('File on Case'),
129 'class' => 'CRM_Activity_Form_Task_FileOnCase',
135 //CRM-4418, check for delete
136 if (!CRM_Core_Permission
::check('delete activities')) {
137 unset(self
::$_tasks[1]);
140 CRM_Utils_Hook
::searchTasks('activity', self
::$_tasks);
141 asort(self
::$_tasks);
142 return self
::$_tasks;
146 * These tasks are the core set of task titles
150 * the set of task titles
152 public static function &taskTitles() {
155 foreach (self
::$_tasks as $id => $value) {
156 $titles[$id] = $value['title'];
162 * Show tasks selectively based on the permission level
165 * @param int $permission
168 * set of tasks that are valid for the user
170 public static function &permissionedTaskTitles($permission) {
172 if ($permission == CRM_Core_Permission
::EDIT
) {
173 $tasks = self
::taskTitles();
177 3 => self
::$_tasks[3]['title'],
181 if (CRM_Core_Permission
::check('delete activities')) {
182 $tasks[1] = self
::$_tasks[1]['title'];
189 * These tasks are the core set of tasks that the user can perform
195 * the set of tasks for a group of activity
197 public static function getTask($value) {
199 if (!$value ||
!CRM_Utils_Array
::value($value, self
::$_tasks)) {
200 // make the print task by default
204 self
::$_tasks[$value]['class'],
205 self
::$_tasks[$value]['result'],