Compare commits
20 Commits
feature/co
...
2410441b88
Author | SHA1 | Date | |
---|---|---|---|
2410441b88 | |||
|
1f49391b36 | ||
|
c17e3090a8 | ||
dc77534bad | |||
|
cb45cf9e22 | ||
|
47a5f71d9b | ||
|
1642ece7f4 | ||
696ff07987 | |||
|
1415c0cf2d | ||
|
d9952a59fb | ||
|
b5b2bb95a7 | ||
bad58f82e2 | |||
|
64b50ead9f | ||
|
a3a87d39d2 | ||
|
c4f36235ab | ||
daa0e0a2c5 | |||
|
464f229a16 | ||
|
fe72097d75 | ||
|
98efb779b1 | ||
30045b9f65 |
1
.gitignore
vendored
1
.gitignore
vendored
@@ -2,6 +2,7 @@
|
|||||||
.ftpconfig
|
.ftpconfig
|
||||||
.ftpconfig2
|
.ftpconfig2
|
||||||
*.log
|
*.log
|
||||||
|
*.bin
|
||||||
config.php
|
config.php
|
||||||
|
|
||||||
_nemazat/index.html
|
_nemazat/index.html
|
||||||
|
@@ -19,7 +19,7 @@ $router->any('/logout', 'Logout');
|
|||||||
$router->any('/automation', 'Automation');
|
$router->any('/automation', 'Automation');
|
||||||
$router->any('/setting', 'Setting');
|
$router->any('/setting', 'Setting');
|
||||||
$router->any('/device', 'Device');
|
$router->any('/device', 'Device');
|
||||||
$router->get('/device/{sortBy}/{sortType}', 'Device');
|
$router->any('/device/{sortBy}/{sortType}', 'Device');
|
||||||
$router->any('/plugins', 'Plugins');
|
$router->any('/plugins', 'Plugins');
|
||||||
$router->any('/ajax', 'Ajax');
|
$router->any('/ajax', 'Ajax');
|
||||||
$router->any('/oauth', 'Oauth');
|
$router->any('/oauth', 'Oauth');
|
||||||
@@ -53,6 +53,7 @@ $router->any('/api/HA', 'GoogleHomeApi@response');
|
|||||||
$router->post('/api/endpoint/', 'EndpointsApi@default');
|
$router->post('/api/endpoint/', 'EndpointsApi@default');
|
||||||
$router->any('/api/update/', 'UpdatesApi@default');
|
$router->any('/api/update/', 'UpdatesApi@default');
|
||||||
$router->any('/api/users/status', 'UsersApi@status');
|
$router->any('/api/users/status', 'UsersApi@status');
|
||||||
|
$router->any('/api/users/subscribe', 'UsersApi@subscribe');
|
||||||
|
|
||||||
// examples
|
// examples
|
||||||
$router->any('/api/example', 'ExampleApi@example');
|
$router->any('/api/example', 'ExampleApi@example');
|
||||||
|
@@ -12,6 +12,11 @@ class CronApi extends ApiController
|
|||||||
$backupWorker = new DatabaseBackup();
|
$backupWorker = new DatabaseBackup();
|
||||||
$backupWorker->purge(5);
|
$backupWorker->purge(5);
|
||||||
|
|
||||||
|
//Old Records Cleanup
|
||||||
|
foreach (SubDeviceManager::getAllSubDevices() as $key => $value) {
|
||||||
|
RecordManager::setHistory($value['subdevice_id']);
|
||||||
|
}
|
||||||
|
|
||||||
$this->response(['Value' => 'OK']);
|
$this->response(['Value' => 'OK']);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -7,11 +7,9 @@ class DevicesApi extends ApiController{
|
|||||||
$response = [];
|
$response = [];
|
||||||
|
|
||||||
// TODO: process the request
|
// TODO: process the request
|
||||||
|
|
||||||
$this->response($response);
|
$this->response($response);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getDevicesByRoom($roomId){
|
public function getDevicesByRoom($roomId){
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -62,6 +62,7 @@ class EndpointsApi extends ApiController{
|
|||||||
}
|
}
|
||||||
|
|
||||||
$device = DeviceManager::getDeviceByToken($obj['token']);
|
$device = DeviceManager::getDeviceByToken($obj['token']);
|
||||||
|
DeviceManager::setHeartbeat($device['device_id']);
|
||||||
|
|
||||||
//Diagnostic
|
//Diagnostic
|
||||||
if (isset($obj['settings'])){
|
if (isset($obj['settings'])){
|
||||||
@@ -112,7 +113,7 @@ class EndpointsApi extends ApiController{
|
|||||||
}
|
}
|
||||||
|
|
||||||
$subDeviceLastReordValue[$key] = $value['value'];
|
$subDeviceLastReordValue[$key] = $value['value'];
|
||||||
RecordManager::create($device['device_id'], $key, round($value['value'],3));
|
RecordManager::create($device['device_id'], $key, round($value['value'],3), 'device');
|
||||||
$logManager->write("[API] Device_ID " . $device['device_id'] . " writed value " . $key . ' ' . $value['value'], LogRecordTypes::INFO);
|
$logManager->write("[API] Device_ID " . $device['device_id'] . " writed value " . $key . ' ' . $value['value'], LogRecordTypes::INFO);
|
||||||
|
|
||||||
//notification
|
//notification
|
||||||
|
@@ -34,4 +34,14 @@ class UsersApi extends ApiController{
|
|||||||
}
|
}
|
||||||
$this->response(['value'=>'OK']);
|
$this->response(['value'=>'OK']);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function subscribe(){
|
||||||
|
//$this->requireAuth();
|
||||||
|
$bearer = $_SERVER['HTTP_AUTHORIZATION'];
|
||||||
|
$authManager = new AuthManager();
|
||||||
|
$userId = $authManager->getUserId($bearer);
|
||||||
|
|
||||||
|
NotificationManager::addSubscriber($userId, $this->input['pushtoken']);
|
||||||
|
$this->response(['value'=>'OK']);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@@ -14,7 +14,7 @@ class WidgetApi extends ApiController
|
|||||||
$subDeviceData = SubDeviceManager::getSubDevice($subDeviceId);
|
$subDeviceData = SubDeviceManager::getSubDevice($subDeviceId);
|
||||||
if ($subDeviceData['type'] == 'on/off') {
|
if ($subDeviceData['type'] == 'on/off') {
|
||||||
$lastValue = RecordManager::getLastRecord($subDeviceData['subdevice_id'])['value'];
|
$lastValue = RecordManager::getLastRecord($subDeviceData['subdevice_id'])['value'];
|
||||||
RecordManager::create($subDeviceData['device_id'], 'on/off', (int) !$lastValue);
|
RecordManager::create($subDeviceData['device_id'], 'on/off', (int) !$lastValue, "vue-app");
|
||||||
$response = !$lastValue;
|
$response = !$lastValue;
|
||||||
} else {
|
} else {
|
||||||
throw new Exception("Bad Request", 403);
|
throw new Exception("Bad Request", 403);
|
||||||
|
@@ -1,6 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
if (!empty ($_POST)){
|
if (!empty ($_POST)){
|
||||||
$deviceManager = new DeviceManager ();
|
$deviceManager = new DeviceManager ();
|
||||||
|
$subDeviceManager = new SubDeviceManager ();
|
||||||
if (!empty ($_FILES['deviceFirmware']) && !empty ($_FILES['deviceFirmware']['tmp_name']) && !empty ($_POST['deviceId'])) {
|
if (!empty ($_FILES['deviceFirmware']) && !empty ($_FILES['deviceFirmware']['tmp_name']) && !empty ($_POST['deviceId'])) {
|
||||||
$file = $_FILES['deviceFirmware'];
|
$file = $_FILES['deviceFirmware'];
|
||||||
$deviceMac = $deviceManager->getDeviceById ($_POST['deviceId'])['mac'];
|
$deviceMac = $deviceManager->getDeviceById ($_POST['deviceId'])['mac'];
|
||||||
@@ -27,6 +28,9 @@ if (!empty ($_POST)){
|
|||||||
if (!empty ($_POST['deviceName']) && !empty ($_POST['deviceId'])) {
|
if (!empty ($_POST['deviceName']) && !empty ($_POST['deviceId'])) {
|
||||||
$deviceManager->edit ($_POST['deviceId'], array ('name' => $_POST['deviceName']));
|
$deviceManager->edit ($_POST['deviceId'], array ('name' => $_POST['deviceName']));
|
||||||
}
|
}
|
||||||
header('Location: ./device');
|
if (isset ($_POST['deviceHistory']) && !empty ($_POST['deviceId'])) {
|
||||||
|
$subDeviceManager->editSubDevicesByDevice($_POST['deviceId'], array ('history' => $_POST['deviceHistory']));
|
||||||
|
}
|
||||||
|
header('Location: ' . BASEURL . str_replace(BASEDIR, "", $_SERVER['REQUEST_URI']));
|
||||||
die();
|
die();
|
||||||
}
|
}
|
||||||
|
@@ -28,6 +28,17 @@ if (isset($_POST) && !empty($_POST)){
|
|||||||
die();
|
die();
|
||||||
} else if (isset ($_POST['userPermission']) && !empty ($_POST['userID'])) {
|
} else if (isset ($_POST['userPermission']) && !empty ($_POST['userID'])) {
|
||||||
$userManager->setUserDataAdmin("permission", $_POST['userPermission'], $_POST['userID']);
|
$userManager->setUserDataAdmin("permission", $_POST['userPermission'], $_POST['userID']);
|
||||||
|
header('Location: ' . BASEURL . 'setting');
|
||||||
|
die();
|
||||||
|
} else {
|
||||||
|
foreach ($_POST as $key => $value) {
|
||||||
|
if ($key == 'submit') continue;
|
||||||
|
$settingMng = new SettingsManager();
|
||||||
|
if ($settingMng->getByName($key)) {
|
||||||
|
$settingMng->update($key, $value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
header('Location: ' . BASEURL . 'setting');
|
header('Location: ' . BASEURL . 'setting');
|
||||||
die();
|
die();
|
||||||
}
|
}
|
||||||
|
@@ -1,6 +1,8 @@
|
|||||||
<?php
|
<?php
|
||||||
class GoogleHome {
|
class GoogleHome
|
||||||
static function sync($requestId){
|
{
|
||||||
|
static function sync($requestId)
|
||||||
|
{
|
||||||
$devices = [];
|
$devices = [];
|
||||||
$roomsData = RoomManager::getAllRooms();
|
$roomsData = RoomManager::getAllRooms();
|
||||||
foreach ($roomsData as $roomKey => $roomData) {
|
foreach ($roomsData as $roomKey => $roomData) {
|
||||||
@@ -26,7 +28,7 @@ class GoogleHome {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($traids < 0){
|
if ($traids < 1) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -64,19 +66,21 @@ class GoogleHome {
|
|||||||
echo json_encode($response);
|
echo json_encode($response);
|
||||||
}
|
}
|
||||||
|
|
||||||
static function query($requestId, $payload){
|
static function query($requestId, $payload)
|
||||||
|
{
|
||||||
$devices = [];
|
$devices = [];
|
||||||
$num = 0;
|
$num = 0;
|
||||||
foreach ($payload['devices'] as $deviceId) {
|
foreach ($payload['devices'] as $deviceId) {
|
||||||
$subDevicesData = SubDeviceManager::getAllSubDevices($deviceId['id']);
|
|
||||||
|
|
||||||
$tempDevice[$deviceId['id']] = [
|
$tempDevice[$deviceId['id']] = [
|
||||||
'online' => false,
|
'online' => false,
|
||||||
'status' => 'OFFLINE',
|
'status' => 'OFFLINE',
|
||||||
];
|
];
|
||||||
|
|
||||||
|
if ($subDevicesData = SubDeviceManager::getAllSubDevices($deviceId['id'])) {
|
||||||
foreach ($subDevicesData as $key => $subDeviceData) {
|
foreach ($subDevicesData as $key => $subDeviceData) {
|
||||||
$lastRecord = RecordManager::getLastRecord($subDeviceData['subdevice_id']);
|
$lastRecord = RecordManager::getLastRecord($subDeviceData['subdevice_id']);
|
||||||
if ($lastRecord['execuded'] == 1){
|
if ($lastRecord != false && $lastRecord['execuded'] == 1) {
|
||||||
$tempDevice[$deviceId['id']]['online'] = true;
|
$tempDevice[$deviceId['id']]['online'] = true;
|
||||||
$tempDevice[$deviceId['id']]['status'] = "SUCCESS";
|
$tempDevice[$deviceId['id']]['status'] = "SUCCESS";
|
||||||
} else {
|
} else {
|
||||||
@@ -121,11 +125,14 @@ class GoogleHome {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if ($lastRecord['execuded'] == 1){
|
// $lastRecord = RecordManager::getLastRecord($deviceId['id']);
|
||||||
$online = true;
|
// //var_dump($lastRecord);
|
||||||
$status = 'SUCCESS';
|
// if ($lastRecord['execuded'] == 1) {
|
||||||
} else {
|
// $online = true;
|
||||||
|
// $status = 'SUCCESS';
|
||||||
|
// } else {
|
||||||
$executed = 0;
|
$executed = 0;
|
||||||
$waiting = 0;
|
$waiting = 0;
|
||||||
foreach (RecordManager::getLastRecord($deviceId['id'], 6) as $key => $value) {
|
foreach (RecordManager::getLastRecord($deviceId['id'], 6) as $key => $value) {
|
||||||
@@ -135,15 +142,16 @@ class GoogleHome {
|
|||||||
$waiting++;
|
$waiting++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($waiting < $executed) {
|
if ($waiting < $executed) {
|
||||||
$status = "PENDING";
|
$status = "PENDING";
|
||||||
$online = true;
|
$online = true;
|
||||||
}
|
}
|
||||||
}
|
// }
|
||||||
$devices = $tempDevice;
|
$devices = $tempDevice;
|
||||||
/*if (count($devices)> 1){
|
if (count($devices)> 1){
|
||||||
$devices[] = $tempDevice;
|
$devices[] = $tempDevice;
|
||||||
}*/
|
}
|
||||||
}
|
}
|
||||||
$response = [
|
$response = [
|
||||||
'requestId' => $requestId,
|
'requestId' => $requestId,
|
||||||
@@ -157,7 +165,8 @@ class GoogleHome {
|
|||||||
echo json_encode($response);
|
echo json_encode($response);
|
||||||
}
|
}
|
||||||
|
|
||||||
static function execute($requestId, $payload){
|
static function execute($requestId, $payload)
|
||||||
|
{
|
||||||
$commands = [];
|
$commands = [];
|
||||||
foreach ($payload['commands'] as $key => $command) {
|
foreach ($payload['commands'] as $key => $command) {
|
||||||
foreach ($command['devices'] as $key2 => $device) {
|
foreach ($command['devices'] as $key2 => $device) {
|
||||||
@@ -167,7 +176,8 @@ static function execute($requestId, $payload){
|
|||||||
}
|
}
|
||||||
|
|
||||||
$deviceType = GoogleHomeDeviceTypes::getType($executionCommand['command']);
|
$deviceType = GoogleHomeDeviceTypes::getType($executionCommand['command']);
|
||||||
$subDeviceId = SubDeviceManager::getSubDeviceByMasterAndType($device['id'], $deviceType)['subdevice_id'];
|
if ($subDeviceId = SubDeviceManager::getSubDeviceByMasterAndType($device['id'], $deviceType)) {
|
||||||
|
$subDeviceId = $subDeviceId['subdevice_id'];
|
||||||
switch ($executionCommand['command']) {
|
switch ($executionCommand['command']) {
|
||||||
case 'action.devices.commands.OnOff':
|
case 'action.devices.commands.OnOff':
|
||||||
$commands[] = self::executeSwitch($subDeviceId, $executionCommand);
|
$commands[] = self::executeSwitch($subDeviceId, $executionCommand);
|
||||||
@@ -212,9 +222,10 @@ static function execute($requestId, $payload){
|
|||||||
case 'action.devices.commands.mediaStop':
|
case 'action.devices.commands.mediaStop':
|
||||||
$commands[] = self::executeMediaCont($subDeviceId, $executionCommand);
|
$commands[] = self::executeMediaCont($subDeviceId, $executionCommand);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
$response = [
|
$response = [
|
||||||
'requestId' => $requestId,
|
'requestId' => $requestId,
|
||||||
@@ -230,14 +241,15 @@ static function execute($requestId, $payload){
|
|||||||
echo json_encode($response);
|
echo json_encode($response);
|
||||||
}
|
}
|
||||||
|
|
||||||
static function executeSwitch($subDeviceId, $executionCommand){
|
static function executeSwitch($subDeviceId, $executionCommand)
|
||||||
|
{
|
||||||
$value = 0;
|
$value = 0;
|
||||||
$status = 'OFFLINE';
|
$status = 'OFFLINE';
|
||||||
$online = false;
|
$online = false;
|
||||||
|
|
||||||
if ($executionCommand['params']['on']) $value = 1;
|
if ($executionCommand['params']['on']) $value = 1;
|
||||||
|
|
||||||
RecordManager::createWithSubId($subDeviceId, $value);
|
RecordManager::createWithSubId($subDeviceId, $value, 'google');
|
||||||
|
|
||||||
$executed = 0;
|
$executed = 0;
|
||||||
$waiting = 0;
|
$waiting = 0;
|
||||||
@@ -266,7 +278,8 @@ static function executeSwitch($subDeviceId, $executionCommand){
|
|||||||
return $commandTemp;
|
return $commandTemp;
|
||||||
}
|
}
|
||||||
|
|
||||||
static function executeTermostatValue($subDeviceId, $executionCommand){
|
static function executeTermostatValue($subDeviceId, $executionCommand)
|
||||||
|
{
|
||||||
$value = 0;
|
$value = 0;
|
||||||
$status = 'OFFLINE';
|
$status = 'OFFLINE';
|
||||||
$online = false;
|
$online = false;
|
||||||
@@ -275,7 +288,7 @@ static function executeTermostatValue($subDeviceId, $executionCommand){
|
|||||||
$value = $executionCommand['params']['thermostatTemperatureSetpoint'];
|
$value = $executionCommand['params']['thermostatTemperatureSetpoint'];
|
||||||
}
|
}
|
||||||
|
|
||||||
RecordManager::createWithSubId($subDeviceId, $value);
|
RecordManager::createWithSubId($subDeviceId, $value, 'google');
|
||||||
|
|
||||||
$executed = 0;
|
$executed = 0;
|
||||||
$waiting = 0;
|
$waiting = 0;
|
||||||
@@ -307,7 +320,8 @@ static function executeTermostatValue($subDeviceId, $executionCommand){
|
|||||||
return $commandTemp;
|
return $commandTemp;
|
||||||
}
|
}
|
||||||
|
|
||||||
static function executeTermostatMode($subDeviceId, $executionCommand){
|
static function executeTermostatMode($subDeviceId, $executionCommand)
|
||||||
|
{
|
||||||
$mode = "off";
|
$mode = "off";
|
||||||
$value = 0;
|
$value = 0;
|
||||||
$status = 'OFFLINE';
|
$status = 'OFFLINE';
|
||||||
@@ -318,7 +332,7 @@ static function executeTermostatMode($subDeviceId, $executionCommand){
|
|||||||
$value = RecordManager::getLastRecordNotNull($subDeviceId)['value'];
|
$value = RecordManager::getLastRecordNotNull($subDeviceId)['value'];
|
||||||
}
|
}
|
||||||
|
|
||||||
RecordManager::createWithSubId($subDeviceId, $value);
|
RecordManager::createWithSubId($subDeviceId, $value, 'google');
|
||||||
|
|
||||||
$executed = 0;
|
$executed = 0;
|
||||||
$waiting = 0;
|
$waiting = 0;
|
||||||
@@ -348,7 +362,8 @@ static function executeTermostatMode($subDeviceId, $executionCommand){
|
|||||||
return $commandTemp;
|
return $commandTemp;
|
||||||
}
|
}
|
||||||
|
|
||||||
static function executeVolume($subDeviceId, $executionCommand){
|
static function executeVolume($subDeviceId, $executionCommand)
|
||||||
|
{
|
||||||
//echo $executionCommand['params']['volumeLevel'];
|
//echo $executionCommand['params']['volumeLevel'];
|
||||||
$status = 'OFFLINE';
|
$status = 'OFFLINE';
|
||||||
$online = false;
|
$online = false;
|
||||||
@@ -386,7 +401,8 @@ static function executeVolume($subDeviceId, $executionCommand){
|
|||||||
return $commandTemp;
|
return $commandTemp;
|
||||||
}
|
}
|
||||||
|
|
||||||
static function executeApp($subDeviceId, $executionCommand){
|
static function executeApp($subDeviceId, $executionCommand)
|
||||||
|
{
|
||||||
//echo $executionCommand['params']['newApplication'];
|
//echo $executionCommand['params']['newApplication'];
|
||||||
$status = 'OFFLINE';
|
$status = 'OFFLINE';
|
||||||
$online = false;
|
$online = false;
|
||||||
@@ -424,7 +440,8 @@ static function executeApp($subDeviceId, $executionCommand){
|
|||||||
return $commandTemp;
|
return $commandTemp;
|
||||||
}
|
}
|
||||||
|
|
||||||
static function executeInput($subDeviceId, $executionCommand){
|
static function executeInput($subDeviceId, $executionCommand)
|
||||||
|
{
|
||||||
//echo $executionCommand['params']['newInput'];
|
//echo $executionCommand['params']['newInput'];
|
||||||
$status = 'OFFLINE';
|
$status = 'OFFLINE';
|
||||||
$online = false;
|
$online = false;
|
||||||
@@ -462,7 +479,8 @@ static function executeInput($subDeviceId, $executionCommand){
|
|||||||
return $commandTemp;
|
return $commandTemp;
|
||||||
}
|
}
|
||||||
|
|
||||||
static function executeMediaCont($subDeviceId, $executionCommand){
|
static function executeMediaCont($subDeviceId, $executionCommand)
|
||||||
|
{
|
||||||
$status = 'SUCCESS';
|
$status = 'SUCCESS';
|
||||||
$online = true;
|
$online = true;
|
||||||
|
|
||||||
|
@@ -187,20 +187,31 @@ class Utilities
|
|||||||
* @param string $operator ('asc'/'desc')
|
* @param string $operator ('asc'/'desc')
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
static function sortArrayByKey($data = [], $key, $operator = "asc"){
|
static function sortArrayByKey($data = [], $key, $operator = "asc")
|
||||||
if ($operator == "asc")
|
|
||||||
{
|
{
|
||||||
|
if ($operator == "asc") {
|
||||||
uasort($data, function ($a, $b) use ($key) {
|
uasort($data, function ($a, $b) use ($key) {
|
||||||
if ($a[$key] == $b[$key]) return 0;
|
$SortA = $a[$key];
|
||||||
return ($a[$key] < $b[$key]) ? -1 : 1;
|
$SortB = $b[$key];
|
||||||
|
if ($key == "room_id") {
|
||||||
|
$SortA = RoomManager::getRoomName($SortA);
|
||||||
|
$SortB = RoomManager::getRoomName($SortB);
|
||||||
|
}
|
||||||
|
if ($SortA == $SortB) return 0;
|
||||||
|
return ($SortA < $SortB) ? -1 : 1;
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
uasort($data, function ($a, $b) use ($key) {
|
uasort($data, function ($a, $b) use ($key) {
|
||||||
if ($a[$key] == $b[$key]) return 0;
|
$SortA = $a[$key];
|
||||||
return ($a[$key] > $b[$key]) ? -1 : 1;
|
$SortB = $b[$key];
|
||||||
|
if ($key == "room_id") {
|
||||||
|
$SortA = RoomManager::getRoomName($SortA);
|
||||||
|
$SortB = RoomManager::getRoomName($SortB);
|
||||||
|
}
|
||||||
|
if ($SortA == $SortB) return 0;
|
||||||
|
return ($SortA > $SortB) ? -1 : 1;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
return $data;
|
return $data;
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -61,4 +61,10 @@ class AuthManager {
|
|||||||
};
|
};
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getUserId($bearer){
|
||||||
|
$token = explode(' ', $bearer)[1];
|
||||||
|
$userid = Db::loadOne('SELECT user_id FROM tokens WHERE token = ? AND expire >= CURRENT_TIMESTAMP AND blocked = 0;', array($token))['user_id'];
|
||||||
|
return $userid;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@@ -7,7 +7,9 @@ class DeviceManager{
|
|||||||
WHERE approved != ?", Array(2));
|
WHERE approved != ?", Array(2));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static function setHeartbeat($deviceId){
|
||||||
|
self::edit($deviceId, ['heartbeat' => date("Y-m-d H:i:s", time())]);
|
||||||
|
}
|
||||||
|
|
||||||
static function getAllDevicesInRoom ($roomId = "") {
|
static function getAllDevicesInRoom ($roomId = "") {
|
||||||
return Db::loadAll ("SELECT * FROM devices WHERE room_id = ? AND approved != ?", Array($roomId, 2));
|
return Db::loadAll ("SELECT * FROM devices WHERE room_id = ? AND approved != ?", Array($roomId, 2));
|
||||||
|
@@ -2,16 +2,21 @@
|
|||||||
class RecordManager{
|
class RecordManager{
|
||||||
public static $records;
|
public static $records;
|
||||||
|
|
||||||
public static function createWithSubId ($subDeviceId, $value) {
|
public static function createWithSubId ($subDeviceId, $value, $origin = false) {
|
||||||
try {
|
try {
|
||||||
$record = [
|
$record = [
|
||||||
'execuded' => 1,
|
'execuded' => 1,
|
||||||
];
|
];
|
||||||
|
|
||||||
Db::edit ('records', $record, 'WHERE subdevice_id = ?', array ($subDeviceId));
|
Db::edit ('records', $record, 'WHERE subdevice_id = ?', array ($subDeviceId));
|
||||||
$record = array (
|
$record = array (
|
||||||
'subdevice_id' => $subDeviceId,
|
'subdevice_id' => $subDeviceId,
|
||||||
'value' => $value,
|
'value' => $value,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
if ($origin != false)
|
||||||
|
$record['Origin'] = $origin;
|
||||||
|
|
||||||
return Db::add ('records', $record);
|
return Db::add ('records', $record);
|
||||||
} catch(PDOException $error) {
|
} catch(PDOException $error) {
|
||||||
echo $error->getMessage();
|
echo $error->getMessage();
|
||||||
@@ -19,7 +24,7 @@ class RecordManager{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function create ($deviceId, $type, $value) {
|
public static function create ($deviceId, $type, $value, $origin = false) {
|
||||||
$subDeviceId = Db::loadOne('SELECT * FROM subdevices WHERE device_id = ? AND type = ?;', array($deviceId, $type))['subdevice_id'];
|
$subDeviceId = Db::loadOne('SELECT * FROM subdevices WHERE device_id = ? AND type = ?;', array($deviceId, $type))['subdevice_id'];
|
||||||
if ($subDeviceId == '') {
|
if ($subDeviceId == '') {
|
||||||
return false;
|
return false;
|
||||||
@@ -28,7 +33,7 @@ class RecordManager{
|
|||||||
//Ochrana proti duplicitním hodnotám zapisují se jen změny
|
//Ochrana proti duplicitním hodnotám zapisují se jen změny
|
||||||
$lastRecord = self::getLastRecord($subDeviceId, 1);
|
$lastRecord = self::getLastRecord($subDeviceId, 1);
|
||||||
|
|
||||||
if ($lastRecord['value'] == $value){
|
if (isset($lastRecord['value']) && $lastRecord['value'] == $value){
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -42,6 +47,10 @@ class RecordManager{
|
|||||||
'subdevice_id' => $subDeviceId,
|
'subdevice_id' => $subDeviceId,
|
||||||
'value' => $value,
|
'value' => $value,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
if ($origin != false)
|
||||||
|
$record['Origin'] = $origin;
|
||||||
|
|
||||||
return Db::add ('records', $record);
|
return Db::add ('records', $record);
|
||||||
} catch(PDOException $error) {
|
} catch(PDOException $error) {
|
||||||
echo $error->getMessage();
|
echo $error->getMessage();
|
||||||
@@ -102,7 +111,7 @@ class RecordManager{
|
|||||||
|
|
||||||
public static function clean ($day) {
|
public static function clean ($day) {
|
||||||
if (isset($day)) {
|
if (isset($day)) {
|
||||||
Db::command ('DELETE FROM records WHERE `time` < ADDDATE(NOW(), INTERVAL -? DAY);', array($day));
|
Db::command ('DELETE FROM records WHERE `time` < ADDDATE(NOW(), INTERVAL ? DAY);', array($day));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -110,5 +119,10 @@ class RecordManager{
|
|||||||
public static function cleanSubdeviceRecords ($subDeviceId) {
|
public static function cleanSubdeviceRecords ($subDeviceId) {
|
||||||
Db::command ('DELETE FROM records WHERE subdevice_id = ?);', array($subDeviceId));
|
Db::command ('DELETE FROM records WHERE subdevice_id = ?);', array($subDeviceId));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static function setHistory($subDeviceId){
|
||||||
|
$history = SubDeviceManager::getSubDevice($subDeviceId)['history'];
|
||||||
|
if ($history > 0) self::clean(-abs($history));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
|
@@ -19,6 +19,12 @@ class RoomManager{
|
|||||||
return $allRoom;
|
return $allRoom;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static function getRoomName ($room_id) {
|
||||||
|
//TODO: ignore Widgets withoud data
|
||||||
|
$allRoom = Db::loadAlone ("SELECT name FROM rooms WHERE room_id=?", array ($room_id));
|
||||||
|
return $allRoom;
|
||||||
|
}
|
||||||
|
|
||||||
public static function create ($name) {
|
public static function create ($name) {
|
||||||
$room = array (
|
$room = array (
|
||||||
'name' => $name,
|
'name' => $name,
|
||||||
|
@@ -14,6 +14,7 @@ class SettingsManager{
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static function create ($name, $value, $type = '') {
|
public static function create ($name, $value, $type = '') {
|
||||||
|
if (!self::getByName($name)){
|
||||||
$setting = array (
|
$setting = array (
|
||||||
'name' => $name,
|
'name' => $name,
|
||||||
'value' => $value,
|
'value' => $value,
|
||||||
@@ -26,9 +27,10 @@ class SettingsManager{
|
|||||||
die();
|
die();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public static function update ($name, $value, $type = '') {
|
public static function update ($name, $value, $type = '') {
|
||||||
if (self::getByName($name)){
|
if (!self::getByName($name)){
|
||||||
self::create($name, $value, $type);
|
self::create($name, $value, $type);
|
||||||
} else {
|
} else {
|
||||||
try {
|
try {
|
||||||
|
@@ -50,7 +50,7 @@ class SubDeviceManager
|
|||||||
}
|
}
|
||||||
|
|
||||||
//check if dubdevice exist
|
//check if dubdevice exist
|
||||||
|
//Add History to be set in Creation
|
||||||
public static function create($deviceId, $type, $unit)
|
public static function create($deviceId, $type, $unit)
|
||||||
{
|
{
|
||||||
$record = array(
|
$record = array(
|
||||||
@@ -66,6 +66,10 @@ 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);
|
||||||
|
@@ -9,6 +9,14 @@ 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'];
|
||||||
|
@@ -9,24 +9,24 @@ class DatabaseBackup
|
|||||||
$filenames[] = $backupWorker->scheme(); //Backup Database scheme
|
$filenames[] = $backupWorker->scheme(); //Backup Database scheme
|
||||||
$filenames[] = $backupWorker->data(); //Backup Database Data
|
$filenames[] = $backupWorker->data(); //Backup Database Data
|
||||||
//$filenames[] = $_SERVER['DOCUMENT_ROOT'] . '/config/config.php'; //Backup Configuration File
|
//$filenames[] = $_SERVER['DOCUMENT_ROOT'] . '/config/config.php'; //Backup Configuration File
|
||||||
$backupWorker->compress($_SERVER['DOCUMENT_ROOT'] . BASEDIR . 'backup/' . date("Y-m-d", time()) . '.zip', $filenames);
|
$backupWorker->compress($_SERVER['DOCUMENT_ROOT'] . BASEDIR . '/backup/' . date("Y-m-d", time()) . '.zip', $filenames);
|
||||||
return 'sucessful';
|
return 'sucessful';
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
return 'exception: ' . $e->getMessage();
|
return 'exception: ' . $e->getMessage();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private function scheme()
|
private function data()
|
||||||
{
|
{
|
||||||
$backupfile = $_SERVER['DOCUMENT_ROOT'] . BASEDIR . "backup/" . DBNAME . '_scheme_' . date("Y-m-d", time()) . '.sql';
|
$backupfile = $_SERVER['DOCUMENT_ROOT'] . BASEDIR . "/backup/" . DBNAME . '_data_' . date("Y-m-d", time()) . '.sql';
|
||||||
$command = "mysqldump --skip-comments --no-create-info -h localhost -u " . DBUSER . " -p" . DBPASS . " " . DBNAME . " -r $backupfile 2>&1";
|
$command = "mysqldump --skip-comments --no-create-info -h localhost -u " . DBUSER . " -p" . DBPASS . " " . DBNAME . " -r $backupfile 2>&1";
|
||||||
$this->executeCommand($command);
|
$this->executeCommand($command);
|
||||||
return $backupfile;
|
return $backupfile;
|
||||||
}
|
}
|
||||||
|
|
||||||
private function data()
|
private function scheme()
|
||||||
{
|
{
|
||||||
$backupfile = $_SERVER['DOCUMENT_ROOT'] . BASEDIR . "backup/" . DBNAME . '_data_' . date("Y-m-d", time()) . '.sql';
|
$backupfile = $_SERVER['DOCUMENT_ROOT'] . BASEDIR . "/backup/" . DBNAME . '_scheme_' . date("Y-m-d", time()) . '.sql';
|
||||||
$command = "mysqldump --skip-comments --no-data -h localhost -u " . DBUSER . " -p" . DBPASS . " " . DBNAME . " -r $backupfile 2>&1";
|
$command = "mysqldump --skip-comments --no-data -h localhost -u " . DBUSER . " -p" . DBPASS . " " . DBNAME . " -r $backupfile 2>&1";
|
||||||
$this->executeCommand($command);
|
$this->executeCommand($command);
|
||||||
return $backupfile;
|
return $backupfile;
|
||||||
@@ -43,9 +43,7 @@ class DatabaseBackup
|
|||||||
$zip = new ZipArchive();
|
$zip = new ZipArchive();
|
||||||
if ($zip->open($filename, ZipArchive::CREATE | ZipArchive::OVERWRITE)) {
|
if ($zip->open($filename, ZipArchive::CREATE | ZipArchive::OVERWRITE)) {
|
||||||
foreach ($files as $file) {
|
foreach ($files as $file) {
|
||||||
$filename = explode('/', $file);
|
$zip->addFile($file);
|
||||||
$filename = end($filename);
|
|
||||||
$zip->addFile($file, $filename);
|
|
||||||
}
|
}
|
||||||
$zip->close();
|
$zip->close();
|
||||||
foreach ($files as $file) {
|
foreach ($files as $file) {
|
||||||
|
@@ -23,6 +23,38 @@ class OpenWeatherMap extends VirtualDeviceManager
|
|||||||
$finalUrl = sprintf($this->api_uri, $this->city_sluig, $this->app_id);
|
$finalUrl = sprintf($this->api_uri, $this->city_sluig, $this->app_id);
|
||||||
$json = json_decode(Utilities::CallAPI('GET', $finalUrl, ''), true);
|
$json = json_decode(Utilities::CallAPI('GET', $finalUrl, ''), true);
|
||||||
|
|
||||||
|
|
||||||
|
//Notification data setup
|
||||||
|
$notificationMng = new NotificationManager;
|
||||||
|
if ($json['weather'][0]['id'] >= 500 && $json['weather'][0]['id'] < 600) {
|
||||||
|
// $notificationData = [
|
||||||
|
// 'title' => 'Weather',
|
||||||
|
// 'body' => 'It Will be rainy outhere, Take Umbrela :)',
|
||||||
|
// 'icon' => 'http://dev.steelants.cz/projekty/simplehome-client/img/icons/favicon-16x16.png',
|
||||||
|
// ];
|
||||||
|
// //Notification for newly added Device
|
||||||
|
// if ($notificationData != []) {
|
||||||
|
// $subscribers = $notificationMng::getSubscription();
|
||||||
|
// foreach ($subscribers as $key => $subscriber) {
|
||||||
|
// $notificationMng::sendSimpleNotification(SERVERKEY, $subscriber['token'], $notificationData);
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
} else if ($json['weather'][0]['id'] >= 600 && $json['weather'][0]['id'] < 700) {
|
||||||
|
// $notificationData = [
|
||||||
|
// 'title' => 'Weather',
|
||||||
|
// 'body' => 'It is white out there :)',
|
||||||
|
// 'icon' => 'http://dev.steelants.cz/projekty/simplehome-client/img/icons/favicon-16x16.png',
|
||||||
|
// ];
|
||||||
|
// //Notification for newly added Device
|
||||||
|
// if ($notificationData != []) {
|
||||||
|
// $subscribers = $notificationMng::getSubscription();
|
||||||
|
// foreach ($subscribers as $key => $subscriber) {
|
||||||
|
// $notificationMng::sendSimpleNotification(SERVERKEY, $subscriber['token'], $notificationData);
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
RecordManager::create($deviceId, $this->subdevice_type, $json['weather'][0]['id']);
|
RecordManager::create($deviceId, $this->subdevice_type, $json['weather'][0]['id']);
|
||||||
} else {
|
} else {
|
||||||
DeviceManager::create($this->virtual_device_name, $this->virtual_device_name, 'senzore-virtual');
|
DeviceManager::create($this->virtual_device_name, $this->virtual_device_name, 'senzore-virtual');
|
||||||
@@ -33,4 +65,8 @@ class OpenWeatherMap extends VirtualDeviceManager
|
|||||||
return 'exception: ' . $e->getMessage();
|
return 'exception: ' . $e->getMessage();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function enable(){
|
||||||
|
(new SettingsManager)->create('open_weather_api_token', '', 'open_weather');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@@ -5,6 +5,21 @@ class Device extends Template
|
|||||||
{
|
{
|
||||||
function __construct($sortBy = null, $sortType = null)
|
function __construct($sortBy = null, $sortType = null)
|
||||||
{
|
{
|
||||||
|
// //Notification data setup
|
||||||
|
// $notificationMng = new NotificationManager;
|
||||||
|
// $notificationData = [
|
||||||
|
// 'title' => 'Info',
|
||||||
|
// 'body' => 'New device Detected Found',
|
||||||
|
// 'icon' => 'http://dev.steelants.cz/projekty/simplehome-client/img/icons/favicon-16x16.png',
|
||||||
|
// ];
|
||||||
|
// //Notification for newly added Device
|
||||||
|
// if ($notificationData != []) {
|
||||||
|
// $subscribers = $notificationMng::getSubscription();
|
||||||
|
// foreach ($subscribers as $key => $subscriber) {
|
||||||
|
// $notificationMng::sendSimpleNotification(SERVERKEY, $subscriber['token'], $notificationData);
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
$userManager = new UserManager();
|
$userManager = new UserManager();
|
||||||
$deviceManager = new DeviceManager();
|
$deviceManager = new DeviceManager();
|
||||||
$subDeviceManager = new SubDeviceManager();
|
$subDeviceManager = new SubDeviceManager();
|
||||||
@@ -28,7 +43,8 @@ class Device extends Template
|
|||||||
"token" => "token",
|
"token" => "token",
|
||||||
"signal" => "signal",
|
"signal" => "signal",
|
||||||
"firmware" => "firmware_hash",
|
"firmware" => "firmware_hash",
|
||||||
"icon" => "icon"
|
"icon" => "icon",
|
||||||
|
"history" => "history",
|
||||||
];
|
];
|
||||||
|
|
||||||
$sortIcons = [
|
$sortIcons = [
|
||||||
@@ -47,12 +63,17 @@ class Device extends Template
|
|||||||
$sortBy = "id";
|
$sortBy = "id";
|
||||||
$sortType = "DESC";
|
$sortType = "DESC";
|
||||||
}
|
}
|
||||||
|
|
||||||
$template->prepare('sortIcon', [$sortBy => $sortIcons[$sortType]]);
|
$template->prepare('sortIcon', [$sortBy => $sortIcons[$sortType]]);
|
||||||
|
|
||||||
foreach ($devices as $key => $device) {
|
foreach ($devices as $key => $device) {
|
||||||
//Signal Stenght
|
//Signal Stenght
|
||||||
$subdevice = $subDeviceManager->getSubDeviceByMasterAndType($device['device_id'], "wifi");
|
$subdevice = $subDeviceManager->getSubDeviceByMasterAndType($device['device_id'], "wifi");
|
||||||
|
$subdeviceLocal = $subDeviceManager->getSubDeviceByMaster($device['device_id']);
|
||||||
|
if (!empty($subdeviceLocal)) {
|
||||||
|
$devices[$key]['history'] = (!empty($subdeviceLocal['history']) ? $subdeviceLocal['history'] : 0);
|
||||||
|
} else {
|
||||||
|
$devices[$key]['history'] = "null";
|
||||||
|
}
|
||||||
$devices[$key]['signal'] = "";
|
$devices[$key]['signal'] = "";
|
||||||
if (!empty($subdevice['subdevice_id'])) {
|
if (!empty($subdevice['subdevice_id'])) {
|
||||||
$record = $recordManager->getLastRecord($subdevice['subdevice_id']);
|
$record = $recordManager->getLastRecord($subdevice['subdevice_id']);
|
||||||
|
@@ -70,6 +70,8 @@ class Setting extends Template
|
|||||||
$result = $settingsManager->getSettingGroup($plugins[$key]['slug']);
|
$result = $settingsManager->getSettingGroup($plugins[$key]['slug']);
|
||||||
if (count ($result) > 0) {
|
if (count ($result) > 0) {
|
||||||
$plugins[$key]['settings'] = $result;
|
$plugins[$key]['settings'] = $result;
|
||||||
|
} else {
|
||||||
|
unset($plugins[$key]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -36,6 +36,7 @@
|
|||||||
<a href="device/mac/<?php echo $SORTTYPE; ?>">(Mac)</a><i class="fa"><?php echo (!empty($SORTICON['mac']) ? $SORTICON['mac'] : ""); ?></i><br>
|
<a href="device/mac/<?php echo $SORTTYPE; ?>">(Mac)</a><i class="fa"><?php echo (!empty($SORTICON['mac']) ? $SORTICON['mac'] : ""); ?></i><br>
|
||||||
<a href="device/token/<?php echo $SORTTYPE; ?>">Token</a><i class="fa"><?php echo (!empty($SORTICON['token']) ? $SORTICON['token'] : ""); ?></i>
|
<a href="device/token/<?php echo $SORTTYPE; ?>">Token</a><i class="fa"><?php echo (!empty($SORTICON['token']) ? $SORTICON['token'] : ""); ?></i>
|
||||||
</th>
|
</th>
|
||||||
|
<th><a href="device/history/<?php echo $SORTTYPE; ?>">Historie</a><i class="fa"><?php echo (!empty($SORTICON['history']) ? $SORTICON['history'] : ""); ?></i></th>
|
||||||
<th>Action
|
<th>Action
|
||||||
<form method="post" action="">
|
<form method="post" action="">
|
||||||
<button class="fa custom-file-input" type="submit" name="deviceCommand" value="reset" title="Reset All"><b></b></button>
|
<button class="fa custom-file-input" type="submit" name="deviceCommand" value="reset" title="Reset All"><b></b></button>
|
||||||
@@ -100,6 +101,14 @@
|
|||||||
<td><?php echo (!empty($device['mac']) ? $device['mac'] : ""); ?><br>
|
<td><?php echo (!empty($device['mac']) ? $device['mac'] : ""); ?><br>
|
||||||
<?php echo (!empty($device['ip_address']) ? $device['ip_address'] : ""); ?><br>
|
<?php echo (!empty($device['ip_address']) ? $device['ip_address'] : ""); ?><br>
|
||||||
<?php echo (!empty($device['token']) ? $device['token'] : ""); ?></td>
|
<?php echo (!empty($device['token']) ? $device['token'] : ""); ?></td>
|
||||||
|
<td>
|
||||||
|
<?php if (isset($device['history']) && $device['history'] != "null"): ?>
|
||||||
|
<form method="post" action="">
|
||||||
|
<input type="hidden" name="deviceId" value="<?php echo (!empty($device['device_id']) ? $device['device_id'] : ""); ?>">
|
||||||
|
<input class="input" type="number" onchange="this.form.submit();" name="deviceHistory" value="<?php echo (!empty($device['history']) ? $device['history'] : 0); ?>">
|
||||||
|
</form>
|
||||||
|
<?php endif; ?>
|
||||||
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<?php if (!empty($device['mac'])) : ?>
|
<?php if (!empty($device['mac'])) : ?>
|
||||||
<form method="post" action="">
|
<form method="post" action="">
|
||||||
@@ -122,12 +131,6 @@
|
|||||||
$partial->render();
|
$partial->render();
|
||||||
//TODO js do main.js
|
//TODO js do main.js
|
||||||
?>
|
?>
|
||||||
<script>
|
|
||||||
$(function() {
|
|
||||||
$("#sortable").sortable();
|
|
||||||
$("#sortable").disableSelection();
|
|
||||||
});
|
|
||||||
</script>
|
|
||||||
</body>
|
</body>
|
||||||
|
|
||||||
</html>
|
</html>
|
||||||
|
@@ -202,7 +202,23 @@ $partial = new Partial('head');
|
|||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<!--Plugins Settings-->
|
||||||
|
<?php foreach ($PLUGINSSETTINGS as $key => $pluginSeting) { ?>
|
||||||
|
<div class="col-12 col-sm-9 mx-auto mt-4">
|
||||||
|
<h4 class="mb-4"><?php echo $pluginSeting['name'] ?></h4>
|
||||||
|
<form method="post">
|
||||||
|
<?php foreach ($pluginSeting['settings'] as $key => $pluginSetingField) { ?>
|
||||||
|
<div class="field">
|
||||||
|
<div class="label"><?php echo $pluginSetingField['name'] ?>:</div>
|
||||||
|
<input type="text" class="input" name="<?php echo $pluginSetingField['name'] ?>" value="<?php echo $pluginSetingField['value'] ?>">
|
||||||
|
</div>
|
||||||
|
<?php } ?>
|
||||||
|
<div class="field">
|
||||||
|
<input type="submit" name="submitPlugins<?php echo $pluginSeting['name'] ?>Settings" class="button" value="<?php $LANGMNG->echo('b_save') ?>">
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
<?php } ?>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
@@ -3,7 +3,7 @@
|
|||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
<title><?php echo $this->title ?></title>
|
<title><?php echo $this->title; ?></title>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<?php echo $this->content(); ?>
|
<?php echo $this->content(); ?>
|
||||||
|
@@ -60,7 +60,6 @@ const UNITS = [
|
|||||||
|
|
||||||
//Notifications
|
//Notifications
|
||||||
define('SERVERKEY','');
|
define('SERVERKEY','');
|
||||||
define('SERVERVAIPKEY','');
|
|
||||||
|
|
||||||
//TODO: Po registraci vzít výchozí hodnoty
|
//TODO: Po registraci vzít výchozí hodnoty
|
||||||
//Default network Setting
|
//Default network Setting
|
||||||
|
@@ -1,24 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace Core\Configuration;
|
|
||||||
|
|
||||||
class ConfigurationLoader
|
|
||||||
{
|
|
||||||
private const CONFIGURATIONS_DIRECTORY = __DIR__ . DIRECTORY_SEPARATOR
|
|
||||||
. '..' . DIRECTORY_SEPARATOR
|
|
||||||
. '..' . DIRECTORY_SEPARATOR . 'config'
|
|
||||||
. DIRECTORY_SEPARATOR;
|
|
||||||
|
|
||||||
public function load(): array
|
|
||||||
{
|
|
||||||
return [];
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Concerns
|
|
||||||
* -> Loading configuration files
|
|
||||||
* - Scan directory for files.
|
|
||||||
* - Filtering none config / php files.
|
|
||||||
* - Creating assoc array.
|
|
||||||
*/
|
|
||||||
}
|
|
@@ -8,18 +8,4 @@ namespace Core\Configuration;
|
|||||||
* @author Romano Schoonheim https://github.com/romano1996
|
* @author Romano Schoonheim https://github.com/romano1996
|
||||||
*/
|
*/
|
||||||
class Configurations
|
class Configurations
|
||||||
{
|
{}
|
||||||
/** @var array */
|
|
||||||
private $configurations;
|
|
||||||
|
|
||||||
public function __construct(ConfigurationLoader $configurationLoader)
|
|
||||||
{
|
|
||||||
// Concern: Storing assoc array to this object.
|
|
||||||
$this->configurations = $configurationLoader->load();
|
|
||||||
}
|
|
||||||
|
|
||||||
public function get(string $path)
|
|
||||||
{
|
|
||||||
// Concern: Accessing configurations based on "paths" application.something For example.
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
@@ -2660,19 +2660,19 @@ html {
|
|||||||
|
|
||||||
@font-face {
|
@font-face {
|
||||||
font-family: 'Metropolis';
|
font-family: 'Metropolis';
|
||||||
src: url("../fonts/Metropolis-Regular.ttf");
|
/*src: url("../fonts/Metropolis-Regular.ttf");*/
|
||||||
font-weight: 400;
|
font-weight: 400;
|
||||||
}
|
}
|
||||||
|
|
||||||
@font-face {
|
@font-face {
|
||||||
font-family: 'Metropolis';
|
font-family: 'Metropolis';
|
||||||
src: url("../fonts/Metropolis-Medium.ttf");
|
/*src: url("../fonts/Metropolis-Medium.ttf");*/
|
||||||
font-weight: 500;
|
font-weight: 500;
|
||||||
}
|
}
|
||||||
|
|
||||||
@font-face {
|
@font-face {
|
||||||
font-family: 'Metropolis';
|
font-family: 'Metropolis';
|
||||||
src: url("../fonts/Metropolis-SemiBold.ttf");
|
/*src: url("../fonts/Metropolis-SemiBold.ttf");*/
|
||||||
font-weight: 600;
|
font-weight: 600;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user