Source of file DashboardAdmin.php
Size: 2,295 Bytes - Last Modified: 2021-12-23T10:10:18+00:00
/var/www/docs.ssmods.com/process/src/src/Admin/DashboardAdmin.php
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485 | <?php namespace Plastyk\Dashboard\Admin; use SilverStripe\Admin\LeftAndMain; use SilverStripe\Security\PermissionProvider; use SilverStripe\View\Requirements; class DashboardAdmin extends LeftAndMain implements PermissionProvider { private static $url_segment = 'dashboard'; private static $menu_title = 'Dashboard'; private static $menu_priority = 1000; private static $menu_icon = 'plastyk/dashboard:images/treeicons/dashboard.png'; private static $required_permission_codes = 'CMS_ACCESS_DASHBOARDADMIN'; public function init() { parent::init(); Requirements::css('https://use.fontawesome.com/releases/v5.15.3/css/all.css'); Requirements::css('plastyk/dashboard:css/dashboard.css'); Requirements::javascript('plastyk/dashboard:javascript/dashboard.js'); if ($panelAccentColor = DashboardAdmin::config()->panel_accent_color) { Requirements::customCSS(<<<CSS .cms-content.DashboardAdmin .dashboard-panel { border-top-color: $panelAccentColor; } CSS ); } $this->extend('updateInit'); } public function providePermissions() { $title = _t('DashboardAdmin.MENUTITLE', LeftAndMain::menu_title_for_class('DashboardAdmin')); return [ 'CMS_ACCESS_DASHBOARDADMIN' => [ 'name' => _t('CMSMain.ACCESS', "Access to '{title}' section", 'Permissions Label', ['title' => $title]), 'category' => $title, 'help' => 'Allow use of the CMS Dashboard', ], ]; } public function getDashboardContent() { return $this->renderWith('Includes/DashboardContent'); } public function getDashboardPanels() { return $this->renderWith('DashboardPanels'); } public function canViewPanel($panelName) { if (class_exists($panelName)) { $panel = new $panelName($this); return $panel->canView(); } return false; } public function showPanel($panelName) { if (!class_exists($panelName)) { return false; } $panel = new $panelName($this); if ($panel->canView()) { return $panel->forTemplate(); } return false; } } |