3 +--------------------------------------------------------------------+
4 | CiviCRM version 4.7 |
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 +--------------------------------------------------------------------+
31 * @copyright CiviCRM LLC (c) 2004-2018
35 * Class to represent the actions that can be performed on a group of contacts.
37 * Used by the search forms
39 class CRM_Case_Task
extends CRM_Core_Task
{
45 static $objectType = 'case';
48 * These tasks are the core set of tasks that the user can perform
49 * on a contact / group of contacts
52 * the set of tasks for a group of contacts
54 public static function tasks() {
56 self
::$_tasks = array(
57 self
::TASK_DELETE
=> array(
58 'title' => ts('Delete cases'),
59 'class' => 'CRM_Case_Form_Task_Delete',
62 self
::TASK_PRINT
=> array(
63 'title' => ts('Print selected rows'),
64 'class' => 'CRM_Case_Form_Task_Print',
67 self
::TASK_EXPORT
=> array(
68 'title' => ts('Export cases'),
70 'CRM_Export_Form_Select',
71 'CRM_Export_Form_Map',
75 self
::RESTORE_CASES
=> array(
76 'title' => ts('Restore cases'),
77 'class' => 'CRM_Case_Form_Task_Restore',
80 self
::PDF_LETTER
=> array(
81 'title' => ts('Print/merge Document'),
82 'class' => 'CRM_Case_Form_Task_PDF',
85 self
::BATCH_UPDATE
=> array(
86 'title' => ts('Update multiple cases'),
88 'CRM_Case_Form_Task_PickProfile',
89 'CRM_Case_Form_Task_Batch',
95 //CRM-4418, check for delete
96 if (!CRM_Core_Permission
::check('delete in CiviCase')) {
97 unset(self
::$_tasks[self
::TASK_DELETE
]);
103 return self
::$_tasks;
107 * Show tasks selectively based on the permission level.
110 * @param int $permission
111 * @param array $params
114 * set of tasks that are valid for the user
116 public static function permissionedTaskTitles($permission, $params = array()) {
117 if (($permission == CRM_Core_Permission
::EDIT
)
118 || CRM_Core_Permission
::check('access all cases and activities')
119 || CRM_Core_Permission
::check('access my cases and activities')
121 $tasks = self
::taskTitles();
125 self
::TASK_EXPORT
=> self
::$_tasks[self
::TASK_EXPORT
]['title'],
128 if (CRM_Core_Permission
::check('delete in CiviCase')) {
129 $tasks[self
::TASK_DELETE
] = self
::$_tasks[self
::TASK_DELETE
]['title'];
133 $tasks = parent
::corePermissionedTaskTitles($tasks, $permission, $params);
138 * These tasks are the core set of tasks.
143 * the set of tasks for a group of contacts
145 public static function getTask($value) {
147 if (!$value ||
!CRM_Utils_Array
::value($value, self
::$_tasks)) {
148 // make the print task by default
149 $value = self
::TASK_PRINT
;
153 self
::$_tasks[$value]['class'],
154 self
::$_tasks[$value]['result'],