function list_facilities($addon = '', $start) { // global {$_SESSION['fip']}, $fmp, {$_SESSION['editfile']}, {$_SESSION['addfile']}, {$_SESSION['unitsfile']}, {$_SESSION['facilitiesfile']}, {$_SESSION['routesfile']}, {$_SESSION['facroutesfile']}; global $iw_width, $u_types, $tolerance; // $assigns = array(); // $tickets = array(); $query = "SELECT `{$GLOBALS['mysql_prefix']}assigns`.`ticket_id`, `{$GLOBALS['mysql_prefix']}assigns`.`responder_id`, `{$GLOBALS['mysql_prefix']}ticket`.`scope` AS `ticket` FROM `{$GLOBALS['mysql_prefix']}assigns` LEFT JOIN `{$GLOBALS['mysql_prefix']}ticket` ON `{$GLOBALS['mysql_prefix']}assigns`.`ticket_id`=`{$GLOBALS['mysql_prefix']}ticket`.`id`"; $result_as = mysql_query($query) or do_error($query, 'mysql query failed', mysql_error(), basename(__FILE__), __LINE__); while ($row_as = stripslashes_deep(mysql_fetch_assoc($result_as))) { $assigns[$row_as['responder_id']] = $row_as['ticket']; $tickets[$row_as['responder_id']] = $row_as['ticket_id']; } unset($result_as); $calls = array(); $calls_nr = array(); $calls_time = array(); $query = "SELECT * , UNIX_TIMESTAMP(packet_date) AS `packet_date` FROM `{$GLOBALS['mysql_prefix']}tracks` ORDER BY `packet_date` ASC"; $result = mysql_query($query) or do_error($query, 'mysql query failed', mysql_error(), __FILE__, __LINE__); while ($row = mysql_fetch_assoc($result)) { if (isset($calls[$row['source']])) { // array_key_exists ( mixed key, array search ) $calls_nr[$row['source']]++; } else { array_push($calls, trim($row['source'])); $calls[trim($row['source'])] = TRUE; $calls_nr[$row['source']] = 1; } $calls_time[$row['source']] = $row['packet_date']; // save latest - note query order } $query = "SELECT `id` FROM `{$GLOBALS['mysql_prefix']}facilities`"; $result = mysql_query($query) or do_error($query, 'mysql query failed', mysql_error(), __FILE__, __LINE__); $facilities = mysql_affected_rows() > 0 ? mysql_affected_rows() : "<I>none</I>"; unset($result); ?> <SCRIPT > var color=0; var colors = new Array ('odd', 'even'); function hideGroup(color) { for (var i = 0; i < gmarkers.length; i++) { if (gmarkers[i]) { if (gmarkers[i].id == color) { gmarkers[i].show(); } else { gmarkers[i].hide(); } } // end if (gmarkers[i]) } // end for () elem = $("allIcons"); elem.style.visibility = "visible"; } // end function function showAll() { for (var i = 0; i < gmarkers.length; i++) { if (gmarkers[i]) { gmarkers[i].show(); } } // end for () elem = $("allIcons"); elem.style.visibility = "hidden"; } // end function function createMarker(point, tabs, color, id, fac_id) { // (point, myinfoTabs,<?php print $row['type']; ?> , i) points = true; // at least one // var letter = to_str(id); var fac_id = fac_id; var icon = new GIcon(listIcon); var icon_url = "./our_icons/gen_fac_icon.php?blank=" + escape(icons[color]) + "&text=" + fac_id; icon.image = icon_url; // var marker = new GMarker(point, icon); marker.id = color; // for hide/unhide - unused GEvent.addListener(marker, "click", function() { // here for both side bar and icon click if (marker) { map.closeInfoWindow(); which = id; gmarkers[which].hide(); marker.openInfoWindowTabsHtml(infoTabs[id]); setTimeout(function() { // wait for rendering complete if ($("detailmap")) { var dMapDiv = $("detailmap"); var detailmap = new GMap2(dMapDiv); detailmap.addControl(new GSmallMapControl()); detailmap.setCenter(point, 17); // larger # = closer detailmap.addOverlay(marker); } else { } },4000); // end setTimeout(...) } // end if (marker) }); // end GEvent.add Listener() gmarkers[id] = marker; // marker to array for side_bar click function infoTabs[id] = tabs; // tabs to array if (!(map_is_fixed)) { bounds.extend(point); } return marker; } // end function create Marker() function createdummyMarker(point, tabs, color, id, fac_id) { // 7/28/10 points = true; // at least one // var letter = to_str(id); var fac_id = fac_id; var icon = new GIcon(listIcon); var icon_url = "./our_icons/question1.png"; icon.image = icon_url; // var dummymarker = new GMarker(point, icon); dummymarker.id = color; // for hide/unhide - unused GEvent.addListener(dummymarker, "click", function() { // here for both side bar and icon click if (dummymarker) { map.closeInfoWindow(); which = id; gmarkers[which].hide(); dummymarker.openInfoWindowTabsHtml(infoTabs[id]); setTimeout(function() { // wait for rendering complete if ($("detailmap")) { var dMapDiv = $("detailmap"); var detailmap = new GMap2(dMapDiv); detailmap.addControl(new GSmallMapControl()); detailmap.setCenter(point, 17); // larger # = closer detailmap.addOverlay(dummymarker); } else { } },4000); // end setTimeout(...) } // end if (marker) }); // end GEvent.add Listener() gmarkers[id] = dummymarker; // marker to array for side_bar click function infoTabs[id] = tabs; // tabs to array if (!(map_is_fixed)) { bounds.extend(point); } return dummymarker; } // end function createdummyMarker() function do_sidebar (sidebar, id, the_class, fac_id) { var fac_id = fac_id; side_bar_html += "<TR CLASS='" + colors[(id)%2] +"'>"; side_bar_html += "<TD CLASS='" + the_class + "' onClick = myclick(" + id + "); >" + fac_id + sidebar +"</TD></TR>\n"; // 3/15/11 } function do_sidebar_nm (sidebar, line_no, id, fac_id) { var fac_id = fac_id; var letter = to_str(line_no); side_bar_html += "<TR CLASS='" + colors[(line_no)%2] +"'>"; side_bar_html += "<TD onClick = myclick_nm(" + id + "); >" + fac_id + sidebar +"</TD></TR>\n"; // 1/23/09, 10/29/09 removed period, 11/11/09, 3/15/11 } function myclick_nm(v_id) { // Responds to sidebar click - view responder data document.view_form.id.value=v_id; document.view_form.submit(); } function myclick(id) { // Responds to sidebar click, then triggers listener above - note [id] GEvent.trigger(gmarkers[id], "click"); location.href = '#top'; // 11/11/090 } function do_lat (lat) { document.forms[0].frm_lat.value=lat.toFixed(6); } function do_lng (lng) { document.forms[0].frm_lng.value=lng.toFixed(6); } function do_ngs() { // LL to USNG into form document.forms[0].frm_ngs.disabled=false; document.forms[0].frm_ngs.value = LLtoUSNG(document.forms[0].frm_lat.value, document.forms[0].frm_lng.value, 5); document.forms[0].frm_ngs.disabled=true; } function do_sel_update_fac (in_unit, in_val) { // 3/15/11 to_server_fac(in_unit, in_val); } function to_server_fac(the_unit, the_status) { // 3/15/11 var querystr = "frm_responder_id=" + the_unit; querystr += "&frm_status_id=" + the_status; var url = "as_up_fac_status.php?" + querystr; // 3/15/11 var payload = syncAjax(url); // if (payload.substring(0,1)=="-") { alert ("<?php print __LINE__; ?> : msg failed "); return false; } else { parent.frames['upper'].show_msg ('Facility status update applied!') return true; } // end if/else (payload.substring(... ) } // end function to_server() var icons=new Array; // maps type to icon blank <?php $query = "SELECT * FROM `{$GLOBALS['mysql_prefix']}fac_types` ORDER BY `id`"; // types in use $result = mysql_query($query) or do_error($query, 'mysql query failed', mysql_error(), basename(__FILE__), __LINE__); $icons = $GLOBALS['fac_icons']; while ($row = stripslashes_deep(mysql_fetch_assoc($result))) { // map type to blank icon id $blank = $icons[$row['icon']]; print "\ticons[" . $row['id'] . "] = " . $row['icon'] . ";\n"; // } unset($result); $dzf = get_variable('def_zoom_fixed'); print "\tvar map_is_fixed = "; print my_is_int($dzf) && $dzf == 2 || my_is_int($dzf) && $dzf == 3 ? "true;\n" : "false;\n"; ?> var map; var side_bar_html = "<TABLE border=0 CLASS='sidebar' ID='tbl_facilities'>"; side_bar_html += "<TR class='even'> <TD colspan='99' ALIGN='center'><B><?php print get_text("Facilities"); ?> (<?php print $facilities; ?> )</B></TD></TR>"; side_bar_html += "<TR class='odd'> <TD colspan='99' ALIGN='center'>Click line or icon for details</TD></TR>"; side_bar_html += "<TR class='even'> <TD></TD><TD ALIGN='center'><B><?php print get_text("Facility"); ?> </B></TD><TD ALIGN='center'><B><?php print get_text("Type"); ?> </B></TD><TD ALIGN='center'><B><?php print get_text("Status"); ?> </B></TD><TD ALIGN='center'><B><?php print get_text("As of"); ?> </B></TD></TR>"; var gmarkers = []; var infoTabs = []; var which; var i = <?php print $start; ?> ; // sidebar/icon index var points = false; // none map = new GMap2($("map")); // create the map <?php $maptype = get_variable('maptype'); switch ($maptype) { case "1": break; case "2": ?> map.setMapType(G_SATELLITE_MAP);<?php break; case "3": ?> map.setMapType(G_PHYSICAL_MAP);<?php break; case "4": ?> map.setMapType(G_HYBRID_MAP);<?php break; default: print "ERROR in " . basename(__FILE__) . " " . __LINE__ . "<BR />"; } ?> // map.addControl(new GSmallMapControl()); map.setUIToDefault(); // 8/13/10 map.addControl(new GMapTypeControl()); <?php if (get_variable('terrain') == 1) { ?> map.addMapType(G_PHYSICAL_MAP); <?php } ?> map.setCenter(new GLatLng(<?php echo get_variable('def_lat'); ?> , <?php echo get_variable('def_lng'); ?> ), <?php echo get_variable('def_zoom'); ?> ); mapBounds=new GLatLngBounds(map.getBounds().getSouthWest(), map.getBounds().getNorthEast()); var bounds = new GLatLngBounds(); // create bounding box map.enableScrollWheelZoom(); var listIcon = new GIcon(); listIcon.image = "./markers/yellow.png"; // yellow.png - 16 X 28 listIcon.shadow = "./markers/sm_shadow.png"; listIcon.iconSize = new GSize(30, 30); listIcon.shadowSize = new GSize(16, 28); listIcon.iconAnchor = new GPoint(8, 28); listIcon.infoWindowAnchor = new GPoint(9, 2); listIcon.infoShadowAnchor = new GPoint(18, 25); GEvent.addListener(map, "infowindowclose", function() { // re-center after move/zoom map.addOverlay(gmarkers[which]) }); <?php $eols = array("\r\n", "\n", "\r"); // all flavors of eol $status_vals = array(); // build array of $status_vals $status_vals[''] = $status_vals['0'] = "TBD"; $query = "SELECT * FROM `{$GLOBALS['mysql_prefix']}fac_status` ORDER BY `id`"; $result_st = mysql_query($query) or do_error($query, 'mysql query failed', mysql_error(), basename(__FILE__), __LINE__); while ($row_st = stripslashes_deep(mysql_fetch_assoc($result_st))) { $temp = $row_st['id']; $status_vals[$temp] = $row_st['status_val']; } unset($result_st); $type_vals = array(); // build array of $status_vals $type_vals[''] = $type_vals['0'] = "TBD"; $query = "SELECT * FROM `{$GLOBALS['mysql_prefix']}fac_types` ORDER BY `id`"; $result_ty = mysql_query($query) or do_error($query, 'mysql query failed', mysql_error(), basename(__FILE__), __LINE__); while ($row_ty = stripslashes_deep(mysql_fetch_assoc($result_ty))) { $temp = $row_ty['id']; $type_vals[$temp] = $row_ty['name']; } unset($result_ty); // 3/15/11 $query = "SELECT *,UNIX_TIMESTAMP(updated) AS updated, `{$GLOBALS['mysql_prefix']}facilities`.id AS id, `{$GLOBALS['mysql_prefix']}facilities`.status_id AS status_id,\n\t\t`{$GLOBALS['mysql_prefix']}facilities`.description AS facility_description,\n\t\t`{$GLOBALS['mysql_prefix']}fac_types`.name AS fac_type_name, `{$GLOBALS['mysql_prefix']}facilities`.name AS name, `{$GLOBALS['mysql_prefix']}facilities`.street AS street,\n\t\t`{$GLOBALS['mysql_prefix']}facilities`.city AS city, `{$GLOBALS['mysql_prefix']}facilities`.state AS state \n\t\tFROM `{$GLOBALS['mysql_prefix']}facilities` \n\t\tLEFT JOIN `{$GLOBALS['mysql_prefix']}fac_types` ON `{$GLOBALS['mysql_prefix']}facilities`.type = `{$GLOBALS['mysql_prefix']}fac_types`.id \n\t\tLEFT JOIN `{$GLOBALS['mysql_prefix']}fac_status` ON `{$GLOBALS['mysql_prefix']}facilities`.status_id = `{$GLOBALS['mysql_prefix']}fac_status`.id \n\t\tORDER BY `{$GLOBALS['mysql_prefix']}facilities`.type ASC"; $result = mysql_query($query) or do_error($query, 'mysql query failed', mysql_error(), basename(__FILE__), __LINE__); $i = 0; // counter // ============================================================================= $utc = gmdate("U"); while ($row = stripslashes_deep(mysql_fetch_assoc($result))) { // ========== major while() for Facility ========== $the_bg_color = $GLOBALS['FACY_TYPES_BG'][$row['icon']]; // 2/8/10 $the_text_color = $GLOBALS['FACY_TYPES_TEXT'][$row['icon']]; // 2/8/10 $the_on_click = my_is_float($row['lat']) ? " onClick = myclick({$i}); " : " onClick = myclick_nm({$row['unit_id']}); "; // 3/15/11 $got_point = FALSE; print "\n\t\tvar i={$i};\n"; if (is_guest()) { $toedit = $tomail = $toroute = ""; } else { $toedit = " <A HREF='{$_SESSION['facilitiesfile']}?func=responder&edit=true&id=" . $row['id'] . "'><U>Edit</U></A>"; $tomail = " <SPAN onClick = 'do_mail_in_win({$row['id']})'><U><B>Email</B></U></SPAN>"; $toroute = " <A HREF='{$_SESSION['facroutesfile']}?fac_id=" . $row['id'] . "'><U>Route To Facility</U></A>"; } $temp = $row['status_id']; $the_status = array_key_exists($temp, $status_vals) ? $status_vals[$temp] : "??"; $temp_type = $row['type']; $the_type = array_key_exists($temp_type, $type_vals) ? $type_vals[$temp_type] : "??"; if (!$got_point && my_is_float($row['lat'])) { if ($row['lat'] == 0.999999 && $row['lng'] == 0.999999) { echo "\t\tvar point = new GLatLng(" . get_variable('def_lat') . ", " . get_variable('def_lng') . ");\n"; } else { echo "\t\tvar point = new GLatLng(" . $row['lat'] . ", " . $row['lng'] . ");\n"; } $got_point = TRUE; } $update_error = strtotime('now - 6 hours'); // set the time for silent setting // name $name = $row['name']; // 10/8/09 $temp = explode("/", $name); $display_name = $temp[0]; // $sidebar_line = "<TD CLASS='td_data' TITLE = '" . addslashes($display_name) . "'><U>" . addslashes(shorten($display_name, 48)) ."</U></TD>"; // 10/8/09 // $sidebar_line .= "<TD CLASS='td_data' TITLE = '" . addslashes ($the_type) . "'> " . shorten($the_type, 18) . // " </TD>"; // $sidebar_line .= "<TD CLASS='td_data' TITLE = '" . addslashes ($the_status) . "'> " . shorten($the_status, 18) . // " </TD>"; $sidebar_line = "<TD TITLE = '" . addslashes($display_name) . "' {$the_on_click}><U><SPAN STYLE='background-color:{$the_bg_color}; opacity: .7; color:{$the_text_color};'>" . addslashes(shorten($display_name, 40)) . "</SPAN></U> </TD><TD>{$the_type} </TD>"; $sidebar_line .= "<TD CLASS='td_data' TITLE = '" . addslashes($the_status) . "'> " . get_status_sel($row['id'], $row['status_id'], 'f') . "</TD>"; // 3/15/11 // as of $strike = $strike_end = ""; $the_time = $row['updated']; $the_class = "td_data"; $strike = $strike_end = ""; $sidebar_line .= "<TD CLASS='{$the_class}'> {$strike}" . format_sb_date($the_time) . "{$strike_end}</TD>"; // tab 1 if (my_is_float($row['lat'])) { // position data? $temptype = $u_types[$row['type']]; $the_type = $temptype[0]; $tab_1 = "<TABLE CLASS='infowin' width='{$iw_width}'>"; $tab_1 .= "<TR CLASS='even'><TD COLSPAN=2 ALIGN='center'><B>" . addslashes(shorten($display_name, 48)) . "</B> - " . $the_type . "</TD></TR>"; $tab_1 .= "<TR CLASS='odd'><TD ALIGN='right'>Description: </TD><TD ALIGN='left'>" . addslashes(shorten(str_replace($eols, " ", $row['description']), 32)) . "</TD></TR>"; $tab_1 .= "<TR CLASS='even'><TD ALIGN='right'>Status: </TD><TD ALIGN='left'>" . $the_status . " </TD></TR>"; $tab_1 .= "<TR CLASS='odd'><TD ALIGN='right'>Contact: </TD><TD ALIGN='left'>" . addslashes($row['contact_name']) . " Via: " . addslashes($row['contact_email']) . "</TD></TR>"; $tab_1 .= "<TR CLASS='even'><TD ALIGN='right'>As of: </TD><TD ALIGN='left'>" . format_date($row['updated']) . "</TD></TR>"; $tab_1 .= "<TR CLASS='odd'><TD COLSPAN=2 ALIGN='center'>" . $toedit . $tomail . " <A HREF='{$_SESSION['facilitiesfile']}?func=responder&view=true&id=" . $row['id'] . "'><U>View</U></A></TD></TR>"; // 08/8/02 $tab_1 .= "</TABLE>"; $tab_2 = "<TABLE CLASS='infowin' width='{$iw_width}' ALIGN = 'center' >"; $tab_2 .= "<TR CLASS='odd'><TD ALIGN='right' STYLE= 'width:50%'>Security contact: </TD><TD ALIGN='left' STYLE= 'width:50%'>" . addslashes($row['security_contact']) . " </TD></TR>"; $tab_2 .= "<TR CLASS='even'><TD ALIGN='right'>Security email: </TD><TD ALIGN='left'>" . addslashes($row['security_email']) . " </TD></TR>"; $tab_2 .= "<TR CLASS='odd'><TD ALIGN='right'>Security phone: </TD><TD ALIGN='left'>" . addslashes($row['security_phone']) . " </TD></TR>"; $tab_2 .= "<TR CLASS='even'><TD ALIGN='right'>" . get_text("Access rules") . ": </TD><TD ALIGN='left'>" . addslashes(str_replace($eols, " ", $row['access_rules'])) . "</TD></TR>"; $tab_2 .= "<TR CLASS='odd'><TD ALIGN='right'>Security reqs: </TD><TD ALIGN='left'>" . addslashes(str_replace($eols, " ", $row['security_reqs'])) . "</TD></TR>"; $tab_2 .= "<TR CLASS='even'><TD ALIGN='right'>Opening hours: </TD><TD ALIGN='left'>" . addslashes(str_replace($eols, " ", $row['opening_hours'])) . "</TD></TR>"; $tab_2 .= "<TR CLASS='odd'><TD ALIGN='right'>Prim pager: </TD><TD ALIGN='left'>" . addslashes($row['pager_p']) . " </TD></TR>"; $tab_2 .= "<TR CLASS='even'><TD ALIGN='right'>Sec pager: </TD><TD ALIGN='left'>" . addslashes($row['pager_s']) . " </TD></TR>"; $tab_2 .= "</TABLE>"; // tab 2 $tabs_done = FALSE; // default if (!$tabs_done) { // ?> var myinfoTabs = [ new GInfoWindowTab("<?php print nl2brr(addslashes(shorten($row['name'], 10))); ?> ", "<?php print $tab_1; ?> "), new GInfoWindowTab("More ...", "<?php print str_replace($eols, " ", $tab_2); ?> "), new GInfoWindowTab("Zoom", "<div id='detailmap' class='detailmap'></div>") ]; <?php } // end if/else $name = $row['name']; // 10/8/09 $temp = explode("/", $name); $index = substr($temp[count($temp) - 1], -6, strlen($temp[count($temp) - 1])); // 3/19/11 if ($row['lat'] == 0.999999 && $row['lng'] == 0.999999) { // check for facilities added in no mpas mode 7/28/10 ?> var fac_id = "<?php print $index; ?> "; // 10/8/09 var the_class = ((map_is_fixed) && (!(mapBounds.containsLatLng(point))))? "emph" : "td_label"; do_sidebar ("<?php print $sidebar_line; ?> ", i, the_class, fac_id); var dummymarker = createdummyMarker(point, myinfoTabs,<?php print $row['type']; ?> , i, fac_id); // 771 (point,tabs, color, id) map.addOverlay(dummymarker); <?php } else { ?> var fac_id = "<?php print $index; ?> "; // 10/8/09 var the_class = ((map_is_fixed) && (!(mapBounds.containsLatLng(point))))? "emph" : "td_label"; do_sidebar ("<?php print $sidebar_line; ?> ", i, the_class, fac_id); var marker = createMarker(point, myinfoTabs,<?php print $row['type']; ?> , i, fac_id); // 771 (point,tabs, color, id) map.addOverlay(marker); <?php } // End of check for facilities added in no maps mode 7/28/10 } else { // end position data available $name = $row['name']; // 11/11/09 $temp = explode("/", $name); $index = substr($temp[count($temp) - 1], -6, strlen($temp[count($temp) - 1])); // 3/19/11 ?> var fac_id = "<?php print $index; ?> "; // 11/11/09 <?php print "\tdo_sidebar_nm (\" {$sidebar_line} \" , i, {$row['id']}, fac_id);\n"; // sidebar only - no map } $i++; // zero-based } // end ========== while() for Facility ========== ?> if (!(map_is_fixed)) { if (!points) { // any? map.setCenter(new GLatLng(<?php echo get_variable('def_lat'); ?> , <?php echo get_variable('def_lng'); ?> ), <?php echo get_variable('def_zoom'); ?> ); } else { center = bounds.getCenter(); zoom = map.getBoundsZoomLevel(bounds); map.setCenter(center,zoom); } } side_bar_html+= "<TR CLASS='" + colors[i%2] +"'></TR>"; side_bar_html +="<TR><TD><?php print get_facilities_legend(); ?> </TD></TR>\n"; // 3/15/11 <?php if (!empty($addon)) { print "\n\tside_bar_html +=\"" . $addon . "\"\n"; } ?> side_bar_html +="</TABLE>\n"; $("side_bar").innerHTML += side_bar_html; // append the assembled side_bar_html contents to the side_bar div <?php do_kml(); ?> </SCRIPT> <?php }
function list_facilities($addon = '', $start) { // global {$_SESSION['fip']}, $fmp, {$_SESSION['editfile']}, {$_SESSION['addfile']}, {$_SESSION['unitsfile']}, {$_SESSION['facilitiesfile']}, {$_SESSION['routesfile']}, {$_SESSION['facroutesfile']}; global $iw_width, $u_types, $tolerance; // $assigns = array(); // $tickets = array(); $query = "SELECT `{$GLOBALS['mysql_prefix']}assigns`.`ticket_id`, `{$GLOBALS['mysql_prefix']}assigns`.`responder_id`, `{$GLOBALS['mysql_prefix']}ticket`.`scope` AS `ticket` FROM `{$GLOBALS['mysql_prefix']}assigns` LEFT JOIN `{$GLOBALS['mysql_prefix']}ticket` ON `{$GLOBALS['mysql_prefix']}assigns`.`ticket_id`=`{$GLOBALS['mysql_prefix']}ticket`.`id`"; $result_as = mysql_query($query) or do_error($query, 'mysql query failed', mysql_error(), basename(__FILE__), __LINE__); while ($row_as = stripslashes_deep(mysql_fetch_assoc($result_as))) { $assigns[$row_as['responder_id']] = $row_as['ticket']; $tickets[$row_as['responder_id']] = $row_as['ticket_id']; } unset($result_as); $calls = array(); $calls_nr = array(); $calls_time = array(); $query = "SELECT * , UNIX_TIMESTAMP(packet_date) AS `packet_date` FROM `{$GLOBALS['mysql_prefix']}tracks` ORDER BY `packet_date` ASC"; $result = mysql_query($query) or do_error($query, 'mysql query failed', mysql_error(), __FILE__, __LINE__); while ($row = mysql_fetch_assoc($result)) { if (isset($calls[$row['source']])) { // array_key_exists ( mixed key, array search ) $calls_nr[$row['source']]++; } else { array_push($calls, trim($row['source'])); $calls[trim($row['source'])] = TRUE; $calls_nr[$row['source']] = 1; } $calls_time[$row['source']] = $row['packet_date']; // save latest - note query order } $query = "SELECT `id` FROM `{$GLOBALS['mysql_prefix']}facilities`"; $result = mysql_query($query) or do_error($query, 'mysql query failed', mysql_error(), __FILE__, __LINE__); $facilities = mysql_affected_rows() > 0 ? mysql_affected_rows() : "<I>none</I>"; unset($result); ?> <SCRIPT > var color=0; var colors = new Array ('odd', 'even'); function hideDiv(div_area, hide_cont, show_cont) { // 3/15/11 if (div_area == "buttons_sh") { var controlarea = "hide_controls"; } if (div_area == "resp_list_sh") { var controlarea = "resp_list"; } if (div_area == "facs_list_sh") { var controlarea = "facs_list"; } if (div_area == "incs_list_sh") { var controlarea = "incs_list"; } if (div_area == "region_boxes") { var controlarea = "region_boxes"; } var divarea = div_area var hide_cont = hide_cont var show_cont = show_cont if($(divarea)) { $(divarea).style.display = 'none'; $(hide_cont).style.display = 'none'; $(show_cont).style.display = ''; } var params = "f_n=" +controlarea+ "&v_n=h&sess_id=<?php print get_sess_key(__LINE__); ?> "; var url = "persist2.php"; sendRequest (url, gb_handleResult, params); } function showDiv(div_area, hide_cont, show_cont) { // 3/15/11 if (div_area == "buttons_sh") { var controlarea = "hide_controls"; } if (div_area == "resp_list_sh") { var controlarea = "resp_list"; } if (div_area == "facs_list_sh") { var controlarea = "facs_list"; } if (div_area == "incs_list_sh") { var controlarea = "incs_list"; } if (div_area == "region_boxes") { var controlarea = "region_boxes"; } var divarea = div_area var hide_cont = hide_cont var show_cont = show_cont if($(divarea)) { $(divarea).style.display = ''; $(hide_cont).style.display = ''; $(show_cont).style.display = 'none'; } var params = "f_n=" +controlarea+ "&v_n=s&sess_id=<?php print get_sess_key(__LINE__); ?> "; var url = "persist2.php"; sendRequest (url, gb_handleResult, params); } function hideGroup(color) { for (var i = 0; i < gmarkers.length; i++) { if (gmarkers[i]) { if (gmarkers[i].id == color) { gmarkers[i].show(); } else { gmarkers[i].hide(); } } // end if (gmarkers[i]) } // end for () elem = $("allIcons"); elem.style.visibility = "visible"; } // end function function showAll() { for (var i = 0; i < gmarkers.length; i++) { if (gmarkers[i]) { gmarkers[i].show(); } } // end for () elem = $("allIcons"); elem.style.visibility = "hidden"; } // end function function checkArray(form, arrayName) { // 5/3/11 var retval = new Array(); for(var i=0; i < form.elements.length; i++) { var el = form.elements[i]; if(el.type == "checkbox" && el.name == arrayName && el.checked) { retval.push(el.value); } } return retval; } function checkForm(form) { // 6/10/11 var errmsg=""; var itemsChecked = checkArray(form, "frm_group[]"); if(itemsChecked.length > 0) { var params = "f_n=viewed_groups&v_n=" +itemsChecked+ "&sess_id=<?php print get_sess_key(__LINE__); ?> "; // 3/15/11 var url = "persist3.php"; // 3/15/11 sendRequest (url, fvg_handleResult, params); // form.submit(); } else { errmsg+= "\tYou cannot Hide all the regions\n"; if (errmsg!="") { alert ("Please correct the following and re-submit:\n\n" + errmsg); return false; } } } function fvg_handleResult(req) { // 6/10/11 The persist callback function for viewed groups. document.region_form.submit(); } function form_validate(theForm) { // 5/3/11 // alert("Validating"); checkForm(theForm); } // end function validate(theForm) function sendRequest(url,callback,postData) { // 2/14/09 var req = createXMLHTTPObject(); if (!req) return; var method = (postData) ? "POST" : "GET"; req.open(method,url,true); req.setRequestHeader('User-Agent','XMLHTTP/1.0'); if (postData) req.setRequestHeader('Content-type','application/x-www-form-urlencoded'); req.onreadystatechange = function () { if (req.readyState != 4) return; if (req.status != 200 && req.status != 304) { return; } callback(req); } if (req.readyState == 4) return; req.send(postData); } var XMLHttpFactories = [ function () {return new XMLHttpRequest() }, function () {return new ActiveXObject("Msxml2.XMLHTTP") }, function () {return new ActiveXObject("Msxml3.XMLHTTP") }, function () {return new ActiveXObject("Microsoft.XMLHTTP") } ]; function createXMLHTTPObject() { var xmlhttp = false; for (var i=0;i<XMLHttpFactories.length;i++) { try { xmlhttp = XMLHttpFactories[i](); } catch (e) { continue; } break; } return xmlhttp; } function createMarker(point, tabs, color, id, fac_id) { // (point, myinfoTabs,<?php print $row['type']; ?> , i) points = true; // at least one // var letter = to_str(id); var fac_id = fac_id; var icon = new GIcon(listIcon); var icon_url = "./our_icons/gen_fac_icon.php?blank=" + escape(icons[color]) + "&text=" + fac_id; icon.image = icon_url; // var marker = new GMarker(point, icon); marker.id = color; // for hide/unhide - unused GEvent.addListener(marker, "click", function() { // here for both side bar and icon click if (marker) { map.closeInfoWindow(); which = id; gmarkers[which].hide(); marker.openInfoWindowTabsHtml(infoTabs[id]); setTimeout(function() { // wait for rendering complete if ($("detailmap")) { var dMapDiv = $("detailmap"); var detailmap = new GMap2(dMapDiv); detailmap.addControl(new GSmallMapControl()); detailmap.setCenter(point, 17); // larger # = closer detailmap.addOverlay(marker); } else { } },4000); // end setTimeout(...) } // end if (marker) }); // end GEvent.add Listener() gmarkers[id] = marker; // marker to array for side_bar click function infoTabs[id] = tabs; // tabs to array if (!(map_is_fixed)) { bounds.extend(point); } return marker; } // end function create Marker() function createdummyMarker(point, tabs, color, id, fac_id) { // 7/28/10 points = true; // at least one // var letter = to_str(id); var fac_id = fac_id; var icon = new GIcon(listIcon); var icon_url = "./our_icons/question1.png"; icon.image = icon_url; // var dummymarker = new GMarker(point, icon); dummymarker.id = color; // for hide/unhide - unused GEvent.addListener(dummymarker, "click", function() { // here for both side bar and icon click if (dummymarker) { map.closeInfoWindow(); which = id; gmarkers[which].hide(); dummymarker.openInfoWindowTabsHtml(infoTabs[id]); setTimeout(function() { // wait for rendering complete if ($("detailmap")) { var dMapDiv = $("detailmap"); var detailmap = new GMap2(dMapDiv); detailmap.addControl(new GSmallMapControl()); detailmap.setCenter(point, 17); // larger # = closer detailmap.addOverlay(dummymarker); } else { } },4000); // end setTimeout(...) } // end if (marker) }); // end GEvent.add Listener() gmarkers[id] = dummymarker; // marker to array for side_bar click function infoTabs[id] = tabs; // tabs to array if (!(map_is_fixed)) { bounds.extend(point); } return dummymarker; } // end function createdummyMarker() function do_sidebar (sidebar, id, the_class, fac_id) { var fac_id = fac_id; side_bar_html += "<TR CLASS='" + colors[(id)%2] +"'>"; side_bar_html += "<TD CLASS='" + the_class + "' onClick = myclick(" + id + "); >" + fac_id + sidebar +"</TD></TR>\n"; // 3/15/11 } function do_sidebar_nm (sidebar, line_no, id, fac_id) { var fac_id = fac_id; var letter = to_str(line_no); side_bar_html += "<TR CLASS='" + colors[(line_no)%2] +"'>"; side_bar_html += "<TD onClick = myclick_nm(" + id + "); >" + fac_id + sidebar +"</TD></TR>\n"; // 1/23/09, 10/29/09 removed period, 11/11/09, 3/15/11 } function myclick_nm(v_id) { // Responds to sidebar click - view responder data document.view_form.id.value=v_id; document.view_form.submit(); } function myclick(id) { // Responds to sidebar click, then triggers listener above - note [id] GEvent.trigger(gmarkers[id], "click"); location.href = '#top'; // 11/11/090 } function do_lat (lat) { document.forms[0].frm_lat.value=lat.toFixed(6); } function do_lng (lng) { document.forms[0].frm_lng.value=lng.toFixed(6); } function do_ngs() { // LL to USNG var loc = <?php print get_variable('locale'); ?> ; document.forms[0].frm_ngs.disabled=false; if(loc == 0) { document.forms[0].frm_ngs.value = LLtoUSNG(document.forms[0].frm_lat.value, document.forms[0].frm_lng.value, 5); } if(loc == 1) { document.forms[0].frm_ngs.value = LLtoOSGB(document.forms[0].frm_lat.value, document.forms[0].frm_lng.value); } if(loc == 2) { document.forms[0].frm_ngs.value = LLtoOSGB(document.forms[0].frm_lat.value, document.forms[0].frm_lng.value); } document.forms[0].frm_ngs.disabled=true; } function do_sel_update_fac (in_unit, in_val) { // 3/15/11 to_server_fac(in_unit, in_val); } function to_server_fac(the_unit, the_status) { // 3/15/11 var querystr = "frm_responder_id=" + the_unit; querystr += "&frm_status_id=" + the_status; var url = "as_up_fac_status.php?" + querystr; // 3/15/11 var payload = syncAjax(url); // if (payload.substring(0,1)=="-") { alert ("<?php print __LINE__; ?> : msg failed "); return false; } else { parent.frames['upper'].show_msg ('Facility status update applied!') return true; } // end if/else (payload.substring(... ) } // end function to_server() var icons=new Array; // maps type to icon blank <?php $query = "SELECT * FROM `{$GLOBALS['mysql_prefix']}fac_types` ORDER BY `id`"; // types in use $result = mysql_query($query) or do_error($query, 'mysql query failed', mysql_error(), basename(__FILE__), __LINE__); $icons = $GLOBALS['fac_icons']; while ($row = stripslashes_deep(mysql_fetch_assoc($result))) { // map type to blank icon id $blank = $icons[$row['icon']]; print "\ticons[" . $row['id'] . "] = " . $row['icon'] . ";\n"; // } unset($result); $dzf = get_variable('def_zoom_fixed'); print "\tvar map_is_fixed = "; print my_is_int($dzf) && $dzf == 2 || my_is_int($dzf) && $dzf == 3 ? "true;\n" : "false;\n"; ?> var map; var side_bar_html = "<TABLE border=0 CLASS='sidebar' ID='tbl_facilities'>"; side_bar_html += "<TR class='even'> <TD><B>Icon</B></TD><TD><B>Handle</B></TD><TD ALIGN='left'><B>Name</B></TD><TD ALIGN='left'><B><?php print get_text("Type"); ?> </B></TD><TD ALIGN='left'><B><?php print get_text("Status"); ?> </B></TD><TD ALIGN='left'><B><?php print get_text("As of"); ?> </B></TD></TR>"; var gmarkers = []; var infoTabs = []; var which; var i = <?php print $start; ?> ; // sidebar/icon index var points = false; // none map = new GMap2($("map")); // create the map <?php $maptype = get_variable('maptype'); switch ($maptype) { case "1": break; case "2": ?> map.setMapType(G_SATELLITE_MAP);<?php break; case "3": ?> map.setMapType(G_PHYSICAL_MAP);<?php break; case "4": ?> map.setMapType(G_HYBRID_MAP);<?php break; default: print "ERROR in " . basename(__FILE__) . " " . __LINE__ . "<BR />"; } ?> // map.addControl(new GSmallMapControl()); map.setUIToDefault(); // 8/13/10 map.addControl(new GMapTypeControl()); <?php if (get_variable('terrain') == 1) { ?> map.addMapType(G_PHYSICAL_MAP); <?php } ?> map.setCenter(new GLatLng(<?php echo get_variable('def_lat'); ?> , <?php echo get_variable('def_lng'); ?> ), <?php echo get_variable('def_zoom'); ?> ); mapBounds=new GLatLngBounds(map.getBounds().getSouthWest(), map.getBounds().getNorthEast()); var bounds = new GLatLngBounds(); // create bounding box map.enableScrollWheelZoom(); do_landb(); // 8/1/11 - show scribbles var listIcon = new GIcon(); listIcon.image = "./markers/yellow.png"; // yellow.png - 16 X 28 listIcon.shadow = "./markers/sm_shadow.png"; listIcon.iconSize = new GSize(30, 30); listIcon.shadowSize = new GSize(16, 28); listIcon.iconAnchor = new GPoint(8, 28); listIcon.infoWindowAnchor = new GPoint(9, 2); listIcon.infoShadowAnchor = new GPoint(18, 25); GEvent.addListener(map, "infowindowclose", function() { // re-center after move/zoom map.addOverlay(gmarkers[which]) }); //-----------------------BOUNDARIES STUFF--------------------6/10/11 var thepoint; var points = new Array(); var boundary = new Array(); var bound_names = new Array(); GEvent.addListener(map, "click", function(overlay,boundpoint) { for (var n = 0; n < boundary.length; n++) { if (boundary[n].Contains(boundpoint)) { map.openInfoWindowHtml(boundpoint,"This is " + bound_names[n]); } } }); <?php $query = "SELECT * FROM `{$GLOBALS['mysql_prefix']}allocates` WHERE `type`= 4 AND `resource_id` = '{$_SESSION['user_id']}' ORDER BY `id` ASC;"; // 6/10/11 $result = mysql_query($query); // 6/10/11 $a_gp_bounds = array(); $gp_bounds = array(); while ($row = stripslashes_deep(mysql_fetch_assoc($result))) { // 6/10/11 $al_groups[] = $row['group']; $query2 = "SELECT * FROM `{$GLOBALS['mysql_prefix']}region` WHERE `id`= '{$row['group']}';"; // 6/10/11 $result2 = mysql_query($query2); // 4/18/11 while ($row2 = stripslashes_deep(mysql_fetch_assoc($result2))) { // // 6/10/11 if ($row2['boundary'] != 0) { $a_gp_bounds[] = $row2['boundary']; } } } if (isset($_SESSION['viewed_groups'])) { // 6/10/11 foreach (explode(",", $_SESSION['viewed_groups']) as $val_vg) { $query3 = "SELECT * FROM `{$GLOBALS['mysql_prefix']}region` WHERE `id`= '{$val_vg}';"; $result3 = mysql_query($query3); // 6/10/11 while ($row3 = stripslashes_deep(mysql_fetch_assoc($result3))) { if ($row3['boundary'] != 0) { $gp_bounds[] = $row3['boundary']; } } } } else { $gp_bounds = $a_gp_bounds; } foreach ($gp_bounds as $value) { // 6/10/11 ?> var points = new Array(); <?php if ($value != 0) { $query_bn = "SELECT * FROM `{$GLOBALS['mysql_prefix']}mmarkup` WHERE `id`='{$value}' AND `use_with_f`=1"; // print $query_bn; $result_bn = mysql_query($query_bn) or do_error($query_bn, mysql_error(), basename(__FILE__), __LINE__); while ($row_bn = stripslashes_deep(mysql_fetch_assoc($result_bn))) { extract($row_bn); $bn_name = $row_bn['line_name']; $points = explode(";", $line_data); for ($xx = 0; $xx < count($points); $xx++) { $coords = explode(",", $points[$xx]); ?> thepoint = new GLatLng(parseFloat(<?php print $coords[0]; ?> ), parseFloat(<?php print $coords[1]; ?> )); points.push(thepoint); <?php } // end for ($i = 0 ... ) ?> <?php switch ($row_bn['line_type']) { case "p": // poly if (intval($filled) == 1) { // 6/10/11 ?> var polyline = new GPolygon(points, "<?php print $line_color; ?> ", <?php print $line_width; ?> , <?php print $line_opacity; ?> , "<?php print $fill_color; ?> ", <?php print $fill_opacity; ?> , {clickable:false}); boundary.push(polyline); bound_names.push("<?php print $bn_name; ?> "); <?php } else { ?> var polyline = new GPolyline(points, "<?php print $line_color; ?> ", <?php print $line_width; ?> , <?php print $line_opacity; ?> , , 0, {clickable:false}); boundary.push(polyline); bound_names.push("<?php print $bn_name; ?> "); <?php } ?> map.addOverlay(polyline); <?php break; case "c": $temp = explode(";", $line_data); $radius = $temp[1]; $coords = explode(",", $temp[0]); $lat = $coords[0]; $lng = $coords[1]; $fill_opacity = intval($filled) == 0 ? 0 : $fill_opacity; echo "\n drawCircle({$lat}, {$lng}, {$radius}, add_hash('{$line_color}'), {$line_opacity}, {$line_width}, add_hash('{$fill_color}'), {$fill_opacity}); // 513\n"; break; } } // End while } // end if $value !=0 } // end foreach $gp_bounds //-------------------------END OF BOUNDARIES STUFF------------------------- $eols = array("\r\n", "\n", "\r"); // all flavors of eol $status_vals = array(); // build array of $status_vals $status_vals[''] = $status_vals['0'] = "TBD"; $query = "SELECT * FROM `{$GLOBALS['mysql_prefix']}fac_status` ORDER BY `id`"; $result_st = mysql_query($query) or do_error($query, 'mysql query failed', mysql_error(), basename(__FILE__), __LINE__); while ($row_st = stripslashes_deep(mysql_fetch_assoc($result_st))) { $temp = $row_st['id']; $status_vals[$temp] = $row_st['status_val']; } unset($result_st); $type_vals = array(); // build array of $status_vals $type_vals[''] = $type_vals['0'] = "TBD"; $query = "SELECT * FROM `{$GLOBALS['mysql_prefix']}fac_types` ORDER BY `id`"; $result_ty = mysql_query($query) or do_error($query, 'mysql query failed', mysql_error(), basename(__FILE__), __LINE__); while ($row_ty = stripslashes_deep(mysql_fetch_assoc($result_ty))) { $temp = $row_ty['id']; $type_vals[$temp] = $row_ty['name']; } unset($result_ty); $query = "SELECT * FROM `{$GLOBALS['mysql_prefix']}allocates` WHERE `type`= 4 AND `resource_id` = '{$_SESSION['user_id']}';"; // 6/10/11 $result = mysql_query($query); // 6/10/11 $al_groups = array(); while ($row_gp = stripslashes_deep(mysql_fetch_assoc($result))) { // 6/10/11 $al_groups[] = $row_gp['group']; } if (isset($_SESSION['viewed_groups'])) { // 6/10/11 $curr_viewed = explode(",", $_SESSION['viewed_groups']); } if (!isset($curr_viewed)) { $x = 0; // 6/10/11 $where2 = "WHERE ("; // 6/10/11 foreach ($al_groups as $grp) { // 6/10/11 $where3 = count($al_groups) > $x + 1 ? " OR " : ")"; $where2 .= "`a`.`group` = '{$grp}'"; $where2 .= $where3; $x++; } } else { $x = 0; // 6/10/11 $where2 = "WHERE ("; // 6/10/11 foreach ($curr_viewed as $grp) { // 6/10/11 $where3 = count($curr_viewed) > $x + 1 ? " OR " : ")"; $where2 .= "`a`.`group` = '{$grp}'"; $where2 .= $where3; $x++; } } $where2 .= "AND `a`.`type` = 3"; // 6/10/11 unset($result); // 3/15/11, 6/10/11 $query = "SELECT *,UNIX_TIMESTAMP(updated) AS updated, \n\t\t`f`.id AS id, \n\t\t`f`.status_id AS status_id,\n\t\t`f`.boundary AS boundary,\t\t\n\t\t`f`.description AS facility_description,\n\t\t`t`.name AS fac_type_name, \n\t\t`f`.name AS name,\n\t\t`f`.type AS type,\n\t\t`f`.street AS street,\n\t\t`f`.city AS city,\n\t\t`f`.state AS state \n\t\tFROM `{$GLOBALS['mysql_prefix']}facilities` `f`\n\t\tLEFT JOIN `{$GLOBALS['mysql_prefix']}allocates` `a` ON ( `f`.`id` = a.resource_id )\t\t\t\n\t\tLEFT JOIN `{$GLOBALS['mysql_prefix']}fac_types` `t` ON `f`.type = `t`.id \n\t\tLEFT JOIN `{$GLOBALS['mysql_prefix']}fac_status` `s` ON `f`.status_id = `s`.id \n\t\t{$where2} GROUP BY `f`.id ORDER BY `f`.type ASC"; $result = mysql_query($query) or do_error($query, 'mysql query failed', mysql_error(), basename(__FILE__), __LINE__); $num_facilities = mysql_affected_rows(); $i = 0; // counter // ============================================================================= $utc = gmdate("U"); while ($row = stripslashes_deep(mysql_fetch_assoc($result))) { // ========== major while() for Facility ========== $boundary = $row['boundary']; //-----------------------FACILITY BOUNDARIES / CATCHMENT STUFF--------------------6/10/11 ?> var thepoint; var points = new Array(); <?php $query_bn = "SELECT * FROM `{$GLOBALS['mysql_prefix']}mmarkup` WHERE `id`='{$boundary}' AND `use_with_f`=1"; $result_bn = mysql_query($query_bn) or do_error($query_bn, mysql_error(), basename(__FILE__), __LINE__); while ($row_bn = stripslashes_deep(mysql_fetch_assoc($result_bn))) { $the_type = $row_bn['line_type']; switch ($the_type) { case "p": extract($row_bn); $bn_name = $row_bn['line_name']; $points = explode(";", $line_data); for ($i = 0; $i < count($points); $i++) { $coords = explode(",", $points[$i]); ?> thepoint = new GLatLng(parseFloat(<?php print $coords[0]; ?> ), parseFloat(<?php print $coords[1]; ?> )); points.push(thepoint); <?php } // end for ($i = 0 ... ) if (intval($filled) == 1) { // 6/10/11 ?> var polyline = new GPolygon(points, "<?php print $line_color; ?> ", <?php print $line_width; ?> , <?php print $line_opacity; ?> , "<?php print $fill_color; ?> ", <?php print $fill_opacity; ?> , {clickable:false}); boundary.push(polyline); bound_names.push("<?php print $bn_name; ?> "); <?php } else { ?> var polyline = new GPolyline(points, "<?php print $line_color; ?> ", <?php print $line_width; ?> , <?php print $line_opacity; ?> , , 0, {clickable:false}); boundary.push(polyline); bound_names.push("<?php print $bn_name; ?> "); <?php } ?> map.addOverlay(polyline); <?php break; case "c": extract($row_bn); $temp = explode(";", $line_data); $radius = $temp[1]; $coords = explode(",", $temp[0]); $lat = $coords[0]; $lng = $coords[1]; $fill_opacity = intval($filled) == 0 ? 0 : $fill_opacity; echo "\n drawCircle({$lat}, {$lng}, {$radius}, add_hash('{$line_color}'), {$line_opacity}, {$line_width}, add_hash('{$fill_color}'), {$fill_opacity}); // 513\n"; break; } // end switch } // End while //-------------------------END OF FACILITY BOUNDARIES STUFF------------------------- $fac_gps = get_allocates(3, $row['id']); // 6/10/11 $grp_names = "Groups Assigned: "; // 6/10/11 $y = 0; // 6/10/11 foreach ($fac_gps as $value) { // 6/10/11 $counter = count($fac_gps) > $y + 1 ? ", " : ""; $grp_names .= get_groupname($value); $grp_names .= $counter; $y++; } $grp_names .= " / "; $the_bg_color = $GLOBALS['FACY_TYPES_BG'][$row['icon']]; // 2/8/10 $the_text_color = $GLOBALS['FACY_TYPES_TEXT'][$row['icon']]; // 2/8/10 $the_on_click = my_is_float($row['lat']) ? " onClick = myclick({$i}); " : " onClick = myclick_nm({$row['unit_id']}); "; // 3/15/11 $got_point = FALSE; print "\n\t\tvar i={$i};\n"; if (is_guest()) { $toedit = $tomail = $toroute = ""; } else { $toedit = " <A HREF='{$_SESSION['facilitiesfile']}?func=responder&edit=true&id=" . $row['id'] . "'><U>Edit</U></A>"; $tomail = " <SPAN onClick = 'do_mail_in_win({$row['id']})'><U><B>Email</B></U></SPAN>"; $toroute = " <A HREF='{$_SESSION['facroutesfile']}?fac_id=" . $row['id'] . "'><U>Route To Facility</U></A>"; } $temp = $row['status_id']; $the_status = array_key_exists($temp, $status_vals) ? $status_vals[$temp] : "??"; $temp_type = $row['type']; $the_type = array_key_exists($temp_type, $type_vals) ? $type_vals[$temp_type] : "??"; if (!$got_point && my_is_float($row['lat'])) { if ($row['lat'] == 0.999999 && $row['lng'] == 0.999999) { echo "\t\tvar point = new GLatLng(" . get_variable('def_lat') . ", " . get_variable('def_lng') . ");\n"; } else { echo "\t\tvar point = new GLatLng(" . $row['lat'] . ", " . $row['lng'] . ");\n"; } $got_point = TRUE; } $update_error = strtotime('now - 6 hours'); // set the time for silent setting $index = $row['icon_str']; // name $display_name = $name = htmlentities($row['name'], ENT_QUOTES); $handle = htmlentities($row['handle'], ENT_QUOTES); // 7/7/11 $sidebar_line = " <TD WIDTH='15%' TITLE = '{$row['handle']}' {$the_on_click}><U><SPAN STYLE='background-color:{$the_bg_color}; opacity: .7; color:{$the_text_color};'>" . addslashes(shorten($handle, 15)) . "</SPAN></U></TD>"; // 6/10/11 $sidebar_line .= "<TD WIDTH='40%' TITLE = '" . addslashes($name) . "' {$the_on_click}><U><SPAN STYLE='background-color:{$the_bg_color}; opacity: .7; color:{$the_text_color};'><NOBR>" . addslashes(shorten($name, 24)) . "</NOBR></SPAN></U></TD><TD WIDTH='15%'>{$the_type}</TD>"; $sidebar_line .= "<TD WIDTH='20%' CLASS='td_data' TITLE = '" . addslashes($the_status) . "'> " . get_status_sel($row['id'], $row['status_id'], 'f') . "</TD>"; // 3/15/11 // as of $strike = $strike_end = ""; $the_time = $row['updated']; $the_class = ""; $strike = $strike_end = ""; $sidebar_line .= "<TD WIDTH='20%' CLASS='{$the_class}'> {$strike} <NOBR>" . format_sb_date($the_time) . "</NOBR> {$strike_end}</TD>"; // tab 1 if (my_is_float($row['lat'])) { // position data? $temptype = $u_types[$row['type']]; $the_type = $temptype[0]; $tab_1 = "<TABLE CLASS='infowin' width='{$iw_width}'>"; $tab_1 .= "<TR CLASS='even'><TD COLSPAN=2 ALIGN='center'><B>" . addslashes(shorten($display_name, 48)) . "</B> - " . $the_type . "</TD></TR>"; $tab_1 .= "<TR CLASS='odd'><TD ALIGN='right'>Description: </TD><TD ALIGN='left'>" . addslashes(shorten(str_replace($eols, " ", $row['description']), 32)) . "</TD></TR>"; $tab_1 .= "<TR CLASS='even'><TD ALIGN='right'>Status: </TD><TD ALIGN='left'>" . $the_status . " </TD></TR>"; $tab_1 .= "<TR CLASS='odd'><TD ALIGN='right'>Contact: </TD><TD ALIGN='left'>" . addslashes($row['contact_name']) . " Via: " . addslashes($row['contact_email']) . "</TD></TR>"; $tab_1 .= "<TR CLASS='even'><TD ALIGN='right'>As of: </TD><TD ALIGN='left'>" . format_date($row['updated']) . "</TD></TR>"; $tab_1 .= "<TR CLASS='odd'><TD COLSPAN=2 ALIGN='center'>" . $toedit . $tomail . " <A HREF='{$_SESSION['facilitiesfile']}?func=responder&view=true&id=" . $row['id'] . "'><U>View</U></A></TD></TR>"; // 08/8/02 $tab_1 .= "</TABLE>"; $tab_2 = "<TABLE CLASS='infowin' width='{$iw_width}' ALIGN = 'center' >"; $tab_2 .= "<TR CLASS='odd'><TD ALIGN='right' STYLE= 'width:50%'>Security contact: </TD><TD ALIGN='left' STYLE= 'width:50%'>" . addslashes($row['security_contact']) . " </TD></TR>"; $tab_2 .= "<TR CLASS='even'><TD ALIGN='right'>Security email: </TD><TD ALIGN='left'>" . addslashes($row['security_email']) . " </TD></TR>"; $tab_2 .= "<TR CLASS='odd'><TD ALIGN='right'>Security phone: </TD><TD ALIGN='left'>" . addslashes($row['security_phone']) . " </TD></TR>"; $tab_2 .= "<TR CLASS='even'><TD ALIGN='right'>" . get_text("Access rules") . ": </TD><TD ALIGN='left'>" . addslashes(str_replace($eols, " ", $row['access_rules'])) . "</TD></TR>"; $tab_2 .= "<TR CLASS='odd'><TD ALIGN='right'>Security reqs: </TD><TD ALIGN='left'>" . addslashes(str_replace($eols, " ", $row['security_reqs'])) . "</TD></TR>"; $tab_2 .= "<TR CLASS='even'><TD ALIGN='right'>Opening hours: </TD><TD ALIGN='left'>" . addslashes(str_replace($eols, " ", $row['opening_hours'])) . "</TD></TR>"; $tab_2 .= "<TR CLASS='odd'><TD ALIGN='right'>Prim pager: </TD><TD ALIGN='left'>" . addslashes($row['pager_p']) . " </TD></TR>"; $tab_2 .= "<TR CLASS='even'><TD ALIGN='right'>Sec pager: </TD><TD ALIGN='left'>" . addslashes($row['pager_s']) . " </TD></TR>"; $tab_2 .= "</TABLE>"; // tab 2 $tabs_done = FALSE; // default if (!$tabs_done) { // ?> var myinfoTabs = [ new GInfoWindowTab("<?php print nl2brr(addslashes(shorten($row['name'], 10))); ?> ", "<?php print $tab_1; ?> "), new GInfoWindowTab("More ...", "<?php print str_replace($eols, " ", $tab_2); ?> "), new GInfoWindowTab("Zoom", "<div id='detailmap' class='detailmap'></div>") ]; <?php } // end if/else $name = $row['name']; // 10/8/09 4/28/11 if ($row['lat'] == 0.999999 && $row['lng'] == 0.999999) { // check for facilities added in no mpas mode 7/28/10 ?> var fac_id = "<?php print $index; ?> "; // 10/8/09 var the_class = ((map_is_fixed) && (!(mapBounds.containsLatLng(point))))? "emph" : "td_label"; do_sidebar ("<?php print $sidebar_line; ?> ", i, the_class, fac_id); var dummymarker = createdummyMarker(point, myinfoTabs,<?php print $row['type']; ?> , i, fac_id); // 771 (point,tabs, color, id) map.addOverlay(dummymarker); <?php } else { ?> var fac_id = "<?php print $index; ?> "; // 10/8/09 var the_class = ((map_is_fixed) && (!(mapBounds.containsLatLng(point))))? "emph" : "td_label"; do_sidebar ("<?php print $sidebar_line; ?> ", i, the_class, fac_id); var marker = createMarker(point, myinfoTabs,<?php print $row['type']; ?> , i, fac_id); // 771 (point,tabs, color, id) map.addOverlay(marker); <?php } // End of check for facilities added in no maps mode 7/28/10 } else { // end position data available $name = $row['name']; // 11/11/09 $temp = explode("/", $name); $index = substr($temp[count($temp) - 1], -6, strlen($temp[count($temp) - 1])); // 3/19/11 ?> var fac_id = "<?php print $index; ?> "; // 11/11/09 <?php print "\tdo_sidebar_nm (\" {$sidebar_line} \" , i, {$row['id']}, fac_id);\n"; // sidebar only - no map } $i++; // zero-based } // end ========== while() for Facility ========== ?> if (!(map_is_fixed)) { if (!points) { // any? map.setCenter(new GLatLng(<?php echo get_variable('def_lat'); ?> , <?php echo get_variable('def_lng'); ?> ), <?php echo get_variable('def_zoom'); ?> ); } else { center = bounds.getCenter(); zoom = map.getBoundsZoomLevel(bounds); map.setCenter(center,zoom); } } var buttons_html = ""; <?php if (!empty($addon)) { print "\n\tbuttons_html +=\"" . $addon . "\"\n"; } ?> side_bar_html +="</TABLE>\n"; $("side_bar").innerHTML += side_bar_html; // append the assembled side_bar_html contents to the side_bar div $("buttons").innerHTML = buttons_html; // append the assembled side_bar_html contents to the side_bar div $("num_facilities").innerHTML = <?php print $num_facilities; ?> ; <?php do_kml(); ?> </SCRIPT> <?php }
print "<TD ALIGN='left' onmouseover=\"Tip('Cleared: " . my_to_date($row['clear']) . "')\" onmouseout=\"UnTip()\" >" . my_to_date_sh($row['clear']) . "{$deltas[5]}</TD>\n"; print "<TD ALIGN='left' onmouseover=\"Tip('Closed: " . my_to_date($row['problemend']) . "')\" onmouseout=\"UnTip()\" >" . my_to_date_sh($row['problemend']) . "{$deltas[6]} </TD>\n"; $is_disabled = $guest ? " DISABLED " : ""; $temp = "???"; print "\t<TD ALIGN='left' onmouseover=\"Tip('{$row['theuser']}')\" onmouseout=\"UnTip()\" CLASS='{$theClass}' onClick = 'editA(" . $row['assign_id'] . ");'>" . $strike . shorten($row['theuser'], 8) . $strikend . "</TD>\n"; // user $the_comment = addslashes(remove_nls($row['assign_comments'])); // 10/20/09 $the_short_one = shorten($the_comment, $COLS_COMMENTS); print "\t<TD ALIGN='left' onmouseover=\"Tip('{$the_comment}')\" onmouseout=\"UnTip()\" CLASS='{$theClass}' onClick = 'editA(" . $row['assign_id'] . ");' >" . $strike . $the_short_one . $strikend . "</TD>\n"; // comment if ($miles) { print "\t<TD ALIGN='left' CLASS='{$theClass}' >" . $row['start_miles'] . " </TD>\n"; print "\t<TD ALIGN='left' CLASS='{$theClass}' >" . $row['on_scene_miles'] . " </TD>\n"; print "\t<TD ALIGN='left' CLASS='{$theClass}' >" . $row['end_miles'] . " </TD>\n"; $dist = my_is_int($row['start_miles']) && my_is_int($row['end_miles']) ? $row['end_miles'] - $row['start_miles'] : ""; print "\t<TD ALIGN='left' CLASS='{$theClass}' >{$dist}</TD>\n"; } print "\n</TR>\n"; $i++; } // end while($row ...) $lines = $i; // snap(basename(__FILE__), __LINE__); print "<TR><TD COLSPAN=99 ALIGN='center'><BR /><B>End</B><BR /></TD></TR>"; } // end if (mysql_affected_rows()>0) ?> </TABLE> <DIV ID='foo'><DIV ID='bar'> <!-- 12/13/09 --> <INPUT TYPE='button' VALUE = 'Finished' onClick = 'window.close()' CLASS = 'btn'>
<?php function my_is_int($x) { hh\asm(' IsTypeL $x Int RetC '); } var_dump(my_is_int(1)); var_dump(my_is_int(1.2));
function list_responders($addon = '', $start) { global $iw_width, $u_types, $tolerance; $assigns = array(); // 08/8/3 $tickets = array(); // ticket id's // 7/18/10 $query = "SELECT `{$GLOBALS['mysql_prefix']}assigns`.`ticket_id`, `{$GLOBALS['mysql_prefix']}assigns`.`responder_id`,\n\t\t`{$GLOBALS['mysql_prefix']}ticket`.`scope` AS `ticket` \n\t\tFROM `{$GLOBALS['mysql_prefix']}assigns` \t\t\n\t\tLEFT JOIN `{$GLOBALS['mysql_prefix']}ticket` ON `{$GLOBALS['mysql_prefix']}assigns`.`ticket_id`=`{$GLOBALS['mysql_prefix']}ticket`.`id`\n\t\tWHERE ( `clear` IS NULL OR DATE_FORMAT(`clear`,'%y') = '00' )"; $result_as = mysql_query($query) or do_error($query, 'mysql query failed', mysql_error(), basename(__FILE__), __LINE__); while ($row_as = stripslashes_deep(mysql_fetch_array($result_as))) { $assigns[$row_as['responder_id']] = $row_as['ticket']; $tickets[$row_as['responder_id']] = $row_as['ticket_id']; } unset($result_as); $calls = array(); // 6/17/08 $calls_nr = array(); $calls_time = array(); $query = "SELECT * , UNIX_TIMESTAMP(packet_date) AS `packet_date` FROM `{$GLOBALS['mysql_prefix']}tracks` ORDER BY `packet_date` ASC"; // 6/17/08 $result = mysql_query($query) or do_error($query, 'mysql query failed', mysql_error(), __FILE__, __LINE__); while ($row = mysql_fetch_array($result)) { if (isset($calls[$row['source']])) { // array_key_exists ( mixed key, array search ) $calls_nr[$row['source']]++; } else { // array_push ($calls, trim($row['source'])); $calls[trim($row['source'])] = TRUE; $calls_nr[$row['source']] = 1; } $calls_time[$row['source']] = $row['packet_date']; // save latest - note query order } ?> <SCRIPT > var color=0; var colors = new Array ('odd', 'even'); function hideDiv(div_area, hide_cont, show_cont) { // 3/15/11 if (div_area == "buttons_sh") { var controlarea = "hide_controls"; } if (div_area == "resp_list_sh") { var controlarea = "resp_list"; } if (div_area == "facs_list_sh") { var controlarea = "facs_list"; } if (div_area == "incs_list_sh") { var controlarea = "incs_list"; } if (div_area == "region_boxes") { var controlarea = "region_boxes"; } var divarea = div_area var hide_cont = hide_cont var show_cont = show_cont if($(divarea)) { $(divarea).style.display = 'none'; $(hide_cont).style.display = 'none'; $(show_cont).style.display = ''; } var params = "f_n=" +controlarea+ "&v_n=h&sess_id=<?php print get_sess_key(__LINE__); ?> "; var url = "persist2.php"; sendRequest (url, gb_handleResult, params); } function showDiv(div_area, hide_cont, show_cont) { // 3/15/11 if (div_area == "buttons_sh") { var controlarea = "hide_controls"; } if (div_area == "resp_list_sh") { var controlarea = "resp_list"; } if (div_area == "facs_list_sh") { var controlarea = "facs_list"; } if (div_area == "incs_list_sh") { var controlarea = "incs_list"; } if (div_area == "region_boxes") { var controlarea = "region_boxes"; } var divarea = div_area var hide_cont = hide_cont var show_cont = show_cont if($(divarea)) { $(divarea).style.display = ''; $(hide_cont).style.display = ''; $(show_cont).style.display = 'none'; } var params = "f_n=" +controlarea+ "&v_n=s&sess_id=<?php print get_sess_key(__LINE__); ?> "; var url = "persist2.php"; sendRequest (url, gb_handleResult, params); } function hideGroup(color) { for (var i = 0; i < gmarkers.length; i++) { if (gmarkers[i]) { if (gmarkers[i].id == color) { gmarkers[i].show(); } else { gmarkers[i].hide(); } } // end if (gmarkers[i]) } // end for () elem = $("allIcons"); elem.style.visibility = "visible"; } // end function function showAll() { for (var i = 0; i < gmarkers.length; i++) { if (gmarkers[i]) { gmarkers[i].show(); } } // end for () elem = $("allIcons"); elem.style.visibility = "hidden"; } // end function function checkArray(form, arrayName) { // 5/3/11 var retval = new Array(); for(var i=0; i < form.elements.length; i++) { var el = form.elements[i]; if(el.type == "checkbox" && el.name == arrayName && el.checked) { retval.push(el.value); } } return retval; } function checkForm(form) { // 6/10/11 var errmsg=""; var itemsChecked = checkArray(form, "frm_group[]"); if(itemsChecked.length > 0) { var params = "f_n=viewed_groups&v_n=" +itemsChecked+ "&sess_id=<?php print get_sess_key(__LINE__); ?> "; // 3/15/11 var url = "persist3.php"; // 3/15/11 sendRequest (url, fvg_handleResult, params); form.submit(); } else { errmsg+= "\tYou cannot Hide all the regions\n"; if (errmsg!="") { alert ("Please correct the following and re-submit:\n\n" + errmsg); return false; } } } function fvg_handleResult(req) { // 6/10/11 The persist callback function for viewed groups. document.region_form.submit(); } function form_validate(theForm) { // 5/3/11 // alert("Validating"); checkForm(theForm); } // end function validate(theForm) function sendRequest(url,callback,postData) { // 2/14/09 var req = createXMLHTTPObject(); if (!req) return; var method = (postData) ? "POST" : "GET"; req.open(method,url,true); req.setRequestHeader('User-Agent','XMLHTTP/1.0'); if (postData) req.setRequestHeader('Content-type','application/x-www-form-urlencoded'); req.onreadystatechange = function () { if (req.readyState != 4) return; if (req.status != 200 && req.status != 304) { return; } callback(req); } if (req.readyState == 4) return; req.send(postData); } var XMLHttpFactories = [ function () {return new XMLHttpRequest() }, function () {return new ActiveXObject("Msxml2.XMLHTTP") }, function () {return new ActiveXObject("Msxml3.XMLHTTP") }, function () {return new ActiveXObject("Microsoft.XMLHTTP") } ]; function createXMLHTTPObject() { var xmlhttp = false; for (var i=0;i<XMLHttpFactories.length;i++) { try { xmlhttp = XMLHttpFactories[i](); } catch (e) { continue; } break; } return xmlhttp; } function createMarker(point,tabs, color, id, unit_id) { // (point, myinfoTabs,<?php print $row['type']; ?> , i) points = true; var unit_id = unit_id; // 2/13/09 var icon = new GIcon(listIcon); var icon_url = "./our_icons/gen_icon.php?blank=" + color + "&text=" + unit_id; // 1/5/09 icon.image = icon_url; // ./our_icons/gen_icon.php?blank=4&text=zz" var marker = new GMarker(point, icon); marker.id = color; // for hide/unhide - unused GEvent.addListener(marker, "click", function() { // here for both side bar and icon click if (marker) { map.closeInfoWindow(); which = id; gmarkers[which].hide(); marker.openInfoWindowTabsHtml(infoTabs[id]); setTimeout(function() { // wait for rendering complete - 12/17/08 if ($("detailmap")) { var dMapDiv = $("detailmap"); var detailmap = new GMap2(dMapDiv); detailmap.addControl(new GSmallMapControl()); detailmap.setCenter(point, 17); // larger # = closer detailmap.addOverlay(marker); } else { // alert(62); // alert($("detailmap")); } },4000); // end setTimeout(...) } // end if (marker) }); // end GEvent.add Listener() gmarkers[id] = marker; // marker to array for side bar click function infoTabs[id] = tabs; // tabs to array if (!(map_is_fixed)) { // 4/3/09 bounds.extend(point); } return marker; } // end function create Marker() function createdummyMarker(point,tabs, color, id, unit_id) { // (point, myinfoTabs,<?php print $row['type']; ?> , i) points = true; var unit_id = unit_id; // 2/13/09 var icon = new GIcon(listIcon); var icon_url = "./our_icons/question1.png"; icon.image = icon_url; // ./our_icons/gen_icon.php?blank=4&text=zz" var dummymarker = new GMarker(point, icon); dummymarker.id = color; // for hide/unhide - unused GEvent.addListener(dummymarker, "click", function() { // here for both side bar and icon click if (dummymarker) { map.closeInfoWindow(); which = id; gmarkers[which].hide(); dummymarker.openInfoWindowTabsHtml(infoTabs[id]); setTimeout(function() { // wait for rendering complete - 12/17/08 if ($("detailmap")) { var dMapDiv = $("detailmap"); var detailmap = new GMap2(dMapDiv); detailmap.addControl(new GSmallMapControl()); detailmap.setCenter(point, 17); // larger # = closer detailmap.addOverlay(dummymarker); } else { // alert(62); // alert($("detailmap")); } },4000); // end setTimeout(...) } // end if (marker) }); // end GEvent.add Listener() gmarkers[id] = dummymarker; // marker to array for side bar click function infoTabs[id] = tabs; // tabs to array if (!(map_is_fixed)) { // 4/3/09 bounds.extend(point); } return dummymarker; } // end function create dummy Marker() function do_sidebar (sidebar, id, the_class, sidebar_id) { var sidebar_id = sidebar_id; side_bar_html += "<TR CLASS='" + colors[(id)%2] +"'>"; side_bar_html += "<TD WIDTH='5%' CLASS='" + the_class + "' onClick = myclick(" + id + "); >" + sidebar_id + sidebar +"</TD></TR>\n"; // 1/5/09, 3/4/09, 10/29/09 removed period } function do_sidebar_nm (sidebar, line_no, id, sidebar_id) { var sidebar_id = sidebar_id; side_bar_html += "<TR CLASS='" + colors[(line_no)%2] +"'>"; side_bar_html += "<TD WIDTH='5%' onClick = myclick_nm(" + sidebar_id + "); >" + sidebar_id + sidebar +"</TD></TR>\n"; // 1/23/09, 10/29/09 removed period, 11/11/09 } function myclick_nm(v_id) { // Responds to sidebar click - view responder data document.view_form.id.value=v_id; document.view_form.submit(); } function myclick(id) { // Responds to sidebar click, then triggers listener above - note [id] GEvent.trigger(gmarkers[id], "click"); location.href = '#top'; // 11/11/09 } function do_lat (lat) { document.forms[0].frm_lat.value=lat.toFixed(6); } function do_lng (lng) { document.forms[0].frm_lng.value=lng.toFixed(6); } function do_ngs() { // LL to USNG var loc = <?php print get_variable('locale'); ?> ; document.forms[0].frm_ngs.disabled=false; if(loc == 0) { document.forms[0].frm_ngs.value = LLtoUSNG(document.forms[0].frm_lat.value, document.forms[0].frm_lng.value, 5); } if(loc == 1) { document.forms[0].frm_ngs.value = LLtoOSGB(document.forms[0].frm_lat.value, document.forms[0].frm_lng.value, 5); } if(loc == 2) { document.forms[0].frm_ngs.value = LLtoOSGB(document.forms[0].frm_lat.value, document.forms[0].frm_lng.value, 5); } document.forms[0].frm_ngs.disabled=true; } var icons=new Array; // maps type to icon blank <?php $query = "SELECT * FROM `{$GLOBALS['mysql_prefix']}unit_types` ORDER BY `id`"; // types in use $result = mysql_query($query) or do_error($query, 'mysql query failed', mysql_error(), basename(__FILE__), __LINE__); $icons = $GLOBALS['icons']; while ($row = stripslashes_deep(mysql_fetch_assoc($result))) { // map type to blank icon id $blank = $row['icon']; print "\ticons[" . $row['id'] . "] = " . $blank . ";\n"; // } unset($result); $dzf = get_variable('def_zoom_fixed'); print "\tvar map_is_fixed = "; print my_is_int($dzf) && $dzf == 2 || my_is_int($dzf) && $dzf == 3 ? "true;\n" : "false;\n"; ?> var map; var side_bar_html = "<TABLE border=0 CLASS='sidebar' WIDTH = '100%' >"; side_bar_html += "<TR class='even'> <TD></TD><TD ALIGN='left'><B>Unit</B></TD><TD ALIGN='left'><B>Handle</B></TD><TD ALIGN='left'><B>Dispatch</B></TD><TD ALIGN='left'><B>Status</B></TD><TD ALIGN='left'><B>M</B></TD><TD ALIGN='left'><B>As of</B></TD></TR>"; var gmarkers = []; var infoTabs = []; var which; var i = <?php print $start; ?> ; // sidebar/icon index var points = false; // none map = new GMap2($("map")); // create the map <?php $maptype = get_variable('maptype'); // 08/02/09 switch ($maptype) { case "1": break; case "2": ?> map.setMapType(G_SATELLITE_MAP);<?php break; case "3": ?> map.setMapType(G_PHYSICAL_MAP);<?php break; case "4": ?> map.setMapType(G_HYBRID_MAP);<?php break; default: print "ERROR in " . basename(__FILE__) . " " . __LINE__ . "<BR />"; } ?> // map.addControl(new GSmallMapControl()); // 10/6/08 map.setUIToDefault(); // 8/13/10 map.addControl(new GMapTypeControl()); <?php if (get_variable('terrain') == 1) { ?> map.addMapType(G_PHYSICAL_MAP); <?php } ?> map.setCenter(new GLatLng(<?php echo get_variable('def_lat'); ?> , <?php echo get_variable('def_lng'); ?> ), <?php echo get_variable('def_zoom'); ?> ); mapBounds=new GLatLngBounds(map.getBounds().getSouthWest(), map.getBounds().getNorthEast()); // 4/4/09 var bounds = new GLatLngBounds(); // create bounding box map.enableScrollWheelZoom(); var listIcon = new GIcon(); listIcon.image = "./markers/yellow.png"; // yellow.png - 16 X 28 listIcon.shadow = "./markers/sm_shadow.png"; listIcon.iconSize = new GSize(20, 34); listIcon.shadowSize = new GSize(37, 34); listIcon.iconAnchor = new GPoint(8, 28); listIcon.infoWindowAnchor = new GPoint(9, 2); listIcon.infoShadowAnchor = new GPoint(18, 25); GEvent.addListener(map, "infowindowclose", function() { // re-center after move/zoom map.addOverlay(gmarkers[which]) }); do_landb(); // 8/1/11 - show scribbles //-----------------------BOUNDARIES STUFF--------------------6/10/11 var thepoint; var points = new Array(); var boundary = new Array(); var bound_names = new Array(); GEvent.addListener(map, "click", function(overlay,boundpoint) { for (var n = 0; n < boundary.length; n++) { if (boundary[n].Contains(boundpoint)) { map.openInfoWindowHtml(boundpoint,"This is " + bound_names[n]); } } }); <?php $query = "SELECT * FROM `{$GLOBALS['mysql_prefix']}allocates` WHERE `type`= 4 AND `resource_id` = '{$_SESSION['user_id']}' ORDER BY `id` ASC;"; // 6/10/11 $result = mysql_query($query); // 6/10/11 $a_gp_bounds = array(); $gp_bounds = array(); while ($row = stripslashes_deep(mysql_fetch_assoc($result))) { // 6/10/11 $al_groups[] = $row['group']; $query2 = "SELECT * FROM `{$GLOBALS['mysql_prefix']}region` WHERE `id`= '{$row['group']}';"; // 6/10/11 $result2 = mysql_query($query2); // 4/18/11 while ($row2 = stripslashes_deep(mysql_fetch_assoc($result2))) { // // 6/10/11 if ($row2['boundary'] != 0) { $a_gp_bounds[] = $row2['boundary']; } } } if (isset($_SESSION['viewed_groups'])) { // 6/10/11 foreach (explode(",", $_SESSION['viewed_groups']) as $val_vg) { $query3 = "SELECT * FROM `{$GLOBALS['mysql_prefix']}region` WHERE `id`= '{$val_vg}';"; $result3 = mysql_query($query3); // 6/10/11 while ($row3 = stripslashes_deep(mysql_fetch_assoc($result3))) { if ($row3['boundary'] != 0) { $gp_bounds[] = $row3['boundary']; } } } } else { $gp_bounds = $a_gp_bounds; } foreach ($gp_bounds as $value) { // 6/10/11 ?> var points = new Array(); <?php if ($value != 0) { $query_bn = "SELECT * FROM `{$GLOBALS['mysql_prefix']}mmarkup` WHERE `id`='{$value}'"; $result_bn = mysql_query($query_bn) or do_error($query_bn, mysql_error(), basename(__FILE__), __LINE__); while ($row_bn = stripslashes_deep(mysql_fetch_assoc($result_bn))) { extract($row_bn); $bn_name = $row_bn['line_name']; $points = explode(";", $line_data); for ($i = 0; $i < count($points); $i++) { $coords = explode(",", $points[$i]); ?> thepoint = new GLatLng(parseFloat(<?php print $coords[0]; ?> ), parseFloat(<?php print $coords[1]; ?> )); points.push(thepoint); <?php } // end for ($i = 0 ... ) ?> <?php if (intval($filled) == 1) { // 6/10/11 ?> var polyline = new GPolygon(points, add_hash("<?php print $line_color; ?> "), <?php print $line_width; ?> , <?php print $line_opacity; ?> , add_hash("<?php print $fill_color; ?> "), <?php print $fill_opacity; ?> , {clickable:false}); boundary.push(polyline); bound_names.push("<?php print $bn_name; ?> "); <?php } else { ?> var polyline = new GPolyline(points, add_hash("<?php print $line_color; ?> "), <?php print $line_width; ?> , <?php print $line_opacity; ?> , , 0, {clickable:false}); boundary.push(polyline); bound_names.push("<?php print $bn_name; ?> "); <?php } ?> map.addOverlay(polyline); <?php } // End while } // end if $value !=0 } // end foreach $gp_bounds //-------------------------END OF BOUNDARIES STUFF------------------------- function can_do_dispatch($the_row) { if (intval($the_row['multi']) == 1) { return TRUE; } $query = "SELECT * FROM `{$GLOBALS['mysql_prefix']}assigns` WHERE `responder_id` = {$the_row['id']}"; // all dispatches this unit $result_temp = mysql_query($query) or do_error($query, 'mysql query failed', mysql_error(), basename(__FILE__), __LINE__); while ($row_temp = stripslashes_deep(mysql_fetch_array($result_temp))) { // check any open runs this unit if (!is_date($row_temp['clear'])) { // if clear is empty, then NOT dispatch-able unset($result_temp, $row_temp); return FALSE; } } // end while ($row_temp ...) unset($result_temp, $row_temp); return TRUE; // none found, can dispatch } // end function can do_dispatch() $eols = array("\r\n", "\n", "\r"); // all flavors of eol $bulls = array(0 => "", 1 => "red", 2 => "green", 3 => "white", 4 => "black"); $status_vals = array(); // build array of $status_vals $status_vals[''] = $status_vals['0'] = "TBD"; $query = "SELECT * FROM `{$GLOBALS['mysql_prefix']}un_status` ORDER BY `id`"; $result_st = mysql_query($query) or do_error($query, 'mysql query failed', mysql_error(), basename(__FILE__), __LINE__); while ($row_st = stripslashes_deep(mysql_fetch_array($result_st))) { $temp = $row_st['id']; $status_vals[$temp] = $row_st['status_val']; } unset($result_st); $query_al = "SELECT * FROM `{$GLOBALS['mysql_prefix']}allocates` WHERE `type`= 4 AND `resource_id` = '{$_SESSION['user_id']}';"; // 6/10/11 $result_al = mysql_query($query_al); // 6/10/11 $al_groups = array(); while ($row_al = stripslashes_deep(mysql_fetch_assoc($result_al))) { // 6/10/11 $al_groups[] = $row_al['group']; } if (isset($_SESSION['viewed_groups'])) { // 6/10/11 $curr_viewed = explode(",", $_SESSION['viewed_groups']); } if (!isset($curr_viewed)) { $x = 0; // 6/10/11 $where2 = "WHERE ("; // 6/10/11 foreach ($al_groups as $grp) { // 6/10/11 $where3 = count($al_groups) > $x + 1 ? " OR " : ")"; $where2 .= "`a`.`group` = '{$grp}'"; $where2 .= $where3; $x++; } } else { $x = 0; // 6/10/11 $where2 = "WHERE ("; // 6/10/11 foreach ($curr_viewed as $grp) { // 6/10/11 $where3 = count($curr_viewed) > $x + 1 ? " OR " : ")"; $where2 .= "`a`.`group` = '{$grp}'"; $where2 .= $where3; $x++; } } $where2 .= "AND `a`.`type` = 2"; // 6/10/11 //-----------------------UNIT RING FENCE STUFF--------------------6/10/11 ?> var thepoint; var points = new Array(); <?php $query_bn = "SELECT * FROM `{$GLOBALS['mysql_prefix']}mmarkup` `l`\n\t\t\t\tLEFT JOIN `{$GLOBALS['mysql_prefix']}responder` `r` ON ( `l`.`id` = `r`.`ring_fence`)\n\t\t\t\tLEFT JOIN `{$GLOBALS['mysql_prefix']}allocates` `a` ON ( `r`.`id` = `a`.`resource_id` )\t\n\t\t\t\t{$where2} AND `use_with_u_rf`=1 GROUP BY `l`.`id`"; $result_bn = mysql_query($query_bn) or do_error($query_bn, mysql_error(), basename(__FILE__), __LINE__); while ($row_bn = stripslashes_deep(mysql_fetch_assoc($result_bn))) { extract($row_bn); $bn_name = $row_bn['line_name']; $all_boundaries[] = $row_bn['ring_fence']; $points = explode(";", $line_data); for ($i = 0; $i < count($points); $i++) { $coords = explode(",", $points[$i]); ?> thepoint = new GLatLng(parseFloat(<?php print $coords[0]; ?> ), parseFloat(<?php print $coords[1]; ?> )); points.push(thepoint); <?php } // end for ($i = 0 ... ) if (intval($filled) == 1) { // 6/10/11 ?> var polyline = new GPolygon(points, add_hash("<?php print $line_color; ?> "), <?php print $line_width; ?> , <?php print $line_opacity; ?> , add_hash("<?php print $fill_color; ?> "), <?php print $fill_opacity; ?> , {clickable:false, id:"ringfence"}); boundary.push(polyline); bound_names.push("<?php print $bn_name; ?> "); <?php } else { ?> var polyline = new GPolyline(points, add_hash("<?php print $line_color; ?> "), <?php print $line_width; ?> , <?php print $line_opacity; ?> , , 0, {clickable:false, id:"ringfence"}); boundary.push(polyline); bound_names.push("<?php print $bn_name; ?> "); <?php } ?> map.addOverlay(polyline); <?php } // End while //-------------------------END OF UNIT RING FENCE STUFF------------------------- //-----------------------UNIT EXCLUSION ZONE STUFF--------------------6/10/11 ?> var thepoint; var points = new Array(); <?php $query_bn = "SELECT * FROM `{$GLOBALS['mysql_prefix']}mmarkup` `l`\n\t\t\t\tLEFT JOIN `{$GLOBALS['mysql_prefix']}responder` `r` ON ( `l`.`id` = `r`.`excl_zone`)\n\t\t\t\tLEFT JOIN `{$GLOBALS['mysql_prefix']}allocates` `a` ON ( `r`.`id` = `a`.`resource_id` )\t\n\t\t\t\t{$where2} AND `use_with_u_ex`=1 GROUP BY `l`.`id`"; $result_bn = mysql_query($query_bn) or do_error($query_bn, mysql_error(), basename(__FILE__), __LINE__); while ($row_bn = stripslashes_deep(mysql_fetch_assoc($result_bn))) { extract($row_bn); $bn_name = $row_bn['line_name']; $all_boundaries[] = $row_bn['ring_fence']; $points = explode(";", $line_data); for ($i = 0; $i < count($points); $i++) { $coords = explode(",", $points[$i]); ?> thepoint = new GLatLng(parseFloat(<?php print $coords[0]; ?> ), parseFloat(<?php print $coords[1]; ?> )); points.push(thepoint); <?php } // end for ($i = 0 ... ) if (intval($filled) == 1) { // 6/10/11 ?> var polyline = new GPolygon(points, add_hash("<?php print $line_color; ?> "), <?php print $line_width; ?> , <?php print $line_opacity; ?> , add_hash("<?php print $fill_color; ?> "), <?php print $fill_opacity; ?> , {clickable:false, id:"ringfence"}); boundary.push(polyline); bound_names.push("<?php print $bn_name; ?> "); <?php } else { ?> var polyline = new GPolyline(points, add_hash("<?php print $line_color; ?> "), <?php print $line_width; ?> , <?php print $line_opacity; ?> , , 0, {clickable:false, id:"ringfence"}); boundary.push(polyline); bound_names.push("<?php print $bn_name; ?> "); <?php } ?> map.addOverlay(polyline); <?php } // End while //-------------------------END OF UNIT EXCLUSION ZONE STUFF------------------------- $query = "SELECT *, UNIX_TIMESTAMP(updated) AS `updated`,\n\t\t`t`.`id` AS `type_id`,\n\t\t`r`.`id` AS `unit_id`,\n\t\t`r`.`name` AS `name`,\n\t\t`s`.`description` AS `stat_descr`,\n\t\t`r`.`description` AS `unit_descr`, \n\t\t`r`.`ring_fence` AS `ring_fence`,\t\n\t\t`r`.`excl_zone` AS `excl_zone`,\t\t\n\t\t(SELECT COUNT(*) as numfound FROM `{$GLOBALS['mysql_prefix']}assigns` \n\t\tWHERE `{$GLOBALS['mysql_prefix']}assigns`.`responder_id` = unit_id AND (`clear` IS NULL OR DATE_FORMAT(`clear`,'%y') = '00' )) AS `nr_assigned` \n\t\tFROM `{$GLOBALS['mysql_prefix']}responder` `r` \n\t\tLEFT JOIN `{$GLOBALS['mysql_prefix']}allocates` `a` ON ( `r`.`id` = a.resource_id )\t\t\t\n\t\tLEFT JOIN `{$GLOBALS['mysql_prefix']}unit_types` `t` ON ( `r`.`type` = t.id )\t\n\t\tLEFT JOIN `{$GLOBALS['mysql_prefix']}un_status` `s` ON ( `r`.`un_status_id` = s.id ) \t\t\n\t\t{$where2} GROUP BY unit_id ORDER BY `nr_assigned` DESC, `handle` ASC, `r`.`name` ASC "; // 2/1/10, 3/15/10, 6/10/11 $result = mysql_query($query) or do_error($query, 'mysql query failed', mysql_error(), basename(__FILE__), __LINE__); $num_units = mysql_affected_rows(); $i = 0; // counter // ============================================================================= $bulls = array(0 => "", 1 => "red", 2 => "green", 3 => "white", 4 => "black"); $utc = gmdate("U"); // ========== major while() for RESPONDER ========== while ($row = stripslashes_deep(mysql_fetch_assoc($result))) { $ringfence = $row['ring_fence']; $resp_gps = get_allocates(2, $row['unit_id']); // 6/10/11 $grp_names = "Groups Assigned: "; // 6/10/11 $y = 0; // 6/10/11 foreach ($resp_gps as $value) { // 6/10/11 $counter = count($resp_gps) > $y + 1 ? ", " : ""; $grp_names .= get_groupname($value); $grp_names .= $counter; $y++; } $grp_names .= " / "; $track_type = get_remote_type($row); $index = $row['icon_str']; // 4/28/11 $the_on_click = my_is_float($row['lat']) ? " onClick = myclick({$i}); " : " onClick = myclick_nm({$row['unit_id']}); "; $the_bg_color = $GLOBALS['UNIT_TYPES_BG'][$row['icon']]; // 2/1/10 $the_text_color = $GLOBALS['UNIT_TYPES_TEXT'][$row['icon']]; // 2/1/10 $do_dispatch = can_do_dispatch($row); // 11/17/09 $got_point = FALSE; print "\n\t\tvar i={$i};\n"; $tofac = is_guest() ? "" : " <A HREF='{$_SESSION['unitsfile']}?func=responder&view=true&dispfac=true&id=" . $row['unit_id'] . "'><U>To Facility</U></A> "; // 10/6/09 $todisp = is_guest() || !can_do_dispatch($row) ? "" : " <A HREF='{$_SESSION['unitsfile']}?func=responder&view=true&disp=true&id=" . $row['unit_id'] . "'><U>Dispatch</U></A> "; // 08/8/02, 9/19/09 $toedit = !can_edit() ? "" : " <A HREF='{$_SESSION['unitsfile']}?func=responder&edit=true&id=" . $row['unit_id'] . "'><U>Edit</U></A> "; // 5/11/10 $totrack = intval($row['mobile']) == 0 || empty($row['callsign']) ? "" : " <SPAN onClick = do_track('" . $row['callsign'] . "');><B><U>Tracks</B></U></SPAN>"; $temp = $row['un_status_id']; // 2/24/09 $the_status = array_key_exists($temp, $status_vals) ? $status_vals[$temp] : "??"; // 2/2/09 $row_track = FALSE; if ($track_type > 0) { // get most recent position data $do_legend = TRUE; $query = "SELECT *,UNIX_TIMESTAMP(packet_date) AS `packet_date`, UNIX_TIMESTAMP(updated) AS `updated` FROM \n\t\t\t\t`{$GLOBALS['mysql_prefix']}tracks`\n\t\t\t\tWHERE `source`= '{$row['callsign']}' ORDER BY `packet_date` DESC LIMIT 1"; // newest $result_tr = mysql_query($query) or do_error($query, 'mysql query failed', mysql_error(), basename(__FILE__), __LINE__); $row_track = mysql_affected_rows() > 0 ? stripslashes_deep(mysql_fetch_assoc($result_tr)) : FALSE; $aprs_updated = $row_track['updated']; $aprs_speed = $row_track['speed']; if ($row_track && my_is_float($row_track['latitude'])) { if ($row['lat'] == 0.999999 && $row['lng'] == 0.999999) { echo "\t\tvar point = new GLatLng(" . get_variable('def_lat') . ", " . get_variable('def_lng') . ");\n"; } else { echo "\t\tvar point = new GLatLng(" . $row_track['latitude'] . ", " . $row_track['longitude'] . "); // 677\n"; } $got_point = TRUE; } unset($result_tr); } if (!$got_point && my_is_float($row['lat'])) { if ($row['lat'] == 0.999999 && $row['lng'] == 0.999999) { echo "\t\tvar point = new GLatLng(" . get_variable('def_lat') . ", " . get_variable('def_lng') . ");\n"; } else { echo "\t\tvar point = new GLatLng(" . $row['lat'] . ", " . $row['lng'] . ");\t// " . __LINE__ . "\n"; } $got_point = TRUE; } $update_error = strtotime('now - 6 hours'); // set the time for silent setting // if ($instam_updated < $update_error) {$the_bull = "<FONT COLOR = 'black'><B>{$GLOBALS['TRACK_2L'][$track_type]}</B></FONT>";} // end bullet stuff // name, handle $handle = htmlentities($row['handle'], ENT_QUOTES); // 7/7/11 $sidebar_line = "<TD WIDTH='15%' TITLE = '{$handle}' {$the_on_click}><NOBR>{$handle}</NOBR></TD>"; $name = htmlentities($row['name'], ENT_QUOTES); $sidebar_line .= "<TD WIDTH='20%' TITLE = '{$name}' {$the_on_click}><U><SPAN STYLE='width: 30%; background-color:{$the_bg_color}; opacity: .7; color:{$the_text_color};'><NOBR>" . addslashes(shorten($row['name'], 14)) . "</NOBR></SPAN></U></TD>"; // 10/8/09 // assignments 3/16/09, 3/15/10 - 8/30/10 $query = "SELECT * FROM `{$GLOBALS['mysql_prefix']}assigns` \n\t\t\tLEFT JOIN `{$GLOBALS['mysql_prefix']}ticket` `t` ON (`{$GLOBALS['mysql_prefix']}assigns`.`ticket_id` = `t`.`id`)\n\t\t\tWHERE `responder_id` = '{$row['unit_id']}' AND (`clear` IS NULL OR DATE_FORMAT(`clear`,'%y') = '00' )"; $result_as = mysql_query($query) or do_error($query, 'mysql query failed', mysql_error(), basename(__FILE__), __LINE__); $row_assign = mysql_affected_rows() == 0 ? FALSE : stripslashes_deep(mysql_fetch_assoc($result_as)); switch ($row_assign['severity']) { //color tickets by severity case $GLOBALS['SEVERITY_MEDIUM']: $severityclass = 'severity_medium'; break; case $GLOBALS['SEVERITY_HIGH']: $severityclass = 'severity_high'; break; default: $severityclass = 'severity_normal'; break; } switch (mysql_affected_rows()) { // 8/29/10 case 0: $the_disp_str = ""; break; case 1: $the_disp_str = get_disp_status($row_assign) . " "; break; default: // multiples $the_disp_str = "<SPAN CLASS='disp_stat'> " . mysql_affected_rows() . " </SPAN> "; break; } // end switch() $onclick = mysql_affected_rows() > 0 ? " onClick = 'open_tick_window ({$row_assign['ticket_id']})'" : ""; $ass_td = mysql_affected_rows() > 0 ? "<TD WIDTH='20%' CLASS='{$severityclass}' TITLE = '{$row_assign['scope']}' {$onclick} ><NOBR>{$the_disp_str}" . shorten($row_assign['scope'], 24) . "</NOBR></TD>" : "<TD WIDTH='20%'>na</TD>"; unset($result_as); $sidebar_line .= $row['nr_assigned'] . $row_assign ? $ass_td : "<TD WIDTH='20%'>na</TD>"; // status, mobility - 4/14/10 $sidebar_line .= "<TD WIDTH='20%' TITLE = '" . addslashes($the_status) . "'> " . get_status_sel($row['unit_id'], $row['un_status_id'], "u") . ($the_bull = ""); // define the bullet if ($row_track['speed'] > 50) { $the_bull = "<FONT COLOR = 'white'><B>{$GLOBALS['TRACK_2L'][$track_type]}</B></FONT>"; } if ($row_track['speed'] < 50) { $the_bull = "<FONT COLOR = 'green'><B>{$GLOBALS['TRACK_2L'][$track_type]}</B></FONT>"; } if ($row_track['speed'] == 0) { $the_bull = "<FONT COLOR = 'red'><B>{$GLOBALS['TRACK_2L'][$track_type]}</B></FONT>"; } $tip = htmlentities($row['callsign'], ENT_QUOTES); $tip_str = "onMouseover=\\\"Tip('{$tip}')\\\" onmouseout=\\\"UnTip();\\\" "; $sidebar_line .= "<TD WIDTH='2%' {$tip_str}>{$the_bull}</TD>"; // 4/14/10 // as of $the_time = $row['updated']; $the_class = ""; $strike = $strike_end = ""; $the_flag = $name . "_flag"; if ($track_type > 0 && abs($utc - $the_time) > $GLOBALS['TOLERANCE']) { // attempt to identify non-current values $strike = "<STRIKE>"; $strike_end = "</STRIKE>"; } $sidebar_line .= "<TD WIDTH='18%' CLASS='{$the_class}'> {$strike}<SPAN id = '" . $name . "'><NOBR>" . format_sb_date($the_time) . "</NOBR></SPAN>{$strike_end} <SPAN ID = '" . $the_flag . "'></SPAN></TD>"; // 6/17/08 // tab 1 if (my_is_float($row['lat'])) { // position data? 4/29/09 $temptype = $u_types[$row['type_id']]; $the_type = $temptype[0]; // 1/1/09 $tab_1 = "<TABLE CLASS='infowin' width='{$iw_width}'>"; $tab_1 .= "<TR CLASS='even'><TD COLSPAN=2 ALIGN='center'><B>" . addslashes(shorten($row['name'], 48)) . "</B> - " . $the_type . "</TD></TR>"; $tab_1 .= "<TR CLASS='odd'><TD>Description:</TD><TD>" . addslashes(shorten(str_replace($eols, " ", $row['description']), 32)) . "</TD></TR>"; $tab_1 .= "<TR CLASS='even'><TD>Status:</TD><TD>" . $the_status . " </TD></TR>"; $tab_1 .= "<TR CLASS='odd'><TD>Contact:</TD><TD>" . addslashes($row['contact_name']) . " Via: " . addslashes($row['contact_via']) . "</TD></TR>"; $tab_1 .= "<TR CLASS='even'><TD>As of:</TD><TD>" . format_date($the_time) . "</TD></TR>"; // 4/11/10 if (array_key_exists($row['unit_id'], $assigns)) { $tab_1 .= "<TR CLASS='even'><TD CLASS='emph'>Dispatched to:</TD><TD CLASS='emph'><A HREF='main.php?id=" . $tickets[$row['unit_id']] . "'>" . addslashes(shorten($assigns[$row['unit_id']], 20)) . "</A></TD></TR>"; } $tab_1 .= "<TR CLASS='odd'><TD COLSPAN=2 ALIGN='center'>" . $tofac . $todisp . $totrack . $toedit . " <A HREF='{$_SESSION['unitsfile']}?func=responder&view=true&id=" . $row['unit_id'] . "'><U>View</U></A></TD></TR>"; // 08/8/02 $tab_1 .= "</TABLE>"; // tab 2 if ($row_track) { // do all three tabs $tab_2 = "<TABLE CLASS='infowin' width='{$iw_width}'>"; $tab_2 .= "<TR CLASS='even'><TD COLSPAN=2 ALIGN='center'><B>" . $row_track['source'] . "</B></TD></TR>"; $tab_2 .= "<TR CLASS='odd'><TD>Course: </TD><TD>" . $row_track['course'] . ", Speed: " . $row_track['speed'] . ", Alt: " . $row_track['altitude'] . "</TD></TR>"; $tab_2 .= "<TR CLASS='even'><TD>Closest city: </TD><TD>" . $row_track['closest_city'] . "</TD></TR>"; $tab_2 .= "<TR CLASS='odd'><TD>Status: </TD><TD>" . $row_track['status'] . "</TD></TR>"; if (array_key_exists('packet_date', $row_track)) { $tab_2 .= "<TR CLASS='even'><TD>As of: </TD><TD> {$strike}" . format_date($row_track['packet_date']) . "{$strike_end} (UTC)</TD></TR></TABLE>"; } ?> var myinfoTabs = [ new GInfoWindowTab("<?php print nl2brr(addslashes(shorten($row['name'], 10))); ?> ", "<?php print $tab_1; ?> "), new GInfoWindowTab("<?php print $GLOBALS['TRACK_2L'][$track_type]; ?> <?php print addslashes(substr($row_track['source'], -3)); ?> ", "<?php print $tab_2; ?> "), new GInfoWindowTab("Zoom", "<div id='detailmap' class='detailmap'></div>") ]; <?php } else { // two tabs ?> var myinfoTabs = [ new GInfoWindowTab("<?php print nl2brr(addslashes(shorten($row['name'], 10))); ?> ", "<?php print $tab_1; ?> "), new GInfoWindowTab("Zoom", "<div id='detailmap' class='detailmap'></div>") ]; <?php } // end if/else ($row_track) if ($row['lat'] == 0.999999 && $row['lng'] == 0.999999) { // check for no maps mode entries 7/28/10 ?> var the_class = ((map_is_fixed) && (!(mapBounds.containsLatLng(point))))? "emph" : "td_label"; // 4/3/09 do_sidebar ("<?php print $sidebar_line; ?> ", i, the_class, "<?php print $row['icon_str']; ?> "); var dummymarker = createdummyMarker(point, myinfoTabs,<?php print $row['icon']; ?> , i, "<?php print $index; ?> "); // 771 (point,tabs, color, id) map.addOverlay(dummymarker); <?php } else { ?> var the_class = ((map_is_fixed) && (!(mapBounds.containsLatLng(point))))? "emph" : "td_label"; // 4/3/09 do_sidebar ("<?php print $sidebar_line; ?> ", i, the_class, "<?php print $index; ?> "); var marker = createMarker(point, myinfoTabs,<?php print $row['icon']; ?> , i, "<?php print $index; ?> "); // 771 (point,tabs, color, id) map.addOverlay(marker); <?php } } else { print "\tdo_sidebar_nm (\" {$sidebar_line} \" , i, {$row['id']}, '{$index}');\n"; // sidebar only - no map, 11/11/09, 5/12/10 } $i++; // zero-based } // end ========== while() for RESPONDER ========== $source_legend = isset($do_legend) ? "<TD CLASS='emph' ALIGN='left'>Source time</TD>" : "<TD></TD>"; // if any remote data/time 3/24/09 ?> if (!(map_is_fixed)) { // 4/3/09 if (!points) { // any? map.setCenter(new GLatLng(<?php echo get_variable('def_lat'); ?> , <?php echo get_variable('def_lng'); ?> ), <?php echo get_variable('def_zoom'); ?> ); } else { center = bounds.getCenter(); zoom = map.getBoundsZoomLevel(bounds); map.setCenter(center,zoom); } } side_bar_html+= "<TR CLASS='" + colors[i%2] +"'><TD COLSPAN=6> </TD><?php print $source_legend; ?> </TR>"; <?php if (!empty($addon)) { print "\n\tside_bar_html +=\"" . $addon . "\"\n"; } ?> side_bar_html +="</TABLE>\n"; $("side_bar").innerHTML += side_bar_html; // append the assembled side_bar_html contents to the side bar div $("num_units").innerHTML = <?php print $num_units; ?> ; <?php // print "<TABLE BORDER = 4 >{$buttons}</TABLE>"; do_kml(); ?> </SCRIPT> <?php }
function list_facilities($addon = '', $start) { global $iw_width, $u_types, $tolerance; // $assigns = array(); // $tickets = array(); // $query = "SELECT `$GLOBALS[mysql_prefix]assigns`.`ticket_id`, `$GLOBALS[mysql_prefix]assigns`.`responder_id`, `$GLOBALS[mysql_prefix]ticket`.`scope` AS `ticket` FROM `$GLOBALS[mysql_prefix]assigns` LEFT JOIN `$GLOBALS[mysql_prefix]ticket` ON `$GLOBALS[mysql_prefix]assigns`.`ticket_id`=`$GLOBALS[mysql_prefix]ticket`.`id`"; // $result_as = mysql_query($query) or do_error($query, 'mysql query failed', mysql_error(), basename( __FILE__), __LINE__); // while ($row_as = stripslashes_deep(mysql_fetch_array($result_as))) { // $assigns[$row_as['responder_id']] = $row_as['ticket']; // $tickets[$row_as['responder_id']] = $row_as['ticket_id']; // } // unset($result_as); // $calls = array(); // $calls_nr = array(); // $calls_time = array(); ?> <SCRIPT > var color=0; var colors = new Array ('odd', 'even'); function hideDiv(div_area, hide_cont, show_cont) { // 3/15/11 if (div_area == "buttons_sh") { var controlarea = "hide_controls"; } if (div_area == "resp_list_sh") { var controlarea = "resp_list"; } if (div_area == "facs_list_sh") { var controlarea = "facs_list"; } if (div_area == "incs_list_sh") { var controlarea = "incs_list"; } if (div_area == "region_boxes") { var controlarea = "region_boxes"; } var divarea = div_area var hide_cont = hide_cont var show_cont = show_cont if($(divarea)) { $(divarea).style.display = 'none'; $(hide_cont).style.display = 'none'; $(show_cont).style.display = ''; } var params = "f_n=" +controlarea+ "&v_n=h&sess_id=<?php print get_sess_key(__LINE__); ?> "; var url = "persist2.php"; sendRequest (url, gb_handleResult, params); } function showDiv(div_area, hide_cont, show_cont) { // 3/15/11 if (div_area == "buttons_sh") { var controlarea = "hide_controls"; } if (div_area == "resp_list_sh") { var controlarea = "resp_list"; } if (div_area == "facs_list_sh") { var controlarea = "facs_list"; } if (div_area == "incs_list_sh") { var controlarea = "incs_list"; } if (div_area == "region_boxes") { var controlarea = "region_boxes"; } var divarea = div_area var hide_cont = hide_cont var show_cont = show_cont if($(divarea)) { $(divarea).style.display = ''; $(hide_cont).style.display = ''; $(show_cont).style.display = 'none'; } var params = "f_n=" +controlarea+ "&v_n=s&sess_id=<?php print get_sess_key(__LINE__); ?> "; var url = "persist2.php"; sendRequest (url, gb_handleResult, params); } function do_sidebar (sidebar, id, the_class, fac_id, fac_index) { var fac_id = fac_id; side_bar_html += "<TR CLASS='" + colors[(id)%2] +"' onClick = myclick(" + fac_index + ");>"; // side_bar_html += "<TD CLASS='" + the_class + "'>" + fac_id + sidebar +"</TD></TR>\n"; //10/29/09 removed period side_bar_html += sidebar + "</TR>\n"; //10/29/09 removed period } function myclick(fac_index) { // Responds to sidebar click - view facility data document.view_form.id.value=fac_index; document.view_form.submit(); } function do_sidebar_nm (sidebar, line_no, id, fac_id) { var fac_id = fac_id; var letter = to_str(line_no); side_bar_html += "<TR CLASS='" + colors[(line_no)%2] +"'>"; side_bar_html += "<TD onClick = myclick_nm(" + id + "); >" + fac_id + sidebar +"</TD></TR>\n"; // 1/23/09, 10/29/09 removed period, 11/11/09, 3/15/11 } function myclick_nm(v_id) { // Responds to sidebar click - view responder data document.view_form.id.value=v_id; document.view_form.submit(); } var icons=new Array; // maps type to icon blank <?php $query = "SELECT * FROM `{$GLOBALS['mysql_prefix']}fac_types` ORDER BY `id`"; // types in use $result = mysql_query($query) or do_error($query, 'mysql query failed', mysql_error(), basename(__FILE__), __LINE__); $icons = $GLOBALS['fac_icons']; while ($row = stripslashes_deep(mysql_fetch_assoc($result))) { // map type to blank icon id $blank = $icons[$row['icon']]; print "\ticons[" . $row['id'] . "] = " . $row['icon'] . ";\n"; // } unset($result); $dzf = get_variable('def_zoom_fixed'); print "\tvar map_is_fixed = "; print my_is_int($dzf) && $dzf == 2 || my_is_int($dzf) && $dzf == 3 ? "true;\n" : "false;\n"; ?> var side_bar_html = "<TABLE border=0 CLASS='sidebar' ID='tbl_facilities' WIDTH = <?php print max(320, intval($_SESSION['scr_width'] * 0.6)); ?> >"; side_bar_html += "<TR class='even'><TD ALIGN='left'><B>Icon</B></TD><TD ALIGN='left'><B><?php print get_text("Handle"); ?> </B></TD><TD ALIGN='left'><B><?php print get_text("Facility"); ?> </B></TD><TD ALIGN='left'><B><?php print get_text("Type"); ?> </B></TD><TD ALIGN='left'><B><?php print get_text("Status"); ?> </B></TD><TD ALIGN='center'><B><?php print get_text("As of"); ?> </B></TD></TR>"; var which; var i = <?php print $start; ?> ; // sidebar/icon index var points = false; // none <?php $eols = array("\r\n", "\n", "\r"); // all flavors of eol // $bulls = array(0 =>"",1 =>"red",2 =>"green",3 =>"white",4 =>"black"); $status_vals = array(); // build array of $status_vals $status_vals[''] = $status_vals['0'] = "TBD"; $query = "SELECT * FROM `{$GLOBALS['mysql_prefix']}fac_status` ORDER BY `id`"; $result_st = mysql_query($query) or do_error($query, 'mysql query failed', mysql_error(), basename(__FILE__), __LINE__); while ($row_st = stripslashes_deep(mysql_fetch_assoc($result_st))) { $temp = $row_st['id']; $status_vals[$temp] = $row_st['status_val']; } unset($result_st); $type_vals = array(); // build array of $status_vals $type_vals[''] = $type_vals['0'] = "TBD"; $query = "SELECT * FROM `{$GLOBALS['mysql_prefix']}fac_types` ORDER BY `id`"; $result_ty = mysql_query($query) or do_error($query, 'mysql query failed', mysql_error(), basename(__FILE__), __LINE__); while ($row_ty = stripslashes_deep(mysql_fetch_assoc($result_ty))) { $temp = $row_ty['id']; $type_vals[$temp] = $row_ty['name']; } unset($result_ty); $query = "SELECT * FROM `{$GLOBALS['mysql_prefix']}allocates` WHERE `type`= 4 AND `resource_id` = '{$_SESSION['user_id']}';"; // 6/10/11 $result = mysql_query($query); // 6/10/11 $al_groups = array(); while ($row = stripslashes_deep(mysql_fetch_assoc($result))) { // 6/10/11 $al_groups[] = $row['group']; } if (isset($_SESSION['viewed_groups'])) { // 6/10/11 $curr_viewed = explode(",", $_SESSION['viewed_groups']); } if (!isset($curr_viewed)) { $x = 0; // 6/10/11 $where2 = "WHERE ("; // 6/10/11 foreach ($al_groups as $grp) { // 6/10/11 $where3 = count($al_groups) > $x + 1 ? " OR " : ")"; $where2 .= "`a`.`group` = '{$grp}'"; $where2 .= $where3; $x++; } } else { $x = 0; // 6/10/11 $where2 = "WHERE ("; // 6/10/11 foreach ($curr_viewed as $grp) { // 6/10/11 $where3 = count($curr_viewed) > $x + 1 ? " OR " : ")"; $where2 .= "`a`.`group` = '{$grp}'"; $where2 .= $where3; $x++; } } $where2 .= "AND `a`.`type` = 3"; // 6/10/11 // 3/15/11, 6/10/11 $query = "SELECT *,UNIX_TIMESTAMP(updated) AS updated,\n\t\t`t`.`id` AS `type_id`, \t\n\t\t`f`.id AS `id`, \n\t\t`f`.status_id AS status_id,\n\t\t`f`.description AS facility_description,\n\t\t`t`.name AS fac_type_name, \n\t\t`f`.name AS name, `f`.street AS street,\n\t\t`f`.city AS city, `f`.state AS state \n\t\tFROM `{$GLOBALS['mysql_prefix']}facilities` `f`\n\t\tLEFT JOIN `{$GLOBALS['mysql_prefix']}allocates` `a` ON ( `f`.`id` = a.resource_id )\t\t\t\n\t\tLEFT JOIN `{$GLOBALS['mysql_prefix']}fac_types` `t` ON `f`.type = `t`.id \n\t\tLEFT JOIN `{$GLOBALS['mysql_prefix']}fac_status` `s` ON `f`.status_id = `s`.id \n\t\t{$where2} GROUP BY `f`.id ORDER BY `f`.type ASC"; $result = mysql_query($query) or do_error($query, 'mysql query failed', mysql_error(), basename(__FILE__), __LINE__); $num_facilities = mysql_affected_rows(); $i = 0; // counter // ============================================================================= $utc = gmdate("U"); while ($row = stripslashes_deep(mysql_fetch_assoc($result))) { // ========== major while() for Facility ========== $fac_gps = get_allocates(3, $row['id']); // 6/10/11 $grp_names = "Groups Assigned: "; // 6/10/11 $y = 0; // 6/10/11 foreach ($fac_gps as $value) { // 6/10/11 $counter = count($fac_gps) > $y + 1 ? ", " : ""; $grp_names .= get_groupname($value); $grp_names .= $counter; $y++; } $grp_names .= " / "; $the_bg_color = $GLOBALS['FACY_TYPES_BG'][$row['icon']]; // 2/8/10 $the_text_color = $GLOBALS['FACY_TYPES_TEXT'][$row['icon']]; // 2/8/10 $the_on_click = my_is_float($row['lat']) ? " onClick = myclick({$i}); " : " onClick = myclick_nm({$row['id']}); "; // 3/15/11 $got_point = FALSE; print "\n\t\tvar i={$i};\n"; if (is_guest()) { $toedit = $tomail = $toroute = ""; } else { $toedit = " <A HREF='facilities_nm.php?func=responder&edit=true&id=" . $row['id'] . "'><U>Edit</U></A>"; $tomail = " <SPAN onClick = 'do_mail_in_win({$row['id']})'><U><B>Email</B></U></SPAN>"; $toroute = " <A HREF='routes_nm.php?fac_id=" . $row['id'] . "'><U>Route To Facility</U></A>"; } $temp = $row['status_id']; $the_status = array_key_exists($temp, $status_vals) ? $status_vals[$temp] : "??"; $temp_type = $row['type_id']; $the_type = array_key_exists($temp_type, $type_vals) ? $type_vals[$temp_type] : "??"; $update_error = strtotime('now - 6 hours'); // set the time for silent setting // name $name = $row['name']; // 10/8/09 $fac_index = $row['id']; // 10/8/09 $temp = explode("/", $name); $display_name = $temp[0]; $icon_str = $row['icon_str']; $sidebar_line = "<TD TITLE = '{$icon_str}'>" . $icon_str . "</TD>"; // 10/8/09 $handle = addslashes($row['handle']); // 5/30/10 $sidebar_line .= "<TD TITLE = '{$handle}'>" . shorten($handle, 16) . "</TD>"; // 10/8/09 $sidebar_line .= "<TD TITLE = '" . $grp_names . "Facility Name: " . addslashes($display_name) . "' {$the_on_click}><U><SPAN STYLE='background-color:{$the_bg_color}; opacity: .7; color:{$the_text_color};'>" . addslashes(shorten($display_name, 40)) . "</SPAN></U> </TD><TD>{$the_type} </TD>"; // 6/10/11 $sidebar_line .= "<TD CLASS='td_data' TITLE = '" . addslashes($the_status) . "'> " . get_status_sel($row['id'], $row['status_id'], 'f') . " </TD>"; // 3/15/11 // as of $strike = $strike_end = ""; $the_time = $row['updated']; $the_class = "td_data"; $strike = $strike_end = ""; $sidebar_line .= "<TD CLASS='{$the_class}'> {$strike}" . format_sb_date($the_time) . "{$strike_end}</TD>"; $name = $row['name']; // 10/8/09 $fac_index = $row['id']; // 10/8/09 $temp = explode("/", $name); $index = substr($temp[count($temp) - 1], -6, strlen($temp[count($temp) - 1])); // 3/19/11 ?> var fac_id = "<?php print $index; ?> "; // 10/8/09 var fac_index = "<?php print $fac_index; ?> "; // 10/8/09 var the_class = "td_label"; <?php print "\tdo_sidebar (\" {$sidebar_line} \", i, the_class, fac_id, fac_index);\n"; $i++; // zero-based } // end ========== while() for Facility ========== ?> var buttons_html = ""; <?php if (!empty($addon)) { print "\n\tbuttons_html +=\"" . $addon . "\"\n"; } ?> side_bar_html +="</TABLE>\n"; $("side_bar").innerHTML += side_bar_html; // append the assembled side_bar_html contents to the side_bar div $("buttons").innerHTML = buttons_html; // append the assembled side_bar_html contents to the side_bar div $("num_facilities").innerHTML = <?php print $num_facilities; ?> ; </SCRIPT> <?php }
function list_responders($addon = '', $start) { // global {$_SESSION['fip']}, $fmp, {$_SESSION['editfile']}, {$_SESSION['addfile']}, {$_SESSION['unitsfile']}, {$_SESSION['facilitiesfile']}, {$_SESSION['routesfile']}, {$_SESSION['facroutesfile']}; global $iw_width, $u_types, $tolerance; $assigns = array(); // 08/8/3 $tickets = array(); // ticket id's $query = "SELECT `{$GLOBALS['mysql_prefix']}assigns`.`ticket_id`, `{$GLOBALS['mysql_prefix']}assigns`.`responder_id`,\n\t\t`{$GLOBALS['mysql_prefix']}ticket`.`scope` AS `ticket` \n\t\tFROM `{$GLOBALS['mysql_prefix']}assigns` \n\t\tLEFT JOIN `{$GLOBALS['mysql_prefix']}ticket` ON `{$GLOBALS['mysql_prefix']}assigns`.`ticket_id`=`{$GLOBALS['mysql_prefix']}ticket`.`id`\n\t\tWHERE ( `clear` IS NULL OR DATE_FORMAT(`clear`,'%y') = '00' )"; $result_as = mysql_query($query) or do_error($query, 'mysql query failed', mysql_error(), basename(__FILE__), __LINE__); while ($row_as = stripslashes_deep(mysql_fetch_array($result_as))) { $assigns[$row_as['responder_id']] = $row_as['ticket']; $tickets[$row_as['responder_id']] = $row_as['ticket_id']; } unset($result_as); $calls = array(); // 6/17/08 $calls_nr = array(); ?> <SCRIPT > var color=0; var colors = new Array ('odd', 'even'); function hideDiv(div_area, hide_cont, show_cont) { // 3/15/11 if (div_area == "buttons_sh") { var controlarea = "hide_controls"; } if (div_area == "resp_list_sh") { var controlarea = "resp_list"; } if (div_area == "facs_list_sh") { var controlarea = "facs_list"; } if (div_area == "incs_list_sh") { var controlarea = "incs_list"; } if (div_area == "region_boxes") { var controlarea = "region_boxes"; } var divarea = div_area var hide_cont = hide_cont var show_cont = show_cont if($(divarea)) { $(divarea).style.display = 'none'; $(hide_cont).style.display = 'none'; $(show_cont).style.display = ''; } var params = "f_n=" +controlarea+ "&v_n=h&sess_id=<?php print get_sess_key(__LINE__); ?> "; var url = "persist2.php"; sendRequest (url, gb_handleResult, params); } function showDiv(div_area, hide_cont, show_cont) { // 3/15/11 if (div_area == "buttons_sh") { var controlarea = "hide_controls"; } if (div_area == "resp_list_sh") { var controlarea = "resp_list"; } if (div_area == "facs_list_sh") { var controlarea = "facs_list"; } if (div_area == "incs_list_sh") { var controlarea = "incs_list"; } if (div_area == "region_boxes") { var controlarea = "region_boxes"; } var divarea = div_area var hide_cont = hide_cont var show_cont = show_cont if($(divarea)) { $(divarea).style.display = ''; $(hide_cont).style.display = ''; $(show_cont).style.display = 'none'; } var params = "f_n=" +controlarea+ "&v_n=s&sess_id=<?php print get_sess_key(__LINE__); ?> "; var url = "persist2.php"; sendRequest (url, gb_handleResult, params); } function checkArray(form, arrayName) { // 5/3/11 var retval = new Array(); for(var i=0; i < form.elements.length; i++) { var el = form.elements[i]; if(el.type == "checkbox" && el.name == arrayName && el.checked) { retval.push(el.value); } } return retval; } function checkForm(form) { // 6/10/11 var errmsg=""; var itemsChecked = checkArray(form, "frm_group[]"); if(itemsChecked.length > 0) { var params = "f_n=viewed_groups&v_n=" +itemsChecked+ "&sess_id=<?php print get_sess_key(__LINE__); ?> "; // 3/15/11 var url = "persist3.php"; // 3/15/11 sendRequest (url, fvg_handleResult, params); // form.submit(); } else { errmsg+= "\tYou cannot Hide all the regions\n"; if (errmsg!="") { alert ("Please correct the following and re-submit:\n\n" + errmsg); return false; } } } function fvg_handleResult(req) { // 6/10/11 The persist callback function for viewed groups. document.region_form.submit(); } function form_validate(theForm) { // 5/3/11 // alert("Validating"); checkForm(theForm); } // end function validate(theForm) function do_sidebar (sidebar, id, the_class, unit_id, index) { var unit_id = unit_id; side_bar_html += "<TR CLASS='" + colors[(id)%2] +"' >"; side_bar_html += "<TD CLASS='" + the_class + "' onClick = 'myclick(" + unit_id + ");'>" + index + "</TD>" + sidebar +"</TD></TR>\n"; // 1/5/09, 3/4/09, 10/29/09 removed period } function myclick(unit_id) { // Responds to sidebar click - view responder data document.view_form.id.value=unit_id; document.view_form.submit(); } function myclick_nm(v_id) { // Responds to sidebar click - view responder data document.view_form.id.value=v_id; document.view_form.submit(); } <?php $dzf = get_variable('def_zoom_fixed'); print "\tvar map_is_fixed = "; print my_is_int($dzf) && $dzf == 2 || my_is_int($dzf) && $dzf == 3 ? "true;\n" : "false;\n"; ?> var side_bar_html = "<TABLE border=0 CLASS='sidebar' WIDTH = <?php print max(320, intval($_SESSION['scr_width'] * 0.6)); ?> >"; side_bar_html += "<TR class='even'> <TD></TD><TD ALIGN='left'><B>Unit</B></TD><TD ALIGN='left'><B>Handle</B></TD><TD ALIGN='left'><B>Dispatch</B></TD><TD ALIGN='left'><B>Status</B></TD><TD ALIGN='left'><B>M</B></TD><TD ALIGN='left'><B>As of</B></TD></TR>"; var which; var i = <?php print $start; ?> ; // sidebar/icon index var points = false; // none <?php function can_do_dispatch($the_row) { if (intval($the_row['multi']) == 1) { return TRUE; } $query = "SELECT * FROM `{$GLOBALS['mysql_prefix']}assigns` WHERE `responder_id` = {$the_row['id']}"; // all dispatches this unit $result_temp = mysql_query($query) or do_error($query, 'mysql query failed', mysql_error(), basename(__FILE__), __LINE__); while ($row_temp = stripslashes_deep(mysql_fetch_array($result_temp))) { // check any open runs this unit if (!is_date($row_temp['clear'])) { // if clear is empty, then NOT dispatch-able unset($result_temp, $row_temp); return FALSE; } } // end while ($row_temp ...) unset($result_temp, $row_temp); return TRUE; // none found, can dispatch } // end function can_do_dispatch() $eols = array("\r\n", "\n", "\r"); // all flavors of eol $bulls = array(0 => "", 1 => "red", 2 => "green", 3 => "white", 4 => "black"); $status_vals = array(); // build array of $status_vals $status_vals[''] = $status_vals['0'] = "TBD"; $query = "SELECT * FROM `{$GLOBALS['mysql_prefix']}un_status` ORDER BY `id`"; $result_st = mysql_query($query) or do_error($query, 'mysql query failed', mysql_error(), basename(__FILE__), __LINE__); while ($row_st = stripslashes_deep(mysql_fetch_array($result_st))) { $temp = $row_st['id']; $status_vals[$temp] = $row_st['status_val']; } unset($result_st); $query = "SELECT * FROM `{$GLOBALS['mysql_prefix']}allocates` WHERE `type`= 4 AND `resource_id` = '{$_SESSION['user_id']}';"; // 6/10/11 $result = mysql_query($query); // 4/13/11 $al_groups = array(); while ($row = stripslashes_deep(mysql_fetch_assoc($result))) { // 6/10/11 $al_groups[] = $row['group']; } if (isset($_SESSION['viewed_groups'])) { // 6/10/11 $curr_viewed = explode(",", $_SESSION['viewed_groups']); } if (!isset($curr_viewed)) { $x = 0; // 6/10/11 $where2 = "WHERE ("; // 6/10/11 foreach ($al_groups as $grp) { // 6/10/11 $where3 = count($al_groups) > $x + 1 ? " OR " : ")"; $where2 .= "`a`.`group` = '{$grp}'"; $where2 .= $where3; $x++; } } else { $x = 0; // 6/10/11 $where2 = "WHERE ("; // 6/10/11 foreach ($curr_viewed as $grp) { // 6/10/11 $where3 = count($curr_viewed) > $x + 1 ? " OR " : ")"; $where2 .= "`a`.`group` = '{$grp}'"; $where2 .= $where3; $x++; } } $where2 .= "AND `a`.`type` = 2"; // 6/10/11 $query = "SELECT *, UNIX_TIMESTAMP(updated) AS `updated`,\n\t\t`t`.`id` AS `type_id`,\n\t\t`r`.`id` AS `unit_id`,\n\t\t`r`.`name` AS `name`,\n\t\t`s`.`description` AS `stat_descr`,\n\t\t`r`.`description` AS `unit_descr`, \n\t\t(SELECT COUNT(*) as numfound FROM `{$GLOBALS['mysql_prefix']}assigns` \n\t\tWHERE `{$GLOBALS['mysql_prefix']}assigns`.`responder_id` = unit_id AND `clear` IS NULL OR DATE_FORMAT(`clear`,'%y') = '00' ) AS `nr_assigned` \n\t\tFROM `{$GLOBALS['mysql_prefix']}responder` `r` \n\t\tLEFT JOIN `{$GLOBALS['mysql_prefix']}allocates` `a` ON ( `r`.`id` = a.resource_id )\t\t\t\n\t\tLEFT JOIN `{$GLOBALS['mysql_prefix']}unit_types` `t` ON ( `r`.`type` = t.id )\t\n\t\tLEFT JOIN `{$GLOBALS['mysql_prefix']}un_status` `s` ON ( `r`.`un_status_id` = s.id ) \t\t\n\t\t{$where2} GROUP BY unit_id ORDER BY `nr_assigned` DESC, `handle` ASC, `r`.`name` ASC "; // 2/1/10, 3/15/10, 6/10/11 $result = mysql_query($query) or do_error($query, 'mysql query failed', mysql_error(), basename(__FILE__), __LINE__); $num_units = mysql_affected_rows(); $aprs = FALSE; $instam = FALSE; $locatea = FALSE; // 7/23/09 $gtrack = FALSE; // 7/23/09 $glat = FALSE; // 7/23/09 $i = 0; // counter // ============================================================================= $bulls = array(0 => "", 1 => "red", 2 => "green", 3 => "white", 4 => "black"); $utc = gmdate("U"); // ========== major while() for RESPONDER ========== while ($row = stripslashes_deep(mysql_fetch_assoc($result))) { $resp_gps = get_allocates(2, $row['unit_id']); // 6/10/11 $grp_names = "Groups Assigned: "; // 6/10/11 $y = 0; // 6/10/11 foreach ($resp_gps as $value) { // 6/10/11 $counter = count($resp_gps) > $y + 1 ? ", " : ""; $grp_names .= get_groupname($value); $grp_names .= $counter; $y++; } $grp_names .= " / "; $aprs = $instam = $locatea = $gtrack = $glat = $t_tracker = FALSE; // all trackers off, 5/11/11 added internal Tickets Tracker $temp = explode("/", $row['name']); $index = substr($temp[count($temp) - 1], -6, strlen($temp[count($temp) - 1])); // 3/19/11 $the_on_click = my_is_float($row['lat']) ? " onClick = myclick({$row['unit_id']}); " : " onClick = myclick_nm({$row['unit_id']}); "; $the_bg_color = $GLOBALS['UNIT_TYPES_BG'][$row['icon']]; // 2/1/10 $the_text_color = $GLOBALS['UNIT_TYPES_TEXT'][$row['icon']]; // 2/1/10 $index = $row['icon_str']; // 4/28/11 $track_type = get_remote_type($row); // 7/6/11 $do_dispatch = can_do_dispatch($row); // 11/17/09 $got_point = FALSE; print "\n\t\tvar i={$i};\n"; $tofac = is_guest() ? "" : " <A HREF='{units_nm.php?func=responder&view=true&dispfac=true&id=" . $row['unit_id'] . "'><U>To Facility</U></A> "; // 10/6/09 $todisp = is_guest() || !can_do_dispatch($row) ? "" : " <A HREF='" . basename(__FILE__) . "?func=responder&view=true&disp=true&id=" . $row['unit_id'] . "'><U>Dispatch</U></A> "; // 08/8/02, 9/19/09 $toedit = is_guest() ? "" : " <A HREF='" . basename(__FILE__) . "?func=responder&edit=true&id=" . $row['unit_id'] . "'><U>Edit</U></A> "; // 10/8/08 $temp = $row['un_status_id']; // 2/24/09 $the_status = array_key_exists($temp, $status_vals) ? $status_vals[$temp] : "??"; // 2/2/09 $the_bull = ""; // define the bullet $update_error = strtotime('now - 6 hours'); // set the time for silent setting if ($track_type > 0) { // get most recent position data $do_legend = TRUE; } // name, handle $name = addslashes(shorten($row['name'], 40)); // 10/8/09 $handle = addslashes($row['handle']); $sidebar_line = "<TD TITLE = '{$handle}' {$the_on_click}><U><SPAN STYLE='background-color:{$the_bg_color}; opacity: .7; color:{$the_text_color};'>{$handle}</SPAN></U></TD>"; // 10/8/09 $sidebar_line .= "<TD TITLE = '" . addslashes($row['name']) . "' {$the_on_click}><U>{$name}</TD>"; // 10/8/09 // assignments 3/16/09, 3/15/10 $query = "SELECT * FROM `{$GLOBALS['mysql_prefix']}assigns` \n\t\t\tLEFT JOIN `{$GLOBALS['mysql_prefix']}ticket` `t` ON (`{$GLOBALS['mysql_prefix']}assigns`.`ticket_id` = `t`.`id`)\n\t\t\tWHERE `responder_id` = '{$row['unit_id']}' AND (`clear` IS NULL OR DATE_FORMAT(`clear`,'%y') = '00' )"; $result_as = mysql_query($query) or do_error($query, 'mysql query failed', mysql_error(), basename(__FILE__), __LINE__); $row_assign = mysql_affected_rows() == 0 ? FALSE : stripslashes_deep(mysql_fetch_assoc($result_as)); switch ($row_assign['severity']) { //color tickets by severity case $GLOBALS['SEVERITY_MEDIUM']: $severityclass = 'severity_medium'; break; case $GLOBALS['SEVERITY_HIGH']: $severityclass = 'severity_high'; break; default: $severityclass = 'severity_normal'; break; } switch (mysql_num_rows($result_as)) { // 10/4/10 case 0: $the_disp_stat = ""; break; case 1: $the_disp_stat = get_disp_status($row_assign) . " "; break; default: // multiples $the_disp_stat = "<SPAN CLASS='disp_stat'> " . mysql_affected_rows() . " </SPAN> "; break; } // end switch() $tick_ct = mysql_affected_rows() > 1 ? "(" . mysql_num_rows($result_as) . ") " : ""; $ass_td = mysql_affected_rows() > 0 ? "<TD CLASS='{$severityclass}' TITLE = '{$row_assign['scope']}' STYLE = 'white-space:nowrap;' >{$the_disp_stat}" . shorten($row_assign['scope'], 24) . "</TD>" : "<TD>na</TD>"; $sidebar_line .= $row_assign ? $ass_td : "<TD>na</TD>"; // status, mobility - 9/11/10 $sidebar_line .= "<TD TITLE = '" . addslashes($the_status) . "'> " . get_status_sel($row['unit_id'], $row['un_status_id'], "u") . "</TD>"; $sidebar_line .= "<TD TITLE ='{$row['callsign']}'> {$GLOBALS['TRACK_2L'][$track_type]} {$the_bull}</TD>"; // 4/14/10 // as of $strike = $strike_end = ""; $the_time = $row['updated']; // 7/6/11 $the_class = ""; if ($row['mobile'] == 1 && abs($utc - $the_time) > $GLOBALS['TOLERANCE']) { // identify non-current values $strike = "<STRIKE>"; $strike_end = "</STRIKE>"; } $sidebar_line .= "<TD CLASS='{$the_class}'> {$strike}" . format_sb_date($the_time) . "{$strike_end}</TD>"; // 6/17/08 ?> var unit_id = "<?php print $index; ?> "; // 10/8/09 var the_class = "td_label"; // 4/3/09 var handle = "<?php print substr($row['handle'], 1); ?> "; var longhandle = "<?php print $row['handle']; ?> "; <?php print "\tdo_sidebar(\" {$sidebar_line} \" , i, {$row['id']}, {$row['unit_id']}, unit_id);\n"; // sidebar only - no map, 11/11/09 $i++; // zero-based } // end ========== while() for RESPONDER ========== $source_legend = isset($do_legend) ? "<TD CLASS='emph' ALIGN='left'>Source time</TD>" : "<TD></TD>"; // if any remote data/time 3/24/09 ?> side_bar_html+= "<TR CLASS='" + colors[i%2] +"'><TD COLSPAN=5> </TD><?php print $source_legend; ?> </TR>"; <?php if (!empty($addon)) { print "\n\tside_bar_html +=\"" . $addon . "\"\n"; } ?> side_bar_html +="</TABLE>\n"; $("side_bar").innerHTML += side_bar_html; // append the assembled side_bar_html contents to the side bar div $("num_units").innerHTML = <?php print $num_units; ?> ; </SCRIPT> <?php }