project structure refactoring
This commit is contained in:
		
							
								
								
									
										66
									
								
								app/views/templates/automation.phtml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										66
									
								
								app/views/templates/automation.phtml
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,66 @@
 | 
			
		||||
<!DOCTYPE html>
 | 
			
		||||
<html lang="en">
 | 
			
		||||
<head>
 | 
			
		||||
	<?php
 | 
			
		||||
	$partial = new Partial('head');
 | 
			
		||||
	$partial->prepare('baseDir', $BASEDIR);
 | 
			
		||||
	$partial->render();
 | 
			
		||||
	?>
 | 
			
		||||
	<title><?php echo $TITLE ?></title>
 | 
			
		||||
</head>
 | 
			
		||||
<body class="no-transitions">
 | 
			
		||||
	<div class="row no-gutters main">
 | 
			
		||||
		<div class="col-md-3 d-sm-none"></div>
 | 
			
		||||
		<div class="col-md-3 nav-container">
 | 
			
		||||
			<?php
 | 
			
		||||
			$partial = new Partial('menu');
 | 
			
		||||
			$partial->prepare('item','automation');
 | 
			
		||||
			$partial->prepare('langMng',$LANGMNG);
 | 
			
		||||
			$partial->prepare('debugMod',$DEBUGMOD);
 | 
			
		||||
			$partial->render();
 | 
			
		||||
			?>
 | 
			
		||||
		</div>
 | 
			
		||||
		<div class="col-md-9 main-body">
 | 
			
		||||
			<a class="button is-primary m-1" onClick="$('#modal').removeClass('modal-container-hiden').show();"><?php $LANGMNG->echo('t_createAutomation'); ?></a>
 | 
			
		||||
			<div class="row no-gutters">
 | 
			
		||||
				<?php foreach ($AUTOMATIONS as $automationId => $automationData) {
 | 
			
		||||
					//BUTTON
 | 
			
		||||
					$partial = new Partial('automationButton');
 | 
			
		||||
					$partial->prepare('langMng',$LANGMNG);
 | 
			
		||||
					$partial->prepare('automationId',$automationId);
 | 
			
		||||
					$partial->prepare('automationData',$automationData);
 | 
			
		||||
					$partial->render();
 | 
			
		||||
 | 
			
		||||
					//EDIT
 | 
			
		||||
					$partial = new Partial('automationEdit');
 | 
			
		||||
					$partial->prepare('langMng',$LANGMNG);
 | 
			
		||||
					$partial->prepare('userManager',$USERMANAGER);
 | 
			
		||||
					$partial->prepare('automationId',$automationId);
 | 
			
		||||
					$partial->prepare('automation',$automationData);
 | 
			
		||||
					$partial->prepare('subDevices',$SUBDEVICES);
 | 
			
		||||
					$partial->render();
 | 
			
		||||
				} ?>
 | 
			
		||||
			</div>
 | 
			
		||||
		</div>
 | 
			
		||||
	</div>
 | 
			
		||||
	<?php
 | 
			
		||||
	if (isset($_POST['modalNext'])) {
 | 
			
		||||
		$partial = new Partial('automationCreateFinal');
 | 
			
		||||
		$partial->prepare('langMng',$LANGMNG);
 | 
			
		||||
		$partial->prepare('userManager',$USERMANAGER);
 | 
			
		||||
		$partial->prepare('subDevices',$SUBDEVICES);
 | 
			
		||||
		$partial->render();
 | 
			
		||||
	} else {
 | 
			
		||||
		$partial = new Partial('automationCreate');
 | 
			
		||||
		$partial->prepare('langMng',$LANGMNG);
 | 
			
		||||
 | 
			
		||||
		$partial->prepare('subDevices',$SUBDEVICES);
 | 
			
		||||
		$partial->render();
 | 
			
		||||
	}?>
 | 
			
		||||
	<script src="./app/templates/js/automation.js"></script>
 | 
			
		||||
	<?php
 | 
			
		||||
	$partial = new Partial('footer');
 | 
			
		||||
	$partial->render();
 | 
			
		||||
	?>
 | 
			
		||||
</body>
 | 
			
		||||
</html>
 | 
			
		||||
							
								
								
									
										67
									
								
								app/views/templates/dashboard.phtml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										67
									
								
								app/views/templates/dashboard.phtml
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,67 @@
 | 
			
		||||
<!DOCTYPE html>
 | 
			
		||||
<html lang="en">
 | 
			
		||||
<head>
 | 
			
		||||
	<?php
 | 
			
		||||
	$partial = new Partial('head');
 | 
			
		||||
	$partial->prepare('baseDir', $BASEDIR);
 | 
			
		||||
	$partial->render();
 | 
			
		||||
	?>
 | 
			
		||||
	<title><?php echo $TITLE; ?></title>
 | 
			
		||||
</head>
 | 
			
		||||
<body class="no-transitions">
 | 
			
		||||
	<div class="row no-gutters main">
 | 
			
		||||
		<div class="col-md-3 d-sm-none"></div>
 | 
			
		||||
		<div class="col-md-3 nav-container">
 | 
			
		||||
			<?php
 | 
			
		||||
			$partial = new Partial('menu');
 | 
			
		||||
			$partial->prepare('item', 'dashboard');
 | 
			
		||||
			$partial->prepare('langMng',$LANGMNG);
 | 
			
		||||
			$partial->prepare('debugMod',$DEBUGMOD);
 | 
			
		||||
			$partial->render();
 | 
			
		||||
			?>
 | 
			
		||||
		</div>
 | 
			
		||||
		<div class="col-md-9 main-body">
 | 
			
		||||
			<a onClick="$('#modal').removeClass('modal-container-hiden').show();" class="button is-primary m-1"><?php $LANGMNG->echo('t_addDevice'); ?></a>
 | 
			
		||||
			<div class="row no-gutters">
 | 
			
		||||
				<?php foreach ($DASHBOARD as $dashboardItemId => $dashboardItemData) {
 | 
			
		||||
					$partialDeviceButton = new Partial('dashboardButton');
 | 
			
		||||
					$partialDeviceButton->prepare('dashboardItemData', $dashboardItemData);
 | 
			
		||||
 | 
			
		||||
					$partialDeviceButton->render();
 | 
			
		||||
				} ?>
 | 
			
		||||
			</div>
 | 
			
		||||
		</div>
 | 
			
		||||
	</div>
 | 
			
		||||
 | 
			
		||||
	<div class="modal-container modal-container-hiden" id="modal">
 | 
			
		||||
		<div class="modal">
 | 
			
		||||
			<div class="close">
 | 
			
		||||
				<i class="fa fa-times"></i>
 | 
			
		||||
			</div>
 | 
			
		||||
			<h4 class="mb-4"><?php $LANGMNG->echo('t_addDevice'); ?></h4>
 | 
			
		||||
			<form method="post">
 | 
			
		||||
				<div class="field px-2">
 | 
			
		||||
					<div class="label"><?php $LANGMNG->echo('l_choseDevice'); ?>:</div>
 | 
			
		||||
					<select class="input" name="devices[]" multiple required>
 | 
			
		||||
						<?php foreach ($SUBDEVICES as $subDeviceKey => $subDeviceValue){ ?>
 | 
			
		||||
							<option value="<?php echo $subDeviceKey; ?>"><?php echo $subDeviceValue['name'] . '[' . $subDeviceValue['type']  . ']'; ?></option>
 | 
			
		||||
						<?php } ?>
 | 
			
		||||
					</select>
 | 
			
		||||
				</div>
 | 
			
		||||
				<input type="submit" class="button" name="modalFinal" value="<?php $LANGMNG->echo('b_create'); ?>"/>
 | 
			
		||||
			</form>
 | 
			
		||||
		</div>
 | 
			
		||||
	</div>
 | 
			
		||||
 | 
			
		||||
	<?php
 | 
			
		||||
	if (isset($_POST['deviceId'])) {
 | 
			
		||||
		$partial = new Partial('deviceEdit');
 | 
			
		||||
		$partial->prepare('DEVICEDATA', $DEVICEDATA);
 | 
			
		||||
 | 
			
		||||
		$partial->render();
 | 
			
		||||
	}
 | 
			
		||||
	$partial = new Partial('footer');
 | 
			
		||||
	$partial->render();
 | 
			
		||||
	?>
 | 
			
		||||
</body>
 | 
			
		||||
</html>
 | 
			
		||||
							
								
								
									
										107
									
								
								app/views/templates/home.phtml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										107
									
								
								app/views/templates/home.phtml
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,107 @@
 | 
			
		||||
<!DOCTYPE html>
 | 
			
		||||
<html lang="en">
 | 
			
		||||
<head>
 | 
			
		||||
	<?php
 | 
			
		||||
	$partial = new Partial('head');
 | 
			
		||||
	$partial->prepare('baseDir', $BASEDIR);
 | 
			
		||||
	$partial->render();
 | 
			
		||||
	?>
 | 
			
		||||
	<title><?php echo $TITLE ?></title>
 | 
			
		||||
</head>
 | 
			
		||||
<body class="no-transitions">
 | 
			
		||||
	<div class="row no-gutters main">
 | 
			
		||||
		<div class="col-md-3 d-sm-none"></div>
 | 
			
		||||
		<div class="col-md-3 nav-container">
 | 
			
		||||
			<?php
 | 
			
		||||
			$partial = new Partial('menu');
 | 
			
		||||
			$partial->prepare('item', 'home');
 | 
			
		||||
			$partial->prepare('langMng',$LANGMNG);
 | 
			
		||||
			$partial->prepare('debugMod',$DEBUGMOD);
 | 
			
		||||
			$partial->render();
 | 
			
		||||
			?>
 | 
			
		||||
		</div>
 | 
			
		||||
 | 
			
		||||
		<script src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.7.3/Chart.bundle.min.js"></script>
 | 
			
		||||
 | 
			
		||||
		<div class="col-md-9 main-body">
 | 
			
		||||
			<div class="label m-1">
 | 
			
		||||
				<?php
 | 
			
		||||
				if ($USERSATHOME != "") {
 | 
			
		||||
					$LANGMNG->echo('l_atHome');
 | 
			
		||||
					echo ': ' . $USERSATHOME;
 | 
			
		||||
				}
 | 
			
		||||
				?>
 | 
			
		||||
			</div>
 | 
			
		||||
			<div class="m-1">
 | 
			
		||||
				<select class="select" name="room">
 | 
			
		||||
					<option value="all">All</option>
 | 
			
		||||
					<?php foreach ($ROOMS as $key => $room) {
 | 
			
		||||
						if ($room['device_count'] > 0) { ?>
 | 
			
		||||
							<option value="<?php echo $room['room_id']?>"><?php echo $room['name'] ?></option>
 | 
			
		||||
						<?php } ?>
 | 
			
		||||
					<?php } ?>
 | 
			
		||||
				</select>
 | 
			
		||||
			</div>
 | 
			
		||||
			<div class="row no-gutters">
 | 
			
		||||
				<?php foreach ($DATA as $roomId => $room) { ?>
 | 
			
		||||
					<?php foreach ($room['devices'] as $deviceId => $device) { ?>
 | 
			
		||||
						<?php foreach ($device['subDevices'] as $subDeviceKey => $subDevice) {
 | 
			
		||||
							//BUTTON
 | 
			
		||||
							$partialDeviceButton = new Partial('deviceButton');
 | 
			
		||||
							$partialDeviceButton->prepare('roomid',$roomId);
 | 
			
		||||
							$partialDeviceButton->prepare('subdeviceid',$subDeviceKey);
 | 
			
		||||
							$partialDeviceButton->prepare('subdevice',$subDevice);
 | 
			
		||||
							$partialDeviceButton->prepare('deviceid',$deviceId);
 | 
			
		||||
							$partialDeviceButton->prepare('device',$device);
 | 
			
		||||
 | 
			
		||||
							$partialDeviceButton->render();
 | 
			
		||||
 | 
			
		||||
							//DETAIL
 | 
			
		||||
							$partialDetail = new Partial('deviceDetail');
 | 
			
		||||
							$partialDetail->prepare('subdeviceid',$subDeviceKey);
 | 
			
		||||
							$partialDetail->prepare('subdevice',$subDevice);
 | 
			
		||||
							$partialDetail->prepare('device',$device);
 | 
			
		||||
							$partialDetail->prepare('langMng',$LANGMNG);
 | 
			
		||||
 | 
			
		||||
							$partialDetail->render();
 | 
			
		||||
 | 
			
		||||
							//SETTING
 | 
			
		||||
							$partialEdit = new Partial('deviceEdit');
 | 
			
		||||
							$partialEdit->prepare('deviceid',$deviceId);
 | 
			
		||||
							$partialEdit->prepare('subdevice',$subDevice);
 | 
			
		||||
							$partialEdit->prepare('device',$device);
 | 
			
		||||
							$partialEdit->prepare('users',$USERS);
 | 
			
		||||
							$partialEdit->prepare('rooms',$ROOMS);
 | 
			
		||||
							$partialEdit->prepare('langMng',$LANGMNG);
 | 
			
		||||
 | 
			
		||||
							$partialEdit->render();
 | 
			
		||||
						}
 | 
			
		||||
					}
 | 
			
		||||
				} ?>
 | 
			
		||||
			</div>
 | 
			
		||||
		</div>
 | 
			
		||||
	</div>
 | 
			
		||||
	<?php
 | 
			
		||||
	$partial = new Partial('footer');
 | 
			
		||||
	$partial->render();
 | 
			
		||||
	?>
 | 
			
		||||
	<script>
 | 
			
		||||
		$(document).on('keyup mouseup', '#value_control', function(event) { 					
 | 
			
		||||
			$.ajax({
 | 
			
		||||
				url: 'ajax',
 | 
			
		||||
				type: 'POST',
 | 
			
		||||
				//TODO: GET Attribute from ID
 | 
			
		||||
				data: { subDevice_id : '46', action : 'set', value: this.value},
 | 
			
		||||
				success: function(msg){
 | 
			
		||||
					console.log("message");
 | 
			
		||||
					console.log(msg);
 | 
			
		||||
				},
 | 
			
		||||
				error: function (request, status, error) {
 | 
			
		||||
					console.log('0');
 | 
			
		||||
				}
 | 
			
		||||
			});
 | 
			
		||||
			console.log(this.value);
 | 
			
		||||
		});	
 | 
			
		||||
	</script>
 | 
			
		||||
