'fa fa-home',
'bibliography' => 'fa fa-bookmark',
'circulation' => 'fa fa-clock-o',
'membership' => 'fa fa-user',
'master_file' => 'fa fa-pencil',
'stock_take' => 'fa fa-suitcase',
'system' => 'fa fa-keyboard-o',
'reporting' => 'fa fa-file-text-o',
'serial_control' => 'fa fa-barcode',
'logout' => 'fa fa-close',
'opac' => 'fa fa-desktop'
);
$appended_first = '
';
$_mods_q = $dbs->query('SELECT * FROM '.$module_table);
while ($_mods_d = $_mods_q->fetch_assoc()) {
$module_list[] = array('name' => $_mods_d['module_name'], 'path' => $_mods_d['module_path'], 'desc' => $_mods_d['module_desc']);
}
$_menu .= '';
$_menu .= $appended_first;
$_menu .= @sub_menu('default', $module_list);
$_menu .= '
'."\n";
$_menu .= '';
$_menu .= '';
if ($module_list) {
foreach ($module_list as $_module) {
$_formated_module_name = ucwords(str_replace('_', ' ', $_module['name']));
$_mod_dir = $_module['path'];
if (isset($_SESSION['priv'][$_module['path']]['r']) && $_SESSION['priv'][$_module['path']]['r'] && file_exists($modules_dir.DS.$_mod_dir)) {
$_menu .= '';
$_menu .= sub_menu($_mod_dir, $_module);
$_menu .= '';
}
}
}
$_menu .= '';
$_menu .= '';
echo $_menu;
}
function sub_menu($str_module = '', $_module = array())
{
global $dbs;
$modules_dir = 'modules';
$_submenu = '';
$_submenu_file = $modules_dir.DS.$_module['path'].DS.'submenu.php';
if (file_exists($_submenu_file)) {
include $_submenu_file;
} else {
include 'default/submenu.php';
$shortcuts = get_shortcuts_menu();
foreach ($shortcuts as $shortcut) {
$path = preg_replace('@^.+?\|/@i', '', $shortcut);
$label = preg_replace('@\|.+$@i', '', $shortcut);
$menu[] = array(__($label), MWB.$path, __($label));
}
}
// iterate menu array
foreach ($menu as $i=>$_list) {
if ($_list[0] == 'Header') {
$_submenu .= ''."\n";
} else {
$_submenu .= ''."\n";
}
}
$_submenu .= '
';
return $_submenu;
}
function get_shortcuts_menu()
{
global $dbs;
$shortcuts = array();
$shortcuts_q = $dbs->query('SELECT * FROM setting WHERE setting_name LIKE \'shortcuts_'.$_SESSION['uid'].'\'');
$shortcuts_d = $shortcuts_q->fetch_assoc();
if ($shortcuts_q->num_rows > 0) {
$shortcuts = unserialize($shortcuts_d['setting_value']);
}
return $shortcuts;
}