FTP -> GIT Diff
This commit is contained in:
parent
9d9304d30e
commit
fe1247fdaf
@ -1,6 +0,0 @@
|
|||||||
.git
|
|
||||||
_FIRMWARE
|
|
||||||
_INSTALATION
|
|
||||||
_README_IMG
|
|
||||||
README.md
|
|
||||||
.todo
|
|
10
.gitignore
vendored
10
.gitignore
vendored
@ -13,9 +13,9 @@ _nemazat/css/font-awesome.min.css
|
|||||||
.vscode/
|
.vscode/
|
||||||
.vscode/sftp.json
|
.vscode/sftp.json
|
||||||
|
|
||||||
app/updater/*.bin
|
|
||||||
app/logs/*.log
|
|
||||||
backup/*.zip
|
|
||||||
|
|
||||||
|
|
||||||
vendor/
|
vendor/
|
||||||
|
|
||||||
|
|
||||||
|
logs/*.log
|
||||||
|
updater/*.bin
|
||||||
|
backup/*.zip
|
||||||
|
@ -1,255 +0,0 @@
|
|||||||
<pre>
|
|
||||||
<?php
|
|
||||||
var_dump($_POST);
|
|
||||||
var_dump(file_exists("./app/updater/" . "3C71BF22FDCF" . ".bin"));
|
|
||||||
?>
|
|
||||||
</pre>
|
|
||||||
|
|
||||||
<form class="" action="" method="post">
|
|
||||||
<label for="operator">Typ podmínky</label>
|
|
||||||
<select class="" name="operator">
|
|
||||||
<option value="or">OR</option>
|
|
||||||
<option value="and">AND</option>
|
|
||||||
</select>
|
|
||||||
<div class="variableArea">
|
|
||||||
|
|
||||||
<button name="addButton" id="addButton">+</button>
|
|
||||||
</div>
|
|
||||||
<br>
|
|
||||||
|
|
||||||
<label for="resetOperator">Typ podmínky</label>
|
|
||||||
<select class="" name="resetOperator">
|
|
||||||
<option value="or">OR</option>
|
|
||||||
<option value="and">AND</option>
|
|
||||||
</select>
|
|
||||||
<div class="resetvariableArea">
|
|
||||||
|
|
||||||
<button name="restartaAddButton" id="restartAddButton">+</button>
|
|
||||||
</div>
|
|
||||||
<br>
|
|
||||||
|
|
||||||
<button type="submit" name="button">Odeslat</button>
|
|
||||||
|
|
||||||
</form>
|
|
||||||
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
|
|
||||||
<script type="text/javascript">
|
|
||||||
function foo(element){
|
|
||||||
var id = element.attr("name").match(/\d+/)[0]
|
|
||||||
$("[name='variable["+id+"][value]']").remove();
|
|
||||||
$("[name='variable["+id+"][equaler]']").remove();
|
|
||||||
|
|
||||||
if (element.val() == "atDeviceValue") {
|
|
||||||
var arrVarOperator = [
|
|
||||||
{val : '>', text: '>'},
|
|
||||||
{val : '<', text: '<'},
|
|
||||||
];
|
|
||||||
|
|
||||||
var varOperator = $('<select name="variable['+id+'][equaler]">');
|
|
||||||
$(arrVarOperator).each(function() {
|
|
||||||
varOperator.append($('<option>').attr('value',this.val).text(this.text));
|
|
||||||
});
|
|
||||||
element.parent().append(varOperator);
|
|
||||||
|
|
||||||
|
|
||||||
var input = $("<input/>");
|
|
||||||
input.attr("type","text");
|
|
||||||
input.attr("name","variable["+id+"][value]");
|
|
||||||
element.parent().append(input);
|
|
||||||
} else if (element.val() == "time") {
|
|
||||||
var arrVarOperator = [
|
|
||||||
{val : '>', text: '>'},
|
|
||||||
{val : '<', text: '<'},
|
|
||||||
];
|
|
||||||
|
|
||||||
var varOperator = $('<select name="variable['+id+'][equaler]">');
|
|
||||||
$(arrVarOperator).each(function() {
|
|
||||||
varOperator.append($('<option>').attr('value',this.val).text(this.text));
|
|
||||||
});
|
|
||||||
element.parent().append(varOperator);
|
|
||||||
|
|
||||||
var input = $("<input/>");
|
|
||||||
input.attr("type","time");
|
|
||||||
input.attr("name","variable["+id+"][value]");
|
|
||||||
element.parent().append(input);
|
|
||||||
}else {
|
|
||||||
var arrVarOperator = [
|
|
||||||
{val : '=', text: '=='},
|
|
||||||
{val : '!=', text: '!='},
|
|
||||||
];
|
|
||||||
|
|
||||||
var varOperator = $('<select name="variable['+id+'][equaler]">');
|
|
||||||
$(arrVarOperator).each(function() {
|
|
||||||
varOperator.append($('<option>').attr('value',this.val).text(this.text));
|
|
||||||
});
|
|
||||||
element.parent().append(varOperator);
|
|
||||||
|
|
||||||
var arrVarValue = [
|
|
||||||
{val : 'true', text: 'True'},
|
|
||||||
{val : 'false', text: 'False'},
|
|
||||||
];
|
|
||||||
|
|
||||||
var varValue = $('<select name="variable['+id+'][value]">');
|
|
||||||
$(arrVarValue).each(function() {
|
|
||||||
varValue.append($('<option>').attr('value',this.val).text(this.text));
|
|
||||||
});
|
|
||||||
element.parent().append(varValue);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
$("#addButton,#restartAddButton").click( function (event) {
|
|
||||||
event.preventDefault();
|
|
||||||
var numItems = $('.var').length
|
|
||||||
var arrVarSelect = [
|
|
||||||
{val : 'sunSet', text: 'Západ Slunce'},
|
|
||||||
{val : 'sunRise', text: 'Východ Slunce'},
|
|
||||||
{val : 'inHome', text: 'Příchod'},
|
|
||||||
{val : 'outHome', text: 'Odchod'},
|
|
||||||
{val : 'time', text: 'Čas'},
|
|
||||||
{val : 'atDeviceValue', text: 'Při hodnotě zařízení'},
|
|
||||||
{val : 'sunRise', text: 'Východ Slunce'},
|
|
||||||
{val : 'noOneHome', text: 'Nikdo Doma'},
|
|
||||||
{val : 'someOneHome', text: 'Nekdo Doma'},
|
|
||||||
];
|
|
||||||
|
|
||||||
var varSelect = $('<select name="variable['+numItems+'][what]">');
|
|
||||||
$(arrVarSelect).each(function() {
|
|
||||||
varSelect.append($('<option>').attr('value',this.val).text(this.text));
|
|
||||||
});
|
|
||||||
varSelect.attr("onchange", "foo($(this))");
|
|
||||||
|
|
||||||
/*onchange = function(e) {
|
|
||||||
console.log(this.value);
|
|
||||||
if (this.value == 'atDeviceValue') {
|
|
||||||
alert("ok");
|
|
||||||
}
|
|
||||||
};*/
|
|
||||||
|
|
||||||
var arrVarOperator = [
|
|
||||||
{val : '>', text: '>'},
|
|
||||||
{val : '<', text: '<'},
|
|
||||||
{val : '=', text: '=='},
|
|
||||||
{val : '!=', text: '!='},
|
|
||||||
];
|
|
||||||
|
|
||||||
var varOperator = $('<select name="variable['+numItems+'][equaler]">');
|
|
||||||
$(arrVarOperator).each(function() {
|
|
||||||
varOperator.append($('<option>').attr('value',this.val).text(this.text));
|
|
||||||
});
|
|
||||||
|
|
||||||
var arrVarValue = [
|
|
||||||
{val : 'true', text: 'True'},
|
|
||||||
{val : 'false', text: 'False'},
|
|
||||||
];
|
|
||||||
|
|
||||||
var varValue = $('<select name="variable['+numItems+'][value]">');
|
|
||||||
$(arrVarValue).each(function() {
|
|
||||||
varValue.append($('<option>').attr('value',this.val).text(this.text));
|
|
||||||
});
|
|
||||||
|
|
||||||
var newDiv = $("<div class=var>").append(varSelect);
|
|
||||||
newDiv = newDiv.append(varOperator);
|
|
||||||
newDiv = newDiv.append(varValue);
|
|
||||||
$(this).parent().append(newDiv);
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
/*var arrVarSelect = [
|
|
||||||
{val : 'sunSet', text: 'Západ Slunce'},
|
|
||||||
{val : 'sunRise', text: 'Východ Slunce'},
|
|
||||||
{val : 'inHome', text: 'Příchod'},
|
|
||||||
{val : 'outHome', text: 'Odchod'},
|
|
||||||
{val : 'time', text: 'Čas'},
|
|
||||||
{val : 'atDeviceValue', text: 'Při hodnotě zařízení'},
|
|
||||||
{val : 'sunRise', text: 'Východ Slunce'},
|
|
||||||
{val : 'noOneHome', text: 'Nikdo Doma'},
|
|
||||||
{val : 'someOneHome', text: 'Nekdo Doma'},
|
|
||||||
];
|
|
||||||
|
|
||||||
var varSelect = $('<select name="variable['+numItems+'][]">');
|
|
||||||
$(arrVarSelect).each(function() {
|
|
||||||
varSelect.append($('<option>').attr('value',this.val).text(this.text));
|
|
||||||
});
|
|
||||||
|
|
||||||
var arrVarOperator = [
|
|
||||||
{val : '>', text: '>'},
|
|
||||||
{val : '<', text: '<'},
|
|
||||||
{val : '=', text: '=='},
|
|
||||||
{val : '!=', text: '!='},
|
|
||||||
];
|
|
||||||
|
|
||||||
var varOperator = $('<select name="variable['+numItems+'][]">');
|
|
||||||
$(arrVarOperator).each(function() {
|
|
||||||
varOperator.append($('<option>').attr('value',this.val).text(this.text));
|
|
||||||
});
|
|
||||||
|
|
||||||
var arrVarValue = [
|
|
||||||
{val : 'true', text: 'True'},
|
|
||||||
{val : 'false', text: 'False'},
|
|
||||||
];
|
|
||||||
|
|
||||||
var varValue = $('<select name="variable['+numItems+'][]">');
|
|
||||||
$(arrVarValue).each(function() {
|
|
||||||
varValue.append($('<option>').attr('value',this.val).text(this.text));
|
|
||||||
});
|
|
||||||
|
|
||||||
//TODO změna výstupní proměné na základě vstupu date,num etc
|
|
||||||
var newDiv = $("<div class=var>").append(varSelect);/*.change(
|
|
||||||
function (subEvent) {
|
|
||||||
alert(subEvent);
|
|
||||||
}
|
|
||||||
);*/
|
|
||||||
/*newDiv = newDiv.append(varOperator);
|
|
||||||
newDiv = newDiv.append(varValue);
|
|
||||||
$(".restartaAddButton")append(newDiv);*/
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
var arrVarSelect = [
|
|
||||||
{val : 'sunSet', text: 'Západ Slunce'},
|
|
||||||
{val : 'sunRise', text: 'Východ Slunce'},
|
|
||||||
{val : 'inHome', text: 'Příchod'},
|
|
||||||
{val : 'outHome', text: 'Odchod'},
|
|
||||||
{val : 'time', text: 'Čas'},
|
|
||||||
{val : 'atDeviceValue', text: 'Při hodnotě zařízení'},
|
|
||||||
{val : 'sunRise', text: 'Východ Slunce'},
|
|
||||||
{val : 'noOneHome', text: 'Nikdo Doma'},
|
|
||||||
{val : 'someOneHome', text: 'Nekdo Doma'},
|
|
||||||
];
|
|
||||||
|
|
||||||
var varSelect = $('<select name="variable['+numItems+'][]">');
|
|
||||||
$(arrVarSelect).each(function() {
|
|
||||||
varSelect.append($('<option>').attr('value',this.val).text(this.text));
|
|
||||||
});
|
|
||||||
|
|
||||||
var arrVarOperator = [
|
|
||||||
{val : '>', text: '>'},
|
|
||||||
{val : '<', text: '<'},
|
|
||||||
{val : '=', text: '=='},
|
|
||||||
{val : '!=', text: '!='},
|
|
||||||
];
|
|
||||||
|
|
||||||
var varOperator = $('<select name="variable['+numItems+'][]">');
|
|
||||||
$(arrVarOperator).each(function() {
|
|
||||||
varOperator.append($('<option>').attr('value',this.val).text(this.text));
|
|
||||||
});
|
|
||||||
|
|
||||||
var arrVarValue = [
|
|
||||||
{val : 'true', text: 'True'},
|
|
||||||
{val : 'false', text: 'False'},
|
|
||||||
];
|
|
||||||
|
|
||||||
var varValue = $('<select name="variable['+numItems+'][]">');
|
|
||||||
$(arrVarValue).each(function() {
|
|
||||||
varValue.append($('<option>').attr('value',this.val).text(this.text));
|
|
||||||
});
|
|
||||||
|
|
||||||
//TODO změna výstupní proměné na základě vstupu date,num etc
|
|
||||||
var newDiv = $("<div class=var>").append(varSelect);/*.change(
|
|
||||||
function (subEvent) {
|
|
||||||
alert(subEvent);
|
|
||||||
}
|
|
||||||
);*/
|
|
||||||
/* newDiv = newDiv.append(varOperator);
|
|
||||||
newDiv = newDiv.append(varValue);
|
|
||||||
$(".variableArea").parent().append(newDiv);*/
|
|
||||||
|
|
||||||
</script>
|
|
2044
adminer.php
2044
adminer.php
File diff suppressed because one or more lines are too long
@ -105,10 +105,8 @@ $apiLogManager->write("[API] request body\n" . json_encode($obj, JSON_PRETTY_PRI
|
|||||||
$apiLogManager->write("[API] POST body\n" . json_encode($_POST, JSON_PRETTY_PRINT), LogRecordTypes::INFO);
|
$apiLogManager->write("[API] POST body\n" . json_encode($_POST, JSON_PRETTY_PRINT), LogRecordTypes::INFO);
|
||||||
$apiLogManager->write("[API] GET body\n" . json_encode($_GET, JSON_PRETTY_PRINT), LogRecordTypes::INFO);
|
$apiLogManager->write("[API] GET body\n" . json_encode($_GET, JSON_PRETTY_PRINT), LogRecordTypes::INFO);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Debugger::flag('dbconnect');
|
Debugger::flag('dbconnect');
|
||||||
//D B Conector
|
//DB Conector
|
||||||
Db::connect (DBHOST, DBUSER, DBPASS, DBNAME);
|
Db::connect (DBHOST, DBUSER, DBPASS, DBNAME);
|
||||||
|
|
||||||
Debugger::flag('routes');
|
Debugger::flag('routes');
|
||||||
|
@ -112,7 +112,7 @@ class Form {
|
|||||||
* [render function whitch dysplay generated form]
|
* [render function whitch dysplay generated form]
|
||||||
*/
|
*/
|
||||||
function render(){
|
function render(){
|
||||||
self::addInput(InputTypes::SUBMIT, 'formSubmit', '', 'Submit', 'Submit');
|
self::addInput(InputTypes::SUBMIT, 'formSubmit', '', '', 'Submit');
|
||||||
$form = '<form '.$this->formName.$this->formId.$this->method.$this->action.'">';
|
$form = '<form '.$this->formName.$this->formId.$this->method.$this->action.'">';
|
||||||
$form .= $this->formContent;
|
$form .= $this->formContent;
|
||||||
$form .= '</form>';
|
$form .= '</form>';
|
||||||
|
29
app/models/managers/Pluginmanager.php
Normal file
29
app/models/managers/Pluginmanager.php
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
<?php
|
||||||
|
class PluginManager
|
||||||
|
{
|
||||||
|
public function load(){
|
||||||
|
$dir = $_SERVER['DOCUMENT_ROOT'] . BASEDIR . '/backup/';
|
||||||
|
|
||||||
|
$pluginsFiles = scandir ($dir);
|
||||||
|
foreach ($pluginsFiles as $key => $pluginFile) {
|
||||||
|
$className = str_replace(".zip", "", $pluginsFiles);
|
||||||
|
if(class_exists($className)){
|
||||||
|
(new $className)->make();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$sleepTime = DeviceManager::getDeviceById($deviceId)['sleep_time'];
|
||||||
|
|
||||||
|
$LastRecordTime = new DateTime(RecordManager::getLastRecord($subDeviceId, 1)['time']);
|
||||||
|
$interval = $LastRecordTime->diff(new DateTime());
|
||||||
|
$hours = $interval->format('%h');
|
||||||
|
$minutes = $interval->format('%i');
|
||||||
|
$lastSeen = ($hours * 60 + $minutes);
|
||||||
|
|
||||||
|
if ($lastSeen > $sleepTime || $sleepTime == 0) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
@ -66,10 +66,6 @@ class SubDeviceManager
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function editSubDevicesByDevice ($deviceId, $subDeviceParameters) {
|
|
||||||
DB::edit('subdevices', $subDeviceParameters, 'WHERE device_id=?', array ($deviceId));
|
|
||||||
}
|
|
||||||
|
|
||||||
public static function remove($subDeviceId)
|
public static function remove($subDeviceId)
|
||||||
{
|
{
|
||||||
RecordManager::cleanSubdeviceRecords($subDeviceId);
|
RecordManager::cleanSubdeviceRecords($subDeviceId);
|
||||||
|
11
app/plugins/!ExamplePlugin.php
Normal file
11
app/plugins/!ExamplePlugin.php
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
<?php
|
||||||
|
class ExamplePlugin extends VirtualDeviceManager
|
||||||
|
{
|
||||||
|
function make(){
|
||||||
|
//Getting Data
|
||||||
|
}
|
||||||
|
|
||||||
|
function translate($value){
|
||||||
|
//Translation of numeric values
|
||||||
|
}
|
||||||
|
}
|
39
app/plugins/!_Covid.php
Normal file
39
app/plugins/!_Covid.php
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
<?php
|
||||||
|
class Covid extends VirtualDeviceManager
|
||||||
|
{
|
||||||
|
private $country_sluig = "czech-republic";
|
||||||
|
private $api_uri = 'https://api.covid19api.com/live/country/%s/status/confirmed'; // Your redirect uri
|
||||||
|
private $virtual_device_name = "Covid";
|
||||||
|
|
||||||
|
function make()
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
if (DeviceManager::registeret($this->virtual_device_name)) {
|
||||||
|
$deviceId = DeviceManager::getDeviceByToken($this->virtual_device_name)['device_id'];
|
||||||
|
$dataItems = ['Confirmed', 'Deaths', 'Recovered', 'Active'];
|
||||||
|
foreach ($dataItems as $dataItem) {
|
||||||
|
if (!$subDevice = SubDeviceManager::getSubDeviceByMaster($deviceId, strtolower($dataItem))) {
|
||||||
|
SubDeviceManager::create($deviceId, strtolower($dataItem), $dataItem);
|
||||||
|
sleep(1);
|
||||||
|
$subDevice = SubDeviceManager::getSubDeviceByMaster($deviceId, strtolower($dataItem));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!$this->fetchEnabled($deviceId, $subDevice['subdevice_id'])) die();
|
||||||
|
|
||||||
|
$finalUrl = sprintf($this->api_uri, $this->country_sluig);
|
||||||
|
$json = json_decode(Utilities::CallAPI('GET', $finalUrl, ''), true);
|
||||||
|
|
||||||
|
foreach ($dataItems as $dataItem) {
|
||||||
|
RecordManager::create($deviceId, strtolower($dataItem), end($json)[$dataItem]);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
DeviceManager::create($this->virtual_device_name, $this->virtual_device_name, 'senzore-virtual');
|
||||||
|
DeviceManager::approved($this->virtual_device_name);
|
||||||
|
}
|
||||||
|
return 'sucessful';
|
||||||
|
} catch (Exception $e) {
|
||||||
|
return 'exception: ' . $e->getMessage();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -9,14 +9,6 @@ class AirQuality extends VirtualDeviceManager
|
|||||||
|
|
||||||
function make()
|
function make()
|
||||||
{
|
{
|
||||||
//Register the settings
|
|
||||||
$settingMng = new SettingsManager();
|
|
||||||
if (!($settingField = $settingMng->getByName("airquality"))) {
|
|
||||||
$settingMng->create("token", "", "airquality");
|
|
||||||
} else {
|
|
||||||
$app_id = $settingField['value'];
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
if (DeviceManager::registeret($this->virtual_device_name)) {
|
if (DeviceManager::registeret($this->virtual_device_name)) {
|
||||||
$deviceId = DeviceManager::getDeviceByToken($this->virtual_device_name)['device_id'];
|
$deviceId = DeviceManager::getDeviceByToken($this->virtual_device_name)['device_id'];
|
||||||
|
@ -24,7 +24,15 @@ $partial = new Partial('head');
|
|||||||
<div class="col-md-9 main-body">
|
<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>
|
<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">
|
<div class="row no-gutters">
|
||||||
<?php foreach ($AUTOMATIONS as $automationId => $automationData) {
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<?php
|
||||||
|
foreach ($AUTOMATIONS as $automationId => $automationData) {
|
||||||
//BUTTON
|
//BUTTON
|
||||||
$partial = new Partial('automationButton');
|
$partial = new Partial('automationButton');
|
||||||
$partial->prepare('langMng',$LANGMNG);
|
$partial->prepare('langMng',$LANGMNG);
|
||||||
@ -57,6 +65,28 @@ $partial = new Partial('head');
|
|||||||
|
|
||||||
$partial->prepare('subDevices',$SUBDEVICES);
|
$partial->prepare('subDevices',$SUBDEVICES);
|
||||||
$partial->render();
|
$partial->render();
|
||||||
|
|
||||||
|
$form = new Form('Automation', 'automation-1', 'POST', '');
|
||||||
|
$form->addInput('text','name', 'name', '', true, true);
|
||||||
|
$form->addSelect('run-condition', 'run-condition', 'l_run_condition', [
|
||||||
|
'test' => 'test',
|
||||||
|
'test1' => 'test',
|
||||||
|
'test2' => 'test',
|
||||||
|
'test3' => 'test',
|
||||||
|
'test4' => 'test',
|
||||||
|
'test5' => 'test',
|
||||||
|
|
||||||
|
], true, true, true);
|
||||||
|
$form->addInput('button','add-condition', 'add-condition', 'l_condition', true, true);
|
||||||
|
$form->addSelect('active-time', 'active-time', 'l_run_schedule', [
|
||||||
|
'all' => 'l_all',
|
||||||
|
'day' => 'l_day',
|
||||||
|
'night' => 'l_night',
|
||||||
|
'custome' => 'l_custome',
|
||||||
|
], true, true, true);
|
||||||
|
|
||||||
|
$form->render();
|
||||||
|
|
||||||
}?>
|
}?>
|
||||||
<script src="./app/templates/js/automation.js"></script>
|
<script src="./app/templates/js/automation.js"></script>
|
||||||
<?php
|
<?php
|
||||||
|
@ -8,60 +8,26 @@
|
|||||||
<div class="field">
|
<div class="field">
|
||||||
<input class="input" type="text" name="name" required/>
|
<input class="input" type="text" name="name" required/>
|
||||||
</div>
|
</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="label"><?php $LANGMNG->echo('l_runCondition')?></div>
|
||||||
<div class="field">
|
<select class="input" name="condOper" id="valueSelector" required>
|
||||||
<select class="input" name="devices[]" multiple>
|
<option value="or"><?php $LANGMNG->echo('l_oneNeedToBeWaild')?></option>
|
||||||
<?php foreach ($SUBDEVICES as $subDeviceKey => $subDeviceValue){
|
<option value="and"><?php $LANGMNG->echo('l_allNeedToBeWalid')?></option>
|
||||||
if ($subDeviceValue['type'] != 'on/off') continue;?>
|
</select>
|
||||||
<option value="<?php echo $subDeviceValue['masterDevice']; ?>"><?php echo $subDeviceValue['name']; ?></option>
|
<input type="button" class="button" name="addCondition" value="<?php $LANGMNG->echo('b_add')?>"/>
|
||||||
<?php } ?>
|
|
||||||
</select>
|
|
||||||
|
<div class="label"><?php $LANGMNG->echo('l_runTask')?></div>
|
||||||
|
<input type="button" class="button" name="addTask" value="<?php $LANGMNG->echo('b_add')?>"/>
|
||||||
|
|
||||||
|
<div class="label"><?php $LANGMNG->echo('l_activeTime')?></div>
|
||||||
|
<select class="input" name="condOper" id="valueSelector" required>
|
||||||
|
<option value="allday"><?php $LANGMNG->echo('l_all')?></option>
|
||||||
|
<option value="daytime"><?php $LANGMNG->echo('l_day')?></option>
|
||||||
|
<option value="night"><?php $LANGMNG->echo('l_night')?></option>
|
||||||
|
<option value="custom"><?php $LANGMNG->echo('l_custome')?></option>
|
||||||
|
</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>
|
</div>
|
||||||
<input type="submit" class="button" name="modalNext" value="<?php $LANGMNG->echo('b_next')?>"/>
|
<input type="submit" class="button" name="modalNext" value="<?php $LANGMNG->echo('b_next')?>"/>
|
||||||
</form>
|
</form>
|
||||||
|
69
app/views/templates/part/newAutomationCreate.phtml
Normal file
69
app/views/templates/part/newAutomationCreate.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>
|
@ -5,14 +5,14 @@ RewriteCond %{REQUEST_FILENAME} !-f
|
|||||||
RewriteCond %{REQUEST_FILENAME} !-d
|
RewriteCond %{REQUEST_FILENAME} !-d
|
||||||
RewriteCond %{REQUEST_FILENAME} !.css
|
RewriteCond %{REQUEST_FILENAME} !.css
|
||||||
RewriteCond %{REQUEST_FILENAME} !.js
|
RewriteCond %{REQUEST_FILENAME} !.js
|
||||||
RewriteRule (.*) ./index.php?url=$1 [QSA,L]
|
RewriteRule (.*) ./index.php?url=$1#$2 [QSA,L]
|
||||||
|
|
||||||
#token to HTTP_AUTHORIZATION
|
#token to HTTP_AUTHORIZATION
|
||||||
RewriteCond %{HTTP:Authorization} ^(.*)
|
RewriteCond %{HTTP:Authorization} ^(.*)
|
||||||
RewriteRule . - [e=HTTP_AUTHORIZATION:%1]
|
RewriteRule . - [e=HTTP_AUTHORIZATION:%1]
|
||||||
|
|
||||||
RewriteCond %{HTTPS} off
|
#RewriteCond %{HTTPS} off
|
||||||
RewriteCond %{REQUEST_URI} !^/api/update
|
#RewriteCond %{REQUEST_URI} !^/api/update
|
||||||
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
|
#RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
|
||||||
|
|
||||||
AddType application/x-httpd-php .php .phtml
|
AddType application/x-httpd-php .php .phtml
|
||||||
|
@ -1,33 +1,3 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
/**
|
require_once __DIR__ . '/../app/Bootstrap.php';
|
||||||
* Composer autoload
|
|
||||||
*/
|
|
||||||
|
|
||||||
use Core\Application\Application;
|
|
||||||
use Core\Configuration\Configurations;
|
|
||||||
use Illuminate\Container\Container;
|
|
||||||
|
|
||||||
require_once __DIR__ . '/../vendor/autoload.php';
|
|
||||||
|
|
||||||
$container = new Container();
|
|
||||||
|
|
||||||
$container->singleton(
|
|
||||||
Configurations::class,
|
|
||||||
Configurations::class
|
|
||||||
);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Create application & run
|
|
||||||
*/
|
|
||||||
$application = new Application(
|
|
||||||
$container,
|
|
||||||
$container->make(Configurations::class)
|
|
||||||
);
|
|
||||||
$application->run();
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Bootstrap v1.0
|
|
||||||
*/
|
|
||||||
require_once __DIR__ . '/../app/Bootstrap.php';
|
|
@ -1,64 +0,0 @@
|
|||||||
importScripts('https://www.gstatic.com/firebasejs/7.1.0/firebase-app.js');
|
|
||||||
importScripts('https://www.gstatic.com/firebasejs/7.1.0/firebase-messaging.js');
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Cache version, change name to force reload
|
|
||||||
*/
|
|
||||||
var CACHE_VERSION = 'v1';
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Stuff to put in the cache at install
|
|
||||||
*/
|
|
||||||
var CACHE_FILES = [
|
|
||||||
'templates/automatio.phtml',
|
|
||||||
'templates/dashboard.phtml',
|
|
||||||
'templates/home.phtml',
|
|
||||||
'templates/login.phtml',
|
|
||||||
'templates/scene.phtml',
|
|
||||||
'templates/setting.phtml',
|
|
||||||
'views/Automation.phtml',
|
|
||||||
'views/Dashboard.phtml',
|
|
||||||
'views/Home.phtml',
|
|
||||||
'views/Login.phtml',
|
|
||||||
'views/Scene.phtml',
|
|
||||||
'views/Setting.phtml',
|
|
||||||
'assets/logo.svg'
|
|
||||||
];
|
|
||||||
|
|
||||||
|
|
||||||
self.addEventListener('install', function(event) {
|
|
||||||
console.info('Installed');
|
|
||||||
});
|
|
||||||
|
|
||||||
self.addEventListener('push', function(event) {
|
|
||||||
console.log('Received a push message', event);
|
|
||||||
if (event && event.data) {
|
|
||||||
var data = event.data.json();
|
|
||||||
data = JSON.parse(data.data.notification);
|
|
||||||
console.log(data);
|
|
||||||
event.waitUntil(self.registration.showNotification(data.title, {
|
|
||||||
body: data.body,
|
|
||||||
icon: data.icon || null
|
|
||||||
}));
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
self.addEventListener('sync', function(event) {
|
|
||||||
console.info('Event: Sync');
|
|
||||||
});
|
|
||||||
|
|
||||||
self.addEventListener('fetch', function (event) {
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
self.addEventListener("online", function (event) {
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
self.addEventListener("offline", function (event) {
|
|
||||||
});
|
|
||||||
|
|
||||||
self.addEventListener('notificationclick', function(e) {
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user