Skip to content

Commit

Permalink
part gpio temp to bootstrap
Browse files Browse the repository at this point in the history
  • Loading branch information
root committed Jun 23, 2015
1 parent 3ad9431 commit d5af191
Show file tree
Hide file tree
Showing 10 changed files with 290 additions and 422 deletions.
5 changes: 3 additions & 2 deletions index.php
Original file line number Diff line number Diff line change
Expand Up @@ -160,8 +160,9 @@

</body>
</html>
<?php
}
?>



<?php }
?>
28 changes: 1 addition & 27 deletions modules/gpio/html/gpio_day.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,6 @@
}


$day_zone1s = isset($_POST['day_zone1s']) ? $_POST['day_zone1s'] : '';
$day_zone1e = isset($_POST['day_zone1e']) ? $_POST['day_zone1e'] : '';
$day_zone2s = isset($_POST['day_zone2s']) ? $_POST['day_zone2s'] : '';
$day_zone2e = isset($_POST['day_zone2e']) ? $_POST['day_zone2e'] : '';
$day_zone3s = isset($_POST['day_zone3s']) ? $_POST['day_zone3s'] : '';
$day_zone3e = isset($_POST['day_zone3e']) ? $_POST['day_zone3e'] : '';

$dayrun = isset($_POST['dayrun']) ? $_POST['dayrun'] : '';
if ($dayrun == "on") {
include('gpio_on.php');
Expand All @@ -24,15 +17,6 @@
exit();
}

$dayset = isset($_POST['dayset']) ? $_POST['dayset'] : '';
if ($dayset == "on") {
$db->exec("UPDATE gpio SET day_zone1s='$day_zone1s',day_zone1e='$day_zone1e',day_zone2s='$day_zone2s',day_zone2e='$day_zone2e',day_zone3s='$day_zone3s',day_zone3e='$day_zone3e' WHERE gpio='$gpio_post'") or die("exec error");
$db = null;
header("location: " . $_SERVER['REQUEST_URI']);
exit();
}


