Merge pull request #18986 from demeritcowboy/drupal-permissions-page
[civicrm-core.git] / CRM / Admin / Page / Admin.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/**
ce064e4f 19 * Page for displaying Administer CiviCRM Control Panel.
6a488035
TO
20 */
21class CRM_Admin_Page_Admin extends CRM_Core_Page {
62d3ee27 22
e0ef6999 23 /**
ce064e4f 24 * Run page.
25 *
e0ef6999
EM
26 * @return string
27 */
00be9182 28 public function run() {
4ef8abc2
CW
29 Civi::resources()->addStyleFile('civicrm', 'css/admin.css');
30
96e82f8f
CW
31 $this->assign('registerSite', htmlspecialchars('https://civicrm.org/register-your-site?src=iam&sid=' . CRM_Utils_System::getSiteID()));
32
be2fb01f 33 $groups = [
353ffa53 34 'Customize Data and Screens' => ts('Customize Data and Screens'),
6a488035
TO
35 'Communications' => ts('Communications'),
36 'Localization' => ts('Localization'),
37 'Users and Permissions' => ts('Users and Permissions'),
38 'System Settings' => ts('System Settings'),
be2fb01f 39 ];
6a488035
TO
40
41 $config = CRM_Core_Config::singleton();
6a488035 42
2067db51
AH
43 foreach ($config->enableComponents as $component) {
44 $comp = CRM_Core_Component::get($component);
45 $groups[$comp->info['name']] = $comp->info['translatedName'];
6a488035
TO
46 }
47
48 $values = CRM_Core_Menu::getAdminLinks();
49
6a488035
TO
50 foreach ($groups as $group => $title) {
51 $groupId = str_replace(' ', '_', $group);
2067db51 52 $adminPanel[$groupId] = array_merge($values[$group] ?? [], ['title' => $title]);
6a488035 53 }
8f4eb478 54
55 CRM_Utils_Hook::alterAdminPanel($adminPanel);
2067db51
AH
56 foreach ($adminPanel as $groupId => $group) {
57 if (count($group) == 1) {
58 // Presumably the only thing is the title; remove the section.
59 // This is done here to give the hook a chance to edit the section.
60 unset($adminPanel[$groupId]);
61 }
62 }
6a488035 63 $this->assign('adminPanel', $adminPanel);
6a488035
TO
64 return parent::run();
65 }
96025800 66
6a488035 67}