1: <?php
2: 3: 4: 5: 6: 7: 8: 9: 10:
11:
12:
13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28:
29:
30: class XoopsGuiDefault
31: {
32:
33: function header()
34: {
35: $xoops = Xoops::getInstance();
36: $xoops->loadLocale('system');
37:
38: $xoops->theme()->addBaseStylesheetAssets('@jqueryuicss');
39: $xoops->theme()->addStylesheet('media/xoops/css/moduladmin.css');
40: $xoops->theme()->addStylesheet(\XoopsBaseConfig::get('adminthemes-url') . '/default/css/style.css');
41:
42: $xoops->theme()->addBaseScriptAssets('@jquery');
43:
44: $xoops->theme()->addBaseScriptAssets('@bootstrap');
45: $xoops->theme()->addBaseScriptAssets('@jqueryui');
46: $xoops->theme()->addBaseScriptAssets('@jgrowl');
47:
48: $xoops->theme()->addScript(\XoopsBaseConfig::get('adminthemes-url') . '/default/js/ddsmoothmenu.js');
49: $xoops->theme()->addScript(\XoopsBaseConfig::get('adminthemes-url') . '/default/js/tooltip.js');
50:
51: $quick = array();
52: $quick[] = array('title' => SystemLocale::CONTROL_PANEL, 'link' => \XoopsBaseConfig::get('url') . '/admin.php');
53: $quick[] = array('title' => XoopsLocale::HOME_PAGE, 'link' => \XoopsBaseConfig::get('url'));
54: $quick[] = array('title' => DefaultThemeLocale::XOOPS_NEWS, 'link' => \XoopsBaseConfig::get('url') . '/admin.php?xoopsorgnews=1');
55: $quick[] = array('title' => 'separator');
56: $quick[] = array('title' => XoopsLocale::A_LOGOUT, 'link' => \XoopsBaseConfig::get('url') . '/user.php?op=logout');
57: $xoops->tpl()->assign('quick_menu', $quick);
58:
59: XoopsLoad::load('module', 'system');
60: XoopsLoad::load('extension', 'system');
61: $system_module = new SystemModule();
62: $system_extension = new SystemExtension();
63:
64: $adminmenu = null;
65: include __DIR__ . '/menu.php';
66: if (!$xoops->isModule() || 'system' === $xoops->module->getVar('dirname', 'n')) {
67: $modpath = \XoopsBaseConfig::get('url') . '/admin.php';
68: $modname = DefaultThemeLocale::SYSTEM_OPTIONS;
69: $modid = 1;
70: $moddir = 'system';
71:
72: $mod_options = $adminmenu;
73: foreach (array_keys($mod_options) as $item) {
74: $mod_options[$item]['link'] = empty($mod_options[$item]['absolute'])
75: ? \XoopsBaseConfig::get('url') . '/modules/' . $moddir . '/' . $mod_options[$item]['link']
76: : $mod_options[$item]['link'];
77: $mod_options[$item]['icon'] = empty($mod_options[$item]['icon']) ? ''
78: : \XoopsBaseConfig::get('adminthemes-url') . '/default/' . $mod_options[$item]['icon'];
79: unset($mod_options[$item]['icon_small']);
80: }
81:
82: } else {
83: $moddir = $xoops->module->getVar('dirname', 'n');
84: $modpath = \XoopsBaseConfig::get('url') . '/modules/' . $moddir;
85: $modname = $xoops->module->getVar('name');
86: $modid = $xoops->module->getVar('mid');
87:
88: $mod_options = $xoops->module->getAdminMenu();
89: foreach (array_keys($mod_options) as $item) {
90: $mod_options[$item]['link'] = empty($mod_options[$item]['absolute'])
91: ? \XoopsBaseConfig::get('url') . "/modules/{$moddir}/" . $mod_options[$item]['link']
92: : $mod_options[$item]['link'];
93: if ( XoopsLoad::fileExists($xoops->path('media/xoops/images/icons/32/' . $mod_options[$item]['icon']) ) ) {
94: $mod_options[$item]['icon'] = $xoops->url('media/xoops/images/icons/32/' . $mod_options[$item]['icon']);
95:
96: } elseif ( XoopsLoad::fileExists($xoops->path('modules/' . $xoops->module->dirname() . '/assets/icons/32/' . $mod_options[$item]['icon'])) ) {
97: $mod_options[$item]['icon'] = $xoops->url('modules/' . $xoops->module->dirname() . '/assets/icons/32/' . $mod_options[$item]['icon']);
98: } else {
99: $mod_options[$item]['icon'] = $xoops->url("modules/" . $xoops->module->dirname() . "/icons/32/" . $mod_options[$item]['icon']);
100: }
101: }
102: }
103: $xoops->tpl()->assign('mod_options', $mod_options);
104: $xoops->tpl()->assign('modpath', $modpath);
105: $xoops->tpl()->assign('modname', $modname);
106: $xoops->tpl()->assign('modid', $modid);
107: $xoops->tpl()->assign('moddir', $moddir);
108:
109:
110: $module_list = $system_module->getModuleList();
111: $xoops->tpl()->assign('module_menu', $module_list);
112: unset($module_list);
113:
114:
115: $extension_list = $system_extension->getExtensionList();
116: $xoops->tpl()->assign('extension_menu', $extension_list);
117: unset($extension_list);
118:
119: $extension_mod = $system_extension->getExtension( $moddir );
120: $xoops->tpl()->assign('extension_mod', $extension_mod);
121:
122:
123: $menu = array();
124:
125: $OPT = array();
126:
127: $menu[] = array(
128: 'link' => \XoopsBaseConfig::get('url') . '/modules/system/admin.php?fct=preferences', 'title' => XoopsLocale::PREFERENCES,
129: 'absolute' => 1, 'url' => \XoopsBaseConfig::get('url') . '/modules/system/', 'options' => $OPT
130: );
131: $menu[] = array('title' => 'separator');
132:
133:
134: if ($xoops->isModule() && $xoops->module->getVar('dirname') !== 'system') {
135:
136: if ($xoops->module->getInfo('system_menu')) {
137:
138:
139: $xoops->module->loadAdminMenu();
140:
141:
142: $menu_handler = $xoops->getModuleHandler('menu', 'system');
143:
144: $menu_handler->addMenuTop(\XoopsBaseConfig::get('url') . "/modules/system/admin.php?fct=preferences&op=showmod&mod=" . $xoops->module->getVar('mid', 'e'), XoopsLocale::PREFERENCES);
145: if ($xoops->module->getInfo('extension')) {
146: $menu_handler->addMenuTop(\XoopsBaseConfig::get('url') . "/modules/system/admin.php?fct=extensions&op=update&module=" . $xoops->module->getVar('dirname', 'e'), XoopsLocale::A_UPDATE);
147: } else {
148: $menu_handler->addMenuTop(\XoopsBaseConfig::get('url') . "/modules/system/admin.php?fct=modulesadmin&op=update&module=" . $xoops->module->getVar('dirname', 'e'), XoopsLocale::A_UPDATE);
149: }
150: if ($xoops->module->getInfo('blocks')) {
151: $menu_handler->addMenuTop(\XoopsBaseConfig::get('url') . "/modules/system/admin.php?fct=blocksadmin&op=list&filter=1&selgen=" . $xoops->module->getVar('mid', 'e') . "&selmod=-2&selgrp=-1&selvis=-1", XoopsLocale::BLOCKS);
152: }
153: if ($xoops->module->getInfo('hasMain')) {
154: $menu_handler->addMenuTop(\XoopsBaseConfig::get('url') . "/modules/" . $xoops->module->getVar('dirname', 'e') . "/", SystemLocale::GO_TO_MODULE);
155: }
156:
157: $i = 0;
158: $current = $i;
159: foreach ($xoops->module->adminmenu as $menu) {
160: if (stripos($_SERVER['REQUEST_URI'], $menu['link']) !== false) {
161: $current = $i;
162: }
163: $menu_handler->addMenuTabs( $xoops->url('modules/' . $xoops->module->getVar('dirname') . '/' . $menu['link']), $menu['title']);
164: ++$i;
165: }
166: if ($xoops->module->getInfo('help')) {
167: if (stripos($_SERVER['REQUEST_URI'], 'admin/' . $xoops->module->getInfo('help')) !== false) {
168: $current = $i;
169: }
170: $menu_handler->addMenuTabs('../../system/help.php?mid=' . $xoops->module->getVar('mid', 's') . '&' . $xoops->module->getInfo('help'), XoopsLocale::HELP);
171: }
172:
173:
174: $xoops->tpl()->assign('xo_system_menu', $menu_handler->render($current, false));
175: }
176: }
177:
178: }
179: }
180: