<?php
require_once "../../../config/settings.inc.php";
require_once "../../../include/myview.php";
require_once "../../../include/cameras.inc.php";

$t = new MyView();
$t->title = "Webcam Lapse Player";
$t->headextra = <<<EOM
<link href="/vendor/flowplayer/7.2.6/skin/skin.css" rel="stylesheet">
EOM;

$camselect = "<select id=\"mycam\" name=\"mycam\" onchange=\"myloader();\">";
foreach ($cameras as $key => $dict) {
    if ($dict["removed"] || $dict["network"] == "IDOT") {
        continue;
    }
    $camselect .= "<option value=\"" . $dict["moviebase"] . "\">" . $dict["name"] . " \n";
}
$camselect .= "</select>";

$t->content = <<<EOM
<h3>Recent Web Cam Time Lapses</h3>

<p>Each day, the IEM generates five time lapses from each of the web cameras.
This page allows you to view the most recent iteration of these lapses. Please
note the timestamp on the lapses, some of them may be old.</p>


<div style="background: #eee; border: 1px solid #000; margin: 5px; padding: 5px;">
<div class="flowplayer">
<video>
<source type="video/mp4" src="https://mesonet.agron.iastate.edu/onsite/lapses/auto/isu_curtis_center_sunrise.mp4">
<source type="video/flv" src="https://mesonet.agron.iastate.edu/onsite/lapses/auto/isu_curtis_center_sunrise.flv">
</video>
</div>
<form name="theform">
<br /><strong>Select Camera:</strong>
{$camselect}
<strong>Select Lapse:</strong>
<select id="mylapse" name="mylapse" onchange="myloader()">
 <option value="sunrise">Sunrise
 <option value="morning">Morning (8 AM - 11 AM)
 <option value="afternoon">Afternoon (1 PM - 4 PM)
 <option value="eve">Sunset
 <option value="day">Full day
</select>
</div>
</form>
EOM;
$t->jsextra = <<<EOM
<script type="text/javascript" src="/vendor/flowplayer/7.2.6/flowplayer.min.js"></script>
<script type="text/javascript" src="app.js?v=2"></script>
EOM;

$t->render('single.phtml');
