3 +--------------------------------------------------------------------+
5 +--------------------------------------------------------------------+
6 | Copyright CiviCRM LLC (c) 2004-2018 |
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-2018
34 * class to represent the actions that can be performed on a group of contacts
35 * used by the search forms.
37 class CRM_Pledge_Task
extends CRM_Core_Task
{
39 static $objectType = 'pledge';
42 * These tasks are the core set of tasks that the user can perform
43 * on a contact / group of contacts
46 * the set of tasks for a group of contacts
48 public static function tasks() {
50 self
::$_tasks = array(
51 self
::TASK_DELETE
=> array(
52 'title' => ts('Delete pledges'),
53 'class' => 'CRM_Pledge_Form_Task_Delete',
56 self
::TASK_PRINT
=> array(
57 'title' => ts('Print selected rows'),
58 'class' => 'CRM_Pledge_Form_Task_Print',
61 self
::TASK_EXPORT
=> array(
62 'title' => ts('Export pledges'),
64 'CRM_Export_Form_Select',
65 'CRM_Export_Form_Map',
71 // CRM-4418, check for delete
72 if (!CRM_Core_Permission
::check('delete in CiviPledge')) {
73 unset(self
::$_tasks[self
::TASK_DELETE
]);
83 * Show tasks selectively based on the permission level
86 * @param int $permission
87 * @param array $params
90 * set of tasks that are valid for the user
92 public static function permissionedTaskTitles($permission, $params = array()) {
93 if (($permission == CRM_Core_Permission
::EDIT
)
94 || CRM_Core_Permission
::check('edit pledges')
96 $tasks = self
::taskTitles();
100 self
::TASK_EXPORT
=> self
::$_tasks[self
::TASK_EXPORT
]['title'],
103 if (CRM_Core_Permission
::check('delete in CiviPledge')) {
104 $tasks[self
::TASK_DELETE
] = self
::$_tasks[self
::TASK_DELETE
]['title'];
108 $tasks = parent
::corePermissionedTaskTitles($tasks, $permission, $params);
113 * These tasks are the core set of tasks that the user can perform
119 * the set of tasks for a group of pledge holders
121 public static function getTask($value) {
124 if (!CRM_Utils_Array
::value($value, self
::$_tasks)) {
125 // make it the print task by default
126 $value = self
::TASK_PRINT
;
128 return parent
::getTask($value);