function ipcam_plugin_setting_page() { global $_, $myUser, $conf; if (isset($_['section']) && $_['section'] == 'ipcam') { require_once 'Camera.class.php'; if (!$myUser) { throw new Exception('Vous devez être connecté pour effectuer cette action'); } $cameraManager = new Camera(); $cameras = $cameraManager->populate(); $roomManager = new Room(); $rooms = $roomManager->populate(); $selected = new Camera(); //Si on est en mode modification if (isset($_['id'])) { $selected = $cameraManager->getById($_['id']); } ?> <div class="span9 userBloc"> <h1>Camera</h1> <p>Gestion des cameras IP</p> <fieldset> <legend>Ajouter/Modifier une camera</legend> <div class="left"> <label for="labelCamera">Nom</label> <input type="hidden" id="id" value="<?php echo $selected->id; ?> "> <input type="text" id="labelCamera" value="<?php echo $selected->label; ?> " placeholder="Sonde du salon"/> <label for="ipCamera">IP</label> <input type="text" value="<?php echo $selected->ip; ?> " id="ipCamera" placeholder="192.168.11.27:87" /> <label for="loginCamera">Login</label> <input type="text" value="<?php echo $selected->login; ?> " id="loginCamera" placeholder="" /> <label for="passwordCamera">Password</label> <input type="text" value="<?php echo $selected->password; ?> " id="passwordCamera" placeholder="" /> <label for="locationCamera">Pièce de la maison</label> <select id="locationCamera"> <?php foreach ($rooms as $room) { ?> <option <?php if ($selected->location == $room->getId()) { echo "selected"; } ?> value="<?php echo $room->getId(); ?> "><?php echo $room->getName(); ?> </option> <?php } ?> </select> </div> <div class="clear"></div> <br/><button onclick="plugin_ipcam_save(this)" class="btn">Enregistrer</button> </fieldset> <br/> <fieldset> <legend>Consulter les sondes existants</legend> <table class="table table-striped table-bordered table-hover"> <thead> <tr> <th>Nom</th> <th>IP</th> <th>Pièce</th> <th colspan="2"></th> </tr> </thead> <?php foreach ($cameras as $camera) { $room = $roomManager->load(array('id' => $camera->location)); ?> <tr> <td><?php echo $camera->label; ?> </td> <td><?php echo $camera->ip; ?> </td> <td><?php echo $room->getName(); ?> </td> <td> <a class="btn" href="setting.php?section=ipcam&id=<?php echo $camera->id; ?> "><i class="fa fa-pencil"></i></a> <div class="btn" onclick="plugin_ipcam_delete(<?php echo $camera->id; ?> ,this);"><i class="fa fa-times"></i></div> </td> </td> </tr> <?php } ?> </table> </fieldset> </div> <?php } }