Merge pull request #17125 from eileenmcnaughton/dupe1
[civicrm-core.git] / CRM / Contact / Page / DashBoard.php
1 <?php
2 /*
3 +--------------------------------------------------------------------+
4 | Copyright CiviCRM LLC. All rights reserved. |
5 | |
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 +--------------------------------------------------------------------+
10 */
11
12 /**
13 *
14 * @package CRM
15 * @copyright CiviCRM LLC https://civicrm.org/licensing
16 */
17
18 /**
19 * CiviCRM Dashboard.
20 */
21 class CRM_Contact_Page_DashBoard extends CRM_Core_Page {
22
23 /**
24 * Run dashboard.
25 */
26 public function run() {
27 // Add dashboard js and css
28 $resources = CRM_Core_Resources::singleton();
29 $resources->addScriptFile('civicrm', 'js/jquery/jquery.dashboard.js', 0, 'html-header', FALSE);
30 $resources->addStyleFile('civicrm', 'css/dashboard.css');
31 $this->assign('contactDashlets', CRM_Core_BAO_Dashboard::getContactDashletsForJS());
32
33 CRM_Utils_System::setTitle(ts('CiviCRM Home'));
34 $contactID = CRM_Core_Session::getLoggedInContactID();
35
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
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
53 return parent::run();
54 }
55
56 }