</body>
 | 
			
		||||
</html>
 | 
			
		||||
							
								
								
									
										20
									
								
								app/views/templates/loading.css
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										20
									
								
								app/views/templates/loading.css
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,20 @@
 | 
			
		||||
.loader {
 | 
			
		||||
  border: 16px solid #f3f3f3;
 | 
			
		||||
  border-radius: 50%;
 | 
			
		||||
  border-top: 16px solid #3498db;
 | 
			
		||||
  width: 120px;
 | 
			
		||||
  height: 120px;
 | 
			
		||||
  -webkit-animation: spin 2s linear infinite; /* Safari */
 | 
			
		||||
  animation: spin 2s linear infinite;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/* Safari */
 | 
			
		||||
@-webkit-keyframes spin {
 | 
			
		||||
  0% { -webkit-transform: rotate(0deg); }
 | 
			
		||||
  100% { -webkit-transform: rotate(360deg); }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@keyframes spin {
 | 
			
		||||
  0% { transform: rotate(0deg); }
 | 
			
		||||
  100% { transform: rotate(360deg); }
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										57
									
								
								app/views/templates/log.phtml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										57
									
								
								app/views/templates/log.phtml
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,57 @@
 | 
			
		||||
<!DOCTYPE html>
 | 
			
		||||
<html lang="en">
 | 
			
		||||
<head>
 | 
			
		||||
    <?php
 | 
			
		||||
    $partial = new Partial('head');
 | 
			
		||||
    $partial->prepare('baseDir', $BASEDIR);
 | 
			
		||||
    $partial->render();
 | 
			
		||||
    ?>
 | 
			
		||||
    <title><?php echo $TITLE ?></title>
 | 
			
		||||
</head>
 | 
			
		||||
<body class="no-transitions">
 | 
			
		||||
    <div class="row no-gutters main">
 | 
			
		||||
        <div class="col-md-3 d-sm-none"></div>
 | 
			
		||||
        <div class="col-md-3 nav-container">
 | 
			
		||||
            <?php
 | 
			
		||||
            $partial = new Partial('menu');
 | 
			
		||||
            $partial->prepare('item', 'log');
 | 
			
		||||
            $partial->prepare('langMng',$LANGMNG);
 | 
			
		||||
            $partial->prepare('debugMod',$DEBUGMOD);
 | 
			
		||||
            $partial->render();
 | 
			
		||||
            ?>
 | 
			
		||||
        </div>
 | 
			
		||||
        <div class="col-md-9 main-body">
 | 
			
		||||
            <div class="col-12 col-sm-9 mx-auto mt-4">
 | 
			
		||||
                <label><?php echo $LANGMNG->get('l_logMaxLiveTime') . " " . $LOGTOLIVETIME . " days";?></label>
 | 
			
		||||
                <form method="post" action="">
 | 
			
		||||
                    <div class="field">
 | 
			
		||||
                        <select class="input" name="LogFile">
 | 
			
		||||
                            <?php foreach ($LOGSFILES as $key => $value) { ?>
 | 
			
		||||
                                <option value="<?php echo $value; ?>"><?php echo $value; ?></option>
 | 
			
		||||
                            <?php } ?>
 | 
			
		||||
                        </select>
 | 
			
		||||
                    </div>
 | 
			
		||||
                    <div class="field">
 | 
			
		||||
                        <input type="submit" class="button" name="selectFile" value="<?php $LANGMNG->echo('b_select');?>"/>
 | 
			
		||||
                    </div>
 | 
			
		||||
                </form>
 | 
			
		||||
                <?php
 | 
			
		||||
                if (isset($_POST['LogFile'])) {
 | 
			
		||||
                    $file_lines = file('./app/logs/' . $_POST['LogFile']);
 | 
			
		||||
                    echo '<pre style="overflow: auto;">';
 | 
			
		||||
                    foreach ($file_lines as $line) {
 | 
			
		||||
                        echo $line;
 | 
			
		||||
                    }
 | 
			
		||||
                    echo '</pre>';
 | 
			
		||||
                }
 | 
			
		||||
                ?>
 | 
			
		||||
            </div>
 | 
			
		||||
        </div>
 | 
			
		||||
 | 
			
		||||
        <?php
 | 
			
		||||
        $partial = new Partial('footer');
 | 
			
		||||
        $partial->render();
 | 
			
		||||
        //TODO js do main.js
 | 
			
		||||
        ?>
 | 
			
		||||
    </body>
 | 
			
		||||
    </html>
 | 
			
		||||
							
								
								
									
										27
									
								
								app/views/templates/login.phtml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										27
									
								
								app/views/templates/login.phtml
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,27 @@
 | 
			
		||||
<!DOCTYPE html>
 | 
			
		||||
<html lang="en">
 | 
			
		||||
<head>
 | 
			
		||||
	<?php
 | 
			
		||||
	$partial = new Partial('head');
 | 
			
		||||
	$partial->render();
 | 
			
		||||
	?>
 | 
			
		||||
	<title><?php echo $TITLE ?></title>
 | 
			
		||||
</head>
 | 
			
		||||
<body class="no-transitions">
 | 
			
		||||
	<?php
 | 
			
		||||
	if (isset($ota) && $ota != '') {	
 | 
			
		||||
		$partial = new Partial('loginOta');
 | 
			
		||||
		$partial->prepare('ota',$ota);
 | 
			
		||||
		$partial->render();
 | 
			
		||||
	} else {
 | 
			
		||||
		$partial = new Partial('loginForm');
 | 
			
		||||
		$partial->render();
 | 
			
		||||
	}
 | 
			
		||||
	?>
 | 
			
		||||
	
 | 
			
		||||
	<?php
 | 
			
		||||
	$partial = new Partial('footer');
 | 
			
		||||
	$partial->render();
 | 
			
		||||
	?>
 | 
			
		||||
</body>
 | 
			
		||||
</html>
 | 
			
		||||
							
								
								
									
										70
									
								
								app/views/templates/part/automationButton.phtml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										70
									
								
								app/views/templates/part/automationButton.phtml
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,70 @@
 | 
			
		||||
<div class="col-12 col-md-6 col-xl-4 square-wrap">
 | 
			
		||||
    <div class="rectangle-2">
 | 
			
		||||
        <div class="square-content double <?php echo ($AUTOMATIONDATA['active'] == 0 ? 'is-inactive' : ''); ?>" id="automation-<?php echo $AUTOMATIONID; ?>">
 | 
			
		||||
            <div class="row">
 | 
			
		||||
                <div class="col-1">
 | 
			
		||||
                    <h5 class="fa">
 | 
			
		||||
                        <?php
 | 
			
		||||
                        //echo $AUTOMATIONDATA['ifSomething'];
 | 
			
		||||
                        $ifCode = json_decode($AUTOMATIONDATA['ifSomething']);
 | 
			
		||||
                        switch ($ifCode->type) {
 | 
			
		||||
                            case 'sunSet':
 | 
			
		||||
                            echo'';
 | 
			
		||||
                            break;
 | 
			
		||||
 | 
			
		||||
                            case 'sunRise':
 | 
			
		||||
                            echo' ';
 | 
			
		||||
                            break;
 | 
			
		||||
 | 
			
		||||
                            case 'inHome':
 | 
			
		||||
                            echo'';
 | 
			
		||||
                            break;
 | 
			
		||||
 | 
			
		||||
                            case 'outHome':
 | 
			
		||||
                            echo'';
 | 
			
		||||
                            break;
 | 
			
		||||
 | 
			
		||||
                            case 'outDevice':
 | 
			
		||||
                            echo'';
 | 
			
		||||
                            break;
 | 
			
		||||
 | 
			
		||||
                            default:
 | 
			
		||||
                            echo'';
 | 
			
		||||
                            break;
 | 
			
		||||
                        }
 | 
			
		||||
                        ?>
 | 
			
		||||
                    </h5>
 | 
			
		||||
                </div>
 | 
			
		||||
                <div class="col">
 | 
			
		||||
                    <h5 class="text-right break-all">
 | 
			
		||||
                        <?php
 | 
			
		||||
                        /*if (!in_array($AUTOMATIONDATA['ifSomething'], ["sunRise", "sunSet"])) {
 | 
			
		||||
                            echo $AUTOMATIONDATA['ifSomething'];
 | 
			
		||||
                        }*/
 | 
			
		||||
                        echo $AUTOMATIONDATA['name'];
 | 
			
		||||
                        ?>
 | 
			
		||||
                    </h5>
 | 
			
		||||
                </div>
 | 
			
		||||
            </div>
 | 
			
		||||
            <div class="row">
 | 
			
		||||
                <div class="col">
 | 
			
		||||
                    <?php echo implode(', ',$AUTOMATIONDATA['onDays']);?>
 | 
			
		||||
                </div>
 | 
			
		||||
                <div class="col">
 | 
			
		||||
                    <?php echo $AUTOMATIONDATA['owner_name'];?>
 | 
			
		||||
                </div>
 | 
			
		||||
                <div class="col">
 | 
			
		||||
                    <?php echo $AUTOMATIONDATA['execution_time'];?>
 | 
			
		||||
                </div>
 | 
			
		||||
            </div>
 | 
			
		||||
            <div class="row">
 | 
			
		||||
                <div class="col">
 | 
			
		||||
                    <a class="button is-primary m-1" onClick="restartAutomation(<?php echo $AUTOMATIONID; ?>);"><?php $LANGMNG->echo('b_restart')?></a>
 | 
			
		||||
                </div>
 | 
			
		||||
                <div class="col">
 | 
			
		||||
                    <a class="button is-primary m-1" onClick="toggleAutomation(<?php echo $AUTOMATIONID; ?>);"><?php $LANGMNG->echo('b_disable')?></a>
 | 
			
		||||
                </div>
 | 
			
		||||
            </div>
 | 
			
		||||
        </div>
 | 
			
		||||
    </div>
 | 
			
		||||
</div>
 | 
			
		||||
							
								
								
									
										69
									
								
								app/views/templates/part/automationCreate.phtml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										69
									
								
								app/views/templates/part/automationCreate.phtml
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,69 @@
 | 
			
		||||
<div class="modal-container modal-container-hiden" id="modal">
 | 
			
		||||
    <div class="modal">
 | 
			
		||||
        <a href=""><i class="fa fa-times close"></i></a>
 | 
			
		||||
        <h4 class="mb-4"><?php $LANGMNG->echo('t_createAutomation')?></h4>
 | 
			
		||||
        <form method="post"  action="" >
 | 
			
		||||
            <div class="field">
 | 
			
		||||
                <div class="label"><?php $LANGMNG->echo('l_nameAt')?></div>
 | 
			
		||||
                <div class="field">
 | 
			
		||||
                    <input class="input" type="text" name="name" required/>
 | 
			
		||||
                </div>
 | 
			
		||||
                <div class="label"><?php $LANGMNG->echo('l_runAt')?></div>
 | 
			
		||||
                <div class="field">
 | 
			
		||||
                    <select class="input" name="atSelector" id="valueSelector" required>
 | 
			
		||||
                        <option	value="sunSet"><?php $LANGMNG->echo('l_sunSet')?></option>
 | 
			
		||||
                        <option	value="sunRise"><?php $LANGMNG->echo('l_sunRice')?></option>
 | 
			
		||||
                        <option	value="inHome"><?php $LANGMNG->echo('l_inHome')?></option>
 | 
			
		||||
                        <option	value="outHome"><?php $LANGMNG->echo('l_outHome')?></option>
 | 
			
		||||
                        <option	value="time"><?php $LANGMNG->echo('l_time')?></option>
 | 
			
		||||
                        <option	value="atDeviceValue"><?php $LANGMNG->echo('l_deviceValue');?></option>
 | 
			
		||||
                        <option	value="noOneHome"><?php $LANGMNG->echo('w_noOne') . ' ' . $LANGMNG->get('w_neni') . ' ' . $LANGMNG->get('w_home');?></option>
 | 
			
		||||
                        <option	value="someOneHome"><?php $LANGMNG->echo('w_someOne') . ' ' . $LANGMNG->get('w_is') . ' ' . $LANGMNG->get('w_home');?></option>
 | 
			
		||||
                    </select>
 | 
			
		||||
                    <input class="input" type="time" name="atTime" id="atTime" disabled/>
 | 
			
		||||
                    <select class="input" name="atDeviceValue" id="atDeviceValue" disabled>
 | 
			
		||||
                        <?php foreach ($SUBDEVICES as $subDeviceKey => $subDeviceValue){ ?>
 | 
			
		||||
                            <option value="<?php echo $subDeviceKey; ?>"><?php echo $subDeviceValue['name']; ?>[<?php echo $subDeviceValue['type'];  ?>]</option>
 | 
			
		||||
                        <?php } ?>
 | 
			
		||||
                    </select>
 | 
			
		||||
                    =
 | 
			
		||||
                    <input class="input" type="num" name="atDeviceValueInt" id="atDeviceValueInt" required disabled/>
 | 
			
		||||
                </div>
 | 
			
		||||
 | 
			
		||||
                <div class="label"><?php $LANGMNG->echo('l_affectedDevices')?></div>
 | 
			
		||||
                <div class="field">
 | 
			
		||||
                    <select class="input" name="devices[]" multiple>
 | 
			
		||||
                        <?php foreach ($SUBDEVICES as $subDeviceKey => $subDeviceValue){
 | 
			
		||||
                            if ($subDeviceValue['type'] != 'on/off') continue;?>
 | 
			
		||||
                            <option value="<?php echo $subDeviceValue['masterDevice']; ?>"><?php echo $subDeviceValue['name']; ?></option>
 | 
			
		||||
                        <?php } ?>
 | 
			
		||||
                    </select>
 | 
			
		||||
 | 
			
		||||
                </div>
 | 
			
		||||
                <div class="label"><?php $LANGMNG->echo('l_atDays')?></div>
 | 
			
		||||
                <div class="field">
 | 
			
		||||
                    <input type="checkbox" name="day[]" value="mon"/> <?php $LANGMNG->echo('d_monday'); ?>
 | 
			
		||||
                </div>
 | 
			
		||||
                <div class="field">
 | 
			
		||||
                    <input type="checkbox" name="day[]" value="tue"/> <?php $LANGMNG->echo('d_tuesday'); ?>
 | 
			
		||||
                </div>
 | 
			
		||||
                <div class="field">
 | 
			
		||||
                    <input type="checkbox" name="day[]" value="wed"/> <?php $LANGMNG->echo('d_wednesday'); ?>
 | 
			
		||||
                </div>
 | 
			
		||||
                <div class="field">
 | 
			
		||||
                    <input type="checkbox" name="day[]" value="thu"/> <?php $LANGMNG->echo('d_thursday'); ?>
 | 
			
		||||
                </div>
 | 
			
		||||
                <div class="field">
 | 
			
		||||
                    <input type="checkbox" name="day[]" value="fri"/> <?php $LANGMNG->echo('d_friday'); ?>
 | 
			
		||||
                </div>
 | 
			
		||||
                <div class="field">
 | 
			
		||||
                    <input type="checkbox" name="day[]" value="sat"/> <?php $LANGMNG->echo('d_saturday'); ?>
 | 
			
		||||
                </div>
 | 
			
		||||
                <div class="field">
 | 
			
		||||
                    <input type="checkbox" name="day[]" value="sun"/> <?php $LANGMNG->echo('d_sunday'); ?>
 | 
			
		||||
                </div>
 | 
			
		||||
            </div>
 | 
			
		||||
            <input type="submit" class="button" name="modalNext" value="<?php $LANGMNG->echo('b_next')?>"/>
 | 
			
		||||
        </form>
 | 
			
		||||
    </div>
 | 
			
		||||
</div>
 | 
			
		||||
							
								
								
									
										44
									
								
								app/views/templates/part/automationCreateFinal.phtml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										44
									
								
								app/views/templates/part/automationCreateFinal.phtml
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,44 @@
 | 
			
		||||
<div class="modal-container" id="modal">
 | 
			
		||||
    <div class="modal" action="" >
 | 
			
		||||
        <a href=""><i class="fa fa-times close"></i></a>
 | 
			
		||||
        <h4 class="mb-4"><?php $LANGMNG->echo('t_createAutomation'); ?></h4>
 | 
			
		||||
        <form method="post">
 | 
			
		||||
            <div class="field">
 | 
			
		||||
                <input type="hidden" name="action" value="add" required/>
 | 
			
		||||
                <input type="hidden" name="atSelector" value="<?php echo $_POST['atSelector']; ?>" required/>
 | 
			
		||||
                <input type="hidden" name="name" value="<?php echo $_POST['name']; ?>" required/>
 | 
			
		||||
                <input type="hidden" name="atSelectorValue" value="<?php if (isset($_POST['atTime'])) {
 | 
			
		||||
                    echo $_POST['atTime'];
 | 
			
		||||
                } else if (isset($_POST['atDeviceValue'])) {
 | 
			
		||||
                    $subDeviceId = $_POST['atDeviceValue'];
 | 
			
		||||
                    $subDeviceValue = $_POST['atDeviceValueInt'];
 | 
			
		||||
                    $subDevice = SubDeviceManager::getSubDevice($subDeviceId);
 | 
			
		||||
                    $subDeviceMaster = SubDeviceManager::getSubDeviceMaster($subDeviceId,$subDevice['type']);
 | 
			
		||||
 | 
			
		||||
                    $json = json_encode([
 | 
			
		||||
                        'deviceID' => $subDeviceMaster['device_id'],
 | 
			
		||||
                        'type'=> htmlspecialchars($subDevice['type']),
 | 
			
		||||
                        'value'=> $subDeviceValue,
 | 
			
		||||
                    ]);
 | 
			
		||||
                    echo  htmlspecialchars($json);
 | 
			
		||||
                } else {
 | 
			
		||||
                    if ($_POST['atSelector'] == "inHome" || $_POST['atSelector'] == "outHome") {
 | 
			
		||||
                       echo $USERMANAGER->getUserData('user_id');
 | 
			
		||||
                    } else {
 | 
			
		||||
                        echo $_POST['atSelector'];
 | 
			
		||||
                    }
 | 
			
		||||
                } ?>" required/>
 | 
			
		||||
                <input type="hidden" name="atDays" value="<?php echo htmlspecialchars(($_POST['day'] != '' ? json_encode($_POST['day']) : '')); ?>" required/>
 | 
			
		||||
                <?php foreach ($_POST['devices'] as $value) { ?>
 | 
			
		||||
                    <?php $deviceData = DeviceManager::getDeviceById($value); ?>
 | 
			
		||||
                    <div class="label"><?php echo $deviceData['name'];?></div>
 | 
			
		||||
                    <select class="input" name="device[<?php echo $deviceData['device_id'];?>]">
 | 
			
		||||
                        <option	value="1">ON</option>
 | 
			
		||||
                        <option	value="0">OFF</option>
 | 
			
		||||
                    </select>
 | 
			
		||||
                <?php } ?>
 | 
			
		||||
            </div>
 | 
			
		||||
            <input type="submit" class="button" name="modalFinal" value="<?php $LANGMNG->echo('b_finish'); ?>"/>
 | 
			
		||||
        </form>
 | 
			
		||||
    </div>
 | 
			
		||||
</div>
 | 
			
		||||
							
								
								
									
										85
									
								
								app/views/templates/part/automationEdit.phtml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										85
									
								
								app/views/templates/part/automationEdit.phtml
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,85 @@
 | 
			
		||||
<div class="modal-container modal-container-hiden" id="modal-setting-<?php echo $AUTOMATIONID; ?>">
 | 
			
		||||
    <div class="modal">
 | 
			
		||||
        <div class="close">
 | 
			
		||||
            <i class="fa fa-times"></i>
 | 
			
		||||
        </div>
 | 
			
		||||
        <h4 class="mb-4"><?php $LANGMNG->echo('t_createAutomation');?></h4>
 | 
			
		||||
        <form method="post">
 | 
			
		||||
            <input type="hidden" name="action" value="edit" required/>
 | 
			
		||||
            <input name="automation_id" type="hidden" value="<?php echo $AUTOMATIONID; ?>">
 | 
			
		||||
            <div class="field">
 | 
			
		||||
                <div class="label"><?php $LANGMNG->echo('l_nameAt');?></div>
 | 
			
		||||
                <div class="field">
 | 
			
		||||
                    <input class="input" type="text" name="name" value="<?php echo (isset ($AUTOMATION['name']) ? $AUTOMATION['name'] : ""); ?>" required/>
 | 
			
		||||
                </div>
 | 
			
		||||
                <div class="label"><?php $LANGMNG->echo('l_runAt');?></div>
 | 
			
		||||
                <div class="field">
 | 
			
		||||
                    <?php //TODO Dodělat identifikaci pro Selctor události a selector času zařízení hodnoty ?>
 | 
			
		||||
                    <select class="input" name="atSelector" id="valueSelector" required>
 | 
			
		||||
                        <option	value="sunSet" <?php ECHO (json_decode($AUTOMATION['ifSomething'], true)['type'] == "sunSet" ? 'selected="selected"' : ''); ?>><?php $LANGMNG->echo('l_sunSet');?></option>
 | 
			
		||||
                        <option	value="sunRise" <?php ECHO (json_decode($AUTOMATION['ifSomething'], true)['type'] == "sunRise" ? 'selected="selected"' : ''); ?>><?php $LANGMNG->echo('l_sunRice');?></option>
 | 
			
		||||
                        <option	value="inHome" <?php ECHO (json_decode($AUTOMATION['ifSomething'], true)['type'] == "inHome" ? 'selected="selected"' : ''); ?>><?php $LANGMNG->echo('l_inHome');?></option>
 | 
			
		||||
                        <option	value="outHome" <?php ECHO (json_decode($AUTOMATION['ifSomething'], true)['type'] == "outHome" ? 'selected="selected"' : ''); ?>><?php $LANGMNG->echo('l_outHome');?></option>
 | 
			
		||||
                        <option	value="time" <?php ECHO (json_decode($AUTOMATION['ifSomething'], true)['type'] == "time" ? 'selected="selected"' : ''); ?>><?php $LANGMNG->echo('l_time');?></option>
 | 
			
		||||
                        <option	value="atDeviceValue" <?php ECHO (json_decode($AUTOMATION['ifSomething'], true)['type'] == "atDeviceValue" ? 'selected="selected"' : ''); ?>><?php $LANGMNG->echo('l_deviceValue');;?></option>
 | 
			
		||||
                        <option	value="noOneHome" <?php ECHO (json_decode($AUTOMATION['ifSomething'], true)['type'] == "noOneHome" ? 'selected="selected"' : ''); ?>><?php $LANGMNG->echo('w_noOne'); echo ' ' . $LANGMNG->get('w_neni') . ' ' . $LANGMNG->get('w_home');?></option>
 | 
			
		||||
                        <option	value="someOneHome" <?php ECHO (json_decode($AUTOMATION['ifSomething'], true)['type'] == "someOneHome" ? 'selected="selected"' : ''); ?>><?php $LANGMNG->echo('w_someOne'); echo ' ' . $LANGMNG->get('w_is') . ' ' . $LANGMNG->get('w_home');?></option>
 | 
			
		||||
                    </select>
 | 
			
		||||
                    <input class="input" type="time" name="atTime" id="atTime" value="<?php echo (json_decode($AUTOMATION['ifSomething'], true)['type'] == "time" ? json_decode($AUTOMATION['ifSomething'], true)['value'] : ""); ?>" <?php ECHO (json_decode($AUTOMATION['ifSomething'], true)['type'] == "time" ? '' : 'disabled'); ?>/>
 | 
			
		||||
                    <select class="input" name="atDeviceValue" id="atDeviceValue" <?php ECHO (json_decode($AUTOMATION['ifSomething'], true)['type'] == "atDeviceValue" ? '' : 'disabled'); ?>>
 | 
			
		||||
                        <?php foreach ($SUBDEVICES as $subDeviceKey => $subDeviceValue){ ?>
 | 
			
		||||
                            <option value="<?php echo $subDeviceKey; ?>"><?php echo $subDeviceValue['name']; ?>[<?php echo $subDeviceValue['type'];  ?>]</option>
 | 
			
		||||
                        <?php } ?>
 | 
			
		||||
                    </select>
 | 
			
		||||
                    =
 | 
			
		||||
                    <input class="input" type="text" name="atDeviceValueInt" id="atDeviceValueInt" required <?php ECHO (json_decode($AUTOMATION['ifSomething'], true)['type'] == "atDeviceValue" ? '' : 'disabled'); ?>/>
 | 
			
		||||
                </div>
 | 
			
		||||
 | 
			
		||||
                <div class="label"><?php $LANGMNG->echo('l_affectedDevices'); ?></div>
 | 
			
		||||
                <div class="field">
 | 
			
		||||
                    <div class="field px-2">
 | 
			
		||||
                        <?php
 | 
			
		||||
                        $i = 0;
 | 
			
		||||
                        foreach($AUTOMATION['doSomething'] as $subDeviceId => $subDeviceData){ ?>
 | 
			
		||||
                            <div id="automation-<?php echo $AUTOMATIONID; ?>-content">
 | 
			
		||||
                                <div class="label"><?php echo $subDeviceData['name']; ?></div>
 | 
			
		||||
                                <select class="input" name="device[<?php echo $subDeviceId; ?>]">
 | 
			
		||||
                                    <option value="0" <?php echo ($subDeviceData['state'] == "0" ? 'selected="selected"' : ''); ?>>off</option>
 | 
			
		||||
                                    <option value="1" <?php echo ($subDeviceData['state'] == "1" ? 'selected="selected"' : ''); ?>>on</option>
 | 
			
		||||
                                </select>
 | 
			
		||||
                                <button name="remove" type="button" class="button is-danger fa" data-automation-id="<?php echo $AUTOMATIONID; ?>"></button>
 | 
			
		||||
                            </div>
 | 
			
		||||
                            <?php
 | 
			
		||||
                            $i++;
 | 
			
		||||
                        } ?>
 | 
			
		||||
                    </div>
 | 
			
		||||
                </div>
 | 
			
		||||
                <div class="label"><?php $LANGMNG->echo('l_atDays');?></div>
 | 
			
		||||
                <div class="field">
 | 
			
		||||
                    <input type="checkbox" name="day[]" value="mon" <?php ECHO (in_array("mon", $AUTOMATION['onDays']) ? 'checked' : ''); ?>/> <?php $LANGMNG->echo('d_monday'); ?>
 | 
			
		||||
                </div>
 | 
			
		||||
                <div class="field">
 | 
			
		||||
                    <input type="checkbox" name="day[]" value="tue" <?php ECHO (in_array("tue", $AUTOMATION['onDays']) ? 'checked' : ''); ?>/> <?php $LANGMNG->echo('d_tuesday'); ?>
 | 
			
		||||
                </div>
 | 
			
		||||
                <div class="field">
 | 
			
		||||
                    <input type="checkbox" name="day[]" value="wed" <?php ECHO (in_array("wed", $AUTOMATION['onDays']) ? 'checked' : ''); ?>/> <?php $LANGMNG->echo('d_wednesday'); ?>
 | 
			
		||||
                </div>
 | 
			
		||||
                <div class="field">
 | 
			
		||||
                    <input type="checkbox" name="day[]" value="thu" <?php ECHO (in_array("thu", $AUTOMATION['onDays']) ? 'checked' : ''); ?>/> <?php $LANGMNG->echo('d_thursday'); ?>
 | 
			
		||||
                </div>
 | 
			
		||||
                <div class="field">
 | 
			
		||||
                    <input type="checkbox" name="day[]" value="fri" <?php ECHO (in_array("fri", $AUTOMATION['onDays']) ? 'checked' : ''); ?>/> <?php $LANGMNG->echo('d_friday'); ?>
 | 
			
		||||
                </div>
 | 
			
		||||
                <div class="field">
 | 
			
		||||
                    <input type="checkbox" name="day[]" value="sat" <?php ECHO (in_array("sat", $AUTOMATION['onDays']) ? 'checked' : ''); ?>/> <?php $LANGMNG->echo('d_saturday'); ?>
 | 
			
		||||
                </div>
 | 
			
		||||
                <div class="field">
 | 
			
		||||
                    <input type="checkbox" name="day[]" value="sun" <?php ECHO (in_array("sun", $AUTOMATION['onDays']) ? 'checked' : ''); ?>/> <?php $LANGMNG->echo('d_sunday'); ?>
 | 
			
		||||
                </div>
 | 
			
		||||
            </div>
 | 
			
		||||
            <input type="submit" class="button" name="modalFinal" value="<?php $LANGMNG->echo('b_edit'); ?>"/>
 | 
			
		||||
            <input type="submit" class="button is-danger"  onClick="ajaxPostSimple('ajax',{automation_id:  '<?php echo $AUTOMATIONID ?>', action:'delete'}, true);"  name="remove" value="<?php $LANGMNG->echo('b_remove');?>"/>
 | 
			
		||||
        </form>
 | 
			
		||||
 | 
			
		||||
    </div>
 | 
			
		||||
</div>
 | 
			
		||||
							
								
								
									
										21
									
								
								app/views/templates/part/dashboardButton.phtml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										21
									
								
								app/views/templates/part/dashboardButton.phtml
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,21 @@
 | 
			
		||||
<div class="col-4 col-sm-3 col-xl-2 square-wrap">
 | 
			
		||||
    <div class="square">
 | 
			
		||||
        <div class="square-content" id="device-<?php echo $DASHBOARDITEMDATA['masterId'] ?>" onClick="ajaxPost('ajax',{subDevice_id:'<?php echo $DASHBOARDITEMDATA['id']; ?>'}, this);">
 | 
			
		||||
            <div class="content">
 | 
			
		||||
                <div class="row">
 | 
			
		||||
                    <div class="col">
 | 
			
		||||
                        <h5 class="fa">&#x<?php echo $DASHBOARDITEMDATA['icon'] ?></h5>
 | 
			
		||||
                    </div>
 | 
			
		||||
                    <div class="col">
 | 
			
		||||
                        <h5 class="text-right"><?php echo $DASHBOARDITEMDATA['lastRecord']['value'].''.$DASHBOARDITEMDATA['unit'] ?></h5>
 | 
			
		||||
                    </div>
 | 
			
		||||
                </div>
 | 
			
		||||
                <div class="row">
 | 
			
		||||
                    <div class="col">
 | 
			
		||||
                        <?php echo $DASHBOARDITEMDATA['name'] ?>
 | 
			
		||||
                    </div>
 | 
			
		||||
                </div>
 | 
			
		||||
            </div>
 | 
			
		||||
        </div>
 | 
			
		||||
    </div>
 | 
			
		||||
</div>
 | 
			
		||||
							
								
								
									
										39
									
								
								app/views/templates/part/deviceButton.phtml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										39
									
								
								app/views/templates/part/deviceButton.phtml
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,39 @@
 | 
			
		||||
<?php 
 | 
			
		||||
$action = "";
 | 
			
		||||
if ($SUBDEVICE['type'] == 'on/off') {
 | 
			
		||||
	$action = 'onClick="ajaxPost(\'ajax\',{subDevice_id:\'' . $SUBDEVICEID . '\', action:\'change\'}, this);"';
 | 
			
		||||
} 
 | 
			
		||||
//neaktivní zařízení is-inactive
 | 
			
		||||
?>
 | 
			
		||||
 | 
			
		||||
<div class="device-button col-4 col-sm-3 col-xl-2 square-wrap" <?php echo $action; ?> data-room-id="<?php echo $ROOMID; ?>">
 | 
			
		||||
	<div class="square">
 | 
			
		||||
		<div class="square-content <?php echo (($SUBDEVICE['comError'] == 1 || $DEVICE['approved'] == 0) ? "is-inactive" : "") ;?>" id="device-<?php echo $DEVICEID ?>" data-sub-device-id="<?php echo $SUBDEVICEID;?>">
 | 
			
		||||
			<div class="content">
 | 
			
		||||
				<div class="row no-gutters">
 | 
			
		||||
					<div class="col">
 | 
			
		||||
						<h5 unselectable="on" class="fa">&#x<?php echo $DEVICE['icon'] ?></h5>
 | 
			
		||||
					</div>
 | 
			
		||||
					<div class="col">
 | 
			
		||||
					<?php if ($SUBDEVICE['type'] == 'temp_cont') { ?>
 | 
			
		||||
						<input type="number" step="5" class="device-button-value text-right" id="value_control" value="<?php echo $SUBDEVICE['lastRecort']['value'] ?>"><?php echo $SUBDEVICE['unit']?>
 | 
			
		||||
						<style>
 | 
			
		||||
							input.device-button-value.text-right {
 | 
			
		||||
    							width: inherit;
 | 
			
		||||
							}
 | 
			
		||||
						</style>
 | 
			
		||||
					
 | 
			
		||||
					<?php } else { ?>
 | 
			
		||||
						<h5 unselectable="on" class="device-button-value text-right" title="<?php echo $SUBDEVICE['lastRecort']['time']; ?>"><?php echo $SUBDEVICE['lastRecort']['value'] . $SUBDEVICE['unit']?></h5>
 | 
			
		||||
					<?php } ?>	
 | 
			
		||||
					</div>
 | 
			
		||||
				</div>
 | 
			
		||||
				<div class="row">
 | 
			
		||||
					<div class="col  button-text" unselectable="on" >
 | 
			
		||||
						<?php echo $DEVICE['name']; ?>
 | 
			
		||||
					</div>
 | 
			
		||||
				</div>
 | 
			
		||||
			</div>
 | 
			
		||||
		</div>
 | 
			
		||||
	</div>
 | 
			
		||||
</div>
 | 
			
		||||
							
								
								
									
										85
									
								
								app/views/templates/part/deviceDetail.phtml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										85
									
								
								app/views/templates/part/deviceDetail.phtml
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,85 @@
 | 
			
		||||
<!-- Detail -->
 | 
			
		||||
<div class="modal-container modal-container-hiden" id="modal-detail-<?php echo $SUBDEVICEID;?>">
 | 
			
		||||
	<div class="modal">
 | 
			
		||||
		<div class="close">
 | 
			
		||||
			<i class="fa fa-times"></i>
 | 
			
		||||
		</div>
 | 
			
		||||
		<h4 class="mb-4"><?php echo $DEVICE['name']; ?></h4>
 | 
			
		||||
		<h5 class="mb-4"><?php echo $SUBDEVICE['lastRecort']['value'] . $SUBDEVICE['unit']?></h5>
 | 
			
		||||
		<p><?php $LANGMNG->echo('l_lastSeen'); echo ' ' . $SUBDEVICE['lastRecort']['niceTime']; ?></p>
 | 
			
		||||
		<div class="">
 | 
			
		||||
			<canvas id="canvas-<?php echo $SUBDEVICEID;?>"></canvas>
 | 
			
		||||
		</div>
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
		<input
 | 
			
		||||
		type="submit"
 | 
			
		||||
		class="button col-2 graph-period"
 | 
			
		||||
		data-period="year"
 | 
			
		||||
		data-group="month"
 | 
			
		||||
		data-sub-device-id="<?php echo $SUBDEVICEID;?>"
 | 
			
		||||
		value="<?php $LANGMNG->echo('b_year');?>"
 | 
			
		||||
		/>
 | 
			
		||||
 | 
			
		||||
		<input
 | 
			
		||||
		type="submit"
 | 
			
		||||
		class="button col-2  graph-period"
 | 
			
		||||
		data-period="month"
 | 
			
		||||
		data-group="day"
 | 
			
		||||
		data-sub-device-id="<?php echo $SUBDEVICEID;?>"
 | 
			
		||||
		value="<?php $LANGMNG->echo('b_month');?>"
 | 
			
		||||
		/>
 | 
			
		||||
 | 
			
		||||
		<input
 | 
			
		||||
		type="submit"
 | 
			
		||||
		class="button col-2 graph-period"
 | 
			
		||||
		data-period="week"
 | 
			
		||||
		data-group="day"
 | 
			
		||||
		data-sub-device-id="<?php echo $SUBDEVICEID;?>"
 | 
			
		||||
		value="<?php $LANGMNG->echo('b_week');?>"
 | 
			
		||||
		/>
 | 
			
		||||
 | 
			
		||||
		<input
 | 
			
		||||
		type="submit"
 | 
			
		||||
		class="button col-2  graph-period"
 | 
			
		||||
		data-period="day"
 | 
			
		||||
		data-group="hour"
 | 
			
		||||
		data-sub-device-id="<?php echo $SUBDEVICEID;?>"
 | 
			
		||||
		value="<?php $LANGMNG->echo('b_day');?>"
 | 
			
		||||
		/>
 | 
			
		||||
 | 
			
		||||
		<input
 | 
			
		||||
		type="submit"
 | 
			
		||||
		class="button col-2  graph-period"
 | 
			
		||||
		data-period="hour"
 | 
			
		||||
		data-group="minute"
 | 
			
		||||
		data-sub-device-id="<?php echo $SUBDEVICEID;?>"
 | 
			
		||||
		value="<?php $LANGMNG->echo('b_hour');?>"
 | 
			
		||||
		/>
 | 
			
		||||
 | 
			
		||||
		<div>
 | 
			
		||||
			<table class="table is-fluid">
 | 
			
		||||
				<thead>
 | 
			
		||||
					<tr>
 | 
			
		||||
						<th><?php $LANGMNG->echo('t_time');?></th>
 | 
			
		||||
						<th><?php $LANGMNG->echo('t_state');?></th>
 | 
			
		||||
					</tr>
 | 
			
		||||
				</thead>
 | 
			
		||||
				<tbody>
 | 
			
		||||
					<?php foreach ($SUBDEVICE['events'] as $key => $value) { ?>
 | 
			
		||||
						<tr>
 | 
			
		||||
							<td><?php echo (new DateTime($value['time']))->format(DATEFORMAT); ?></td>
 | 
			
		||||
							<td title="test"><?php 
 | 
			
		||||
							echo $value['value'] . $SUBDEVICE['unit'];
 | 
			
		||||
							if (DEBUGMOD) {
 | 
			
		||||
								echo ' (' . $SUBDEVICE['eventsRaw'][$key]['value'] . ')';
 | 
			
		||||
							}
 | 
			
		||||
							?></td>
 | 
			
		||||
							<?php //TODO: P5IDAT TOOLTIP PRO RAW VALUE?>
 | 
			
		||||
						</tr>
 | 
			
		||||
					<?php } ?>
 | 
			
		||||
				</tbody>
 | 
			
		||||
			</table>
 | 
			
		||||
		</div>
 | 
			
		||||
	</div>
 | 
			
		||||
</div>
 | 
			
		||||
							
								
								
									
										179
									
								
								app/views/templates/part/deviceEdit.phtml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										179
									
								
								app/views/templates/part/deviceEdit.phtml
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,179 @@
 | 
			
		||||
<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>
 | 
			
		||||
        <h4 class="mb-4"><?php $LANGMNG->echo('t_editDevice'); ?></h4>
 | 
			
		||||
        <form method="post" action="" enctype="multipart/form-data">
 | 
			
		||||
            <input class="input" type="hidden" name="deviceId" value="<?php echo $DEVICEID; ?>">
 | 
			
		||||
            <?php if ($DEVICE['approved'] != 0) { ?>
 | 
			
		||||
                <?php if ($DEVICE['userIsAdmin']) { ?>
 | 
			
		||||
                    <div class="field">
 | 
			
		||||
                        <div class="label"><?php $LANGMNG->echo('l_owner'); ?></div>
 | 
			
		||||
                        <select class="input" name="deviceOwnerUserId">
 | 
			
		||||
                            <option value=""><?php $LANGMNG->echo('w_noOne'); ?></option>
 | 
			
		||||
                            <?php foreach ($USERS as $user) {
 | 
			
		||||
                                $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>
 | 
			
		||||
                    <div class="label"><?php $LANGMNG->echo('l_permission'); ?></div>
 | 
			
		||||
                    <div class="row">
 | 
			
		||||
 | 
			
		||||
                        <div class="col-6">
 | 
			
		||||
                            <div class="label"> - <?php $LANGMNG->echo('l_owner'); ?></div>
 | 
			
		||||
                        </div>
 | 
			
		||||
 | 
			
		||||
                        <div class="col-6">
 | 
			
		||||
                            <?php
 | 
			
		||||
                            $permissions = $DEVICE['permission'];
 | 
			
		||||
                            //Debug
 | 
			
		||||
                            if (DEBUGMOD == 1) {
 | 
			
		||||
                                echo '<pre>';
 | 
			
		||||
                                VAR_DUMP($permissions);
 | 
			
		||||
                                echo '</pre>';
 | 
			
		||||
                            }
 | 
			
		||||
                            ?>
 | 
			
		||||
                            <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'); ?>
 | 
			
		||||
 | 
			
		||||
                        </div>
 | 
			
		||||
                    </div>
 | 
			
		||||
                    <div class="row">
 | 
			
		||||
                        <div class="col-6">
 | 
			
		||||
                            <div class="label"> - <?php $LANGMNG->echo('l_member'); ?></div>
 | 
			
		||||
                        </div>
 | 
			
		||||
                        <div class="col-6">
 | 
			
		||||
                            <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'); ?>
 | 
			
		||||
                        </div>
 | 
			
		||||
                    </div>
 | 
			
		||||
                    <div class="field">
 | 
			
		||||
                        <div class="label"><?php $LANGMNG->echo('w_title'); ?></div>
 | 
			
		||||
                        <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>
 | 
			
		||||
                <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">Mac Address:</div>
 | 
			
		||||
                    <input class="input" type="text" name="deviceMac" value="<?php echo $DEVICE['mac']; ?>" disabled>
 | 
			
		||||
                </div>
 | 
			
		||||
                <div class="field">
 | 
			
		||||
                    <div class="label">IP:</div>
 | 
			
		||||
                    <input class="input" type="text" name="deviceIp" 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="deviceSubnet" 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="deviceGateway" 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>
 | 
			
		||||
 | 
			
		||||
                <h4 class="mb-4"><?php $LANGMNG->echo('t_deviceVersion'); ?></h4>
 | 
			
		||||
                <div class="field">
 | 
			
		||||
                    <div class="label"><?php $LANGMNG->echo('l_uploadFirmware'); ?></div>
 | 
			
		||||
                    <input class="input" type="file" name="deviceFirmware" value="">
 | 
			
		||||
                </div>
 | 
			
		||||
 | 
			
		||||
                <?php if ($DEVICE['userIsAdmin']) { ?>
 | 
			
		||||
                    <?php if (!in_array($SUBDEVICE['type'], ['on/off', 'door', 'water'])) { ?>
 | 
			
		||||
                        <div class="field">
 | 
			
		||||
                            <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' : ''); ?>>
 | 
			
		||||
                            <p>* - <?php $LANGMNG->echo('l_inMinutes'); ?></p>
 | 
			
		||||
                        </div>
 | 
			
		||||
                    <?php }?>
 | 
			
		||||
                    <div class="field">
 | 
			
		||||
                        <div class="label"><?php $LANGMNG->echo('w_room'); ?></div>
 | 
			
		||||
                        <select class="input" name="deviceOwnerId">
 | 
			
		||||
                            <?php foreach ($ROOMS as $room) {
 | 
			
		||||
                                $roomId =  $room['room_id'];
 | 
			
		||||
                                $roomName =  $room['name'];
 | 
			
		||||
                                ?>
 | 
			
		||||
                                <option value="<?php echo $roomId; ?>" <?php ECHO ((int) $roomId === (int)  $DEVICE['room'] ? 'selected="selected"' : ''); ?>><?php echo $roomName; ?></option>
 | 
			
		||||
                            <?php } ?>
 | 
			
		||||
                        </select>
 | 
			
		||||
                    </div>
 | 
			
		||||
                    <div class="field">
 | 
			
		||||
                        <div class="label"><?php $LANGMNG->echo('w_icon'); ?></div>
 | 
			
		||||
                        <select class="input fa" name="deviceIcon" <?php echo (!$DEVICE['userIsAdmin'] ? 'disabled' : ''); ?>>
 | 
			
		||||
                            <option value=""><?php $LANGMNG->echo('w_no'); ?><?php echo ' '; ?><?php $LANGMNG->echo('w_icon'); ?></option>
 | 
			
		||||
                            <option value="f0eb" <?php ECHO ($DEVICE['icon'] == "f0eb" ? 'selected="selected"' : ''); ?>> - fa-lightbulb-o</option>
 | 
			
		||||
                            <option value="f2dc" <?php ECHO ($DEVICE['icon'] == "f2dc" ? 'selected="selected"' : ''); ?>> - fa-snowflake-o</option>
 | 
			
		||||
                            <option value="f0e7" <?php ECHO ($DEVICE['icon'] == "f0e7" ? 'selected="selected"' : ''); ?>> - fa-bolt</option>
 | 
			
		||||
                            <option value="f2c7" <?php ECHO ($DEVICE['icon'] == "f2c7" ? 'selected="selected"' : ''); ?>> - fa-thermometer-full</option>
 | 
			
		||||
                            <option value="f236" <?php ECHO ($DEVICE['icon'] == "f236" ? 'selected="selected"' : ''); ?>> - fa-bed</option>
 | 
			
		||||
                            <option value="f185" <?php ECHO ($DEVICE['icon'] == "f185" ? 'selected="selected"' : ''); ?>> - fa-sun-o</option>
 | 
			
		||||
                            <option value="f2db" <?php ECHO ($DEVICE['icon'] == "f2db" ? 'selected="selected"' : ''); ?>> - fa-microchip</option>
 | 
			
		||||
                            <option value="f011" <?php ECHO ($DEVICE['icon'] == "f011" ? 'selected="selected"' : ''); ?>> - fa-power-off</option>
 | 
			
		||||
                            <option value="f011" <?php ECHO ($DEVICE['icon'] == "f011" ? 'selected="selected"' : ''); ?>> - fa-desktop</option>
 | 
			
		||||
                        </select>
 | 
			
		||||
                    </div>
 | 
			
		||||
                <?php } ?>
 | 
			
		||||
                <div class="field">
 | 
			
		||||
                    <div class="label"><?php $LANGMNG->echo('w_moduls'); ?></div>
 | 
			
		||||
                    <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">
 | 
			
		||||
                                <div class="square">
 | 
			
		||||
                                    <div class="square-content">
 | 
			
		||||
                                        <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>
 | 
			
		||||
                                        </div>
 | 
			
		||||
                                        <div class="row">
 | 
			
		||||
                                            <div class="col  button-text" unselectable="on" >
 | 
			
		||||
                                                <?php echo $DEVICE['name']; ?>
 | 
			
		||||
                                            </div>
 | 
			
		||||
                                        </div>
 | 
			
		||||
                                    </div>
 | 
			
		||||
                                </div>
 | 
			
		||||
                            </div>
 | 
			
		||||
                        <?php } ?>
 | 
			
		||||
                    </div>
 | 
			
		||||
                </div>
 | 
			
		||||
                <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'); ?>"/>
 | 
			
		||||
            <?php } else { ?>
 | 
			
		||||
                <div class="field">
 | 
			
		||||
                    <div class="label"><?php $LANGMNG->echo('w_moduls'); ?></div>
 | 
			
		||||
                    <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">
 | 
			
		||||
                                <div class="square">
 | 
			
		||||
                                    <div class="square-content">
 | 
			
		||||
 | 
			
		||||
                                        <?php echo $DEVICE['name']; ?>
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
                                    </div>
 | 
			
		||||
                                </div>
 | 
			
		||||
                            </div>
 | 
			
		||||
                        <?php } ?>
 | 
			
		||||
                    </div>
 | 
			
		||||
                </div>
 | 
			
		||||
                <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'); ?>"/>
 | 
			
		||||
            <?php } ?>
 | 
			
		||||
        </form>
 | 
			
		||||
    </div>
 | 
			
		||||
</div>
 | 
			
		||||
							
								
								
									
										5
									
								
								app/views/templates/part/footer.phtml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										5
									
								
								app/views/templates/part/footer.phtml
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,5 @@
 | 
			
		||||
<script src="./app/templates/js/jquery.js"></script>
 | 
			
		||||
<script src="https://www.gstatic.com/firebasejs/7.1.0/firebase-app.js"></script>
 | 
			
		||||
<script src="https://www.gstatic.com/firebasejs/7.1.0/firebase-messaging.js"></script>
 | 
			
		||||
<script src="./app/templates/js/script.js"></script>
 | 
			
		||||
<script src="./app/templates/js/post.js"></script>
 | 
			
		||||
							
								
								
									
										26
									
								
								app/views/templates/part/head.phtml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										26
									
								
								app/views/templates/part/head.phtml
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,26 @@
 | 
			
		||||
<link rel="manifest" href="manifest.json">
 | 
			
		||||
 | 
			
		||||
<meta name="mobile-web-app-capable" content="yes">
 | 
			
		||||
<meta name="apple-mobile-web-app-capable" content="yes">
 | 
			
		||||
<meta name="application-name" content="Home">
 | 
			
		||||
<meta name="apple-mobile-web-app-title" content="Home">
 | 
			
		||||
<meta name="theme-color" content="#182239">
 | 
			
		||||
<meta name="msapplication-navbutton-color" content="#182239">
 | 
			
		||||
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent">
 | 
			
		||||
<meta name="msapplication-starturl" content="<?php echo $BASEDIR; ?>">
 | 
			
		||||
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
 | 
			
		||||
 | 
			
		||||
<link rel="icon" sizes="192x192" href="<?php echo $BASEDIR; ?>app/templates/images/icon-192x192.png">
 | 
			
		||||
<link rel="apple-touch-icon" sizes="192x192" href="<?php echo $BASEDIR; ?>app/templates/images/icon-192x192.png">
 | 
			
		||||
<link rel="icon" sizes="512x512" href="<?php echo $BASEDIR; ?>app/templates/images/icon-512x512.png">
 | 
			
		||||
<link rel="apple-touch-icon" sizes="512x512" href="<?php echo $BASEDIR; ?>app/templates/images/icon-512x512.png">
 | 
			
		||||
 | 
			
		||||
<meta charset="UTF-8">
 | 
			
		||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
 | 
			
		||||
<meta http-equiv="X-UA-Compatible" content="ie=edge">
 | 
			
		||||
<link rel="stylesheet" href="./css/main.css?v2">
 | 
			
		||||
<link rel="stylesheet" href="./css/font-awesome.min.css">
 | 
			
		||||
<link rel="stylesheet" href="./css/modal.css">
 | 
			
		||||
<link rel="stylesheet" href="./css/pre.css">
 | 
			
		||||
<link rel="stylesheet" href="./css/loading.css">
 | 
			
		||||
<link rel="stylesheet" href="./css/override.css">
 | 
			
		||||
							
								
								
									
										20
									
								
								app/views/templates/part/loginForm.phtml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										20
									
								
								app/views/templates/part/loginForm.phtml
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,20 @@
 | 
			
		||||
<div class="modal-container">
 | 
			
		||||
    <div class="modal">
 | 
			
		||||
        <h4 class="mb-4">Login</h4>
 | 
			
		||||
        <form method="post">
 | 
			
		||||
            <div class="field">
 | 
			
		||||
                <div class="label">Name:</div>
 | 
			
		||||
                <input class="input" type="text" name="username" placeholder="Jméno.."/>
 | 
			
		||||
            </div>
 | 
			
		||||
            <div class="field">
 | 
			
		||||
                <div class="label">Password:</div>
 | 
			
		||||
                <input class="input" type="password" name="password" placeholder="Heslo.."/>
 | 
			
		||||
            </div>
 | 
			
		||||
            <div class="field">
 | 
			
		||||
                <div class="label">Remember me:</div>
 | 
			
		||||
                <input class="" type="checkbox" name="remember" value="true"/>
 | 
			
		||||
            </div>
 | 
			
		||||
            <input type="submit" class="button" name="login" value="Login"/>
 | 
			
		||||
        </form>
 | 
			
		||||
    </div>
 | 
			
		||||
</div>
 | 
			
		||||
							
								
								
									
										13
									
								
								app/views/templates/part/loginOta.phtml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										13
									
								
								app/views/templates/part/loginOta.phtml
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,13 @@
 | 
			
		||||
<div class="modal-container">
 | 
			
		||||
    <div class="modal">
 | 
			
		||||
        <h4 class="mb-4">OTA</h4>
 | 
			
		||||
        <form method="post">
 | 
			
		||||
            <input type="hidden" name="otaSecret" value="<?php echo $OTA; ?>"/>
 | 
			
		||||
            <div class="field">
 | 
			
		||||
                <div class="label">Code:</div>
 | 
			
		||||
                <input class="input" type="text" name="otaCode" placeholder=""/>
 | 
			
		||||
            </div>
 | 
			
		||||
            <input type="submit" class="button" name="login" value="Login"/>
 | 
			
		||||
        </form>
 | 
			
		||||
    </div>
 | 
			
		||||
</div>
 | 
			
		||||
							
								
								
									
										50
									
								
								app/views/templates/part/menu.phtml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										50
									
								
								app/views/templates/part/menu.phtml
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,50 @@
 | 
			
		||||
<div class="nav">
 | 
			
		||||
    <?php
 | 
			
		||||
    $menuItems = [
 | 
			
		||||
        'fa-home' => [
 | 
			
		||||
            'slug' => 'home',
 | 
			
		||||
            'lngKey' => 'home',
 | 
			
		||||
            'path' => './',
 | 
			
		||||
        ],
 | 
			
		||||
        'fa-tachometer' => [
 | 
			
		||||
            'slug' => 'dashboard',
 | 
			
		||||
            'lngKey' => 'dashboard',
 | 
			
		||||
            'path' => 'dashboard',
 | 
			
		||||
        ],
 | 
			
		||||
        'fa-wrench' => [
 | 
			
		||||
            'slug' => 'setting',
 | 
			
		||||
            'lngKey' => 'settings',
 | 
			
		||||
            'path' => 'setting',
 | 
			
		||||
        ],
 | 
			
		||||
        'fa-calendar-o' => [
 | 
			
		||||
            'slug' => 'automation',
 | 
			
		||||
            'lngKey' => 'automatization',
 | 
			
		||||
            'path' => 'automation',
 | 
			
		||||
        ],
 | 
			
		||||
        'fa-terminal' => [
 | 
			
		||||
            'slug' => 'scene',
 | 
			
		||||
            'lngKey' => 'scenes',
 | 
			
		||||
            'path' => 'scene',
 | 
			
		||||
        ],
 | 
			
		||||
        'fa-bug' =>[
 | 
			
		||||
            'slug' => 'log',
 | 
			
		||||
            'lngKey' => 'log',
 | 
			
		||||
            'path' => 'log',
 | 
			
		||||
        ],
 | 
			
		||||
    ];
 | 
			
		||||
    foreach ( $menuItems as $key => $value) {
 | 
			
		||||
        if ($DEBUGMOD == 0 && $value['path'] == 'log') {
 | 
			
		||||
            continue;
 | 
			
		||||
        }
 | 
			
		||||
        ?>
 | 
			
		||||
        <div class="nav-item <?php echo ($ITEM == $value ? 'is-active' : ''); ?>">
 | 
			
		||||
            <a href="<?php echo $value['path']?>">
 | 
			
		||||
                <i class="fa <?php echo $key ?>"></i>
 | 
			
		||||
                <span>
 | 
			
		||||
                    <?php $LANGMNG->echo('m_'.$value['lngKey']); ?>
 | 
			
		||||
                </span>
 | 
			
		||||
            </a>
 | 
			
		||||
        </div>
 | 
			
		||||
    <?php }?>
 | 
			
		||||
 | 
			
		||||
</div>
 | 
			
		||||
							
								
								
									
										22
									
								
								app/views/templates/part/sceneButton.phtml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										22
									
								
								app/views/templates/part/sceneButton.phtml
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,22 @@
 | 
			
		||||
<div class="col-12 col-md-6 col-xl-4 square-wrap noselect">
 | 
			
		||||
    <div class="rectangle-2">
 | 
			
		||||
        <div class="square-content double" id="scene-<?php echo $SCENEID ?>" onClick="ajaxPost('ajax',{scene_id:'<?php echo $SCENEID; ?>',action:'execute'}, this);" >
 | 
			
		||||
            <div class="row">
 | 
			
		||||
                <div class="col-1">
 | 
			
		||||
                    <h5 class="fa noselect">
 | 
			
		||||
                        &#x<?php echo $SCENEDATA['icon']; ?>
 | 
			
		||||
                    </h5>
 | 
			
		||||
                </div>
 | 
			
		||||
                <div class="col">
 | 
			
		||||
                    <h5 class="text-right break-all noselect">
 | 
			
		||||
                        <?php echo $SCENEDATA['name']; ?>
 | 
			
		||||
                    </h5>
 | 
			
		||||
                </div>
 | 
			
		||||
            </div>
 | 
			
		||||
            <div class="row">
 | 
			
		||||
                <div class="col">
 | 
			
		||||
                </div>
 | 
			
		||||
            </div>
 | 
			
		||||
        </div>
 | 
			
		||||
    </div>
 | 
			
		||||
</div>
 | 
			
		||||
							
								
								
									
										40
									
								
								app/views/templates/part/sceneCreate.phtml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										40
									
								
								app/views/templates/part/sceneCreate.phtml
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,40 @@
 | 
			
		||||
<div class="modal-container modal-container-hiden" id="modal">
 | 
			
		||||
    <div class="modal">
 | 
			
		||||
        <div class="close">
 | 
			
		||||
            <i class="fa fa-times"></i>
 | 
			
		||||
        </div>
 | 
			
		||||
        <h4 class="mb-4"><?php $LANGMNG->echo('t_createScene');?></h4>
 | 
			
		||||
        <form method="post">
 | 
			
		||||
            <div class="field">
 | 
			
		||||
                <div class="label"><?php $LANGMNG->echo('w_title');?>:</div>
 | 
			
		||||
                <input type="text" class="input" name="sceneName" value=""/>  
 | 
			
		||||
            </div>
 | 
			
		||||
            <div class="field">
 | 
			
		||||
                <div class="label"><?php $LANGMNG->echo('w_icon');?>:</div>
 | 
			
		||||
                <select class="input fa" name="sceneIcon" <?php echo (!$DEVICE['userIsAdmin'] ? 'disabled' : ''); ?>>
 | 
			
		||||
                    <option value="">No icon</option>
 | 
			
		||||
                    <option value="f0eb"> - fa-lightbulb-o</option>
 | 
			
		||||
                    <option value="f2dc"> - fa-snowflake-o</option>
 | 
			
		||||
                    <option value="f0e7"> - fa-bolt</option>
 | 
			
		||||
                    <option value="f2c7"> - fa-thermometer-full</option>
 | 
			
		||||
                    <option value="f236"> - fa-bed</option>
 | 
			
		||||
                    <option value="f185"> - fa-sun-o</option>
 | 
			
		||||
                    <option value="f2db"> - fa-microchip</option>
 | 
			
		||||
                    <option value="f011"> - fa-power-off</option>
 | 
			
		||||
                    <option value="f011"> - fa-desktop</option>
 | 
			
		||||
                </select>
 | 
			
		||||
            </div>
 | 
			
		||||
            <div class="field">
 | 
			
		||||
                <div class="label"><?php $LANGMNG->echo('l_choseDevice');?></div>
 | 
			
		||||
                <select  class="input" name="devices[]" multiple required>
 | 
			
		||||
                    <?php
 | 
			
		||||
                    foreach ($SUBDEVICES as $subdeviceId => $subdeviceData) {
 | 
			
		||||
                        echo '<option value="'.$subdeviceId.'">'.$subdeviceData['name'].'</option>';
 | 
			
		||||
                    }
 | 
			
		||||
                    ?>
 | 
			
		||||
                </select>
 | 
			
		||||
            </div>
 | 
			
		||||
            <input type="submit" class="button" name="submit" value="<?php $LANGMNG->echo('b_next');?>"/>
 | 
			
		||||
        </form>
 | 
			
		||||
    </div>
 | 
			
		||||
</div>
 | 
			
		||||
							
								
								
									
										26
									
								
								app/views/templates/part/sceneCreateFinal.phtml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										26
									
								
								app/views/templates/part/sceneCreateFinal.phtml
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,26 @@
 | 
			
		||||
<div class="modal-container" id="modal">
 | 
			
		||||
    <div class="modal">
 | 
			
		||||
        <div class="close">
 | 
			
		||||
            <i class="fa fa-times"></i>
 | 
			
		||||
        </div>
 | 
			
		||||
        <h4 class="mb-4"><?php $LANGMNG->echo('t_createScene');?></h4>
 | 
			
		||||
        <form method="post">
 | 
			
		||||
            <input type="hidden" name="sceneName" value="<?php echo $SCENENAME; ?>">
 | 
			
		||||
            <input type="hidden" name="sceneIcon" value="<?php echo $SCENEICON; ?>">
 | 
			
		||||
            <?php 
 | 
			
		||||
            $i = 0;
 | 
			
		||||
            foreach($SETSTATEFORMDEVICES as $device){ ?>
 | 
			
		||||
                <div class="field px-2">
 | 
			
		||||
                    <div class="label"><?php echo $device['name']; ?></div>
 | 
			
		||||
                    <select  class="input" name="devices[<?php echo $device['setableSubDevices']; ?>]">
 | 
			
		||||
                        <option value="0">off</option>
 | 
			
		||||
                        <option value="1">on</option>
 | 
			
		||||
                    </select>
 | 
			
		||||
                </div>
 | 
			
		||||
                <?php 
 | 
			
		||||
                $i++;
 | 
			
		||||
            } ?>
 | 
			
		||||
            <input type="submit" class="button" name="submitFinal" value="<?php echo $LANGMNG->echo('b_create');?>"/>
 | 
			
		||||
        </form>
 | 
			
		||||
    </div>
 | 
			
		||||
</div>
 | 
			
		||||
							
								
								
									
										47
									
								
								app/views/templates/part/sceneEdit.phtml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										47
									
								
								app/views/templates/part/sceneEdit.phtml
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,47 @@
 | 
			
		||||
<div class="modal-container modal-container-hiden" id="modal-setting-<?php echo $SCENEID ?>">
 | 
			
		||||
    <div class="modal">
 | 
			
		||||
        <div class="close">
 | 
			
		||||
            <i class="fa fa-times"></i>
 | 
			
		||||
        </div>
 | 
			
		||||
        <h4 class="mb-4"><?php $LANGMNG->echo('t_editScene')?></h4>
 | 
			
		||||
        <form method="post">
 | 
			
		||||
            <div class="field">
 | 
			
		||||
                <div class="label"><?php $LANGMNG->echo('w_title');?>:</div>
 | 
			
		||||
                <input type="text" class="input" name="sceneName" value="<?php echo $SCENE['name']; ?>"/>  
 | 
			
		||||
            </div>
 | 
			
		||||
            <div class="field">
 | 
			
		||||
                <div class="label"><?php $LANGMNG->echo('w_icon');?>:</div>
 | 
			
		||||
                <select class="input fa" name="sceneIcon">
 | 
			
		||||
                    <option value=""><?php $LANGMNG->echo('w_no').$LANGMNG->get('w_icon');?></option>
 | 
			
		||||
                    <option value="f0eb" <?php ECHO ($SCENE['icon'] == "f0eb" ? 'selected="selected"' : ''); ?>> - fa-lightbulb-o</option>
 | 
			
		||||
                    <option value="f2dc" <?php ECHO ($SCENE['icon'] == "f2dc" ? 'selected="selected"' : ''); ?>> - fa-snowflake-o</option>
 | 
			
		||||
                    <option value="f0e7" <?php ECHO ($SCENE['icon'] == "f0e7" ? 'selected="selected"' : ''); ?>> - fa-bolt</option>
 | 
			
		||||
                    <option value="f2c7" <?php ECHO ($SCENE['icon'] == "f2c7" ? 'selected="selected"' : ''); ?>> - fa-thermometer-full</option>
 | 
			
		||||
                    <option value="f236" <?php ECHO ($SCENE['icon'] == "f236" ? 'selected="selected"' : ''); ?>> - fa-bed</option>
 | 
			
		||||
                    <option value="f185" <?php ECHO ($SCENE['icon'] == "f185" ? 'selected="selected"' : ''); ?>> - fa-sun-o</option>
 | 
			
		||||
                    <option value="f2db" <?php ECHO ($SCENE['icon'] == "f2db" ? 'selected="selected"' : ''); ?>> - fa-microchip</option>
 | 
			
		||||
                    <option value="f011" <?php ECHO ($SCENE['icon'] == "f011" ? 'selected="selected"' : ''); ?>> - fa-power-off</option>
 | 
			
		||||
                    <option value="f011" <?php ECHO ($SCENE['icon'] == "f011" ? 'selected="selected"' : ''); ?>> - fa-desktop</option>
 | 
			
		||||
                </select>
 | 
			
		||||
            </div>
 | 
			
		||||
            <div class="field px-2">
 | 
			
		||||
                <?php 
 | 
			
		||||
                $i = 0;
 | 
			
		||||
                foreach($SCENE['doSomething'] as $subDeviceId => $subDeviceData){ ?> 
 | 
			
		||||
                    <div id="scene-<?php echo $SCENEID; ?>-content">               
 | 
			
		||||
                        <div class="label"><?php echo $subDeviceData['name']; ?></div>
 | 
			
		||||
                        <select class="input" name="devices[<?php echo $subDeviceId; ?>]">
 | 
			
		||||
                            <option value="0" <?php ECHO ($subDeviceData['state'] == "0" ? 'selected="selected"' : ''); ?>>off</option>
 | 
			
		||||
                            <option value="1" <?php ECHO ($subDeviceData['state'] == "1" ? 'selected="selected"' : ''); ?>>on</option>
 | 
			
		||||
                        </select>
 | 
			
		||||
                        <button name="remove" type="button" class="button is-danger fa" data-scene-id="<?php echo $SCENEID; ?>"></button>
 | 
			
		||||
                    </div>
 | 
			
		||||
                    <?php 
 | 
			
		||||
                    $i++;
 | 
			
		||||
                } ?>
 | 
			
		||||
            </div>
 | 
			
		||||
            <input type="submit" class="button" name="saveDevice" value="<?php $LANGMNG->echo('b_edit');?>"/>	
 | 
			
		||||
            <input type="button" class="button is-danger" onClick="ajaxPost('ajax',{scene_id:'<?php echo $SCENEID ?>', 'action':'delete'}, this, true);" name="saveDevice" value="<?php $LANGMNG->echo('b_remove');?>"/>	
 | 
			
		||||
        </form>
 | 
			
		||||
    </div>
 | 
			
		||||
</div>
 | 
			
		||||
							
								
								
									
										3
									
								
								app/views/templates/part/test.phtml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										3
									
								
								app/views/templates/part/test.phtml
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,3 @@
 | 
			
		||||
<H1>
 | 
			
		||||
    TEST - TEST
 | 
			
		||||
</H1>
 | 
			
		||||
							
								
								
									
										154
									
								
								app/views/templates/rooms.phtml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										154
									
								
								app/views/templates/rooms.phtml
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,154 @@
 | 
			
		||||
<!DOCTYPE html>
 | 
			
		||||
<html lang="en">
 | 
			
		||||
<head>
 | 
			
		||||
    <?php
 | 
			
		||||
    $partial = new Partial('head');
 | 
			
		||||
    $partial->prepare('baseDir', $BASEDIR);
 | 
			
		||||
    $partial->render();
 | 
			
		||||
    ?>
 | 
			
		||||
    <title><?php echo $TITLE ?></title>
 | 
			
		||||
</head>
 | 
			
		||||
<body class="no-transitions">
 | 
			
		||||
    <div class="row no-gutters main">
 | 
			
		||||
        <div class="col-md-3 d-sm-none"></div>
 | 
			
		||||
        <div class="col-md-3 nav-container">
 | 
			
		||||
            <?php
 | 
			
		||||
            $partial = new Partial('menu');
 | 
			
		||||
            $partial->prepare('item', 'rooms');
 | 
			
		||||
            $partial->prepare('langMng',$LANGMNG);
 | 
			
		||||
            $partial->prepare('debugMod',$DEBUGMOD);
 | 
			
		||||
            $partial->render();
 | 
			
		||||
            ?>
 | 
			
		||||
        </div>
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
        <div class="col-md-9 main-body">
 | 
			
		||||
            <div class="frame">
 | 
			
		||||
                <?php foreach ($ROOMS as $roomId => $room) {  ?>
 | 
			
		||||
                    <div class="single-frame" id="room-<?php echo $roomId; ?>">
 | 
			
		||||
                        <div class="">
 | 
			
		||||
                            <h1><?php echo $room['name']; ?></h1>
 | 
			
		||||
                            <?php foreach ($room['reading'] as $key => $value) { ?>
 | 
			
		||||
                                <?php echo $LANGMNG->get($key) .": ".  $value; ?></br>
 | 
			
		||||
                            <?php } ?>
 | 
			
		||||
                            <?php if (DEBUGMOD == 1) { ?>
 | 
			
		||||
                                <pre>
 | 
			
		||||
                                    <?php var_dump($room);?>
 | 
			
		||||
                                </pre>
 | 
			
		||||
                            <?php } ?>
 | 
			
		||||
                        </div>
 | 
			
		||||
                        <?php foreach ($room['controls'] as $key => $value) { ?>
 | 
			
		||||
                            <div class="row no-gutters">
 | 
			
		||||
                                <div class="device-button col-4 col-sm-3 col-xl-2 square-wrap"  data-room-id="">
 | 
			
		||||
                                    <div class="square">
 | 
			
		||||
                                        <div class="square-content" id="device-" data-sub-device-id="">
 | 
			
		||||
                                            <div class="content">
 | 
			
		||||
                                                <div class="row">
 | 
			
		||||
                                                    <div class="col">
 | 
			
		||||
                                                        <h5 unselectable="on" class="fa">&#x<?php echo $value['icon'];?></h5>
 | 
			
		||||
                                                    </div>
 | 
			
		||||
                                                    <div class="col">
 | 
			
		||||
                                                        <h5 unselectable="on" class="device-button-value text-right" title=""><?php echo $value['value'];?></h5>
 | 
			
		||||
                                                    </div>
 | 
			
		||||
                                                </div>
 | 
			
		||||
                                                <div class="row">
 | 
			
		||||
                                                    <div class="col" unselectable="on" >
 | 
			
		||||
                                                        <?php echo $value['name'];?>
 | 
			
		||||
                                                    </div>
 | 
			
		||||
                                                </div>
 | 
			
		||||
                                            </div>
 | 
			
		||||
                                        </div>
 | 
			
		||||
                                    </div>
 | 
			
		||||
                                </div>
 | 
			
		||||
                            </div>
 | 
			
		||||
                        <?php } ?>
 | 
			
		||||
                    </div>
 | 
			
		||||
                <?php } ?>
 | 
			
		||||
            </div>
 | 
			
		||||
            <style>
 | 
			
		||||
            .single-frame {
 | 
			
		||||
                background-color: red;
 | 
			
		||||
                width: 100%;
 | 
			
		||||
                flex: 0 0 100%;
 | 
			
		||||
                height: 100%;
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            .frame {
 | 
			
		||||
                overflow-x: auto;
 | 
			
		||||
                width: 100%;
 | 
			
		||||
                display: flex;
 | 
			
		||||
                height: 100%;
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            body,html{
 | 
			
		||||
                height: 100%;
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            .frame .single-frame:nth-child(even) {
 | 
			
		||||
                background: red;
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            .frame .single-frame:nth-child(odd) {
 | 
			
		||||
                background: green;
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            </style>
 | 
			
		||||
        </div>
 | 
			
		||||
    </div>
 | 
			
		||||
    <?php
 | 
			
		||||
    $partial = new Partial('footer');
 | 
			
		||||
    $partial->render();
 | 
			
		||||
    ?>
 | 
			
		||||
    <script>
 | 
			
		||||
    var prev_id;
 | 
			
		||||
    var id;
 | 
			
		||||
    var current_element
 | 
			
		||||
    var elementWidth = $('.frame').width();
 | 
			
		||||
 | 
			
		||||
    $('.frame').scroll(function(){
 | 
			
		||||
        //console.log('SCROLLING!');
 | 
			
		||||
        //console.log('scrool'+$('.single-frame').scrollLeft());
 | 
			
		||||
        var element_width = $('.single-frame').width();
 | 
			
		||||
 | 
			
		||||
        var offset = $('.single-frame').offset();
 | 
			
		||||
        var positive =  Math.abs(offset.left)
 | 
			
		||||
        var divided = positive / element_width;
 | 
			
		||||
        var round = Math.round(divided);
 | 
			
		||||
 | 
			
		||||
        current_element = $('.frame').children().eq(round);
 | 
			
		||||
        id = current_element.attr('id');
 | 
			
		||||
 | 
			
		||||
        if (prev_id != id){
 | 
			
		||||
            prev_id = id;
 | 
			
		||||
            console.log(prev_id);
 | 
			
		||||
        }
 | 
			
		||||
        var scrollTo = $('#'+id).offset().left;
 | 
			
		||||
        console.log('s-f: '+ scrollTo)
 | 
			
		||||
 | 
			
		||||
    });
 | 
			
		||||
    $('.frame').on('touchend', function(){ // listen to mouse up
 | 
			
		||||
        console.log('STOPPED SCROLLING!');
 | 
			
		||||
        var scrollLeft = $('.frame').scrollLeft();
 | 
			
		||||
        console.log('frameLeft' + scrollLeft);
 | 
			
		||||
        var a = $('.frame').children();
 | 
			
		||||
        for (index = 0; index < a.length; ++index) {
 | 
			
		||||
            if(a[index].id == id){
 | 
			
		||||
                $('.frame').animate({
 | 
			
		||||
                    scrollLeft: (index * elementWidth)
 | 
			
		||||
                });
 | 
			
		||||
                $('.frame').animate({
 | 
			
		||||
                    scrollLeft: (index * elementWidth)
 | 
			
		||||
                });
 | 
			
		||||
            }
 | 
			
		||||
            console.log(a[index]);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        if (scrollTo > 160) {
 | 
			
		||||
            console.log($('#'+id).left)
 | 
			
		||||
 | 
			
		||||
        }
 | 
			
		||||
    });
 | 
			
		||||
    </script>
 | 
			
		||||
</body>
 | 
			
		||||
</html>
 | 
			
		||||
							
								
								
									
										67
									
								
								app/views/templates/scene.phtml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										67
									
								
								app/views/templates/scene.phtml
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,67 @@
 | 
			
		||||
<!DOCTYPE html>
 | 
			
		||||
<html lang="en">
 | 
			
		||||
<head>
 | 
			
		||||
    <?php
 | 
			
		||||
    $partial = new Partial('head');
 | 
			
		||||
    $partial->prepare('baseDir', $BASEDIR);
 | 
			
		||||
    $partial->render();
 | 
			
		||||
    ?>
 | 
			
		||||
    <title><?php echo $TITLE ?></title>
 | 
			
		||||
</head>
 | 
			
		||||
<body class="no-transitions">
 | 
			
		||||
    <div class="row no-gutters main">
 | 
			
		||||
        <div class="col-md-3 d-sm-none"></div>
 | 
			
		||||
        <div class="col-md-3 nav-container">
 | 
			
		||||
            <?php
 | 
			
		||||
            $partial = new Partial('menu');
 | 
			
		||||
            $partial->prepare('item', 'scene');
 | 
			
		||||
            $partial->prepare('langMng',$LANGMNG);
 | 
			
		||||
            $partial->prepare('debugMod',$DEBUGMOD);
 | 
			
		||||
            $partial->render();
 | 
			
		||||
            ?>
 | 
			
		||||
        </div>
 | 
			
		||||
        <div class="col-md-9 main-body">
 | 
			
		||||
            <a class="button is-primary m-1" onClick="$('#modal').removeClass('modal-container-hiden').show();"><?php $LANGMNG->echo('t_createScene');?></a>
 | 
			
		||||
            <div class="row no-gutters">
 | 
			
		||||
                <?php foreach ($SCENES as $sceneId => $sceneData) {
 | 
			
		||||
                    //BUTTON
 | 
			
		||||
                    $partialScenButton = new Partial('sceneButton');
 | 
			
		||||
                    $partialScenButton->prepare('langMng', $LANGMNG);
 | 
			
		||||
                    $partialScenButton->prepare('sceneId', $sceneId);
 | 
			
		||||
                    $partialScenButton->prepare('sceneData', $sceneData);
 | 
			
		||||
 | 
			
		||||
                    $partialScenButton->render();
 | 
			
		||||
 | 
			
		||||
                    // Edit
 | 
			
		||||
                    $partialSceneEdit = new Partial('sceneEdit');
 | 
			
		||||
                    $partialSceneEdit->prepare('langMng',$LANGMNG);
 | 
			
		||||
                    $partialSceneEdit->prepare('sceneId',$sceneId);
 | 
			
		||||
                    $partialSceneEdit->prepare('scene',$sceneData);
 | 
			
		||||
 | 
			
		||||
                    $partialSceneEdit->render();
 | 
			
		||||
                    ?>
 | 
			
		||||
                <?php } ?>
 | 
			
		||||
            </div>
 | 
			
		||||
        </div>
 | 
			
		||||
    </div>
 | 
			
		||||
 | 
			
		||||
    <?php if (isset($_POST['submit'])) {
 | 
			
		||||
        $partial = new Partial('sceneCreateFinal');
 | 
			
		||||
        $partial->prepare('langMng',$LANGMNG);
 | 
			
		||||
        $partial->prepare('setStateFormDevices',$SETSTATEFORMDEVICES );
 | 
			
		||||
        $partial->prepare('sceneIcon',$SCENEICON );
 | 
			
		||||
        $partial->prepare('SceneName',$SCENENAME );
 | 
			
		||||
 | 
			
		||||
        $partial->render();
 | 
			
		||||
    } else {
 | 
			
		||||
        $partial = new Partial('sceneCreate');
 | 
			
		||||
        $partial->prepare('langMng',$LANGMNG);
 | 
			
		||||
        $partial->prepare('subDevices',$SUBDEVICES);
 | 
			
		||||
 | 
			
		||||
        $partial->render();
 | 
			
		||||
    }
 | 
			
		||||
    $partial = new Partial('footer');
 | 
			
		||||
    $partial->render();
 | 
			
		||||
    ?>
 | 
			
		||||
</body>
 | 
			
		||||
</html>
 | 
			
		||||
							
								
								
									
										203
									
								
								app/views/templates/setting.phtml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										203
									
								
								app/views/templates/setting.phtml
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,203 @@
 | 
			
		||||
<!DOCTYPE html>
 | 
			
		||||
<html lang="en">
 | 
			
		||||
<head>
 | 
			
		||||
	<?php
 | 
			
		||||
	$partial = new Partial('head');
 | 
			
		||||
	$partial->prepare('baseDir', $BASEDIR);
 | 
			
		||||
	$partial->render();
 | 
			
		||||
	?>
 | 
			
		||||
	<title><?php echo $TITLE ?></title>
 | 
			
		||||
</head>
 | 
			
		||||
<body class="no-transitions">
 | 
			
		||||
	<div class="row no-gutters main">
 | 
			
		||||
		<div class="col-md-3 d-sm-none"></div>
 | 
			
		||||
		<div class="col-md-3 nav-container">
 | 
			
		||||
			<?php
 | 
			
		||||
			$partial = new Partial('menu');
 | 
			
		||||
			$partial->prepare('item', 'setting');
 | 
			
		||||
			$partial->prepare('langMng',$LANGMNG);
 | 
			
		||||
			$partial->prepare('debugMod',$DEBUGMOD);
 | 
			
		||||
			$partial->render();
 | 
			
		||||
			?>
 | 
			
		||||
		</div>
 | 
			
		||||
		<div class="col-md-9 main-body">
 | 
			
		||||
			<div class="col-12 col-sm-9 mx-auto mt-4">
 | 
			
		||||
				<h4 class="mb-4">
 | 
			
		||||
 | 
			
		||||
					<?php $LANGMNG->echo('t_pageAfterLogIn') ?>
 | 
			
		||||
				</h4>
 | 
			
		||||
				<form method="post" enctype="multipart/form-data">
 | 
			
		||||
					<div class="">
 | 
			
		||||
						<div class="field">
 | 
			
		||||
							<select class="input" name="loadPage">
 | 
			
		||||
								<option value="0" <?php echo (UserManager::getUserData("startPage") == 0 ? "selected" : ""); ?>>Default</option>
 | 
			
		||||
								<option value="1" <?php echo (UserManager::getUserData("startPage") == 1 ? "selected" : ""); ?>>Dashboard</option>
 | 
			
		||||
							</select>
 | 
			
		||||
						</div>
 | 
			
		||||
						<input type="submit" name="submit" class="button" value="<?php $LANGMNG->echo('b_save') ?>"/>
 | 
			
		||||
					</div>
 | 
			
		||||
				</div>
 | 
			
		||||
			</form>
 | 
			
		||||
			<div class="col-12 col-sm-9 mx-auto mt-4">
 | 
			
		||||
				<h4 class="mb-4"><?php $LANGMNG->echo('t_profile') ?></h4>
 | 
			
		||||
				<div class="field">
 | 
			
		||||
					<div class="label"><?php $LANGMNG->echo('l_userAvatar') ?>:</div>
 | 
			
		||||
					<img src="<?php echo $USERAVATARURL; ?>" />
 | 
			
		||||
					<div class="label">* providet by Gavatar</div>
 | 
			
		||||
				</div>
 | 
			
		||||
				<div class="field">
 | 
			
		||||
					<div class="label"><?php $LANGMNG->echo('l_userName') ?>:</div>
 | 
			
		||||
					<input class="input" value="<?php echo $USERNAME; ?>" disabled>
 | 
			
		||||
				</div>
 | 
			
		||||
				<div class="field">
 | 
			
		||||
					<div class="label"><?php $LANGMNG->echo('l_userEmail') ?>:</div>
 | 
			
		||||
					<input class="input" value="<?php echo $USEREMAIL; ?>" disabled>
 | 
			
		||||
				</div>
 | 
			
		||||
				<div class="field">
 | 
			
		||||
					<a href="logout" class="button is-primary"><?php $LANGMNG->echo('b_logOut') ?></a>
 | 
			
		||||
				</div>
 | 
			
		||||
			</div>
 | 
			
		||||
			<div class="col-12 col-sm-9 mx-auto mt-4">
 | 
			
		||||
				<h4 class="mb-4"><?php $LANGMNG->echo('t_notification') ?></h4>
 | 
			
		||||
				<input id="notifications" type="checkbox" onChange="toggleNotificationPermissions(this);" />
 | 
			
		||||
				<div class="label"><?php $LANGMNG->echo('l_notificationStatus') ?></div>
 | 
			
		||||
				<div class="field">
 | 
			
		||||
					<a onClick="sendTestNotification();" class="button"><?php $LANGMNG->echo('b_sendTestNotification');?></a>
 | 
			
		||||
				</div>
 | 
			
		||||
			</div>
 | 
			
		||||
			<div class="col-12 col-sm-9 mx-auto mt-4">
 | 
			
		||||
				<h4 class="mb-4"><?php $LANGMNG->echo('t_experimental') ?></h4>
 | 
			
		||||
				<div class="field">
 | 
			
		||||
					<a href="rooms" class="button"><?php $LANGMNG->echo('b_rooms') ?></a>
 | 
			
		||||
				</div>
 | 
			
		||||
			</div>
 | 
			
		||||
			<div class="col-12 col-sm-9 mx-auto mt-4">
 | 
			
		||||
				<h4 class="mb-4"><?php $LANGMNG->echo('t_changePassword') ?></h4>
 | 
			
		||||
				<form method="post">
 | 
			
		||||
					<div class="field">
 | 
			
		||||
						<div class="label"><?php $LANGMNG->echo('l_oldPassword') ?>:</div>
 | 
			
		||||
						<input type="password" class="input" name="oldPassword" value="" data-cip-id="cIPJQ342845639">
 | 
			
		||||
					</div>
 | 
			
		||||
					<div class="field">
 | 
			
		||||
						<div class="label"><?php $LANGMNG->echo('l_newPassword') ?>:</div>
 | 
			
		||||
						<input type="password" class="input" name="newPassword1" value="">
 | 
			
		||||
					</div>
 | 
			
		||||
					<div class="field">
 | 
			
		||||
						<div class="label"><?php $LANGMNG->echo('l_newPassword') ?>:</div>
 | 
			
		||||
						<input type="password" class="input" name="newPassword2" value="">
 | 
			
		||||
					</div>
 | 
			
		||||
					<div class="field">
 | 
			
		||||
						<input type="submit" name="submitPasswordChange" class="button" value="Uložit">
 | 
			
		||||
					</div>
 | 
			
		||||
				</form>
 | 
			
		||||
			</div>
 | 
			
		||||
			<div class="col-12 col-sm-9 mx-auto mt-4">
 | 
			
		||||
				<h4 class="mb-4"><?php $LANGMNG->echo('t_ota') ?></h4>
 | 
			
		||||
				<?php if (!empty($QRURL)) {?>
 | 
			
		||||
					<img src="<?php echo $QRURL;?>" />
 | 
			
		||||
					<?php echo $OTACODE; ?>
 | 
			
		||||
					<form method="post" action="setting">
 | 
			
		||||
						<div class="field">
 | 
			
		||||
							<div class="label"><?php $LANGMNG->echo('l_gooleAutenticatorOtaCode') ?>:</div>
 | 
			
		||||
							<input type="text" class="input" name="otaCode" value="" required>
 | 
			
		||||
							<input type="hidden" class="input" name="otaSecret" value="<?php echo $OTASECRET;?>" required>
 | 
			
		||||
						</div>
 | 
			
		||||
						<div class="field">
 | 
			
		||||
							<input type="submit" name="submitEnableOta" class="button" value="Uložit">
 | 
			
		||||
						</div>
 | 
			
		||||
					</form>
 | 
			
		||||
				<?php } else {?>
 | 
			
		||||
					<button name="deactivateOta" type="button" class="button is-danger fa"><?php $LANGMNG->echo('b_disable');?> <?php $LANGMNG->echo('b_ota'); ?></button>
 | 
			
		||||
				<?php }?>
 | 
			
		||||
			</div>
 | 
			
		||||
			<div class="col-12 col-sm-9 mx-auto mt-4">
 | 
			
		||||
				<h4 class="mb-4"><?php $LANGMNG->echo('t_listUsers') ?></h4>
 | 
			
		||||
				<table class="table is-fluid">
 | 
			
		||||
					<thead>
 | 
			
		||||
						<tr>
 | 
			
		||||
							<th><?php $LANGMNG->echo('t_avatar');?></th>
 | 
			
		||||
							<th><?php $LANGMNG->echo('t_userName');?></th>
 | 
			
		||||
							<th><?php $LANGMNG->echo('t_ota');?></th>
 | 
			
		||||
							<th><?php $LANGMNG->echo('t_action');?></th>
 | 
			
		||||
						</tr>
 | 
			
		||||
					</thead>
 | 
			
		||||
					<tbody>
 | 
			
		||||
						<?php foreach ($USERS as $key => $user) { ?>
 | 
			
		||||
							<tr>
 | 
			
		||||
								<td><img src="<?php echo $user['gavatar_url']; ?>" /></td>
 | 
			
		||||
								<td><?php echo $user['username']; ?></td>
 | 
			
		||||
								<td><?php echo ($user['ota'] ? '<span class="fa"></span>' : ''); ?></td>
 | 
			
		||||
								<td><button name="deleteUser" type="button" class="button is-danger fa"></button></td>
 | 
			
		||||
							</tr>
 | 
			
		||||
						<?php } ?>
 | 
			
		||||
					</tbody>
 | 
			
		||||
				</table>
 | 
			
		||||
			</div>
 | 
			
		||||
			<div class="col-12 col-sm-9 mx-auto mt-4">
 | 
			
		||||
				<h4 class="mb-4"><?php $LANGMNG->echo('t_createuser') ?></h4>
 | 
			
		||||
				<form method="post">
 | 
			
		||||
					<div class="field">
 | 
			
		||||
						<div class="label"><?php $LANGMNG->echo('l_userName') ?>:</div>
 | 
			
		||||
						<input type="text" class="input" name="userName" value="">
 | 
			
		||||
					</div>
 | 
			
		||||
					<div class="field">
 | 
			
		||||
						<div class="label"><?php $LANGMNG->echo('l_password') ?>:</div>
 | 
			
		||||
						<input type="password" class="input" name="userPassword" value="">
 | 
			
		||||
					</div>
 | 
			
		||||
					<div class="field">
 | 
			
		||||
						<input type="submit" name="submitCreateUser" class="button" value="Uložit">
 | 
			
		||||
					</div>
 | 
			
		||||
				</form>
 | 
			
		||||
			</div>
 | 
			
		||||
 | 
			
		||||
			<!--Room Managment-->
 | 
			
		||||
			<div class="col-12 col-sm-9 mx-auto mt-4">
 | 
			
		||||
				<h4 class="mb-4"><?php $LANGMNG->echo('t_listRooms') ?></h4>
 | 
			
		||||
				<table class="table is-fluid">
 | 
			
		||||
					<thead>
 | 
			
		||||
						<tr>
 | 
			
		||||
							<th><?php $LANGMNG->echo('t_roomName');?></th>
 | 
			
		||||
							<th><?php $LANGMNG->echo('t_action');?></th>
 | 
			
		||||
						</tr>
 | 
			
		||||
					</thead>
 | 
			
		||||
					<tbody>
 | 
			
		||||
						<?php foreach ($ROOMS as $key => $room) { ?>
 | 
			
		||||
							<tr>
 | 
			
		||||
								<td><?php echo $room['name']; ?></td>
 | 
			
		||||
								<td>
 | 
			
		||||
									<button name="deleteRoom" type="button" class="button is-danger fa"></button>
 | 
			
		||||
									<button name="defaultRoom" type="button" class="button fa" <?php echo ($room['default'] ? 'disabled' : ''); ?>></button>
 | 
			
		||||
								</td>
 | 
			
		||||
							</tr>
 | 
			
		||||
						<?php } ?>
 | 
			
		||||
					</tbody>
 | 
			
		||||
				</table>
 | 
			
		||||
			</div>
 | 
			
		||||
 | 
			
		||||
			<!--Room Creation-->
 | 
			
		||||
			<div class="col-12 col-sm-9 mx-auto mt-4">
 | 
			
		||||
				<h4 class="mb-4"><?php $LANGMNG->echo('t_createRoom') ?></h4>
 | 
			
		||||
				<form method="post">
 | 
			
		||||
					<div class="field">
 | 
			
		||||
						<div class="label"><?php $LANGMNG->echo('l_roomName') ?>:</div>
 | 
			
		||||
						<input type="text" class="input" name="roomName" value="">
 | 
			
		||||
					</div>
 | 
			
		||||
					<div class="field">
 | 
			
		||||
						<input type="submit" name="submitCreateUser" class="button" value="<?php $LANGMNG->echo('b_create') ?>">
 | 
			
		||||
					</div>
 | 
			
		||||
				</form>
 | 
			
		||||
			</div>
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
		</div>
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
	</div>
 | 
			
		||||
	<?php
 | 
			
		||||
	$partial = new Partial('footer');
 | 
			
		||||
	$partial->render();
 | 
			
		||||
	?>
 | 
			
		||||
	<script src="./app/templates/js/setting.js"></script>
 | 
			
		||||
</script>
 | 
			
		||||
</body>
 | 
			
		||||
</html>
 | 
			
		||||
		Reference in New Issue
	
	Block a user