project structure refactoring
This commit is contained in:
		
							
								
								
									
										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>
 | 
			
		||||
		Reference in New Issue
	
	Block a user