PHP_SMART_HOME_V3/app/templates/part/deviceEdit.phtml

169 lines
12 KiB
PHTML
Raw Normal View History

2019-08-23 11:39:42 +00:00
<div class="modal-container modal-container-hiden" id="modal-setting-<?php echo $DEVICEID ?>">
<div class="modal">
<div class="close">
<i class="fa fa-times"></i>
</div>
2019-10-11 12:12:05 +00:00
<h4 class="mb-4"><?php $LANGMNG->echo('t_editDevice'); ?></h4>
2019-08-23 11:39:42 +00:00
<form method="post" action="">
<input class="input" type="hidden" name="deviceId" value="<?php echo $DEVICEID; ?>">
<?php if ($DEVICE['approved'] != 0) { ?>
<?php if ($DEVICE['userIsAdmin']) { ?>
<div class="field">
2019-10-11 12:12:05 +00:00
<div class="label"><?php $LANGMNG->echo('l_owner'); ?></div>
2019-08-23 11:39:42 +00:00
<select class="input" name="deviceOwnerUserId">
2019-10-11 12:12:05 +00:00
<option value=""><?php $LANGMNG->echo('w_noOne'); ?></option>
<?php foreach ($USERS as $user) {
2019-08-23 11:39:42 +00:00
$userId = $user['user_id'];
$userName = $user['username'];
?>
<option value="<?php echo $userId; ?>" <?php ECHO ((int) $userId === (int) $DEVICE['owner'] ? 'selected="selected"' : ''); ?>><?php echo $userName; ?></option>
<?php } ?>
</select>
</div>
2019-10-11 12:12:05 +00:00
<div class="label"><?php $LANGMNG->echo('l_permission'); ?></div>
2019-08-23 11:39:42 +00:00
<div class="row">
2019-11-27 18:48:59 +00:00
2019-08-23 11:39:42 +00:00
<div class="col-6">
2019-10-11 12:12:05 +00:00
<div class="label"> - <?php $LANGMNG->echo('l_owner'); ?></div>
2019-08-23 11:39:42 +00:00
</div>
2019-11-27 18:48:59 +00:00
2019-08-23 11:39:42 +00:00
<div class="col-6">
<?php
2019-08-23 11:39:42 +00:00
$permissions = $DEVICE['permission'];
//Debug
if (DEBUGMOD == 1) {
echo '<pre>';
VAR_DUMP($permissions);
echo '</pre>';
}
?>
2019-10-11 12:12:05 +00:00
<input type="radio" name="permissionOwner" value=1 <?php ECHO ($permissions[0] == 1 ? 'checked' : ''); ?>/><?php $LANGMNG->echo('l_read'); ?>
<input type="radio" name="permissionOwner" value=2 <?php ECHO ($permissions[0] == 2 ? 'checked' : ''); ?>/><?php $LANGMNG->echo('l_use'); ?>
<input type="radio" name="permissionOwner" value=3 <?php ECHO ($permissions[0] == 3 ? 'checked' : ''); ?>/><?php $LANGMNG->echo('l_edit'); ?>
2019-11-27 18:48:59 +00:00
2019-08-23 11:39:42 +00:00
</div>
</div>
<div class="row">
<div class="col-6">
2019-10-11 12:12:05 +00:00
<div class="label"> - <?php $LANGMNG->echo('l_member'); ?></div>
2019-08-23 11:39:42 +00:00
</div>
<div class="col-6">
2019-10-11 12:12:05 +00:00
<input type="radio" name="permissionOther" value=1 <?php ECHO ($permissions[1] == 1 ? 'checked' : ''); ?>/><?php $LANGMNG->echo('l_read'); ?>
<input type="radio" name="permissionOther" value=2 <?php ECHO ($permissions[1] == 2 ? 'checked' : ''); ?>/><?php $LANGMNG->echo('l_use'); ?>
<input type="radio" name="permissionOther" value=3 <?php ECHO ($permissions[1] == 3 ? 'checked' : ''); ?>/><?php $LANGMNG->echo('l_edit'); ?>
2019-08-23 11:39:42 +00:00
</div>
</div>
<div class="field">
2019-10-11 12:12:05 +00:00
<div class="label"><?php $LANGMNG->echo('w_title'); ?></div>
2019-08-23 11:39:42 +00:00
<input class="input" type="text" name="deviceName" value="<?php echo $DEVICE['name']; ?>" <?php echo (!$DEVICE['userIsAdmin'] ? 'disabled' : ''); ?>>
</div>
<?php } ?>
<div class="field">
<div class="label">Token:</div>
<input class="input" type="text" name="deviceToken" value="<?php echo $DEVICE['token']; ?>" disabled>
</div>
2019-11-27 18:48:59 +00:00
<h4 class="mb-4"><?php $LANGMNG->echo('t_networkSetting'); ?></h4>
<div class="field">
<div class="label">Type:</div>
<input class="input" type="text" name="deviceToken" value="<?php echo $DEVICE['type']; ?>" disabled>
</div>
<div class="field">
<div class="label">IP:</div>
2019-11-27 18:48:59 +00:00
<input class="input" type="text" name="deviceToken" value="<?php echo $DEVICE['ip']; ?>" minlength="7" maxlength="15" size="15" pattern="^((\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.){3}(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])$" disabled>
</div>
<div class="field">
<div class="label">Subnet:</div>
<input class="input" type="text" name="deviceToken" value="<?php echo $DEVICE['subnet']; ?>" minlength="7" maxlength="15" size="15" pattern="^((\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.){3}(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])$" disabled>
</div>
<div class="field">
<div class="label">Gateway:</div>
<input class="input" type="text" name="deviceToken" value="<?php echo $DEVICE['gateway']; ?>" minlength="7" maxlength="15" size="15" pattern="^((\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.){3}(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])$" disabled>
</div>
2019-08-23 11:39:42 +00:00
<?php if ($DEVICE['userIsAdmin']) { ?>
2019-10-09 08:54:22 +00:00
<?php if (!in_array($SUBDEVICE['type'], ['on/off', 'door', 'water'])) { ?>
2019-08-23 11:39:42 +00:00
<div class="field">
2019-10-11 12:12:05 +00:00
<div class="label"><?php $LANGMNG->echo('l_sleepTime'); ?></div>
<input class="input" type="int" name="sleepTime" value="<?php echo $DEVICE['sleepTime']; ?>" <?php echo (!$DEVICE['userIsAdmin'] ? 'disabled' : ''); ?>>
2019-10-11 12:12:05 +00:00
<p>* - <?php $LANGMNG->echo('l_inMinutes'); ?></p>
2019-08-23 11:39:42 +00:00
</div>
<?php }?>
<div class="field">
2019-10-11 12:12:05 +00:00
<div class="label"><?php $LANGMNG->echo('w_room'); ?></div>
2019-08-23 11:39:42 +00:00
<select class="input" name="deviceOwnerId">
<?php foreach ($ROOMS as $room) {
2019-08-23 11:39:42 +00:00
$roomId = $room['room_id'];
$roomName = $room['name'];
2019-08-23 11:39:42 +00:00
?>
2019-09-09 19:30:03 +00:00
<option value="<?php echo $roomId; ?>" <?php ECHO ((int) $roomId === (int) $DEVICE['room'] ? 'selected="selected"' : ''); ?>><?php echo $roomName; ?></option>
2019-08-23 11:39:42 +00:00
<?php } ?>
</select>
</div>
<div class="field">
2019-10-11 12:12:05 +00:00
<div class="label"><?php $LANGMNG->echo('w_icon'); ?></div>
2019-08-23 11:39:42 +00:00
<select class="input fa" name="deviceIcon" <?php echo (!$DEVICE['userIsAdmin'] ? 'disabled' : ''); ?>>
2019-10-11 12:12:05 +00:00
<option value=""><?php $LANGMNG->echo('w_no'); ?><?php echo ' '; ?><?php $LANGMNG->echo('w_icon'); ?></option>
2019-08-23 11:39:42 +00:00
<option value="f0eb" <?php ECHO ($DEVICE['icon'] == "f0eb" ? 'selected="selected"' : ''); ?>>&#xf0eb; - fa-lightbulb-o</option>
<option value="f2dc" <?php ECHO ($DEVICE['icon'] == "f2dc" ? 'selected="selected"' : ''); ?>>&#xf2dc; - fa-snowflake-o</option>
<option value="f0e7" <?php ECHO ($DEVICE['icon'] == "f0e7" ? 'selected="selected"' : ''); ?>>&#xf0e7; - fa-bolt</option>
<option value="f2c7" <?php ECHO ($DEVICE['icon'] == "f2c7" ? 'selected="selected"' : ''); ?>>&#xf2c7; - fa-thermometer-full</option>
<option value="f236" <?php ECHO ($DEVICE['icon'] == "f236" ? 'selected="selected"' : ''); ?>>&#xf236; - fa-bed</option>
<option value="f185" <?php ECHO ($DEVICE['icon'] == "f185" ? 'selected="selected"' : ''); ?>>&#xf185; - fa-sun-o</option>
<option value="f2db" <?php ECHO ($DEVICE['icon'] == "f2db" ? 'selected="selected"' : ''); ?>>&#xf2db; - fa-microchip</option>
<option value="f011" <?php ECHO ($DEVICE['icon'] == "f011" ? 'selected="selected"' : ''); ?>>&#xf011; - fa-power-off</option>
<option value="f011" <?php ECHO ($DEVICE['icon'] == "f011" ? 'selected="selected"' : ''); ?>>&#xf108; - fa-desktop</option>
</select>
</div>
<?php } ?>
<div class="field">
2019-10-11 12:12:05 +00:00
<div class="label"><?php $LANGMNG->echo('w_moduls'); ?></div>
2019-08-23 11:39:42 +00:00
<div class="row no-gutters">
<?php foreach ($DEVICE['subDevices'] as $subDeviceKey => $subDevice) { ?>
<div class="device-button col-4 col-sm-3 col-xl-2 square-wrap">
2019-08-23 11:39:42 +00:00
<div class="square">
<div class="square-content">
2019-11-27 18:48:59 +00:00
<div class="row no-gutters">
<div class="col">
<h5 unselectable="on" class="fa">&#x<?php echo $DEVICE['icon'] ?></h5>
</div>
<div class="col">
<h5 unselectable="on" class="device-button-value text-right" title="<?php echo $subDevice['lastRecort']['time']; ?>"><?php echo $subDevice['lastRecort']['value'] . $subDevice['unit']?></h5>
</div>
2019-08-23 11:39:42 +00:00
</div>
2019-11-27 18:48:59 +00:00
<div class="row">
<div class="col button-text" unselectable="on" >
<?php echo $DEVICE['name']; ?>
</div>
2019-08-23 11:39:42 +00:00
</div>
</div>
</div>
</div>
<?php } ?>
2019-08-23 11:39:42 +00:00
</div>
</div>
2019-10-11 12:12:05 +00:00
<input type="submit" class="button" name="saveDevice" value="<?php $LANGMNG->echo('b_save'); ?>" <?php echo (!$DEVICE['userIsAdmin'] ? 'disabled' : ''); ?>/>
<input type="submit" class="button is-danger" name="disableDevice" value="<?php $LANGMNG->echo('b_disable'); ?>"/>
2019-08-23 11:39:42 +00:00
<?php } else { ?>
<div class="field">
2019-10-11 12:12:05 +00:00
<div class="label"><?php $LANGMNG->echo('w_moduls'); ?></div>
2019-08-23 11:39:42 +00:00
<div class="row no-gutters">
<?php foreach ($DEVICE['subDevices'] as $subDeviceKey => $subDevice) { ?>
<div class="device-button col-4 col-sm-3 col-xl-2 square-wrap">
2019-08-23 11:39:42 +00:00
<div class="square">
<div class="square-content">
2019-11-27 18:48:59 +00:00
<?php echo $DEVICE['name']; ?>
2019-08-23 11:39:42 +00:00
</div>
</div>
</div>
<?php } ?>
2019-08-23 11:39:42 +00:00
</div>
</div>
2019-10-11 12:12:05 +00:00
<input type="submit" class="button is-primary" name="approveDevice" value="<?php $LANGMNG->echo('b_approve'); ?>"/>
<input type="submit" class="button is-danger" name="disableDevice" value="<?php $LANGMNG->echo('b_disable'); ?>"/>
2019-08-23 11:39:42 +00:00
<?php } ?>
</form>
</div>
</div>