3 +--------------------------------------------------------------------+
4 | Copyright CiviCRM LLC. All rights reserved. |
6 | This work is published under the GNU AGPLv3 license with some |
7 | permitted exceptions and without any warranty. For full license |
8 | and copyright information, see https://civicrm.org/licensing |
9 +--------------------------------------------------------------------+
14 * @copyright CiviCRM LLC https://civicrm.org/licensing
19 * class to represent the actions that can be performed on a group of contacts
20 * used by the search forms
23 class CRM_Event_Task
extends CRM_Core_Task
{
29 CANCEL_REGISTRATION
= 301,
30 PARTICIPANT_STATUS
= 302;
35 public static $objectType = 'event';
38 * These tasks are the core set of tasks that the user can perform
39 * on a contact / group of contacts
42 * The set of tasks for a group of contacts
43 * [ 'title' => The Task title,
44 * 'class' => The Task Form class name,
45 * 'result => Boolean. FIXME: Not sure what this is for
48 public static function tasks() {
51 self
::TASK_DELETE
=> [
52 'title' => ts('Delete participants from event'),
53 'class' => 'CRM_Event_Form_Task_Delete',
57 'title' => ts('Print selected rows'),
58 'class' => 'CRM_Event_Form_Task_Print',
61 self
::TASK_EXPORT
=> [
62 'title' => ts('Export participants'),
64 'CRM_Export_Form_Select',
65 'CRM_Export_Form_Map',
69 self
::BATCH_UPDATE
=> [
70 'title' => ts('Update multiple participants'),
72 'CRM_Event_Form_Task_PickProfile',
73 'CRM_Event_Form_Task_Batch',
77 self
::CANCEL_REGISTRATION
=> [
78 'title' => ts('Cancel registration'),
79 'class' => 'CRM_Event_Form_Task_Cancel',
83 'title' => ts('Email - send now (to %1 or less)', [
85 ->get('simple_mail_limit'),
87 'class' => 'CRM_Event_Form_Task_Email',
90 self
::SAVE_SEARCH
=> [
91 'title' => ts('Group - create smart group'),
92 'class' => 'CRM_Event_Form_Task_SaveSearch',
95 self
::SAVE_SEARCH_UPDATE
=> [
96 'title' => ts('Group - update smart group'),
97 'class' => 'CRM_Event_Form_Task_SaveSearch_Update',
100 self
::PARTICIPANT_STATUS
=> [
101 'title' => ts('Participant status - change'),
102 'class' => 'CRM_Event_Form_Task_ParticipantStatus',
105 self
::LABEL_CONTACTS
=> [
106 'title' => ts('Name badges - print'),
107 'class' => 'CRM_Event_Form_Task_Badge',
110 self
::PDF_LETTER
=> [
111 'title' => ts('PDF letter - print for participants'),
112 'class' => 'CRM_Event_Form_Task_PDF',
116 'title' => ts('Group - add contacts'),
117 'class' => 'CRM_Event_Form_Task_AddToGroup',
122 //CRM-4418, check for delete
123 if (!CRM_Core_Permission
::check('delete in CiviEvent')) {
124 unset(self
::$_tasks[self
::TASK_DELETE
]);
126 //CRM-12920 - check for edit permission
127 if (!CRM_Core_Permission
::check('edit event participants')) {
128 unset(self
::$_tasks[self
::BATCH_UPDATE
], self
::$_tasks[self
::CANCEL_REGISTRATION
], self
::$_tasks[self
::PARTICIPANT_STATUS
]);
134 return self
::$_tasks;
138 * Show tasks selectively based on the permission level
141 * @param int $permission
142 * @param array $params
145 * set of tasks that are valid for the user
147 public static function permissionedTaskTitles($permission, $params = []) {
148 if (($permission == CRM_Core_Permission
::EDIT
)
149 || CRM_Core_Permission
::check('edit event participants')
151 $tasks = self
::taskTitles();
155 self
::TASK_EXPORT
=> self
::$_tasks[self
::TASK_EXPORT
]['title'],
156 self
::TASK_EMAIL
=> self
::$_tasks[self
::TASK_EMAIL
]['title'],
160 if (CRM_Core_Permission
::check('delete in CiviEvent')) {
161 $tasks[self
::TASK_DELETE
] = self
::$_tasks[self
::TASK_DELETE
]['title'];
165 $tasks = parent
::corePermissionedTaskTitles($tasks, $permission, $params);
170 * These tasks are the core set of tasks that the user can perform
176 * the set of tasks for a group of participants
178 public static function getTask($value) {
180 if (!$value ||
!CRM_Utils_Array
::value($value, self
::$_tasks)) {
181 // make the print task by default
182 $value = self
::TASK_PRINT
;
184 return parent
::getTask($value);