3 +--------------------------------------------------------------------+
4 | CiviCRM version 4.7 |
5 +--------------------------------------------------------------------+
6 | Copyright CiviCRM LLC (c) 2004-2015 |
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 and the CiviCRM Licensing Exception. |
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 and the CiviCRM Licensing Exception along |
21 | with this program; if not, contact CiviCRM LLC |
22 | at info[AT]civicrm[DOT]org. If you have questions about the |
23 | GNU Affero General Public License or the licensing of CiviCRM, |
24 | see the CiviCRM license FAQ at http://civicrm.org/licensing |
25 +--------------------------------------------------------------------+
31 * @copyright CiviCRM LLC (c) 2004-2015
35 * Class to represent the actions that can be performed on a group of contacts used by the search forms.
37 class CRM_Activity_Task
{
39 DELETE_ACTIVITIES
= 1,
41 EXPORT_ACTIVITIES
= 3,
51 static $_tasks = NULL;
54 * The optional task array.
58 static $_optionalTasks = NULL;
61 * These tasks are the core set of tasks that the user can perform.
62 * on a contact / group of contacts
65 * the set of tasks for a group of contacts
67 public static function &tasks() {
68 if (!(self
::$_tasks)) {
69 self
::$_tasks = array(
71 'title' => ts('Delete Activities'),
72 'class' => 'CRM_Activity_Form_Task_Delete',
76 'title' => ts('Print Selected Rows'),
77 'class' => 'CRM_Activity_Form_Task_Print',
81 'title' => ts('Export Activities'),
83 'CRM_Export_Form_Select',
84 'CRM_Export_Form_Map',
89 'title' => ts('Batch Update Activities Via Profile'),
91 'CRM_Activity_Form_Task_PickProfile',
92 'CRM_Activity_Form_Task_Batch',
97 'title' => ts('Send Email to Contacts'),
99 'CRM_Activity_Form_Task_PickOption',
100 'CRM_Activity_Form_Task_Email',
105 'title' => ts('Send Reply SMS To Contacts'),
106 'class' => 'CRM_Activity_Form_Task_SMS',
110 'title' => ts('Tag Activities (assign tags)'),
111 'class' => 'CRM_Activity_Form_Task_AddToTag',
115 'title' => ts('Untag Activities (remove tags)'),
116 'class' => 'CRM_Activity_Form_Task_RemoveFromTag',
121 $config = CRM_Core_Config
::singleton();
122 if (in_array('CiviCase', $config->enableComponents
)) {
123 if (CRM_Core_Permission
::check('access all cases and activities') ||
124 CRM_Core_Permission
::check('access my cases and activities')
126 self
::$_tasks[6] = array(
127 'title' => ts('File on Case'),
128 'class' => 'CRM_Activity_Form_Task_FileOnCase',
134 //CRM-4418, check for delete
135 if (!CRM_Core_Permission
::check('delete activities')) {
136 unset(self
::$_tasks[1]);
139 CRM_Utils_Hook
::searchTasks('activity', self
::$_tasks);
140 asort(self
::$_tasks);
141 return self
::$_tasks;
145 * These tasks are the core set of task titles.
149 * the set of task titles
151 public static function &taskTitles() {
154 foreach (self
::$_tasks as $id => $value) {
155 $titles[$id] = $value['title'];
161 * Show tasks selectively based on the permission level.
164 * @param int $permission
167 * set of tasks that are valid for the user
169 public static function &permissionedTaskTitles($permission) {
171 if ($permission == CRM_Core_Permission
::EDIT
) {
172 $tasks = self
::taskTitles();
176 3 => self
::$_tasks[3]['title'],
180 if (CRM_Core_Permission
::check('delete activities')) {
181 $tasks[1] = self
::$_tasks[1]['title'];
188 * These tasks are the core set of tasks that the user can perform.
194 * the set of tasks for a group of activity
196 public static function getTask($value) {
198 if (!$value ||
!CRM_Utils_Array
::value($value, self
::$_tasks)) {
199 // make the print task by default
203 self
::$_tasks[$value]['class'],
204 self
::$_tasks[$value]['result'],