From: maxious Date: Fri, 15 Jul 2011 04:54:45 +0000 Subject: Merge service alerts relating to stops into their page X-Git-Url: http://maxious.lambdacomplex.org/git/?p=busui.git&a=commitdiff&h=94b4506782530c63129d0f229042aeb1b13f4731 --- Merge service alerts relating to stops into their page --- --- a/include/common-geo.inc.php +++ b/include/common-geo.inc.php @@ -1,8 +1,9 @@ $mapPoint) { - $markers.= $mapPoint[0] . "," . $mapPoint[1] . "," . $markerImage . ($index + 1); + if ($twotone && $index == 0) { + $markers.= $mapPoint[0] . "," . $mapPoint[1] . "," . "iconr" . ($index + 1); + $center = "{$mapPoints[0][0]},{$mapPoints[0][1]}"; + } + else { + $markers.= $mapPoint[0] . "," . $mapPoint[1] . "," . $markerImage . ($index + 1); + } if ($index + 1 != sizeof($mapPoints)) $markers.= "|"; - if ($mapPoint[0] < $minlat) $minlat = $mapPoint[0]; - if ($mapPoint[0] > $maxlat) $maxlat = $mapPoint[0]; - if ($mapPoint[1] < $minlon) $minlon = $mapPoint[1]; - if ($mapPoint[1] > $maxlon) $maxlon = $mapPoint[1]; + $dist = distance($mapPoints[0][0], $mapPoint[0][1], $mapPoint[0], $mapPoint[1]); + $mapwidthinmeters = ($dist > $mapwidthinmeters ? $dist : $mapwidthinmeters); $totalLat+= $mapPoint[0]; $totalLon+= $mapPoint[1]; } if ($zoom == 0) { $mapwidthinmeters = distance($minlat, $minlon, $minlat, $maxlon); foreach (array_reverse($metersperpixel, true) as $zoomLevel => $maxdistance) { - if ($zoom == 0 && $mapwidthinmeters < ($maxdistance + 50)) $zoom = $zoomLevel; + if ($zoom == 0 && $mapwidthinmeters * 1.5 < ($maxdistance)) $zoom = $zoomLevel; } } $center = $totalLat / sizeof($mapPoints) . "," . $totalLon / sizeof($mapPoints); } $output = ""; if ($collapsible) $output.= '

Open Map...

'; - $output.= ''; + $output.= ''; if ($collapsible) $output.= '
'; return $output; } @@ -66,11 +67,11 @@ $c = 2 * atan2(sqrt($a) , sqrt(1 - $a)); $km = $r * $c; if ($roundLargeValues) { - if ($km < 1) return floor($km * 1000); - else return round($km,2)."k"; - } else return floor($km * 1000); + if ($km < 1) return floor($km * 1000); + else return round($km, 2) . "k"; + } + else return floor($km * 1000); } - function decodePolylineToArray($encoded) { // source: http://latlongeeks.com/forum/viewtopic.php?f=4&t=5 --- a/include/common-request.inc.php +++ b/include/common-request.inc.php @@ -15,7 +15,7 @@ $nearby = true; } if (isset($_REQUEST['suburb'])) { - $suburb = filter_var($_REQUEST['suburb'], FILTER_SANITIZE_STRING); + $suburb = $_REQUEST['suburb']; } $pageKey = filter_var($_REQUEST['pageKey'], FILTER_SANITIZE_NUMBER_INT); $lat = filter_var($_REQUEST['lat'], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); --- a/include/common-template.inc.php +++ b/include/common-template.inc.php @@ -23,8 +23,10 @@ $url.= "&guid=ON"; return str_replace("&", "&", $url); } + function include_header($pageTitle, $pageType, $opendiv = true, $geolocate = false, $datepicker = false) { +global $labsPath; echo ' @@ -33,16 +35,16 @@ ' . $pageTitle . ' - '; + '; if (isDebugServer()) { - echo ' + echo ' - + - '; + '; } else { echo ' @@ -54,10 +56,10 @@ '; } echo ' - - - - + + + +