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_Dashlet
extends CRM_Core_Page
{
26 public function run() {
27 CRM_Utils_System
::setTitle(ts('Dashlets'));
29 $this->assign('admin', CRM_Core_Permission
::check('administer CiviCRM'));
32 $allDashlets = CRM_Core_BAO_Dashboard
::getDashlets(FALSE);
34 // get dashlets for logged in contact
35 $currentDashlets = CRM_Core_BAO_Dashboard
::getContactDashlets();
36 $contactDashlets = $availableDashlets = [];
38 foreach ($currentDashlets as $item) {
39 $key = "{$item['dashboard_id']}-0";
40 $contactDashlets[$item['column_no']][$key] = [
41 'label' => $item['label'],
42 'is_reserved' => $allDashlets[$item['dashboard_id']]['is_reserved'],
44 unset($allDashlets[$item['dashboard_id']]);
47 foreach ($allDashlets as $dashletID => $values) {
48 $key = "{$dashletID}-0";
49 $availableDashlets[$key] = [
50 'label' => $values['label'],
51 'is_reserved' => $values['is_reserved'],
55 $this->assign('contactDashlets', $contactDashlets);
56 $this->assign('availableDashlets', $availableDashlets);