function vessel_select_vessel_by_user($user_id, $href_url, $title, $showtrades) { assert(is_numeric($user_id)); assert(!empty($href_url)); assert(!empty($title)); assert(!empty($showtrades)); global $_RUN; print_subtitle($title); $template = new Smarty(); $template->debugging = true; $result = sql_query("SELECT g.* FROM g_vessels AS g, s_vessels AS s WHERE g.user_id=" . $user_id . " AND g.created=1 AND g.vessel_id = s.id ORDER BY s.type, g.id"); while ($vessel = sql_fetchrow($result)) { if ($showtrades == NO_SHOW_TRADEROUTES) { $result2 = sql_query("SELECT * FROM a_trades WHERE vessel_id = " . $vessel['id']); if (!sql_fetchrow($result2)) { $tmpvar[] = vessel_show_table_row($vessel['id'], $href_url); } } else { $tmpvar[] = vessel_show_table_row($vessel['id'], $href_url); } } $template->assign("vessels", $tmpvar); $template->display($_RUN['theme_path'] . "/vessel-user.tpl"); }
function vessel_show_vessels_orbiting_planet($planet_id) { assert(is_numeric($planet_id)); $planet = anomaly_get_anomaly($planet_id); if (!anomaly_is_planet($planet_id)) { print_subtitle("This is not a planet!"); return; } print_subtitle("All vessels orbiting planet " . $planet['name']); $firstrow = 1; $userid = 0; $result = sql_query("SELECT g.* FROM g_vessels AS g, s_vessels AS s WHERE g.status='ORBIT' AND g.planet_id={$planet_id} AND g.created=1 AND s.id = g.vessel_id ORDER BY g.user_id, s.type"); while ($vessel = sql_fetchrow($result)) { if ($vessel['user_id'] != $userid) { $userid = $vessel['user_id']; if ($firstrow == 0) { echo "</table>\n"; echo "<br><br>\n"; } else { $firstrow = 0; } echo "<table align=center border=0>\n"; echo " <tr class=wb>"; echo "<th>Name</th>"; echo "<th>Type</th>"; echo "<th>Status</th>"; echo "<th>Coords</th>"; echo "<th>Race</th>"; echo "</tr>\n"; } vessel_show_table_row($vessel['id'], $_SERVER['PHP_SELF'], "SHOW_SPECIES"); } echo "</table>\n"; echo "<br><br>\n"; }