3 +--------------------------------------------------------------------+
5 +--------------------------------------------------------------------+
6 | Copyright CiviCRM LLC (c) 2004-2019 |
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-2019
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
{
45 CANCEL_REGISTRATION
= 301,
46 PARTICIPANT_STATUS
= 302;
51 public static $objectType = 'event';
54 * These tasks are the core set of tasks that the user can perform
55 * on a contact / group of contacts
58 * The set of tasks for a group of contacts
59 * [ 'title' => The Task title,
60 * 'class' => The Task Form class name,
61 * 'result => Boolean. FIXME: Not sure what this is for
64 public static function tasks() {
67 self
::TASK_DELETE
=> [
68 'title' => ts('Delete participants from event'),
69 'class' => 'CRM_Event_Form_Task_Delete',
73 'title' => ts('Print selected rows'),
74 'class' => 'CRM_Event_Form_Task_Print',
77 self
::TASK_EXPORT
=> [
78 'title' => ts('Export participants'),
80 'CRM_Export_Form_Select',
81 'CRM_Export_Form_Map',
85 self
::BATCH_UPDATE
=> [
86 'title' => ts('Update multiple participants'),
88 'CRM_Event_Form_Task_PickProfile',
89 'CRM_Event_Form_Task_Batch',
93 self
::CANCEL_REGISTRATION
=> [
94 'title' => ts('Cancel registration'),
95 'class' => 'CRM_Event_Form_Task_Cancel',
99 'title' => ts('Email - send now (to %1 or less)', [
100 1 => Civi
::settings()
101 ->get('simple_mail_limit'),
103 'class' => 'CRM_Event_Form_Task_Email',
106 self
::SAVE_SEARCH
=> [
107 'title' => ts('Group - create smart group'),
108 'class' => 'CRM_Event_Form_Task_SaveSearch',
111 self
::SAVE_SEARCH_UPDATE
=> [
112 'title' => ts('Group - update smart group'),
113 'class' => 'CRM_Event_Form_Task_SaveSearch_Update',
116 self
::PARTICIPANT_STATUS
=> [
117 'title' => ts('Participant status - change'),
118 'class' => 'CRM_Event_Form_Task_ParticipantStatus',
121 self
::LABEL_CONTACTS
=> [
122 'title' => ts('Name badges - print'),
123 'class' => 'CRM_Event_Form_Task_Badge',
126 self
::PDF_LETTER
=> [
127 'title' => ts('PDF letter - print for participants'),
128 'class' => 'CRM_Event_Form_Task_PDF',
132 'title' => ts('Group - add contacts'),
133 'class' => 'CRM_Event_Form_Task_AddToGroup',
138 //CRM-4418, check for delete
139 if (!CRM_Core_Permission
::check('delete in CiviEvent')) {
140 unset(self
::$_tasks[self
::TASK_DELETE
]);
142 //CRM-12920 - check for edit permission
143 if (!CRM_Core_Permission
::check('edit event participants')) {
144 unset(self
::$_tasks[self
::BATCH_UPDATE
], self
::$_tasks[self
::CANCEL_REGISTRATION
], self
::$_tasks[self
::PARTICIPANT_STATUS
]);
150 return self
::$_tasks;
154 * Show tasks selectively based on the permission level
157 * @param int $permission
158 * @param array $params
161 * set of tasks that are valid for the user
163 public static function permissionedTaskTitles($permission, $params = []) {
164 if (($permission == CRM_Core_Permission
::EDIT
)
165 || CRM_Core_Permission
::check('edit event participants')
167 $tasks = self
::taskTitles();
171 self
::TASK_EXPORT
=> self
::$_tasks[self
::TASK_EXPORT
]['title'],
172 self
::TASK_EMAIL
=> self
::$_tasks[self
::TASK_EMAIL
]['title'],
176 if (CRM_Core_Permission
::check('delete in CiviEvent')) {
177 $tasks[self
::TASK_DELETE
] = self
::$_tasks[self
::TASK_DELETE
]['title'];
181 $tasks = parent
::corePermissionedTaskTitles($tasks, $permission, $params);
186 * These tasks are the core set of tasks that the user can perform
192 * the set of tasks for a group of participants
194 public static function getTask($value) {
196 if (!$value ||
!CRM_Utils_Array
::value($value, self
::$_tasks)) {
197 // make the print task by default
198 $value = self
::TASK_PRINT
;
200 return parent
::getTask($value);