From: Maxious Date: Thu, 02 Jun 2011 09:51:29 +0000 Subject: Stop Browser Map X-Git-Url: http://maxious.lambdacomplex.org/git/?p=busui.git&a=commitdiff&h=2d9f08afc1e69943d6dc62b795425dff81000728 --- Stop Browser Map --- --- a/include/common-template.inc.php +++ b/include/common-template.inc.php @@ -5,6 +5,7 @@ function googleAnalyticsGetImageUrl() { global $GA_ACCOUNT, $GA_PIXEL; + //if (stristr($_SERVER['HTTP_USER_AGENT'], 'Googlebot') return ""; $url = ""; $url.= $GA_PIXEL . "?"; $url.= "utmac=" . $GA_ACCOUNT; @@ -125,7 +126,25 @@ border-radius: 15px; } - +/*#leftcolumn { + float: none; +} +.min-width-768px #leftcolumn { + float: left; + width: 30%; +} +#rightcolumn { + float: none; +} +.min-width-768px #rightcolumn { + float: right; + width: 68%; +}*/ + +#footer { +clear:both; +text-align:center; +} // source http://webaim.org/techniques/skipnav/ #skip a, #skip a:hover, #skip a:visited { @@ -144,7 +163,7 @@ height:auto; } '; - if (strstr($_SERVER['HTTP_USER_AGENT'], 'iPhone') || strstr($_SERVER['HTTP_USER_AGENT'], 'iPod')) { + if (strstr($_SERVER['HTTP_USER_AGENT'], 'iPhone') || strstr($_SERVER['HTTP_USER_AGENT'], 'iPod') || strstr($_SERVER['HTTP_USER_AGENT'], 'iPad')) { echo ' @@ -175,7 +194,11 @@ } $(document).ready(function() { $('#here').click(function(event) { $('#geolocate').val(geolocate()); return false;}); -$('#here').show(); + $('#here').show(); + /*if ($.mobile.media('screen and (min-width: 768px)')) { + $('map a:first').click(); + $('#settings a:first').click(); + }*/ }); "; if (!isset($_SESSION['lat']) || $_SESSION['lat'] == "") echo "geolocate();"; @@ -187,6 +210,7 @@ var _gaq = _gaq || []; _gaq.push(['_setAccount', 'UA-22173039-1']); _gaq.push(['_trackPageview']); + _gaq.push(['_trackPageLoadTime']); "; echo ' @@ -249,7 +273,7 @@ or enter an address/co-ordinates in the box below.'; } echo ''; - echo '
+ echo '

Change Time/Place (' . (isset($_SESSION['time']) ? $_SESSION['time'] : "Current Time,") . ' ' . ucwords(service_period()) . ')...

