array( 'title' => ts('Delete Participants'), 'class' => 'CRM_Event_Form_Task_Delete', 'result' => FALSE, ), 2 => array( 'title' => ts('Print Selected Rows'), 'class' => 'CRM_Event_Form_Task_Print', 'result' => FALSE, ), 3 => array( 'title' => ts('Export Participants'), 'class' => array( 'CRM_Export_Form_Select', 'CRM_Export_Form_Map', ), 'result' => FALSE, ), 4 => array( 'title' => ts('Batch Update Participants Via Profile'), 'class' => array( 'CRM_Event_Form_Task_PickProfile', 'CRM_Event_Form_Task_Batch', ), 'result' => TRUE, ), 5 => array( 'title' => ts('Cancel Registration'), 'class' => 'CRM_Event_Form_Task_Cancel', 'result' => FALSE, ), 6 => array( 'title' => ts('Send Email to Contacts'), 'class' => 'CRM_Event_Form_Task_Email', 'result' => TRUE, ), 13 => array( 'title' => ts('New Smart Group'), 'class' => 'CRM_Event_Form_Task_SaveSearch', 'result' => TRUE, ), 14 => array( 'title' => ts('Update Smart Group'), 'class' => 'CRM_Event_Form_Task_SaveSearch_Update', 'result' => TRUE, ), 15 => array( 'title' => ts('Change Participant Status'), 'class' => 'CRM_Event_Form_Task_ParticipantStatus', 'result' => TRUE, ), 16 => array( 'title' => ts('Print Event Name Badges'), 'class' => 'CRM_Event_Form_Task_Badge', 'result' => FALSE, ), 17 => array( 'title' => ts('Print PDF Letter for Participants'), 'class' => 'CRM_Event_Form_Task_PDF', 'result' => TRUE, ), 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); asort(self::$_tasks); return self::$_tasks; } /** * These tasks are the core set of task titles * for participants * * @return array * the set of task titles */ public static function &taskTitles() { self::tasks(); $titles = array(); foreach (self::$_tasks as $id => $value) { // skip Update Smart Group task if ($id != self::SAVE_SEARCH_UPDATE) { $titles[$id] = $value['title']; } } return $titles; } /** * These tasks get added based on the context the user is in. * * @return array * the set of optional tasks for a group of contacts */ public static function &optionalTaskTitle() { $tasks = array( 14 => self::$_tasks[14]['title'], ); return $tasks; } /** * 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 */ public static function &permissionedTaskTitles($permission) { $tasks = array(); if (($permission == CRM_Core_Permission::EDIT) || CRM_Core_Permission::check('edit event participants') ) { $tasks = self::taskTitles(); } else { $tasks = array( 3 => self::$_tasks[3]['title'], 6 => self::$_tasks[6]['title'], ); //CRM-4418, if (CRM_Core_Permission::check('delete in CiviEvent')) { $tasks[1] = self::$_tasks[1]['title']; } } return $tasks; } /** * These tasks are the core set of tasks that the user can perform * on participants * * @param int $value * * @return array * the set of tasks for a group of participants */ public static function getTask($value) { self::tasks(); if (!$value || !CRM_Utils_Array::value($value, self::$_tasks)) { // make the print task by default $value = 2; } return array( self::$_tasks[$value]['class'], self::$_tasks[$value]['result'], ); } }