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.
21 class CRM_Pledge_Task
extends CRM_Core_Task
{
23 public static $objectType = 'pledge';
26 * These tasks are the core set of tasks that the user can perform
27 * on a contact / group of contacts
30 * the set of tasks for a group of contacts
32 public static function tasks() {
35 self
::TASK_DELETE
=> [
36 'title' => ts('Delete pledges'),
37 'class' => 'CRM_Pledge_Form_Task_Delete',
41 'title' => ts('Print selected rows'),
42 'class' => 'CRM_Pledge_Form_Task_Print',
45 self
::TASK_EXPORT
=> [
46 'title' => ts('Export pledges'),
48 'CRM_Export_Form_Select',
49 'CRM_Export_Form_Map',
55 // CRM-4418, check for delete
56 if (!CRM_Core_Permission
::check('delete in CiviPledge')) {
57 unset(self
::$_tasks[self
::TASK_DELETE
]);
67 * Show tasks selectively based on the permission level
70 * @param int $permission
71 * @param array $params
74 * set of tasks that are valid for the user
76 public static function permissionedTaskTitles($permission, $params = []) {
77 if (($permission == CRM_Core_Permission
::EDIT
)
78 || CRM_Core_Permission
::check('edit pledges')
80 $tasks = self
::taskTitles();
84 self
::TASK_EXPORT
=> self
::$_tasks[self
::TASK_EXPORT
]['title'],
87 if (CRM_Core_Permission
::check('delete in CiviPledge')) {
88 $tasks[self
::TASK_DELETE
] = self
::$_tasks[self
::TASK_DELETE
]['title'];
92 $tasks = parent
::corePermissionedTaskTitles($tasks, $permission, $params);
97 * These tasks are the core set of tasks that the user can perform
103 * the set of tasks for a group of pledge holders
105 public static function getTask($value) {
108 if (!CRM_Utils_Array
::value($value, self
::$_tasks)) {
109 // make it the print task by default
110 $value = self
::TASK_PRINT
;
112 return parent
::getTask($value);