[REF] Remove duplicate checks for an array key existing
[civicrm-core.git] / CRM / Contact / Page / DashBoard.php
CommitLineData
6a488035
TO
1<?php
2/*
3 +--------------------------------------------------------------------+
bc77d7c0 4 | Copyright CiviCRM LLC. All rights reserved. |
6a488035 5 | |
bc77d7c0
TO
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 |
6a488035 9 +--------------------------------------------------------------------+
d25dd0ee 10 */
6a488035
TO
11
12/**
13 *
14 * @package CRM
ca5cec67 15 * @copyright CiviCRM LLC https://civicrm.org/licensing
6a488035
TO
16 */
17
18/**
616eac7e 19 * CiviCRM Dashboard.
6a488035
TO
20 */
21class CRM_Contact_Page_DashBoard extends CRM_Core_Page {
22
23 /**
fe482240 24 * Run dashboard.
6a488035 25 */
00be9182 26 public function run() {
6a488035 27 // Add dashboard js and css
cf6f10ce 28 $resources = CRM_Core_Resources::singleton();
3d80d622 29 $resources->addScriptFile('civicrm', 'js/jquery/jquery.dashboard.js', 0, 'html-header', FALSE);
a5c5a349 30 $resources->addStyleFile('civicrm', 'css/dashboard.css');
dd3770bc 31 $this->assign('contactDashlets', CRM_Core_BAO_Dashboard::getContactDashletsForJS());
cf6f10ce 32
6a488035 33 CRM_Utils_System::setTitle(ts('CiviCRM Home'));
3bdcd4ec 34 $contactID = CRM_Core_Session::getLoggedInContactID();
6a488035 35
6a488035
TO
36 // call hook to get html from other modules
37 // ignored but needed to prevent warnings
38 $contentPlacement = CRM_Utils_Hook::DASHBOARD_BELOW;
39 $html = CRM_Utils_Hook::dashboard($contactID, $contentPlacement);
40 if (is_array($html)) {
41 $this->assign_by_ref('hookContent', $html);
42 $this->assign('hookContentPlacement', $contentPlacement);
43 }
44
9d9fa5bc
TO
45 $communityMessages = CRM_Core_CommunityMessages::create();
46 if ($communityMessages->isEnabled()) {
47 $message = $communityMessages->pick();
48 if ($message) {
49 $this->assign('communityMessages', $communityMessages->evalMarkup($message['markup']));
50 }
51 }
52
6a488035
TO
53 return parent::run();
54 }
96025800 55
6a488035 56}