Commit | Line | Data |
---|---|---|
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 | */ |
21 | class 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(); | |
42 | if (in_array('CiviContribute', $config->enableComponents)) { | |
43 | $groups['CiviContribute'] = ts('CiviContribute'); | |
44 | } | |
45 | ||
46 | if (in_array('CiviMember', $config->enableComponents)) { | |
47 | $groups['CiviMember'] = ts('CiviMember'); | |
48 | } | |
49 | ||
50 | if (in_array('CiviEvent', $config->enableComponents)) { | |
51 | $groups['CiviEvent'] = ts('CiviEvent'); | |
52 | } | |
53 | ||
54 | if (in_array('CiviMail', $config->enableComponents)) { | |
55 | $groups['CiviMail'] = ts('CiviMail'); | |
56 | } | |
57 | ||
58 | if (in_array('CiviCase', $config->enableComponents)) { | |
59 | $groups['CiviCase'] = ts('CiviCase'); | |
60 | } | |
61 | ||
62 | if (in_array('CiviReport', $config->enableComponents)) { | |
63 | $groups['CiviReport'] = ts('CiviReport'); | |
64 | } | |
65 | ||
66 | if (in_array('CiviCampaign', $config->enableComponents)) { | |
67 | $groups['CiviCampaign'] = ts('CiviCampaign'); | |
68 | } | |
69 | ||
70 | $values = CRM_Core_Menu::getAdminLinks(); | |
71 | ||
72 | $this->_showHide = new CRM_Core_ShowHideBlocks(); | |
73 | foreach ($groups as $group => $title) { | |
74 | $groupId = str_replace(' ', '_', $group); | |
8ef12e64 | 75 | |
6a488035 TO |
76 | $this->_showHide->addShow("id_{$groupId}_show"); |
77 | $this->_showHide->addHide("id_{$groupId}"); | |
78 | $v = CRM_Core_ShowHideBlocks::links($this, $groupId, '', '', FALSE); | |
79 | if (isset($values[$group])) { | |
80 | $adminPanel[$groupId] = $values[$group]; | |
81 | $adminPanel[$groupId]['show'] = $v['show']; | |
82 | $adminPanel[$groupId]['hide'] = $v['hide']; | |
83 | $adminPanel[$groupId]['title'] = $title; | |
0db6c3e1 TO |
84 | } |
85 | else { | |
be2fb01f | 86 | $adminPanel[$groupId] = []; |
6a488035 TO |
87 | $adminPanel[$groupId]['show'] = ''; |
88 | $adminPanel[$groupId]['hide'] = ''; | |
89 | $adminPanel[$groupId]['title'] = $title; | |
90 | } | |
91 | } | |
8f4eb478 | 92 | |
93 | CRM_Utils_Hook::alterAdminPanel($adminPanel); | |
6a488035 TO |
94 | $this->assign('adminPanel', $adminPanel); |
95 | $this->_showHide->addToTemplate(); | |
96 | return parent::run(); | |
97 | } | |
96025800 | 98 | |
6a488035 | 99 | } |