Skip to content

Commit

Permalink
Lights & floodlights pages
Browse files Browse the repository at this point in the history
  • Loading branch information
adamaflynn committed Mar 19, 2012
1 parent 0066186 commit 087bb63
Show file tree
Hide file tree
Showing 5 changed files with 101 additions and 0 deletions.
20 changes: 20 additions & 0 deletions mobile/floodlights.php
@@ -0,0 +1,20 @@
<?php
session_start();

if (empty($_SESSION['loggedin'])) {
header('Location: index.php');
exit;
}

if (empty($_SESSION['house_id'])) {
die('You have no house.');
}

require_once '../shared/util.php';
require_once '../shared/floodlights.php';
db_connect();

$lights = FloodlightsRecord::load($_SESSION['house_id']);

require 'tpl/floodlights.tpl';
?>
20 changes: 20 additions & 0 deletions mobile/lights.php
@@ -0,0 +1,20 @@
<?php
session_start();

if (empty($_SESSION['loggedin'])) {
header('Location: index.php');
exit;
}

if (empty($_SESSION['house_id'])) {
die('You have no house.');
}

require_once '../shared/util.php';
require_once '../shared/lights.php';
db_connect();

$lights = LightsRecord::load($_SESSION['house_id']);

require 'tpl/lights.tpl';
?>
28 changes: 28 additions & 0 deletions mobile/tpl/floodlights.tpl
@@ -0,0 +1,28 @@
<?php require 'header.tpl'; ?>
<div data-role="page" id="lights">
<div data-role="header">
<a href="home.php" data-icon="home"
data-iconpos="notext" data-direction="reverse">Home</a>
<h3>Floodlights</h3>
</div>
<div data-role="content">
<?php if (!empty($floodlights)) { ?>
<ul data-role="listview">
<?php foreach($floodlights as $light) { ?>
<li>
<?php echo $light->getTimestamp(); ?> -
Device: <?php echo $lights->getDevice(); ?> -
State: <?php echo $lights->getState() ? 'On' : 'Off'; ?>
</li>
<?php } ?>
</ul>
<?php } else { ?>
You don't have any light events yet. Don't worry, they'll come soon!
<?php } ?>
</div>
<div data-theme="a" data-role="footer" data-position="fixed">
<h3>HOMOS Home Monitoring System</h3>
</div>
</div>
<?php require 'footer.tpl'; ?>
27 changes: 27 additions & 0 deletions mobile/tpl/lights.tpl
@@ -0,0 +1,27 @@
<?php require 'header.tpl'; ?>
<div data-role="page" id="lights">
<div data-role="header">
<a href="home.php" data-icon="home"
data-iconpos="notext" data-direction="reverse">Home</a>
<h3>Lights</h3>
</div>
<div data-role="content">
<?php if (!empty($lights)) { ?>
<ul data-role="listview">
<?php foreach($lights as $light) { ?>
<li>
<?php echo $light->getTimestamp(); ?> -
Device: <?php echo $lights->getDevice(); ?> -
State: <?php echo $lights->getState() ? 'On' : 'Off'; ?>
</li>
<?php } ?>
</ul>
<?php } else { ?>
You don't have any light events yet. Don't worry, they'll come soon!
<?php } ?>
</div>
<div data-theme="a" data-role="footer" data-position="fixed">
<h3>HOMOS Home Monitoring System</h3>
</div>
</div>
<?php require 'footer.tpl'; ?>
6 changes: 6 additions & 0 deletions mobile/tpl/main.tpl
Expand Up @@ -8,6 +8,12 @@
<a data-role="button" data-transition="slide" href="stream.php">
Activity Stream
</a>
<a data-role="button" data-transition="slide" href="lights.php">
Lights
</a>
<a data-role="button" data-transition="slide" href="floodlights.php">
Floodlights
</a>
<a data-role="button" data-transition="slide" href="houseinfo.php">
My Home Info
</a>
Expand Down

0 comments on commit 087bb63

Please sign in to comment.