function mystery_generate_quick_nav() { // this function generates the table list for quick navigation global $_MYSTERY; $quick_nav = ''; $links = array(); $labels = array(); $menu_items = mystery_get_main_menu_items(); reset($menu_items); while (list($key, $value) = each($menu_items['name'])) { $links[] = $_SERVER['SCRIPT_NAME'] . '?action=' . $menu_items['action'][$key] . '&table=' . $menu_items['table'][$key]; $labels[] = htmlspecialchars($value); } $quick_nav .= ' <form action="' . $_SERVER['SCRIPT_NAME'] . '?action=redirect" method="post" class="NoPaddingNoMargin"> <select name="location" onchange="document.location=location.value;" class="QuickNav"> <option value="">Quick Navigation</option> <option value="">-----------------------</option> '; for ($i = 0; $i < count($links); $i++) { $quick_nav .= ' <option value="' . $links[$i] . '">' . $labels[$i] . '</option>'; } $quick_nav .= ' </select> <noscript> <input type="submit" value="Go"> </noscript> </form> '; return $quick_nav; }
function mystery_display_select_table_list() { // this function generates and displays the table list for the main menu page global $_MYSTERY; $table_list_parts = array(); $menu_items = mystery_get_main_menu_items(); reset($menu_items); $total = count($menu_items['name']); $half = ceil($total / 2); $current_prefix = ''; $list_count = 0; $this_split = 'no'; while (list($key, $value) = each($menu_items['name'])) { $this_prefix = substr($value, 0, strpos($value, ':')); $this_separator = ''; if ($this_prefix != $current_prefix && $list_count > 0) { $this_separator .= '</ul>'; if ($list_count >= $half && $this_split == 'no') { $this_separator .= ' </td><td width="50%" valign="top" align="left"> '; $this_split = 'yes'; } $this_separator .= '<ul>'; } $this_link = $_SERVER['SCRIPT_NAME'] . '?action=' . $menu_items['action'][$key] . '&table=' . $menu_items['table'][$key]; $table_list_parts[] = ' ' . $this_separator . ' <li> <a href="' . $this_link . '" title="' . htmlspecialchars($menu_items['description'][$key]) . '" class="MainMenuList">' . htmlspecialchars($value) . '</a> <a href="' . $this_link . '" title="Open in a new window">' . $_MYSTERY['new_window_image'] . '</a> </li> '; $current_prefix = $this_prefix; $list_count++; } echo ' <h1>Main Menu</h1> <p>Please choose a ', $_MYSTERY['word_that_means_table'], ' from the list below:</p> <table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr><td width="50%" valign="top" align="left"> <ul> ', implode("\n", $table_list_parts), ' </ul> </td></tr> </table> '; }