<div id="get"> |
<?php |
<div class="toolbar"> |
include('common.inc.php'); |
<h1>GET Example</h1> |
include_header("Stops"); |
<a class="back" href="#">AJAX</a> |
echo' |
</div> |
<div data-role="navbar"> |
<div class="info"> |
<ul> |
This page was loaded via AJAX. |
<li><a href="stopList.php" class="ui-btn-active">Timing Points</a></li> |
</div> |
<li><a href="stopList.php?allstops=yes">All Stops</a></li> |
<ul class="rounded"> |
</ul> |
<li><a href="#livetest">Test live events</a></li> |
</div> |
</ul> |
'; |
</div> |
echo ' <ul data-role="listview" data-filter="true">'; |
<div id="livetest"> |
$url = $APIurl."/json/timingpoints"; |
<div class="toolbar"> |
if ($_REQUEST['allstops']) $url = $APIurl."/json/stops"; |
<h1>Events test</h1> |
if ($_REQUEST['lat'] && $_REQUEST['lon']) $url = $APIurl."/json/neareststops?lat={$_REQUEST['lat']}&lon={$_REQUEST['lon']}&limit=15"; |
<a class="back" href="#">AJAX</a> |
$contents = json_decode(getPage($url)); |
<a class="button goback" href="#home">Home</a> |
foreach ($contents as $key => $row) { |
</div> |
$stopName[$key] = $row[1]; |
<div class="info"> |
} |
This is a test of live events. |
|
</div> |
|
</div> |
|
|
|
|
// Sort the data with volume descending, edition ascending |
|
// Add $data as the last parameter, to sort by the common key |
|
array_multisort($stopName, SORT_ASC, $contents); |
|
|
|
foreach ($contents as $row) |
|
{ |
|
|
|
echo '<li><a href="stop.php?stopid='.$row[0].'">'.$row[1].'</a></li>'; |
|
} |
|
echo '</ul>'; |
|
|
|
include_footer(); |
|
?> |
|
|
|
|