FTP -> GIT (SYNC)
This commit is contained in:
parent
ad3118799f
commit
8f709bfb30
40
api.php
40
api.php
@ -3,12 +3,33 @@
|
||||
include_once('./config.php');
|
||||
|
||||
//Autoloader
|
||||
foreach (["class", "views"] as $dir) {
|
||||
$files = scandir('./'.$dir.'/');
|
||||
$files = array_diff($files, array('.', '..'));
|
||||
|
||||
$files = scandir('./app/class/');
|
||||
|
||||
$files = array_diff($files, array(
|
||||
'.',
|
||||
'..',
|
||||
'app',
|
||||
'ChartJS.php',
|
||||
'ChartJS_Line.php',
|
||||
'ChartManager.php',
|
||||
'DashboardManager.php',
|
||||
'Partial.php',
|
||||
'Form.php',
|
||||
'Route.php',
|
||||
'Template.php',
|
||||
'Ajax.php',
|
||||
));
|
||||
|
||||
foreach($files as $file) {
|
||||
include_once './'.$dir.'/'. $file;
|
||||
include './app/class/'. $file;
|
||||
}
|
||||
|
||||
|
||||
//Allow acces only wia Curl, Ajax ETC
|
||||
$restAcess = 'XMLHttpRequest' == ( $_SERVER['HTTP_X_REQUESTED_WITH'] ?? '' );
|
||||
if (!$restAcess){
|
||||
header('Location: ./');
|
||||
}
|
||||
|
||||
//Log
|
||||
@ -21,17 +42,16 @@ Db::connect (DBHOST, DBUSER, DBPASS, DBNAME);
|
||||
$json = file_get_contents('php://input');
|
||||
$obj = json_decode($json, true);
|
||||
|
||||
|
||||
//zabespecit proti Ddosu
|
||||
if (isset($obj['user']) && $obj['user'] != ''){
|
||||
//user at home
|
||||
|
||||
$user = UserManager::getUser($obj['user']);
|
||||
if (!empty($user)) {
|
||||
$userId = $user['user_id'];
|
||||
$atHome = boolval ($obj['atHome']);
|
||||
UserManager::atHome($userId, $atHome ? 'true' : 'false');
|
||||
echo 'Saved';
|
||||
$atHome = $obj['atHome'];
|
||||
UserManager::atHome($userId, $atHome);
|
||||
$logManager->write("[Record] user " . $userId . "changet his home state to " . $atHome . RECORDTIMOUT , LogRecordType::WARNING);
|
||||
echo 'Saved: ' . $atHome;
|
||||
header("HTTP/1.1 200 OK");
|
||||
die();
|
||||
}
|
||||
@ -114,7 +134,7 @@ if ($values != null || $values != "") {
|
||||
SubDeviceManager::create($deviceId, $key, UNITS[$key]);
|
||||
}
|
||||
RecordManager::create($deviceId, $key, round($value['value'],2));
|
||||
$logManager->write("[API] Device_ID " . $deviceId . " writed value " . $key . $value['value'], LogRecordType::INFO);
|
||||
$logManager->write("[API] Device_ID " . $deviceId . " writed value " . $key . ' ' . $value['value'], LogRecordType::INFO);
|
||||
}
|
||||
|
||||
$hostname = strtolower($device['name']);
|
||||
|
121
app/class/Form.php
Normal file
121
app/class/Form.php
Normal file
@ -0,0 +1,121 @@
|
||||
<?php
|
||||
/**
|
||||
* [InputTypes datatype for input types]
|
||||
*/
|
||||
class InputTypes
|
||||
{
|
||||
const TEXT = 'text';
|
||||
const NUMBER = 'number';
|
||||
const COLOR = 'color';
|
||||
const CHECK = 'checkbox';
|
||||
const BUTTON = 'button';
|
||||
const DATE = 'date';
|
||||
const DATETIME = 'datetime';
|
||||
const SUBMIT = 'submit';
|
||||
const HIDEN = 'hidden';
|
||||
const EMAIL = 'email';
|
||||
}
|
||||
/**
|
||||
* [Form Form Generator Class]
|
||||
*/
|
||||
class Form {
|
||||
|
||||
public $formContent = "";
|
||||
private $formName;
|
||||
private $formId;
|
||||
private $method;
|
||||
private $action;
|
||||
|
||||
/**
|
||||
* [__construct description]
|
||||
* @param String $name [description]
|
||||
* @param String $id [description]
|
||||
* @param String $method [description]
|
||||
* @param String $action [description]
|
||||
*/
|
||||
function __construct(String $name, String $id, String $method, String $action) {
|
||||
if ($name != "") {
|
||||
$this->formName = 'name="'.$name.'"';
|
||||
}
|
||||
if ($id != "") {
|
||||
$this->formId = 'id="'.$id.'"';
|
||||
}
|
||||
if ($method != "") {
|
||||
$this->method = 'method="'.$method.'"';
|
||||
}
|
||||
if ($action != "") {
|
||||
$this->$action = 'action="'.$action.'"';
|
||||
}
|
||||
}
|
||||
/**
|
||||
* [addInput description]
|
||||
* @param String $type Type of input element (text, number, color,checkbox, button, date, datetime, submit)
|
||||
* @param String $name name of element
|
||||
* @param String $id id of element
|
||||
* @param String $label label of element
|
||||
* @param String $value value of element
|
||||
* @param boolean $require require selector toggle
|
||||
* @param boolean $enabled enable selector toggle
|
||||
*/
|
||||
function addInput(String $type, String $name, String $id, String $label, String $value, Bool $require = false, Bool $enabled = true){
|
||||
$this->formContent .= '<div class="field">';
|
||||
if ($label != "") {
|
||||
$this->formContent .= '<div class="label">'.$label.'</div>';
|
||||
}
|
||||
$this->formContent .= '<input class="input" type="'.$type.'" name="'.$name.'" value="'.$value.'" ' . ($enabled ? '' : 'disabled') . ($require ? '' : 'required') .'>';
|
||||
$this->formContent .= '</div>';
|
||||
}
|
||||
|
||||
//TODO: add Group support
|
||||
/**
|
||||
* [addSelect description]
|
||||
* @param String $name name of element
|
||||
* @param String $id id of element
|
||||
* @param String $label label of element
|
||||
* @param Array $data array of options [value => valueName]
|
||||
* @param boolean $multiple multiple selector toggle
|
||||
* @param boolean $enabled enable selector toggle
|
||||
*/
|
||||
function addSelect(String $name, String $id, String $label, Array $data, Bool $multiple = false, Bool $require = false, Bool $enabled = true){
|
||||
$this->formContent .= '<div class="field">';
|
||||
if ($label != "") {
|
||||
$this->formContent .= '<div class="label">'.$label.'</div>';
|
||||
}
|
||||
$this->formContent .= '<select class="input"' . ($multiple ? '' : 'multiple') . ($enabled ? '' : 'disabled') . ($require ? '' : 'required') .'>';
|
||||
foreach ($data as $value => $text) {
|
||||
$this->formContent .= '<option value="' . $value . '">' . $text . '</option>';
|
||||
}
|
||||
$this->formContent .= '</select>';
|
||||
$this->formContent .= '</div>';
|
||||
}
|
||||
|
||||
/**
|
||||
* [addTextarea description]
|
||||
* @param String $name name of element
|
||||
* @param String $id id of element
|
||||
* @param String $label label of element
|
||||
* @param String $value value of element
|
||||
* @param boolean $enabled enable selector toggle
|
||||
*/
|
||||
function addTextarea(String $name, String $id, String $label, Array $value, Bool $require = false, Bool $enabled = true){
|
||||
$this->formContent .= '<div class="field">';
|
||||
if ($label != "") {
|
||||
$this->formContent .= '<div class="label">'.$label.'</div>';
|
||||
}
|
||||
$this->formContent .= '<textarea class="input"' . ($enabled ? '' : 'disabled') . ($require ? '' : 'required') .'>';
|
||||
$this->formContent .= $value;
|
||||
$this->formContent .= '</textarea>';
|
||||
$this->formContent .= '</div>';
|
||||
}
|
||||
|
||||
/**
|
||||
* [render function whitch dysplay generated form]
|
||||
*/
|
||||
function render(){
|
||||
self::addInput(InputTypes::SUBMIT, 'formSubmit', '', 'Submit', 'Submit');
|
||||
$form = '<form '.$this->formName.$this->formId.$this->method.$this->action.'">';
|
||||
$form .= $this->formContent;
|
||||
$form .= '</form>';
|
||||
echo $form;
|
||||
}
|
||||
}
|
@ -16,17 +16,18 @@ class LogManager
|
||||
function __construct($fileName = "")
|
||||
{
|
||||
if ($fileName == ""){
|
||||
$fileName = './logs/'. date("Y-m-d").'.log';
|
||||
$fileName = './app/logs/'. date("Y-m-d").'.log';
|
||||
}
|
||||
if(!is_dir("./logs/"))
|
||||
if(!is_dir("./app/logs/"))
|
||||
{
|
||||
mkdir("./logs/");
|
||||
mkdir("./app/logs/");
|
||||
}
|
||||
$this->logFile = fopen($fileName, "a") or die("Unable to open file!");
|
||||
}
|
||||
|
||||
function write($value, $type = LogRecordType::ERROR){
|
||||
$record = "[".date("H:m:s")."][".$type."]" . $value . "\n";
|
||||
$record = Utilities::stringInsert($record,"\n",65);
|
||||
fwrite($this->logFile, $record);
|
||||
}
|
||||
|
@ -7,7 +7,7 @@ class Partial{
|
||||
|
||||
function __construct($path = "", $debug = false) {
|
||||
$this->debug = $debug;
|
||||
if (!empty('templates/part/' . $path . '.phtml') && file_exists('templates/part/' . $path . '.phtml')) {
|
||||
if (!empty('app/templates/part/' . $path . '.phtml') && file_exists('app/templates/part/' . $path . '.phtml')) {
|
||||
$this->path = $path;
|
||||
} else {
|
||||
echo '<pre>';
|
||||
@ -29,6 +29,6 @@ class Partial{
|
||||
extract($this->assignedValues);
|
||||
}
|
||||
|
||||
require('templates/part/' . $this->path . '.phtml');
|
||||
require('app/templates/part/' . $this->path . '.phtml');
|
||||
}
|
||||
}
|
@ -7,7 +7,7 @@ class Template extends Partial{
|
||||
|
||||
function __construct($path = "", $debug = false) {
|
||||
$this->debug = $debug;
|
||||
if (!empty('templates/' . $path . '.phtml') && file_exists('templates/' . $path . '.phtml')) {
|
||||
if (!empty('app/templates/' . $path . '.phtml') && file_exists('app/templates/' . $path . '.phtml')) {
|
||||
$this->path = $path;
|
||||
} else {
|
||||
echo '<pre>';
|
||||
@ -26,9 +26,9 @@ class Template extends Partial{
|
||||
|
||||
function render() {
|
||||
extract($this->assignedValues);
|
||||
if (!empty('controls/' . $this->path . '.php') && file_exists('controls/' . $this->path . '.php')) {
|
||||
require_once('controls/' . $this->path . '.php');
|
||||
if (!empty('app/controls/' . $this->path . '.php') && file_exists('app/controls/' . $this->path . '.php')) {
|
||||
require_once('app/controls/' . $this->path . '.php');
|
||||
}
|
||||
require_once('templates/' . $this->path . '.phtml');
|
||||
require_once('app/templates/' . $this->path . '.phtml');
|
||||
}
|
||||
}
|
@ -35,4 +35,10 @@ class Utilities
|
||||
);
|
||||
return preg_replace(array_keys($utf8), array_values($utf8), $text);
|
||||
}
|
||||
|
||||
function stringInsert($str,$insertstr,$pos)
|
||||
{
|
||||
$str = substr($str, 0, $pos) . $insertstr . substr($str, $pos);
|
||||
return $str;
|
||||
}
|
||||
}
|
@ -6,6 +6,7 @@ $lang = [
|
||||
'm_settings' => 'Nastavení',
|
||||
'm_automatization' => 'Automatizace',
|
||||
'm_scenes' => 'Scény',
|
||||
'm_log' => 'Log',
|
||||
|
||||
//Buttons
|
||||
'b_year' => 'Rok',
|
||||
@ -42,6 +43,7 @@ $lang = [
|
||||
'l_permission' => 'Oprávmnění',
|
||||
'l_inMinutes' => 'v minutách',
|
||||
'l_sleepTime' => 'Doba spánku zařízení',
|
||||
'l_atHome' => 'Doma Jsou',
|
||||
|
||||
//Title
|
||||
't_createScene' => 'Vytvořit scénu',
|
@ -6,6 +6,7 @@ $lang = [
|
||||
'm_settings' => 'Setting',
|
||||
'm_automatization' => 'Automatization',
|
||||
'm_scenes' => 'Scenes',
|
||||
'm_log' => 'Log',
|
||||
|
||||
//Buttons
|
||||
'b_year' => 'Year',
|
||||
@ -42,6 +43,7 @@ $lang = [
|
||||
'l_permission' => 'Permission',
|
||||
'l_inMinutes' => 'in minutes',
|
||||
'l_sleepTime' => 'Device sleep Time',
|
||||
'l_atHome' => 'At home',
|
||||
|
||||
//Title
|
||||
't_createScene' => 'Create Scene',
|
0
app/logs/.gitkeep
Normal file
0
app/logs/.gitkeep
Normal file
@ -11,23 +11,12 @@
|
||||
<div class="row no-gutters main">
|
||||
<div class="col-md-3 d-sm-none"></div>
|
||||
<div class="col-md-3 nav-container">
|
||||
<div class="nav">
|
||||
<div class="nav-item">
|
||||
<a href="./"><i class="fa fa-home"></i><span><?php echo $LANG['m_home']?></span></a>
|
||||
</div>
|
||||
<div class="nav-item">
|
||||
<a href="dashboard"><i class="fa fa-tachometer" aria-hidden="true"></i><span><?php echo $LANG['m_dashboard']?></span></a>
|
||||
</div>
|
||||
<div class="nav-item">
|
||||
<a href="setting"><i class="fa fa-wrench" aria-hidden="true"></i></i><span><?php echo $LANG['m_settings']?></span></a>
|
||||
</div>
|
||||
<div class="nav-item is-active">
|
||||
<a href="automation"><i class="fa fa-calendar-o" aria-hidden="true"></i><span><?php echo $LANG['m_automatization']?></span></a>
|
||||
</div>
|
||||
<div class="nav-item">
|
||||
<a href="scene"><i class="fa fa-terminal" aria-hidden="true"></i><span><?php echo $LANG['m_scenes']?></span></a>
|
||||
</div>
|
||||
</div>
|
||||
<?php
|
||||
$partial = new Partial('menu');
|
||||
$partial->prepare('item','automation');
|
||||
$partial->prepare('lang',$LANG);
|
||||
$partial->render();
|
||||
?>
|
||||
</div>
|
||||
<div class="col-md-9 main-body">
|
||||
<a class="button is-primary m-1" onClick="$('#modal').removeClass('modal-container-hiden').show();"><?php echo $LANG['t_createAutomation'];?></a>
|
@ -11,23 +11,12 @@
|
||||
<div class="row no-gutters main">
|
||||
<div class="col-md-3 d-sm-none"></div>
|
||||
<div class="col-md-3 nav-container">
|
||||
<div class="nav">
|
||||
<div class="nav-item">
|
||||
<a href="./"><i class="fa fa-home"></i><span><?php echo $LANG['m_home']?></span></a>
|
||||
</div>
|
||||
<div class="nav-item is-active">
|
||||
<a href="dashboard"><i class="fa fa-tachometer" aria-hidden="true"></i><span><?php echo $LANG['m_dashboard']?></span></a>
|
||||
</div>
|
||||
<div class="nav-item">
|
||||
<a href="setting"><i class="fa fa-wrench" aria-hidden="true"></i></i><span><?php echo $LANG['m_settings']?></span></a>
|
||||
</div>
|
||||
<div class="nav-item">
|
||||
<a href="automation"><i class="fa fa-calendar-o" aria-hidden="true"></i><span><?php echo $LANG['m_automatization']?></span></a>
|
||||
</div>
|
||||
<div class="nav-item">
|
||||
<a href="scene"><i class="fa fa-terminal" aria-hidden="true"></i><span><?php echo $LANG['m_scenes']?></span></a>
|
||||
</div>
|
||||
</div>
|
||||
<?php
|
||||
$partial = new Partial('menu');
|
||||
$partial->prepare('item', 'dashboard');
|
||||
$partial->prepare('lang',$LANG);
|
||||
$partial->render();
|
||||
?>
|
||||
</div>
|
||||
<div class="col-md-9 main-body">
|
||||
<a onClick="$('#modal').removeClass('modal-container-hiden').show();" class="button is-primary m-1">Add Device</a>
|
Before Width: | Height: | Size: 434 KiB After Width: | Height: | Size: 434 KiB |
@ -11,23 +11,12 @@
|
||||
<div class="row no-gutters main">
|
||||
<div class="col-md-3 d-sm-none"></div>
|
||||
<div class="col-md-3 nav-container">
|
||||
<div class="nav">
|
||||
<div class="nav-item is-active">
|
||||
<a href="./"><i class="fa fa-home"></i><span><?php echo $LANG['m_home']?></span></a>
|
||||
</div>
|
||||
<div class="nav-item">
|
||||
<a href="dashboard"><i class="fa fa-tachometer" aria-hidden="true"></i><span><?php echo $LANG['m_dashboard']?></span></a>
|
||||
</div>
|
||||
<div class="nav-item">
|
||||
<a href="setting"><i class="fa fa-wrench" aria-hidden="true"></i></i><span><?php echo $LANG['m_settings']?></span></a>
|
||||
</div>
|
||||
<div class="nav-item">
|
||||
<a href="automation"><i class="fa fa-calendar-o" aria-hidden="true"></i><span><?php echo $LANG['m_automatization']?></span></a>
|
||||
</div>
|
||||
<div class="nav-item">
|
||||
<a href="scene"><i class="fa fa-terminal" aria-hidden="true"></i><span><?php echo $LANG['m_scenes']?></span></a>
|
||||
</div>
|
||||
</div>
|
||||
<?php
|
||||
$partial = new Partial('menu');
|
||||
$partial->prepare('item', 'home');
|
||||
$partial->prepare('lang',$LANG);
|
||||
$partial->render();
|
||||
?>
|
||||
</div>
|
||||
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.7.3/Chart.bundle.min.js"></script>
|
||||
@ -35,14 +24,8 @@
|
||||
<div class="col-md-9 main-body">
|
||||
<div class="label m-1">
|
||||
<?php
|
||||
$usersAtHome = '';
|
||||
foreach ($USERS as $user) {
|
||||
if ($user['at_home'] == 'true') {
|
||||
$usersAtHome .= $user['username'] . ' ';
|
||||
}
|
||||
}
|
||||
if ($usersAtHome != "") {
|
||||
echo 'doma jsou:' . $usersAtHome;
|
||||
if ($USERSATHOME != "") {
|
||||
echo $LANG['l_atHome'] . ': ' . $USERSATHOME;
|
||||
}
|
||||
?>
|
||||
</div>
|
Before Width: | Height: | Size: 7.1 KiB After Width: | Height: | Size: 7.1 KiB |
Before Width: | Height: | Size: 3.3 KiB After Width: | Height: | Size: 3.3 KiB |
@ -11,23 +11,12 @@
|
||||
<div class="row no-gutters main">
|
||||
<div class="col-md-3 d-sm-none"></div>
|
||||
<div class="col-md-3 nav-container">
|
||||
<div class="nav">
|
||||
<div class="nav-item">
|
||||
<a href="./"><i class="fa fa-home"></i><span><?php echo $LANG['m_home']?></span></a>
|
||||
</div>
|
||||
<div class="nav-item">
|
||||
<a href="dashboard"><i class="fa fa-tachometer" aria-hidden="true"></i><span><?php echo $LANG['m_dashboard']?></span></a>
|
||||
</div>
|
||||
<div class="nav-item is-active">
|
||||
<a href="setting"><i class="fa fa-wrench" aria-hidden="true"></i></i><span><?php echo $LANG['m_settings']?></span></a>
|
||||
</div>
|
||||
<div class="nav-item">
|
||||
<a href="automation"><i class="fa fa-calendar-o" aria-hidden="true"></i><span><?php echo $LANG['m_automatization']?></span></a>
|
||||
</div>
|
||||
<div class="nav-item">
|
||||
<a href="scene"><i class="fa fa-terminal" aria-hidden="true"></i><span><?php echo $LANG['m_scenes']?></span></a>
|
||||
</div>
|
||||
</div>
|
||||
<?php
|
||||
$partial = new Partial('menu');
|
||||
$partial->prepare('item', 'log');
|
||||
$partial->prepare('lang',$LANG);
|
||||
$partial->render();
|
||||
?>
|
||||
</div>
|
||||
<div class="col-md-9 main-body">
|
||||
<div class="col-12 col-sm-9 mx-auto mt-4">
|
||||
@ -42,15 +31,17 @@
|
||||
<input type="submit" class="button" name="selectFile" value="file"/>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
<?php
|
||||
if (isset($_POST['LogFile'])) {
|
||||
$file_lines = file('./logs/' . $_POST['LogFile']);
|
||||
$file_lines = file('./app/logs/' . $_POST['LogFile']);
|
||||
echo '<pre>';
|
||||
foreach ($file_lines as $line) {
|
||||
echo $line . '</br>';
|
||||
echo $line;
|
||||
}
|
||||
echo '</pre>';
|
||||
}
|
||||
?>
|
||||
</pre>
|
||||
</div>
|
||||
</div>
|
||||
|
46
app/templates/part/menu.phtml
Normal file
46
app/templates/part/menu.phtml
Normal file
@ -0,0 +1,46 @@
|
||||
<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) { ?>
|
||||
<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 echo $LANG['m_'.$value['lngKey']]; ?>
|
||||
</span>
|
||||
</a>
|
||||
</div>
|
||||
<?php }?>
|
||||
|
||||
</div>
|
@ -11,23 +11,12 @@
|
||||
<div class="row no-gutters main">
|
||||
<div class="col-md-3 d-sm-none"></div>
|
||||
<div class="col-md-3 nav-container">
|
||||
<div class="nav">
|
||||
<div class="nav-item is-active">
|
||||
<a href="./"><i class="fa fa-home"></i><span><?php echo $LANG['m_home']?></span></a>
|
||||
</div>
|
||||
<div class="nav-item">
|
||||
<a href="dashboard"><i class="fa fa-tachometer" aria-hidden="true"></i><span><?php echo $LANG['m_dashboard']?></span></a>
|
||||
</div>
|
||||
<div class="nav-item">
|
||||
<a href="setting"><i class="fa fa-wrench" aria-hidden="true"></i></i><span><?php echo $LANG['m_settings']?></span></a>
|
||||
</div>
|
||||
<div class="nav-item">
|
||||
<a href="automation"><i class="fa fa-calendar-o" aria-hidden="true"></i><span><?php echo $LANG['m_automatization']?></span></a>
|
||||
</div>
|
||||
<div class="nav-item">
|
||||
<a href="scene"><i class="fa fa-terminal" aria-hidden="true"></i><span><?php echo $LANG['m_scenes']?></span></a>
|
||||
</div>
|
||||
</div>
|
||||
<?php
|
||||
$partial = new Partial('menu');
|
||||
$partial->prepare('item', 'rooms');
|
||||
$partial->prepare('lang',$LANG);
|
||||
$partial->render();
|
||||
?>
|
||||
</div>
|
||||
|
||||
|
@ -11,23 +11,12 @@
|
||||
<div class="row no-gutters main">
|
||||
<div class="col-md-3 d-sm-none"></div>
|
||||
<div class="col-md-3 nav-container">
|
||||
<div class="nav">
|
||||
<div class="nav-item">
|
||||
<a href="./"><i class="fa fa-home"></i><span><?php echo $LANG['m_home']?></span></a>
|
||||
</div>
|
||||
<div class="nav-item">
|
||||
<a href="dashboard"><i class="fa fa-tachometer" aria-hidden="true"></i><span><?php echo $LANG['m_dashboard']?></span></a>
|
||||
</div>
|
||||
<div class="nav-item">
|
||||
<a href="setting"><i class="fa fa-wrench" aria-hidden="true"></i></i><span><?php echo $LANG['m_settings']?></span></a>
|
||||
</div>
|
||||
<div class="nav-item">
|
||||
<a href="automation"><i class="fa fa-calendar-o" aria-hidden="true"></i><span><?php echo $LANG['m_automatization']?></span></a>
|
||||
</div>
|
||||
<div class="nav-item is-active">
|
||||
<a href="scene"><i class="fa fa-terminal" aria-hidden="true"></i><span><?php echo $LANG['m_scenes']?></span></a>
|
||||
</div>
|
||||
</div>
|
||||
<?php
|
||||
$partial = new Partial('menu');
|
||||
$partial->prepare('item', 'scene');
|
||||
$partial->prepare('lang',$LANG);
|
||||
$partial->render();
|
||||
?>
|
||||
</div>
|
||||
<div class="col-md-9 main-body">
|
||||
<a class="button is-primary m-1" onClick="$('#modal').removeClass('modal-container-hiden').show();"><?php echo $LANG['t_createScene'];?></a>
|
@ -11,23 +11,12 @@
|
||||
<div class="row no-gutters main">
|
||||
<div class="col-md-3 d-sm-none"></div>
|
||||
<div class="col-md-3 nav-container">
|
||||
<div class="nav">
|
||||
<div class="nav-item">
|
||||
<a href="./"><i class="fa fa-home"></i><span><?php echo $LANG['m_home']?></span></a>
|
||||
</div>
|
||||
<div class="nav-item">
|
||||
<a href="dashboard"><i class="fa fa-tachometer" aria-hidden="true"></i><span><?php echo $LANG['m_dashboard']?></span></a>
|
||||
</div>
|
||||
<div class="nav-item is-active">
|
||||
<a href="setting"><i class="fa fa-wrench" aria-hidden="true"></i></i><span><?php echo $LANG['m_settings']?></span></a>
|
||||
</div>
|
||||
<div class="nav-item">
|
||||
<a href="automation"><i class="fa fa-calendar-o" aria-hidden="true"></i><span><?php echo $LANG['m_automatization']?></span></a>
|
||||
</div>
|
||||
<div class="nav-item">
|
||||
<a href="scene"><i class="fa fa-terminal" aria-hidden="true"></i><span><?php echo $LANG['m_scenes']?></span></a>
|
||||
</div>
|
||||
</div>
|
||||
<?php
|
||||
$partial = new Partial('menu');
|
||||
$partial->prepare('item', 'setting');
|
||||
$partial->prepare('lang',$LANG);
|
||||
$partial->render();
|
||||
?>
|
||||
</div>
|
||||
<div class="col-md-9 main-body">
|
||||
<div class="col-12 col-sm-9 mx-auto mt-4">
|
||||
@ -55,6 +44,11 @@
|
||||
<a href="rooms" class="button">ROOMS</a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-12 col-sm-9 mx-auto mt-4">
|
||||
<div class="field">
|
||||
<a href="log" class="button">Logs</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
@ -1,8 +1,8 @@
|
||||
<?php
|
||||
$files = scandir('class/');
|
||||
$files = scandir('app/class/');
|
||||
$files = array_diff($files, array('.', '..'));
|
||||
foreach($files as $file) {
|
||||
include_once 'class/'. $file;
|
||||
include_once 'app/class/'. $file;
|
||||
}
|
||||
|
||||
class Ajax extends Template
|
@ -1,8 +1,8 @@
|
||||
<?php
|
||||
$files = scandir('class/');
|
||||
$files = scandir('app/class/');
|
||||
$files = array_diff($files, array('.', '..'));
|
||||
foreach($files as $file) {
|
||||
include_once 'class/'. $file;
|
||||
include_once 'app/class/'. $file;
|
||||
}
|
||||
|
||||
class Automation extends Template
|
@ -14,6 +14,24 @@ class Home extends Template
|
||||
|
||||
$template = new Template('home');
|
||||
|
||||
//users instantialize
|
||||
$users = UserManager::getUsers();
|
||||
$template->prepare('users', $users);
|
||||
|
||||
//Users at home Info
|
||||
$usersAtHome = '';
|
||||
$i = 0;
|
||||
foreach ($users as $user) {
|
||||
$i++;
|
||||
if ($user['at_home'] == 'true') {
|
||||
$usersAtHome .= $user['username'];
|
||||
if ($usersAtHome != "" && isset($users[$i + 1])){
|
||||
$usersAtHome .= ', ';
|
||||
}
|
||||
}
|
||||
}
|
||||
$template->prepare('usersAtHome', $usersAtHome);
|
||||
|
||||
$roomsItems = [];
|
||||
$roomsData = RoomManager::getAllRooms();
|
||||
foreach ($roomsData as $roomKey => $roomsData) {
|
||||
@ -124,9 +142,6 @@ class Home extends Template
|
||||
];
|
||||
}
|
||||
|
||||
$users = UserManager::getUsers();
|
||||
$template->prepare('users', $users);
|
||||
|
||||
$rooms = RoomManager::getAllRooms();
|
||||
$template->prepare('rooms', $rooms);
|
||||
$template->prepare('title', 'Home');
|
@ -16,7 +16,7 @@ class Log extends Template
|
||||
$template->prepare('title', 'Log');
|
||||
|
||||
$result = array();
|
||||
$cdir = scandir('./logs/');
|
||||
$cdir = scandir('./app/logs/');
|
||||
foreach ($cdir as $key => $value)
|
||||
{
|
||||
if (!in_array($value,array(".","..")))
|
@ -1 +0,0 @@
|
||||
C:/Users/spaninger/Documents/git/PHP_FORM_GENERATOR/Form.php
|
@ -11,10 +11,11 @@ mb_internal_encoding ("UTF-8");
|
||||
|
||||
//Autoloader
|
||||
foreach (["class", "views"] as $dir) {
|
||||
$files = scandir('./'.$dir.'/');
|
||||
$files = array_diff($files, array('.', '..'));
|
||||
$files = scandir('./app/'.$dir.'/');
|
||||
$files = array_diff($files, array('.', '..', 'app'));
|
||||
|
||||
foreach($files as $file) {
|
||||
include_once './'.$dir.'/'. $file;
|
||||
include './app/'.$dir.'/'. $file;
|
||||
}
|
||||
}
|
||||
|
||||
@ -33,7 +34,7 @@ if (DEBUGMOD == 1) {
|
||||
echo '</pre>';
|
||||
echo '</dev>';*/
|
||||
}
|
||||
require_once './lang/' . $langTag . '.php';
|
||||
require_once './app/lang/' . $langTag . '.php';
|
||||
|
||||
//DB Conector
|
||||
Db::connect (DBHOST, DBUSER, DBPASS, DBNAME);
|
||||
|
Loading…
Reference in New Issue
Block a user