--- a/include/common.inc.php +++ b/include/common.inc.php @@ -163,7 +163,7 @@ $key => $val )); } - if ($sort_ascending) $array = array_reverse($temp_array); + if ($sort_ascending && isset($temp_array)) $array = array_reverse($temp_array); else $array = $temp_array; } function r_implode( $glue, $pieces ) --- a/include/db/route-dao.inc.php +++ b/include/db/route-dao.inc.php @@ -200,7 +200,7 @@ $query = $conn->prepare($query); $query->bindParam(":service_period", $service_period); $query->bindParam(":distance", $distance); - $query->bindParam(":limit", $limit); + if ($limit != "") $query->bindParam(":limit", $limit); $query->execute(); if (!$query) { databaseError($conn->errorInfo()); --- a/index.php +++ b/index.php @@ -28,5 +28,4 @@ echo ' Busness R&D'; include_footer(true) ?> - --- a/labs/index.php +++ b/labs/index.php @@ -10,6 +10,8 @@

Analysis of route timing points

  • Bus Stop Density Map

    Analysis of bus stop coverage

  • +
  • Bus Stop Browser Map

    +

    Bus stop location/route browser

  • More coming soon!
  • --- a/labs/myway_api.json.php +++ b/labs/myway_api.json.php @@ -23,7 +23,7 @@ "DOBday" => "day", "DOByear" => "year", "secret_answer" => "pwrd", - "button" => "button" + "button" => "Submit" ); foreach (Array( "card_number", @@ -64,6 +64,7 @@ curl_setopt($ch, CURLOPT_POST, count($fields)); curl_setopt($ch, CURLOPT_POSTFIELDS, $fields_string); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); + curl_setopt($ch, CURLOPT_REFERER, "https://www.action.act.gov.au/ARTS/getbalance.asp"); curl_setopt($ch, CURLOPT_HEADER, 0); curl_setopt($ch, CURLOPT_TIMEOUT, 30); //execute post @@ -75,6 +76,7 @@ if (!isset($return['error'])) { include_once ('lib/simple_html_dom.php'); + //print_r($pageHTML); $page = str_get_html($pageHTML); $pageAlerts = $page->find(".smartCardAlert"); if (sizeof($pageAlerts) > 0) { @@ -94,12 +96,14 @@ $tableColumns[$tableColumnNum] = cleanString($th->plaintext); $tableColumnNum++; } + //print_r($tableColumns); $tableRowNum = 0; foreach ($table->find("tr") as $tr) { $tableColumnNum = 0; foreach ($tr->find("td") as $td) { if ($tableNum == 1) $return[$tableName[$tableNum]][$tableColumns[$tableColumnNum]] = cleanString($td->plaintext); else $return[$tableName[$tableNum]][$tableRowNum][$tableColumns[$tableColumnNum]] = cleanString($td->plaintext); + //print_r($return); $tableColumnNum++; } $tableRowNum++; --- a/labs/mywaybalance.php +++ b/labs/mywaybalance.php @@ -29,8 +29,10 @@ echo '
    • Recent Transactions
    • '; $txCount=0; foreach ($return['myway_transactions'] as $transaction) { - echo "
    • " . $transaction["Date / Time"] . ""; - echo "
      " . $transaction["TX Reference No / Type"] . ""; + echo "
    • "; + if ($transaction["Deduction Type"] == "DEFAULT") echo 'Failed to tap off: '; + echo"" . $transaction["Date / Time"] . ""; + echo "
      " .$transaction["Route"] ." at " . $transaction["Stop Name"]. "
      ". $transaction["TX Reference No / Type"] . "
      "; echo '

      ' . $transaction["TX Amount"] . '

      '; echo "
    • "; $txCount++; --- /dev/null +++ b/labs/stopBrowser.kml.php @@ -1,1 +1,62 @@ +createElementNS('http://earth.google.com/kml/2.1', 'kml'); + $parNode = $dom->appendChild($node); + + // Creates a KML Document element and append it to the KML element. + $dnode = $dom->createElement('Document'); + $docNode = $parNode->appendChild($dnode); + + +$bbox = $_GET['bbox']; // get the bbox param from google earth +list($bbox_south, $bbox_west, $bbox_north,$bbox_east) = explode(",", $bbox); // west, south, east, north + +include ('../include/common.inc.php'); +$debugOkay = Array(); +$contents = getNearbyStops( (($bbox_west+ $bbox_east) /2), ($bbox_south + $bbox_north)/2 ,50, 3000); +foreach ($contents as $stop) { + $description = 'http://bus.lambdacomplex.org/' . 'stop.php?stopid=' . $stop['stop_id'] ."
      "; + $trips = getStopTripsWithTimes($stop['stop_id'], "", "", "", 3); + if ($trips) { + foreach ($trips as $key => $row) { + if ($key < 3) { + $description .= $row['route_short_name'] . ' ' . $row['route_long_name'] . ' @ ' . $row['arrival_time'] . "
      "; + } + } + } else { + $description .= "No more trips today"; + } + // Creates a Placemark and append it to the Document. + $node = $dom->createElement('Placemark'); + $placeNode = $docNode->appendChild($node); + + // Creates an id attribute and assign it the value of id column. + $placeNode->setAttribute('id', 'placemark' . $stop['stop_id']); + + // Create name, and description elements and assigns them the values of the name and address columns from the results. + $nameNode = $dom->createElement('name',htmlentities($stop['stop_name'])); + $descriptionNode = $dom->createElement('description',$description); + $placeNode->appendChild($nameNode); + $placeNode->appendChild($descriptionNode); + + // Creates a Point element. + $pointNode = $dom->createElement('Point'); + $placeNode->appendChild($pointNode); + + // Creates a coordinates element and gives it the value of the lng and lat columns from the results. + $coorStr = $stop['stop_lon'] . ',' . $stop['stop_lat']; + $coorNode = $dom->createElement('coordinates', $coorStr); + $pointNode->appendChild($coorNode); + } + + + $kmlOutput = $dom->saveXML(); + echo $kmlOutput; +?> + --- /dev/null +++ b/labs/stopBrowser.php @@ -1,1 +1,102 @@ + + + + + + + + +
      + + + + --- a/robots.txt +++ b/robots.txt @@ -1,4 +1,6 @@ User-agent: * Allow: / +User-agent: * +Disallow: /lib/ga.php sitemap: http://bus.lambdacomplex.org/sitemap.xml.php --- a/stop.php +++ b/stop.php @@ -60,6 +60,7 @@ } } include_header($stop['stop_name'], "stop"); +echo ''; timePlaceSettings(); echo $stopLinks; if (sizeof($stops) > 0) { @@ -75,6 +76,7 @@ ) )) ; } +echo ''; echo '
        '; if (sizeof($allStopsTrips) > 0) { sktimesort($allStopsTrips,"arrival_time", true); @@ -107,6 +109,7 @@ } } echo '
      '; +echo '
      '; include_footer(); ?> --- a/trip.php +++ b/trip.php @@ -16,7 +16,7 @@ include_header("Stops on " . $trip['route_short_name'] . ' ' . $trip['route_long_name'], "trip"); trackEvent("Route/Trip View","View Route", $trip['route_short_name'] . ' ' . $trip['route_long_name'], $routeid); - +echo ''; echo '

      Via:

      ' . viaPointNames($tripid) . ''; echo '

      Other Trips:

      '; foreach (getRouteTrips($routeid) as $othertrip) { @@ -27,6 +27,7 @@ foreach (getRoutesByNumber($trip['route_short_name']) as $row) { if ($row['route_id'] != $routeid) echo '' . $row['route_long_name'] . ' (' . ucwords($row['service_id']) . ') '; } +echo '
      '; flush(); @ob_flush(); echo ' '; + +echo ''; include_footer(); ?>