3 +--------------------------------------------------------------------+
4 | CiviCRM version 4.7 |
5 +--------------------------------------------------------------------+
6 | Copyright CiviCRM LLC (c) 2004-2018 |
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 +--------------------------------------------------------------------+
30 * @copyright CiviCRM LLC (c) 2004-2018
35 * class to represent the actions that can be performed on a group of contacts
36 * used by the search forms
39 class CRM_Event_Task
extends CRM_Core_Task
{
43 CANCEL_REGISTRATION
= 301,
44 PARTICIPANT_STATUS
= 302;
46 static $objectType = 'event';
49 * These tasks are the core set of tasks that the user can perform
50 * on a contact / group of contacts
52 * @return array The set of tasks for a group of contacts
53 * [ 'title' => The Task title,
54 * 'class' => The Task Form class name,
55 * 'result => Boolean. FIXME: Not sure what this is for
58 public static function tasks() {
60 self
::$_tasks = array(
61 self
::TASK_DELETE
=> array(
62 'title' => ts('Delete participants from event'),
63 'class' => 'CRM_Event_Form_Task_Delete',
66 self
::TASK_PRINT
=> array(
67 'title' => ts('Print selected rows'),
68 'class' => 'CRM_Event_Form_Task_Print',
71 self
::TASK_EXPORT
=> array(
72 'title' => ts('Export participants'),
74 'CRM_Export_Form_Select',
75 'CRM_Export_Form_Map',
79 self
::BATCH_UPDATE
=> array(
80 'title' => ts('Update multiple participants'),
82 'CRM_Event_Form_Task_PickProfile',
83 'CRM_Event_Form_Task_Batch',
87 self
::CANCEL_REGISTRATION
=> array(
88 'title' => ts('Cancel registration'),
89 'class' => 'CRM_Event_Form_Task_Cancel',
92 self
::TASK_EMAIL
=> array(
93 'title' => ts('Email - send now (to %1 or less)', array(
95 ->get('simple_mail_limit'),
97 'class' => 'CRM_Event_Form_Task_Email',
100 self
::SAVE_SEARCH
=> array(
101 'title' => ts('Group - create smart group'),
102 'class' => 'CRM_Event_Form_Task_SaveSearch',
105 self
::SAVE_SEARCH_UPDATE
=> array(
106 'title' => ts('Group - update smart group'),
107 'class' => 'CRM_Event_Form_Task_SaveSearch_Update',
110 self
::PARTICIPANT_STATUS
=> array(
111 'title' => ts('Participant status - change'),
112 'class' => 'CRM_Event_Form_Task_ParticipantStatus',
115 self
::LABEL_CONTACTS
=> array(
116 'title' => ts('Name badges - print'),
117 'class' => 'CRM_Event_Form_Task_Badge',
120 self
::TASK_PRINT
=> array(
121 'title' => ts('PDF letter - print for participants'),
122 'class' => 'CRM_Event_Form_Task_PDF',
125 self
::GROUP_ADD
=> array(
126 'title' => ts('Group - add contacts'),
127 'class' => 'CRM_Event_Form_Task_AddToGroup',
132 //CRM-4418, check for delete
133 if (!CRM_Core_Permission
::check('delete in CiviEvent')) {
134 unset(self
::$_tasks[self
::TASK_DELETE
]);
136 //CRM-12920 - check for edit permission
137 if (!CRM_Core_Permission
::check('edit event participants')) {
138 unset(self
::$_tasks[self
::BATCH_UPDATE
], self
::$_tasks[self
::CANCEL_REGISTRATION
], self
::$_tasks[self
::PARTICIPANT_STATUS
]);
144 return self
::$_tasks;
148 * Show tasks selectively based on the permission level
151 * @param int $permission
152 * @param array $params
155 * set of tasks that are valid for the user
157 public static function permissionedTaskTitles($permission, $params = array()) {
158 if (($permission == CRM_Core_Permission
::EDIT
)
159 || CRM_Core_Permission
::check('edit event participants')
161 $tasks = self
::taskTitles();
165 self
::TASK_EXPORT
=> self
::$_tasks[self
::TASK_EXPORT
]['title'],
166 self
::TASK_EMAIL
=> self
::$_tasks[self
::TASK_EMAIL
]['title'],
170 if (CRM_Core_Permission
::check('delete in CiviEvent')) {
171 $tasks[self
::TASK_DELETE
] = self
::$_tasks[self
::TASK_DELETE
]['title'];
175 $tasks = parent
::corePermissionedTaskTitles($tasks, $permission, $params);
180 * These tasks are the core set of tasks that the user can perform
186 * the set of tasks for a group of participants
188 public static function getTask($value) {
190 if (!$value ||
!CRM_Utils_Array
::value($value, self
::$_tasks)) {
191 // make the print task by default
192 $value = self
::TASK_PRINT
;
194 return parent
::getTask($value);