<?php
	//
	// Description:
	// 
	// This is just an example iUI interface that supplied appropriate
	// parameters to the event.php script (which does the heavy lifting).
	//
	
	// this array controls the select lists for goto operations
	$locations = array( 'kitchen', 'couch', 'desk', 'drawers' );
?>

<!DOCTYPE html>
<html>
<head>
	<title>Robot Interface</title>
	<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0"/>
	<link rel="stylesheet" href="iui/iui.css" type="text/css" />
	<link rel="stylesheet" title="Default" href="iui/t/default/default-theme.css"  type="text/css"/>
	<script type="application/x-javascript" src="iui/iui.js"></script>
</head>
<body>
	<div class="toolbar">
		<h1 id="pageTitle"></h1>
		<a id="backButton" class="button" href="#"></a>
	</div>
	
	<ul id="index" title="Home" selected="true">
		<li><a href="#drawer">Drawer</a></li>
		<li><a href="#goto">GoTo</a></li>
		<li><a href="#todo">ToDo</a></li>
	</ul>
	
	<form class="panel" id="goto" name="goto" title="Go To" method="GET" action="event.php">
		<input type="hidden" name="screen" value="goto" />
		<input type="hidden" name="action" value="goto" />
		
		<fieldset>
			<div class="row">
				<label>From:</label>
				<select name="p1">
				<?php
					foreach ( $locations as $l )
					{
						echo ( '<option value="' . htmlentities( $l ) . '">' . htmlentities( $l ) . '</option>' );
					}
				?>
				</select>
			</div>

			<div class="row">
				<label>To:</label>
				<select name="p2">
				<?php
					foreach ( $locations as $l )
					{
						echo ( '<option value="' . htmlentities( $l ) . '">' . htmlentities( $l ) . '</option>' );
					}
				?>
				</select>
			</div>
		</fieldset>
		<a class="redButton" href="javascript:goto.submit()">Submit</a>
	</form>
	
	<form class="panel" id="drawer" name="drawer" title="Drawer" method="GET" action="event.php">
		<input type="hidden" name="screen" value="drawer" />
		<input type="hidden" name="action" value="drawer" />

		<fieldset>
			<div class="row">
				<label>Operation:</label>
				<select name="p1">
					<option value="close">close</option>
					<option value="open">open</option>
				</select>
			</div>
		</fieldset>
		<a class="redButton" href="javascript:drawer.submit()">Submit</a>
	</form>

	<form class="panel" id="todo" name="todo" title="ToDo" method="GET" action="event.php">
		<input type="hidden" name="screen" value="todo" />
		<input type="hidden" name="action" value="todo" />

		<fieldset>
			<div class="row">
				<label>Type:</label>
				<select name="p1">
					<option value="meal">meal</option>
					<option value="relax">relax</option>
					<option value="work">work</option>

					<option value="start">start</option>
					<option value="stop">stop</option>
				</select>
			</div>
		</fieldset>
		<a class="redButton" href="javascript:todo.submit()">Submit</a>
	</form>
</body>
</html>
