1: <?php
2: 3: 4: 5: 6: 7: 8: 9: 10:
11:
12: use Xoops\Core\Kernel\Criteria;
13: use Xoops\Core\Kernel\CriteriaCompo;
14:
15: 16: 17: 18: 19: 20: 21: 22: 23:
24:
25: function b_system_main_show()
26: {
27: $xoops = Xoops::getInstance();
28: $block = array();
29: $block['lang_home'] = XoopsLocale::HOME;
30: $block['lang_close'] = XoopsLocale::A_CLOSE;
31: $module_handler = $xoops->getHandlerModule();
32: $criteria = new CriteriaCompo(new Criteria('hasmain', 1));
33: $criteria->add(new Criteria('isactive', 1));
34: $criteria->add(new Criteria('weight', 0, '>'));
35: $modules = $module_handler->getObjectsArray($criteria, true);
36: $moduleperm_handler = $xoops->getHandlerGroupPermission();
37: $groups = $xoops->getUserGroups();
38: $read_allowed = $moduleperm_handler->getItemIds('module_read', $groups);
39:
40: foreach ($modules as $i => $module) {
41: if (in_array($i, $read_allowed)) {
42: $block['modules'][$i]['name'] = $module->getVar('name');
43: $block['modules'][$i]['dirname'] = $module->getVar('dirname');
44: if (XoopsLoad::fileExists($xoops->path('modules/' . $module->getVar('dirname') . '/icons/logo_small.png'))) {
45: $block['modules'][$i]['image'] = $xoops->url('modules/' . $module->getVar('dirname') . '/icons/logo_small.png');
46: }
47: if ($xoops->isModule() && ($i == $xoops->module->getVar('mid'))) {
48: $block['modules'][$i]['highlight'] = true;
49: $block['nothome'] = true;
50: }
51: if ($xoops->module && ($i == $xoops->module->getVar('mid'))) {
52: $block['modules'][$i]['highlight'] = true;
53: $block['nothome'] = true;
54: }
55:
56: if ($xoops->isModule() && $module->getVar('dirname') == $xoops->module->getVar('dirname') && $plugin = \Xoops\Module\Plugin::getPlugin($module->getVar('dirname'), 'menus')) {
57: $sublinks = $plugin->subMenus();
58: foreach ($sublinks as $sublink) {
59: $block['modules'][$i]['sublinks'][] = array(
60: 'name' => $sublink['name'],
61: 'url' => \XoopsBaseConfig::get('url') . '/modules/' . $module->getVar('dirname') . '/' . $sublink['url']
62: );
63: }
64: }
65:
66: }
67: }
68: return $block;
69: }
70:
71: function b_system_main_edit($options)
72: {
73: $xoops = Xoops::getInstance();
74: $system = System::getInstance();
75: $system_module = new SystemModule();
76: $admin_page = new \Xoops\Module\Admin();
77:
78:
79: $xoops->theme()->addStylesheet('media/xoops/css/icons.css');
80: $xoops->theme()->addStylesheet('modules/system/css/admin.css');
81:
82: $xoops->theme()->addScript('media/jquery/plugins/jquery.jeditable.js');
83: $xoops->theme()->addScript('modules/system/js/module.js');
84:
85: $admin_page->addTips(SystemLocale::MENU_TIPS);
86: $admin_page->renderTips();
87: $list = $system_module->getModuleList();
88: $xoops->tpl()->assign('modules_list', $list);
89: return $xoops->tpl()->fetch('admin:system/system_modules_menu.tpl');
90: }
91: