array( 'title' => ts('Delete Grants'), 'class' => 'CRM_Grant_Form_Task_Delete', 'result' => FALSE, ), 2 => array( 'title' => ts('Print Selected Rows'), 'class' => 'CRM_Grant_Form_Task_Print', 'result' => FALSE, ), 3 => array( 'title' => ts('Export Grants'), 'class' => array( 'CRM_Export_Form_Select', 'CRM_Export_Form_Map', ), 'result' => FALSE, ), 4 => array( 'title' => ts('Update Grants'), 'class' => 'CRM_Grant_Form_Task_Update', 'result' => FALSE, ), ); } if (!CRM_Core_Permission::check('delete in CiviGrant')) { unset(self::$_tasks[1]); } CRM_Utils_Hook::searchTasks('grant', self::$_tasks); asort(self::$_tasks); return self::$_tasks; } /** * These tasks are the core set of task titles * * @return array the set of task titles * @static * @access public */ static function &taskTitles() { self::tasks(); $titles = array(); foreach (self::$_tasks as $id => $value) { $titles[$id] = $value['title']; } return $titles; } /** * 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) { $tasks = array(); if (($permission == CRM_Core_Permission::EDIT) || CRM_Core_Permission::check('edit grants') ) { $tasks = self::taskTitles(); } else { $tasks = array( 3 => self::$_tasks[3]['title'], ); //CRM-4418, if (CRM_Core_Permission::check('delete in CiviGrant')) { $tasks[1] = self::$_tasks[1]['title']; } } return $tasks; } /** * These tasks are the core set of tasks that the user can perform * * @param int $value * * @return array the set of tasks for a group of contacts * @static * @access 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'], ); } }