function sensor_display($room) { global $_; $sensorManager = new Sensor(); $sensors = $sensorManager->loadAll(array('room' => $room->getId())); if (count($sensors) > 0) { foreach ($sensors as $sensor) { $sensorTypeManager = new sensorType(); $type = $sensorTypeManager->load(array('id' => $sensor->getType())); ?> <div class="flatBloc blue-color" style="max-width:30%;"> <h3><?php echo $sensor->getName(); ?> </h3> <h4><?php $sensor->getPositive() == 1 ? '+' : '-'; ?> <?php echo $sensor->getValue(); ?> °C</h4> <p><?php echo $sensor->getDescription(); ?> </p><ul> <li>Code radio : <code><?php echo $sensor->getRadioCode(); ?> </code></li> <li>Type : <span><?php echo $type->getName(); ?> </span></li> <li>Emplacement : <span><?php echo $room->getName(); ?> </span></li> <li>Dernière réception : <span><?php if ($sensor->getLastrcv() < 0 || !is_int($sensor->getLastrcv())) { echo 'Aucune'; } else { echo date("d/m/Y H:i:s", $sensor->getLastrcv()); } ?> </span></li> </ul> <a class="flatBloc" title="Activer le capteur" href="action.php?action=sensor_change_state&engine=<?php echo $sensor->getId(); ?> &code=<?php echo $sensor->getRadioCode(); ?> &state=on"><i class="icon-thumbs-up"></i></a> <a class="flatBloc" title="Désactiver le capteur" href="action.php?action=sensor_change_state&engine=<?php echo $sensor->getId(); ?> &code=<?php echo $sensor->getRadioCode(); ?> &state=off"><i class="icon-thumbs-down "></i></a> </div> <?php } } else { ?> Aucun Capteur radio ajouté dans la piece <code><?php echo $room->getName(); ?> </code>, <a href="setting.php?section=sensor&room=<?php echo $room->getId(); ?> ">ajouter un capteur radio ?</a><?php } }