forked from civicrm/civicrm-core
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMyCases.php
60 lines (51 loc) · 1.83 KB
/
MyCases.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
<?php
/*
+--------------------------------------------------------------------+
| Copyright CiviCRM LLC. All rights reserved. |
| |
| This work is published under the GNU AGPLv3 license with some |
| permitted exceptions and without any warranty. For full license |
| and copyright information, see https://civicrm.org/licensing |
+--------------------------------------------------------------------+
*/
/**
*
* @package CRM
* @copyright CiviCRM LLC https://civicrm.org/licensing
*/
/**
* Main page for Cases dashlet
*
*/
class CRM_Dashlet_Page_MyCases extends CRM_Core_Page {
/**
* List activities as dashlet.
*
* @return void
*/
public function run() {
$context = CRM_Utils_Request::retrieve('context', 'Alphanumeric', $this, FALSE, 'dashlet');
$this->assign('context', $context);
//check for civicase access.
if (!CRM_Case_BAO_Case::accessCiviCase()) {
CRM_Core_Error::statusBounce(ts('You are not authorized to access this page.'));
}
$controller = new CRM_Core_Controller_Simple('CRM_Case_Form_Search',
ts('Case'), CRM_Core_Action::BROWSE,
NULL,
FALSE, FALSE, TRUE
);
$controller->setEmbedded(TRUE);
$controller->process();
// Default to cases with statuses that represent Open
$caseStatusGroupings = CRM_Core_OptionGroup::values('case_status', TRUE, TRUE, FALSE, NULL, 'value');
$caseStatuses = array_keys(array_intersect($caseStatusGroupings, ['Opened']));
$form = current($controller->_pages);
$form->setDefaults(['case_status_id' => $caseStatuses]);
$controller->run();
if (CRM_Case_BAO_Case::getCases(FALSE, ['type' => 'any'], $context, TRUE)) {
$this->assign('casePresent', TRUE);
}
return parent::run();
}
}