$ui_options['menu_path'] = array('admin', 'open_search'); $ui_options['title'] = 'Administration för söklådor (Open search)'; $action = isset($_GET['action']) ? $_GET['action'] : 'home'; if (!isset($_GET['ajax'])) { ui_top($ui_options); echo open_search_menu_list($action); } switch ($action) { case 'home': echo '<h1>Välj något av alternativen högst upp.</h1>' . "\n"; echo open_search_stats_query_list_mini(); echo open_search_stats_boxes_list(); break; case 'add_search_box': echo '<h1>Lägg till söklåda</h1>'; echo open_search_addbox_draw_input(array('action' => 'add', 'formname' => 'add', 'submit_value' => 'Skapa låda')); break; case 'help': if (!isset($_GET['ajax'])) { echo '<h1>Liten hjälpdel</h1>'; } echo open_search_help_list($_GET['what']); break; case 'edit_search_boxes': echo '<h1>Redigera söklådor</h1>'; echo open_search_edit_list(); break; case 'view_stats': echo '<h1>Se statistik</h1>'; echo open_search_stats_query_list(array('no_limit' => true)); echo open_search_stats_boxes_list();
function open_search_edit_list($options = null) { $query = 'SELECT * FROM open_search_boxes ORDER BY `timestamp` DESC'; $result = mysql_query($query) or report_sql_error($query, __FILE__, __LINE__); $out = ''; if (mysql_num_rows($result) > 0) { $out = '<ul class="open_search_edit">' . "\n"; while ($data = mysql_fetch_assoc($result)) { $out .= rounded_corners_top(array('color' => 'blue_deluxe'), true); $out .= '<span style="clear:both;"> </span>' . "\n"; $out .= "\t" . '<li><h3><a href="#" class="box_link" id="link_' . $data['id'] . '"><img src="' . IMAGE_URL . 'plus.gif" alt="Expandera/Kollapsa" id="image_' . $data['id'] . '" /></a> ' . $data['name'] . '</h3>'; $out .= '<div class="open_search_box_info" id="box_' . $data['id'] . '">' . "\n"; $data['formname'] = 'edit'; $data['action'] = 'edit'; $data['submit_value'] = 'Uppdatera'; $out .= open_search_addbox_draw_input($data); $out .= '</div>'; $out .= '</li>' . "\n"; $out .= '<span style="clear:both;"> </span>' . "\n"; $out .= rounded_corners_bottom(array('color' => 'blue_deluxe'), true); } $out .= '</ul>' . "\n"; } return $out; }