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 +--------------------------------------------------------------------+
15 * @copyright CiviCRM LLC https://civicrm.org/licensing
19 * This page is for Case Dashboard.
21 class CRM_Case_Page_DashBoard
extends CRM_Core_Page
{
23 public $useLivePageJS = TRUE;
26 * Heart of the viewing process.
28 * The runner gets all the meta data for the contact and calls the appropriate type of page to view.
30 public function preProcess() {
31 //check for civicase access.
32 if (!CRM_Case_BAO_Case
::accessCiviCase()) {
33 CRM_Core_Error
::statusBounce(ts('You are not authorized to access this page.'));
36 //validate case configuration.
37 $configured = CRM_Case_BAO_Case
::isCaseConfigured();
38 $this->assign('notConfigured', !$configured['configured']);
39 $this->assign('allowToAddNewCase', $configured['allowToAddNewCase']);
40 if (!$configured['configured']) {
44 $session = CRM_Core_Session
::singleton();
45 $allCases = CRM_Utils_Request
::retrieve('all', 'Positive', $this);
47 CRM_Utils_System
::setTitle(ts('CiviCase Dashboard'));
49 $userID = $session->get('userID');
51 //validate access for all cases.
52 if ($allCases && !CRM_Core_Permission
::check('access all cases and activities')) {
54 CRM_Core_Session
::setStatus(ts('You are not authorized to access all cases and activities.'), ts('Sorry'), 'error');
56 $this->assign('all', $allCases);
58 $this->assign('myCases', TRUE);
61 $this->assign('myCases', FALSE);
64 $this->assign('newClient', FALSE);
65 if (CRM_Core_Permission
::check('add contacts') &&
66 CRM_Core_Permission
::check('access all cases and activities')
68 $this->assign('newClient', TRUE);
70 $summary = CRM_Case_BAO_Case
::getCasesSummary($allCases);
71 $upcoming = CRM_Case_BAO_Case
::getCases($allCases, [], 'dashboard', TRUE);
72 $recent = CRM_Case_BAO_Case
::getCases($allCases, ['type' => 'recent'], 'dashboard', TRUE);
74 $this->assign('casesSummary', $summary);
75 if (!empty($upcoming)) {
76 $this->assign('upcomingCases', TRUE);
78 if (!empty($recent)) {
79 $this->assign('recentCases', TRUE);
82 $controller = new CRM_Core_Controller_Simple('CRM_Case_Form_Search',
83 ts('Case'), CRM_Core_Action
::BROWSE
,
87 $controller->set('context', 'dashboard');
88 $controller->setEmbedded(TRUE);
89 $controller->process();
94 * the main function that is called when the page loads,
95 * it decides the which action has to be taken for the page.
99 public function run() {
102 return parent
::run();