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
18 * class to represent the actions that can be performed on a group of contacts
19 * used by the search forms
22 class CRM_Event_Task
extends CRM_Core_Task
{
28 CANCEL_REGISTRATION
= 301,
29 PARTICIPANT_STATUS
= 302;
34 public static $objectType = 'event';
37 * These tasks are the core set of tasks that the user can perform
38 * on a contact / group of contacts
41 * The set of tasks for a group of contacts
42 * [ 'title' => The Task title,
43 * 'class' => The Task Form class name,
44 * 'result => Boolean. FIXME: Not sure what this is for
47 public static function tasks() {
50 self
::TASK_DELETE
=> [
51 'title' => ts('Delete participants from event'),
52 'class' => 'CRM_Event_Form_Task_Delete',
56 'title' => ts('Print selected rows'),
57 'class' => 'CRM_Event_Form_Task_Print',
60 self
::TASK_EXPORT
=> [
61 'title' => ts('Export participants'),
63 'CRM_Event_Export_Form_Select',
64 'CRM_Event_Export_Form_Map',
68 self
::BATCH_UPDATE
=> [
69 'title' => ts('Update multiple participants'),
71 'CRM_Event_Form_Task_PickProfile',
72 'CRM_Event_Form_Task_Batch',
76 self
::CANCEL_REGISTRATION
=> [
77 'title' => ts('Cancel registration'),
78 'class' => 'CRM_Event_Form_Task_Cancel',
82 'title' => ts('Email - send now (to %1 or less)', [
84 ->get('simple_mail_limit'),
86 'class' => 'CRM_Event_Form_Task_Email',
89 self
::SAVE_SEARCH
=> [
90 'title' => ts('Group - create smart group'),
91 'class' => 'CRM_Event_Form_Task_SaveSearch',
94 self
::SAVE_SEARCH_UPDATE
=> [
95 'title' => ts('Group - update smart group'),
96 'class' => 'CRM_Event_Form_Task_SaveSearch_Update',
99 self
::PARTICIPANT_STATUS
=> [
100 'title' => ts('Participant status - change'),
101 'class' => 'CRM_Event_Form_Task_ParticipantStatus',
104 self
::LABEL_CONTACTS
=> [
105 'title' => ts('Name badges - print'),
106 'class' => 'CRM_Event_Form_Task_Badge',
109 self
::PDF_LETTER
=> [
110 'title' => ts('PDF letter - print for participants'),
111 'class' => 'CRM_Event_Form_Task_PDF',
115 'title' => ts('Group - add contacts'),
116 'class' => 'CRM_Event_Form_Task_AddToGroup',
121 //CRM-4418, check for delete
122 if (!CRM_Core_Permission
::check('delete in CiviEvent')) {
123 unset(self
::$_tasks[self
::TASK_DELETE
]);
125 //CRM-12920 - check for edit permission
126 if (!CRM_Core_Permission
::check('edit event participants')) {
127 unset(self
::$_tasks[self
::BATCH_UPDATE
], self
::$_tasks[self
::CANCEL_REGISTRATION
], self
::$_tasks[self
::PARTICIPANT_STATUS
]);
133 return self
::$_tasks;
137 * Show tasks selectively based on the permission level
140 * @param int $permission
141 * @param array $params
144 * set of tasks that are valid for the user
146 public static function permissionedTaskTitles($permission, $params = []) {
147 if (($permission == CRM_Core_Permission
::EDIT
)
148 || CRM_Core_Permission
::check('edit event participants')
150 $tasks = self
::taskTitles();
154 self
::TASK_EXPORT
=> self
::$_tasks[self
::TASK_EXPORT
]['title'],
155 self
::TASK_EMAIL
=> self
::$_tasks[self
::TASK_EMAIL
]['title'],
159 if (CRM_Core_Permission
::check('delete in CiviEvent')) {
160 $tasks[self
::TASK_DELETE
] = self
::$_tasks[self
::TASK_DELETE
]['title'];
164 $tasks = parent
::corePermissionedTaskTitles($tasks, $permission, $params);
169 * These tasks are the core set of tasks that the user can perform
175 * the set of tasks for a group of participants
177 public static function getTask($value) {
179 if (!$value ||
empty(self
::$_tasks[$value])) {
180 // make the print task by default
181 $value = self
::TASK_PRINT
;
183 return parent
::getTask($value);