XOOPS  2.6.0
default.php
Go to the documentation of this file.
1 <?php
2 /*
3  You may not change or alter any portion of this comment or credits
4  of supporting developers from this source code or any supporting source code
5  which is considered copyrighted (c) material of the original comment or credit authors.
6 
7  This program is distributed in the hope that it will be useful,
8  but WITHOUT ANY WARRANTY; without even the implied warranty of
9  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
10  */
11 
12 
13 /*
14  * Xoops Cpanel default GUI class
15  *
16  * @copyright The XOOPS project http://sf.net/projects/xoops/
17  * @license GNU GPL 2 or later (http://www.gnu.org/licenses/gpl-2.0.html)
18  * @package system
19  * @usbpackage GUI
20  * @since 2.4
21  * @author Mamba <mambax7@gmail.com>
22  * @author Mojtabajml <jamali.mojtaba@gmail.com>
23  * @author Voltan <djvoltan@gmail.com>
24  * @author BitC3R0 <BitC3R0@gmail.com>
25  * @author trabis <lusopoemas@gmail.com>
26  * @version 1.2
27  * @version $Id$
28  */
29 
31 {
32 
33  function header()
34  {
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  // bootstrap has to come before jquery.ui or dialog close buttons are blank
44  $xoops->theme()->addBaseScriptAssets('@bootstrap');
45  $xoops->theme()->addBaseScriptAssets('@jqueryui');
46  $xoops->theme()->addBaseScriptAssets('@jgrowl');
47  // ddsmoothmenu
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');
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';
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  } else {
96  $mod_options[$item]['icon'] = $xoops->url("/modules/" . $xoops->module->dirname() . "/icons/32/" . $mod_options[$item]['icon']);
97  }
98  }
99  }
100  $xoops->tpl()->assign('mod_options', $mod_options);
101  $xoops->tpl()->assign('modpath', $modpath);
102  $xoops->tpl()->assign('modname', $modname);
103  $xoops->tpl()->assign('modid', $modid);
104  $xoops->tpl()->assign('moddir', $moddir);
105 
106  // Modules list
107  $module_list = $system_module->getModuleList();
108  $xoops->tpl()->assign('module_menu', $module_list);
109  unset($module_list);
110 
111  // Extensions list
112  $extension_list = $system_extension->getExtensionList();
113  $xoops->tpl()->assign('extension_menu', $extension_list);
114  unset($extension_list);
115 
116  $extension_mod = $system_extension->getExtension( $moddir );
117  $xoops->tpl()->assign('extension_mod', $extension_mod);
118 
119  // add preferences menu
120  $menu = array();
121 
122  $OPT = array();
123 
124  $menu[] = array(
125  'link' => \XoopsBaseConfig::get('url') . '/modules/system/admin.php?fct=preferences', 'title' => XoopsLocale::PREFERENCES,
126  'absolute' => 1, 'url' => \XoopsBaseConfig::get('url') . '/modules/system/', 'options' => $OPT
127  );
128  $menu[] = array('title' => 'separator');
129 
130  // Module adminmenu
131  if ($xoops->isModule() && $xoops->module->getVar('dirname') != 'system') {
132 
133  if ($xoops->module->getInfo('system_menu')) {
134  //$xoops->theme()->addStylesheet('modules/system/css/menu.css');
135 
136  $xoops->module->loadAdminMenu();
137  // Get menu tab handler
138  /* @var $menu_handler SystemMenuHandler */
139  $menu_handler = $xoops->getModuleHandler('menu', 'system');
140  // Define top navigation
141  $menu_handler->addMenuTop(\XoopsBaseConfig::get('url') . "/modules/system/admin.php?fct=preferences&amp;op=showmod&amp;mod=" . $xoops->module->getVar('mid', 'e'), XoopsLocale::PREFERENCES);
142  if ($xoops->module->getInfo('extension')) {
143  $menu_handler->addMenuTop(\XoopsBaseConfig::get('url') . "/modules/system/admin.php?fct=extensions&amp;op=update&amp;module=" . $xoops->module->getVar('dirname', 'e'), XoopsLocale::A_UPDATE);
144  } else {
145  $menu_handler->addMenuTop(\XoopsBaseConfig::get('url') . "/modules/system/admin.php?fct=modulesadmin&amp;op=update&amp;module=" . $xoops->module->getVar('dirname', 'e'), XoopsLocale::A_UPDATE);
146  }
147  if ($xoops->module->getInfo('blocks')) {
148  $menu_handler->addMenuTop(\XoopsBaseConfig::get('url') . "/modules/system/admin.php?fct=blocksadmin&amp;op=list&amp;filter=1&amp;selgen=" . $xoops->module->getVar('mid', 'e') . "&amp;selmod=-2&amp;selgrp=-1&amp;selvis=-1", XoopsLocale::BLOCKS);
149  }
150  if ($xoops->module->getInfo('hasMain')) {
151  $menu_handler->addMenuTop(\XoopsBaseConfig::get('url') . "/modules/" . $xoops->module->getVar('dirname', 'e') . "/", SystemLocale::GO_TO_MODULE);
152  }
153  // Define main tab navigation
154  $i = 0;
155  $current = $i;
156  foreach ($xoops->module->adminmenu as $menu) {
157  if (stripos($_SERVER['REQUEST_URI'], $menu['link']) !== false) {
158  $current = $i;
159  }
160  $menu_handler->addMenuTabs( $xoops->url('modules/' . $xoops->module->getVar('dirname') . '/' . $menu['link']), $menu['title']);
161  ++$i;
162  }
163  if ($xoops->module->getInfo('help')) {
164  if (stripos($_SERVER['REQUEST_URI'], 'admin/' . $xoops->module->getInfo('help')) !== false) {
165  $current = $i;
166  }
167  $menu_handler->addMenuTabs('../../system/help.php?mid=' . $xoops->module->getVar('mid', 's') . '&amp;' . $xoops->module->getInfo('help'), XoopsLocale::HELP);
168  }
169 
170  // Display navigation tabs
171  $xoops->tpl()->assign('xo_system_menu', $menu_handler->render($current, false));
172  }
173  }
174 
175  }
176 }
$i
Definition: dialog.php:68
static getInstance()
Definition: Xoops.php:160
$_SERVER['REQUEST_URI']
const PREFERENCES
Definition: en_US.php:909
$modid
Definition: groupperm.php:27
const GO_TO_MODULE
Definition: en_US.php:316
$xoops
Definition: admin.php:25
const HOME_PAGE
Definition: en_US.php:464
$menu
static fileExists($file)
Definition: xoopsload.php:506
static get($name)
const CONTROL_PANEL
Definition: en_US.php:247
const BLOCKS
Definition: en_US.php:138
static load($name, $type="core")
Definition: xoopsload.php:65
$adminmenu
Definition: menu.php:23
const A_UPDATE
Definition: en_US.php:132
$current
Definition: install_tpl.php:38
const A_LOGOUT
Definition: en_US.php:103