function buildmenu($menu) { $level = ''; foreach ($menu as $key => $item) { $level .= "<li>"; if (!is_array($item)) { $level .= "{$item}"; } else { $level .= "<a>{$key}</a><ul>"; $level .= buildmenu($item); $level .= "</ul>"; } $level .= "</li>"; } return $level; }
function getusermenu() { global $otmp_user; //$otmp_user = new tmp_user(); $otmp_user->Update(array('us_menu' => $otmp_user->GetSqlColValue('us_menu', '')), array('us_id' => $_SESSION['us_id']), false); //global $omenu; //$result = $omenu->ExecuteStatement('UPDATE tmp_user SET us_menu = \'\' WHERE us_id = ' . $_SESSION['us_id'], false, null, null, false); //buildmenu('Site', '', '', 1); //buildmenu('Control Panel', 'icon-16-cpanel', 'module.php'); //buildmenu('Home', 'icon-16-lock', 'main.php'); //buildmenu('', '', '', 0, 0, 1); //buildmenu('Change Password', 'icon-16-lock', 'chgPassForm.php'); //buildmenu('', '', '', 0, 0, 1); //buildmenu('Logout', 'icon-16-logout', 'login.php?cAction=Logout'); closemenu(1); $result = new page(); $result = getCursorFromDB($result, getquery(), false); $rows = $result->RecordsArray(MYSQL_ASSOC); if ($rows) { foreach ($rows as $row) { buildmenudb($row, 1); $result1 = getCursorFromDB($result, getquery($row['pg_id']), false); $rows1 = $result1->RecordsArray(MYSQL_ASSOC); foreach ($rows1 as $row1) { $result2 = getCursorFromDB($result, getquery($row1['pg_id']), false); $rows2 = $result2->RecordsArray(MYSQL_ASSOC); if ($rows2) { buildmenudb($row1, 3); } else { buildmenudb($row1, 2); } if ($rows2) { foreach ($rows2 as $row2) { //$row2 = $result2->RowArray(null, MYSQL_ASSOC); buildmenudb($row2, 4); } closemenu(3); } else { closemenu(2); } } closemenu(1); } buildmenu('', '', '', 0, 0, 0, 0, 0, 1); } }