Device Room Select

This commit is contained in:
Václav Španinger 2020-09-07 11:33:24 +02:00
parent 50e161e1ce
commit 6945d58eb6
2 changed files with 13 additions and 1 deletions

View File

@ -6,6 +6,7 @@ class Device extends Template
function __construct () { function __construct () {
$userManager = new UserManager (); $userManager = new UserManager ();
$deviceManager = new DeviceManager (); $deviceManager = new DeviceManager ();
$roomManager = new RoomManager ();
$langMng = new LanguageManager ('en'); $langMng = new LanguageManager ('en');
if (!$userManager->isLogin ()) { if (!$userManager->isLogin ()) {
@ -31,9 +32,12 @@ class Device extends Template
} }
} }
$rooms = $roomManager->getAllRooms();
$template->prepare ('baseDir', BASEDIR); $template->prepare ('baseDir', BASEDIR);
$template->prepare ('debugMod', DEBUGMOD); $template->prepare ('debugMod', DEBUGMOD);
$template->prepare ('logToLiveTime', LOGTIMOUT); $template->prepare ('logToLiveTime', LOGTIMOUT);
$template->prepare ('rooms', $rooms);
$template->prepare ('devices', $devices); $template->prepare ('devices', $devices);
$template->prepare ('langMng', $langMng); $template->prepare ('langMng', $langMng);

View File

@ -43,7 +43,15 @@
<tr> <tr>
<td><i class="fa">&#x<?php echo (!empty($device['icon']) ? $device['icon'] : ""); ?></i></td> <td><i class="fa">&#x<?php echo (!empty($device['icon']) ? $device['icon'] : ""); ?></i></td>
<td><?php echo (!empty($device['name']) ? $device['name'] : ""); ?></td> <td><?php echo (!empty($device['name']) ? $device['name'] : ""); ?></td>
<td>Room</td> <td>
<select class="input" id="device-<?php echo $device['device_id']?>-roomId">
<?php
foreach ($ROOMS as $key => $room) {
echo '<option value="'.$room['room_id'].'" '.($device['room_id'] == $room['room_id'] ? 'selected' : '').'>'.$room['name'].'</option>';
}
?>
</select>
</td>
<td> <td>
<?php if (!empty($device['mac'])) : ?> <?php if (!empty($device['mac'])) : ?>
<?php <?php