Exemple #1
0
if($_POST['dimanche'] == 'on'){
$dimanche = 1;
} else {
$dimanche = 0;
}
$cal->day['lundi'] = $lundi;
$cal->day['mardi'] = $mardi;
$cal->day['mercredi'] = $mercredi;
$cal->day['jeudi'] = $jeudi;
$cal->day['vendredi'] = $vendredi;
$cal->day['samedi'] = $samedi;
$cal->day['dimanche'] = $dimanche;
$zibase->setCalendar($_POST['id'],$cal);
}
for ($i = 1; $i <= 17; $i++) {
$calendrier=$zibase->getCalendar($i);
echo "<center><h2>Calendrier Numero ".$i."</h2></center>";
?>
<center><p align="center"><form method="post" action="./index.php?page=calendrier">
<? 
for ($j = 0; $j < 24; $j++) {
if($j > 0 && $j <> 13) { echo " | "; }
if($j == 13) { echo "<br>"; }
?>
<? echo $j; ?>h <input type=checkbox name=<? echo $j; if($calendrier->hour[$j] == 1) { ?> Checked<? } ?>>
<? } ?>
<BR>
Lundi <input type=checkbox name=lundi<? if($calendrier->day['lundi'] == 1) { ?> Checked<? } ?>>
 | Mardi <input type=checkbox name=mardi<? if($calendrier->day['mardi'] == 1) { ?> Checked<? } ?>>
 | Mercredi <input type=checkbox name=mercredi<? if($calendrier->day['mercredi'] == 1) { ?> Checked<? } ?>>
 | Jeudi <input type=checkbox name=jeudi<? if($calendrier->day['jeudi'] == 1) { ?> Checked<? } ?>>
Exemple #2
0
echo "<center><p align=center>Mode : <br>";
?>
<FORM method="post" action="./index.php?page=thermostat">
<input type="radio" name="mode" value="0"<? if($zibase->getVariable($thermostat[$i]['5']) == "0") { echo " checked"; } ?>>Auto | 
<input type="radio" name="mode" value="16"<? if($zibase->getVariable($thermostat[$i]['5']) == "16") { echo " checked"; } ?>>Jour | 
<input type="radio" name="mode" value="32"<? if($zibase->getVariable($thermostat[$i]['5']) == "32") { echo " checked"; } ?>>Jour temporaire | 
<input type="radio" name="mode" value="6"<? if($zibase->getVariable($thermostat[$i]['5']) == "6") { echo " checked"; } ?>>Hor gel | 
<input type="radio" name="mode" value="48"<? if($zibase->getVariable($thermostat[$i]['5']) == "48") { echo " checked"; } ?>>Nuit | 
<input type="radio" name="mode" value="64"<? if($zibase->getVariable($thermostat[$i]['5']) == "64") { echo " checked"; } ?>>Nuit temporaire | 
<input type="radio" name="mode" value="5"<? if($zibase->getVariable($thermostat[$i]['5']) == "5") { echo " checked"; } ?>>Stop
<INPUT TYPE="HIDDEN" NAME="id" VALUE="<? echo $thermostat[$i]['5']; ?>">
<INPUT TYPE="SUBMIT" NAME="Modifier_mode" VALUE="Valider">
</FORM></p></center>
<?
for ($k = 0; $k < 3; $k++) {
$calendrier=$zibase->getCalendar($thermostat[$i]['7']+$k);
echo "<center>Calendrier Numero ".($thermostat[$i]['7']+$k)."</center>";
?>
<center><p align="center"><form method="post" action="./index.php?page=thermostat">
<?
for ($j = 0; $j < 24; $j++) {
if($j > 0 && $j <> 13) { echo " | "; }
if($j == 13) { echo "<br>"; }
?>
<? echo $j; ?>h <input type=checkbox name=<? echo $j; if($calendrier->hour[$j] == 1) { ?> Checked<? } ?>>
<? } ?>
<BR>
Lundi <input type=checkbox name=lundi<? if($calendrier->day['lundi'] == 1) { ?> Checked<? } ?>>
 | Mardi <input type=checkbox name=mardi<? if($calendrier->day['mardi'] == 1) { ?> Checked<? } ?>>
 | Mercredi <input type=checkbox name=mercredi<? if($calendrier->day['mercredi'] == 1) { ?> Checked<? } ?>>
 | Jeudi <input type=checkbox name=jeudi<? if($calendrier->day['jeudi'] == 1) { ?> Checked<? } ?>>
# lm 3 aft 60 (lance le scenario 3 dans 60s)
# lm 2.lm [autre] (lance le scenario 2 puis le scenario "autre")
?>
 <?php 
# Lit la variable 2 de la zibase
$var2 = $zibase->getVariable(2);
echo "var2=" . $var2;
?>
 <br/>
 <?php 
# Met à jour la variable 14 de la zibase en lui mettant la valeur 44
$zibase->setVariable(14, 44);
?>
 <?php 
# Lit une variable calendrier
$cal = $zibase->getCalendar(12);
echo "00h00=" . $cal->hour[0] . "<br/>";
echo "04h00=" . $cal->hour[4] . "<br/>";
echo "Mardi=" . $cal->day["mardi"] . "<br/>";
echo "Dimanche=" . $cal->day["dimanche"] . "<br/>";
?>
 <br/>
 <?php 
# Met à jour le calendrier 12 de la zibase
# Par défaut, tout est à 0 (= tout décoché)
$cal = new ZbCalendar();
# On met 05h00 à actif (= coché)
$cal->hour[5] = 1;
# On met le jeudi à actif (=coché)
$cal->day["jeudi"] = 1;
$zibase->setCalendar(12, $cal);