<?php
/*
+--------------------------------------------------------------------+
- | CiviCRM version 4.5 |
+ | CiviCRM version 4.6 |
+--------------------------------------------------------------------+
| Copyright CiviCRM LLC (c) 2004-2014 |
+--------------------------------------------------------------------+
*/
class CRM_Event_Task {
// Value for SAVE_SEARCH is set to 13 in accordance with CRM_Contact_Task::SAVE_SEARCH
- CONST DELETE_EVENTS = 1, PRINT_EVENTS = 2, EXPORT_EVENTS = 3, BATCH_EVENTS = 4, CANCEL_REGISTRATION = 5, EMAIL_CONTACTS = 6,
+ const DELETE_EVENTS = 1, PRINT_EVENTS = 2, EXPORT_EVENTS = 3, BATCH_EVENTS = 4, CANCEL_REGISTRATION = 5, EMAIL_CONTACTS = 6,
// Value for LABEL_CONTACTS is set to 16 in accordance with CRM_Contact_Task::LABEL_CONTACTS
SAVE_SEARCH = 13, SAVE_SEARCH_UPDATE = 14, PARTICIPANT_STATUS = 15,
- LABEL_CONTACTS = 16;
+ LABEL_CONTACTS = 16, GROUP_CONTACTS = 20;
/**
- * the task array
+ * The task array
*
* @var array
* @static
static $_tasks = NULL;
/**
- * the optional task array
+ * The optional task array
*
* @var array
* @static
*
* @return array the set of tasks for a group of contacts
* @static
- * @access public
*/
- static function &tasks() {
+ public static function &tasks() {
if (!(self::$_tasks)) {
- self::$_tasks = array(1 => array(
+ self::$_tasks = array(
+ 1 => array(
'title' => ts('Delete Participants'),
'class' => 'CRM_Event_Form_Task_Delete',
'result' => FALSE,
'class' => 'CRM_Event_Form_Task_Badge',
'result' => FALSE,
),
+ 20 => array(
+ 'title' => ts('Add Contacts to Group'),
+ 'class' => 'CRM_Event_Form_Task_AddToGroup',
+ 'result' => FALSE,
+ ),
);
//CRM-4418, check for delete
if (!CRM_Core_Permission::check('delete in CiviEvent')) {
unset(self::$_tasks[1]);
}
+ //CRM-12920 - check for edit permission
+ if (!CRM_Core_Permission::check('edit event participants')) {
+ unset(self::$_tasks[4], self::$_tasks[5], self::$_tasks[15]);
+ }
}
CRM_Utils_Hook::searchTasks('event', self::$_tasks);
*
* @return array the set of task titles
* @static
- * @access public
*/
- static function &taskTitles() {
+ public static function &taskTitles() {
self::tasks();
$titles = array();
foreach (self::$_tasks as $id => $value) {
*
* @return array the set of optional tasks for a group of contacts
* @static
- * @access public
*/
- static function &optionalTaskTitle() {
+ public static function &optionalTaskTitle() {
$tasks = array(
14 => self::$_tasks[14]['title'],
);
}
/**
- * show tasks selectively based on the permission level
+ * Show tasks selectively based on the permission level
* of the user
*
* @param int $permission
*
* @return array set of tasks that are valid for the user
- * @access public
*/
- static function &permissionedTaskTitles($permission) {
+ public static function &permissionedTaskTitles($permission) {
$tasks = array();
if (($permission == CRM_Core_Permission::EDIT)
|| CRM_Core_Permission::check('edit event participants')
*
* @return array the set of tasks for a group of participants
* @static
- * @access public
*/
- static function getTask($value) {
+ public static function getTask($value) {
self::tasks();
if (!$value || !CRM_Utils_Array::value($value, self::$_tasks)) {
// make the print task by default
);
}
}
-