3 +--------------------------------------------------------------------+
4 | CiviCRM version 4.6 |
5 +--------------------------------------------------------------------+
6 | Copyright CiviCRM LLC (c) 2004-2014 |
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-2014
37 * This page is for Case Dashboard
39 class CRM_Case_Page_DashBoard
extends CRM_Core_Page
{
41 public $useLivePageJS = TRUE;
44 * Heart of the viewing process. The runner gets all the meta data for
45 * the contact and calls the appropriate type of page to view.
50 public function preProcess() {
51 //check for civicase access.
52 if (!CRM_Case_BAO_Case
::accessCiviCase()) {
53 CRM_Core_Error
::fatal(ts('You are not authorized to access this page.'));
56 //validate case configuration.
57 $configured = CRM_Case_BAO_Case
::isCaseConfigured();
58 $this->assign('notConfigured', !$configured['configured']);
59 $this->assign('allowToAddNewCase', $configured['allowToAddNewCase']);
60 if (!$configured['configured']) {
64 $session = CRM_Core_Session
::singleton();
65 $allCases = CRM_Utils_Request
::retrieve('all', 'Positive', $session);
67 CRM_Utils_System
::setTitle(ts('CiviCase Dashboard'));
69 $userID = $session->get('userID');
71 //validate access for all cases.
72 if ($allCases && !CRM_Core_Permission
::check('access all cases and activities')) {
74 CRM_Core_Session
::setStatus(ts('You are not authorized to access all cases and activities.'), ts('Sorry'), 'error');
77 $this->assign('myCases', TRUE);
80 $this->assign('myCases', FALSE);
83 $this->assign('newClient', FALSE);
84 if (CRM_Core_Permission
::check('add contacts') &&
85 CRM_Core_Permission
::check('access all cases and activities')
87 $this->assign('newClient', TRUE);
89 $summary = CRM_Case_BAO_Case
::getCasesSummary($allCases, $userID);
90 $upcoming = CRM_Case_BAO_Case
::getCases($allCases, $userID, 'upcoming');
91 $recent = CRM_Case_BAO_Case
::getCases($allCases, $userID, 'recent');
93 foreach ($upcoming as $key => $value) {
94 if (strtotime($value['case_scheduled_activity_date']) < time()) {
95 $upcoming[$key]['activity_status'] = 'status-overdue';
98 $this->assign('casesSummary', $summary);
99 if (!empty($upcoming)) {
100 $this->assign('upcomingCases', $upcoming);
102 if (!empty($recent)) {
103 $this->assign('recentCases', $recent);
108 * This function is the main function that is called when the page loads,
109 * it decides the which action has to be taken for the page.
113 public function run() {
116 return parent
::run();