function add_mini_module($module, $generate_cache = true) { $info_module = load_ini_file(PATH_TO_ROOT . '/' . $module . '/lang/', get_ulang()); if (empty($info_module) || empty($info_module['mini_module'])) { return false; } $mini_modules_menus = parse_ini_array($info_module['mini_module']); if (empty($mini_modules_menus)) { return false; } $installed = false; foreach ($mini_modules_menus as $filename => $location) { if (file_exists(PATH_TO_ROOT . '/' . $module . '/' . $filename)) { $file = explode('.', $filename, 2); if (!is_array($file) || count($file) < 1) { continue; } include_once PATH_TO_ROOT . '/' . $module . '/' . $filename; if (!function_exists($file[0])) { continue; } $menu = new ModuleMiniMenu($module, $file[0]); $menu->enabled(false); $menu->set_auth(array('r1' => MENU_AUTH_BIT, 'r0' => MENU_AUTH_BIT, 'r-1' => MENU_AUTH_BIT)); $menu->set_block(MenuService::str_to_location($location)); MenuService::save($menu); if ($generate_cache) { MenuService::generate_cache(); } $installed = true; } } return $installed; }
$array_pos = array(0, 4, 3, 3, 3, 1); $menus_numbers = array('index' => 1, 'administration' => 2, 'tools' => 3, 'members' => 4, 'content' => 5, 'modules' => 6); foreach ($modules_config as $module_name => $auth) { $name = $modules_config[$module_name]['module_name']; if (is_array($modules_config[$module_name])) { $menu_pos_name = $modules_config[$module_name]['admin']; $menu_pos = 0; if (!empty($menu_pos_name) && !empty($menus_numbers[$menu_pos_name])) { $menu_pos = $menus_numbers[$menu_pos_name]; } if ($menu_pos > 0) { $array_pos[$menu_pos - 1]++; $idmenu = $array_pos[$menu_pos - 1]; $Template->assign_vars(array('C_ADMIN_LINKS_' . $menu_pos => true)); if (!empty($modules_config[$module_name]['admin_links'])) { $admin_links = parse_ini_array($modules_config[$module_name]['admin_links']); $links = ''; $i = 0; $j = 0; foreach ($admin_links as $key => $value) { if (is_array($value)) { $links .= '<li class="extend" onmouseover="show_menu(\'' . $idmenu . $i . $name . '\', 2);" onmouseout="hide_menu(2);"><a href="#" style="background-image:url(' . PATH_TO_ROOT . '/' . $name . '/' . $name . '_mini.png);cursor:default;">' . $key . '</a><ul id="sssmenu' . $idmenu . $i . $name . '">' . "\n"; foreach ($value as $key2 => $value2) { $links .= '<li><a href="' . PATH_TO_ROOT . '/' . $name . '/' . $value2 . '" style="background-image:url(' . PATH_TO_ROOT . '/' . $name . '/' . $name . '_mini.png);">' . $key2 . '</a></li>' . "\n"; } $links .= '</ul></li>' . "\n"; $i++; } else { $links .= '<li><a href="' . PATH_TO_ROOT . '/' . $name . '/' . $value . '" style="background-image:url(' . PATH_TO_ROOT . '/' . $name . '/' . $name . '_mini.png);">' . $key . '</a></li>' . "\n"; } $j++;