PHP_SMART_HOME_V3/app/views/Setting.php

37 lines
893 B
PHP
Raw Normal View History

2019-08-23 11:39:42 +00:00
<?php
class Setting extends Template
{
function __construct()
{
global $userManager;
2019-10-11 12:12:05 +00:00
global $langMng;
2019-08-23 11:39:42 +00:00
if (!$userManager->isLogin()){
2019-10-11 14:32:05 +00:00
header('Location: ' . BASEDIR . 'login');
2019-08-23 11:39:42 +00:00
}
$automations = [];
$automationsData = AutomationManager::getAll();
foreach ($automationsData as $automationKey => $automationData) {
$automations[$automationData['automation_id']] = [
'name' => '',
'onDays' => $automationData['on_days'],
'ifSomething' => $automationData['if_something'],
'doSomething' => $automationData['do_something'],
];
}
$template = new Template('setting');
2019-10-11 14:38:20 +00:00
$template->prepare('baseDir', BASEDIR);
2019-08-23 11:39:42 +00:00
$template->prepare('title', 'Automation');
2019-10-11 12:12:05 +00:00
$template->prepare('langMng', $langMng);
2019-08-23 11:39:42 +00:00
$template->prepare('automations', $automations);
2019-10-13 12:01:33 +00:00
$users = $userManager->getUsers();
$template->prepare('users', $users);
2019-08-23 11:39:42 +00:00
$template->render();
}
}