Files
dev-chiefworks f76abffdcd first commit
2022-05-31 16:21:53 -04:00

107 lines
4.0 KiB
PHP

<?php
require('../backend.php');
require('config.php');
$member_id = 3;
$members_id = "3,22";
$date1 = isset($_GET['date1'])?date("Y-m-d",strtotime($_GET['date1'])):date("Y-m-1");
$date2 = isset($_GET['date2'])?date("Y-m-d",strtotime($_GET['date2'])):date("Y-m-d");
require('functions.php');
require('ajax.php');
require('templates/header.html.php');
$url = API_BASE_URL . "?date1=${date1}&date2=${date2}";
$opts = array(
'http' => array(
'method' => "GET",
'header' => "Accept: application/json\r\n" .
"Authorization: Server-Token ${catalogToken}\r\n"
)
);
$context = stream_context_create($opts);
$body = file_get_contents($url, false, $context);
$result = json_decode($body,true);
$data = array();
if (is_array($result)) {
if (isset($result["data"])) {
$data = $result["data"];
}
if (isset($result["pub1"])) {
$pub1 = $result["pub1"];
}
if (isset($result["pub2"])) {
$pub2 = $result["pub2"];
}
if (isset($result["taxi"])) {
$taxi = $result["taxi"];
}
if (isset($result["taxi0"])) {
$taxi0 = $result["taxi0"];
}
if (isset($result["public_vs_rideshare"])) {
$public_vs_rideshare = $result["public_vs_rideshare"];
}
/*
if (isset($result[""])) {
$ = $result[""];
}
*/
}
require_once('templates/header.js.php');
?>
<a href="csv.php">Download CSV</a><br/>
<table width="100%">
<col><col><col><col><col><col><col><col><col><col>
<tr><th>Travel Date (Start)</th><th>End Time</th><th>Duration</th><th>Distance</th><th>Travel From</th><th>Travel To</th><th>Cost</th><th>Provider</th><th>Routes</th><th>Member ID</th></tr>
<?
$i = 0;
foreach ($data as $f) {
//echo "<tr onclick=\"document.getElementById('item".$f["id"]."').style.display='block';\" align=\"center\">";
$str = "<tr onclick=\"$('#item".$f["id"]."').popup('show');\" align=\"center\">";
$str.= "<td nowrap>".$f["travel_date"]."</td>";
$f_end_date = getEndDateTime($f["travel_date"],$f["travel_date_end"],$f["duration"]);
$str.= "<td nowrap>".$f_end_date."</td>";
$f_duration = getDuration($f["duration"],$f["travel_date"],$f["travel_date_end"]);
$str.= "<td>".$f_duration."</td>";
$str.= "<td>".$f["distance"]."</td>";
$str.= "<td align=\"left\">".$f["location_start"]."</td>";
$str.= "<td align=\"left\">".$f["location_end"]."</td>";
$str.= "<td align=\"right\" nowrap>".$f["cost_raw"]."</td>";
$f_transport_provider = getTransportProvider($f["transport_provider_id"]);
$str.= "<td>".$f_transport_provider."</td>";
$str.= "<td>".$f["routes"]."</td>";
$str.= "<td>".$f["member_id"]."</td>";
$str.= "</tr>\n";
echo $str;
echo "<tr><td colspan=10></a><div id=\"item".$f["id"]."\" class=\"well\">";
echo "<a href='#' onclick=\"$('#item".$f["id"]."').popup('hide');return false;\">click to hide (#".$f["tid"].")...</a>";
$str = "<tr><td width='150'>".$f["travel_date"]."</td><td width='100' align=right>Duration: </td><td width='70'>".$f_duration."</td>";
$str.= "<td width='70' align=right>Cost: </td><td width='50' nowrap>".$f["cost_raw"]."</td>";
$str.= "<td width='50' align=right>Routes: </td><td width='50'>".$f["routes"]."</td><td>".$f["location_start"]."</td></tr>\n";
$str.= "<tr><td width='150'>".$f_end_date."</td><td width='100' align=right>Distance: </td><td width='70'>".$f["distance"]."</td>";
$str.= "<td width='70' align=right>Vendor:</td><td width='50' nowrap>".$f_transport_provider."</td>";
$str.= "<td width='50' align=right>Member: </td><td width='50'>".$f["member_id"]."</td><td>".$f["location_end"]."</td></tr>\n";
showDirections($f, true, $str);
echo "</div>\n";
echo "<script>$(document).ready(function () { $('#item".$f["id"]."').popup();});</script>\n";
if ($i%10==0) {
echo '<script>$("#progress").attr("data-progresspercent",'.(int)(50+50*$i/$total).');</script>' . "\n";
}
echo "</td></tr>\n";
$i++;
}
echo "</table></div>";
echo '<script>$("#loader").hide();$("#tabs").show();$("#dfilter").show();</script>' . "\n";
echo "<script>$(document).ready(function() { $.fn.popup.defaults.pagecontainer = '#page'; }); </script>\n";
require('javascript.php');
echo "</div>\n</body>\n</html>";
// vi:ts=2