<?php
require_once "../../../config/settings.inc.php";
define("IEM_APPID", 80);
require_once "../../../include/myview.php";
$t = new MyView();
require_once "../../../include/forms.php";

$t->title = "RWIS Traffic Data Download";

$ys = yearSelect(2008, date("Y"), "year1");
$ms = monthSelect("", "month1");
$ds = daySelect("", "day1");
$hs = gmtHourSelect("", "hour1");

$ys2 = yearSelect(2008, date("Y"), "year2");
$ms2 = monthSelect("", "month2");
$ds2 = daySelect("", "day2");
$hs2 = gmtHourSelect("", "hour2");

$rselect = networkSelect(
    "IA_RWIS",
    "",
    array(),
    "station",
    FALSE,
    "",
    10,
);

$ar = array(
    "Etc/UTC" => "Coordinated Universal Time (UTC)",
    "America/New_York" => "America/New_York (EST/EDT)",
    "America/Chicago" => "America/Chicago (CST/CDT)",
    "America/Denver" => "America/Denver (MST/MDT)",
    "America/Los_Angeles" => "America/Los_Angeles (PST/PDT)",
    "America/Anchorage" => "America/Anchorage (AKST/AKDT)",
);
$tzselect = make_select("tz", "Etc/UTC", $ar);

$t->content = <<<EOM
<ol class="breadcrumb">
 <li><a href="/RWIS/">RWIS Homepage</a></li>
 <li class="active">Traffic Download</li>
</ol>

<p>This page provides the IEM collected archive of Iowa RWIS Traffic Data.


<form method="GET" action="/cgi-bin/request/rwis.py">
<input type="hidden" value="traffic" name="src">
<input type="hidden" value="lane_id" name="vars">
<input type="hidden" value="avg_speed" name="vars">
<input type="hidden" value="avg_headway" name="vars">
<input type="hidden" value="normal_vol" name="vars">
<input type="hidden" value="long_vol" name="vars">
<input type="hidden" value="occupancy" name="vars">


<table>
<tr><td width="50%">

<p><h3>1. Select Station:</h3><br>
<i>Select One or More or All stations in the network.</i><br />
{$rselect}


<p><h3>2. Select Start/End Time:</h3><br>
<i>Times are in UTC. Archive starts in December 2008.</i>
<table>
  <tr>
    <td></td>
    <th>Year</th><th>Month</th><th>Day</th>
    <th>Hour</th>
  </tr>

  <tr>
    <th>Start:</th>
    <td>{$ys}</td>
    <td>{$ms}</td>
    <td>{$ds}</td>
    <td>{$hs}
    <input type="hidden" name="minute1" value="0"></td>
  </tr>

  <tr>
    <th>End:</th>
    <td>{$ys2}</td>
    <td>{$ms2}</td>
    <td>{$ds2}</td>
    <td>{$hs2}
    <input type="hidden" name="minute2" value="0"></td>
    </tr>
</table>

</td><td valign="TOP">

<p><h4>3. Timezone of Timestamps</h4>
   <i>This controls the timezone used for presenting the timestamps in the
    downloaded file.</i>
   <br />{$tzselect}</p>

<p><h3 class="subtitle">4. How to view?</h3><br>
<select name="what">
  <option value="txt">Download to Disk</option>
  <option value="view">View on-line
</select>

<p><h3 class="subtitle">5. Data Delimitation:</h3><br>
How shall the output values be seperated?
<br><select name="delim">
    <option value="comma">Comma
    <option value="space">Space
    <option value="tab">Tab
   </select>

<p>
<h3 class="subtitle">6. Include Lat / Lons?</h3><img src="/images/gisready.png"><br>
 <select name="gis">
   <option value="no">No
   <option value="yes">Yes
 </select>

</td></tr></table>

<p><h3>Submit Form:</h3><br>
<input type="submit" value="Process Data Request">
<input type="reset">
</form>
EOM;
$t->render('single.phtml');
