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
21 class CRM_Contact_Page_DashBoard
extends CRM_Core_Page
{
26 public function run() {
27 CRM_Utils_System
::setTitle(ts('CiviCRM Home'));
28 $contactID = CRM_Core_Session
::getLoggedInContactID();
30 // call hook to get html from other modules
31 // ignored but needed to prevent warnings
32 $contentPlacement = CRM_Utils_Hook
::DASHBOARD_BELOW
;
33 $html = CRM_Utils_Hook
::dashboard($contactID, $contentPlacement);
34 if (is_array($html)) {
35 $this->assign_by_ref('hookContent', $html);
36 $this->assign('hookContentPlacement', $contentPlacement);
39 $communityMessages = CRM_Core_CommunityMessages
::create();
40 if ($communityMessages->isEnabled()) {
41 $message = $communityMessages->pick();
43 $this->assign('communityMessages', $communityMessages->evalMarkup($message['markup']));
47 $loader = new Civi\Angular\
AngularLoader();
48 $loader->setPageName('civicrm/dashboard');
50 // For each dashlet that requires an angular directive, load the angular module which provides that directive
52 foreach (CRM_Core_BAO_Dashboard
::getContactDashlets() as $dashlet) {
53 if (!empty($dashlet['directive'])) {
54 foreach ($loader->getAngular()->getModules() as $name => $module) {
55 if (!empty($module['exports'][$dashlet['directive']])) {
62 $loader->setModules($modules);
70 * partialsCallback from crmDashboard.ang.php
72 * Generates an html template for each angular-based dashlet.
78 public static function angularPartials($moduleName, $module) {
80 foreach (CRM_Core_BAO_Dashboard
::getContactDashlets() as $dashlet) {
81 if (!empty($dashlet['directive'])) {
82 $partials["~/$moduleName/directives/{$dashlet['directive']}.html"] = "<{$dashlet['directive']}></{$dashlet['directive']}>";
89 * settingsFactory from crmDashboard.ang.php
93 public static function angularSettings() {
95 'dashlets' => CRM_Core_BAO_Dashboard
::getContactDashlets(),