if ($dayrun == "off") {
include('gpio_off.php');
$db->exec("UPDATE gpio SET day_run='', status='OFF' WHERE gpio='$gpio_post'") or die("exec error");
Expand Down Expand Up @@ -64,18 +48,8 @@
}
else
{
include('gpio_day_forms.php');
?>


<form action="" method="post" style=" display:inline!important;">
Set hour range:
Zone 1 <input type="text" name="day_zone1s" value="<?php echo $a['day_zone1s']; ?>" size="3" placeholder="08:00" >-<input type="text" name="day_zone1e" value="<?php echo $a['day_zone1e']; ?>" size="3" placeholder="11:00">
Zone 2 <input type="text" name="day_zone2s" value="<?php echo $a['day_zone2s']; ?>" size="3" placeholder="12:30" >-<input type="text" name="day_zone2e" value="<?php echo $a['day_zone2e']; ?>" size="3" placeholder="16:30">
Zone 3 <input type="text" name="day_zone3s" value="<?php echo $a['day_zone3s']; ?>" size="3" placeholder="20:15" >-<input type="text" name="day_zone3e" value="<?php echo $a['day_zone3e']; ?>" size="3" placeholder="06:00">
<input type="hidden" name="gpio" value="<?php echo $a['gpio']; ?>"/>
<button type="submit" class="btn btn-xs btn-primary"><span class="glyphicon glyphicon-pencil"></span></button>
<input type="hidden" name="dayset" value="on" />
</form>
<form action="" method="post" style=" display:inline!important;">
<input type="hidden" name="gpio" value="<?php echo $a['gpio']; ?>"/>
<button type="submit" class="btn btn-xs btn-primary">ON</button>
Expand Down
45 changes: 45 additions & 0 deletions modules/gpio/html/gpio_day_forms.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
<?php
$day_zone1s = isset($_POST['day_zone1s']) ? $_POST['day_zone1s'] : '';
$day_zone1e = isset($_POST['day_zone1e']) ? $_POST['day_zone1e'] : '';
$day_zone2s = isset($_POST['day_zone2s']) ? $_POST['day_zone2s'] : '';
$day_zone2e = isset($_POST['day_zone2e']) ? $_POST['day_zone2e'] : '';
$day_zone3s = isset($_POST['day_zone3s']) ? $_POST['day_zone3s'] : '';
$day_zone3e = isset($_POST['day_zone3e']) ? $_POST['day_zone3e'] : '';

$dayset = isset($_POST['dayset']) ? $_POST['dayset'] : '';
if ($dayset == "on") {
$db->exec("UPDATE gpio SET day_zone1s='$day_zone1s',day_zone1e='$day_zone1e',day_zone2s='$day_zone2s',day_zone2e='$day_zone2e',day_zone3s='$day_zone3s',day_zone3e='$day_zone3e' WHERE gpio='$gpio_post'") or die("exec error");
$db = null;
header("location: " . $_SERVER['REQUEST_URI']);
exit();
}
?>

<fieldset>
<!-- Form Name -->
<legend>Day plan</legend>
<form action="" method="post" role="form" class="form-horizontal">
<div class="form-group">
<label class="col-sm-1">Zone 1</label>
<div class="col-sm-1"><input class="form-control" placeholder="08:00" type="text" name="day_zone1s" value="<?php echo $a['day_zone1s']; ?>"></div>
<div class="col-sm-1"><input class="form-control" placeholder="10:00" type="text" name="day_zone1e" value="<?php echo $a['day_zone1e']; ?>"></div>
</div>
<div class="form-group">
<label class="col-sm-1">Zone 2</label>
<div class="col-sm-1"><input class="form-control" placeholder="13:00" type="text" name="day_zone2s" value="<?php echo $a['day_zone2s']; ?>"></div>
<div class="col-sm-1"><input class="form-control" placeholder="16:15" type="text" name="day_zone2e" value="<?php echo $a['day_zone2e']; ?>"></div>
</div>
<div class="form-group">
<label class="col-sm-1">Zone 3</label>
<div class="col-sm-1"><input class="form-control" placeholder="19:00" type="text" name="day_zone3s" value="<?php echo $a['day_zone3s']; ?>"></div>
<div class="col-sm-1"><input class="form-control" placeholder="21:30" type="text" name="day_zone3e" value="<?php echo $a['day_zone3e']; ?>"></div>
</div>
<div class="form-group">
<div class="col-sm-6">
<input type="hidden" name="gpio" value="<?php echo $a['gpio']; ?>"/>
<button type="submit" class="btn btn-xs btn-primary">SAVE</button>
<input type="hidden" name="dayset" value="on" />
</div>
</div>
</form>
</fieldset>
16 changes: 11 additions & 5 deletions modules/gpio/html/gpio_name.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,18 @@
}


if (!empty($mode)) { ?>
<td><img type="image" src="media/ico/SMD-64-pin-icon_24.png" ></td>
<?php echo $a['name'];
}
else {
//if (!empty($mode)) {
?>
<!-- <td><img type="image" src="media/ico/SMD-64-pin-icon_24.png" ></td> -->
<?php //echo $a['name'];
//}
//else {
?>

<?php
if (empty($mode)) {
?>

<form action="" method="post" style=" display:inline!important;">
<img type="image" src="media/ico/SMD-64-pin-icon_24.png" >
<input type="text" name="name" value="<?php echo $a['name']; ?>" size="6">
Expand Down
3 changes: 2 additions & 1 deletion modules/gpio/html/gpio_settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,11 @@
foreach ( $result as $a) {
$gpio=$a['gpio'];
$mode=$a['mode'];
$name=$a['name'];
?>
<div class="panel panel-default">
<div class="panel-heading">
<h3 class="panel-title">GPIO <?php echo $gpio ?></h3>
<h3 class="panel-title">GPIO <?php echo $gpio ?> - <?php echo $name ?> </h3>
</div>
<div class="panel-body">
<table">
Expand Down
Loading

0 comments on commit d5af191

Please sign in to comment.