mirror of
https://github.com/claradex/nativegallery.git
synced 2025-02-23 03:59:50 +03:00
update admin
This commit is contained in:
parent
52dbf10d3d
commit
3360b9d208
3 changed files with 81 additions and 25 deletions
|
@ -88,10 +88,10 @@ body {
|
|||
<i class="bx bx-file-blank nav__icon"></i>
|
||||
<span class="nav__name">Страницы</span>
|
||||
</a>
|
||||
<!--a href="/admin?type=Settings" class="nav__link">
|
||||
<a href="/admin?type=Settings" class="nav__link">
|
||||
<i class="bx bx-cog nav__icon"></i>
|
||||
<span class="nav__name">Настройки<span class="badge text-bg-warning">BETA</span></span>
|
||||
<-->
|
||||
</a>
|
||||
|
||||
|
||||
</div>
|
||||
|
|
|
@ -5,9 +5,8 @@ use \App\Models\User;
|
|||
|
||||
$task = new TaskScheduler();
|
||||
|
||||
//$userprofile = new User(explode('/', $_SERVER['REQUEST_URI'])[2]);
|
||||
$contestCreate = true;
|
||||
if (!$task->isTaskExists("FinishContests", "php /path/to/finish_contests.php")) {
|
||||
if (!$task->isTaskExists("ExecContests", "php ".$_SERVER['DOCUMENT_ROOT'].$task->findHandlerById(NGALLERY_TASKS, 'ExecContests'))) {
|
||||
$contestCreate = false;
|
||||
}
|
||||
?>
|
||||
|
@ -38,16 +37,9 @@ if (!$task->isTaskExists("FinishContests", "php /path/to/finish_contests.php"))
|
|||
} ?>">Провести новый</a>
|
||||
<table class="table">
|
||||
<?php
|
||||
/*echo $task->addTask(
|
||||
"FinishContests",
|
||||
"php ".$_SERVER['DOCUMENT_ROOT']."/app/Controllers/Exec/Tasks/FinishContests.php >> ".$_SERVER['DOCUMENT_ROOT'].NGALLERY['root']['logslocation']." 2>&1",
|
||||
"* * * * *" // Каждую минуту (можно менять)
|
||||
);*/
|
||||
if ($contestCreate === false) {
|
||||
echo "<div class='alert alert-warning' role='alert'>У вас не добавлена задача на проведение конкурсов. Без неё, сервер не сможет завершать конкурс и проводить новый автоматически.</div>";
|
||||
echo "<div class='alert alert-warning mt-3' role='alert'>У вас не добавлена задача на проведение конкурсов. Без неё, сервер не сможет завершать конкурс и проводить новый автоматически.<a href='/admin?type=Settings' type='button' style='margin-left: 5px;' class='btn btn-sm btn-outline-dark'>Включить</a></div>";
|
||||
}
|
||||
echo $task->removeTask("FinishContests", "php /path/to/finish_contests.php");
|
||||
|
||||
?>
|
||||
<tbody>
|
||||
<tr>
|
||||
|
|
|
@ -1,12 +1,14 @@
|
|||
<?php
|
||||
|
||||
use \App\Services\{KeyTranslation};
|
||||
use \App\Services\{KeyTranslation, TaskScheduler};
|
||||
use \App\Models\User;
|
||||
|
||||
use Symfony\Component\Yaml\Yaml;
|
||||
|
||||
$yamlFile = $_SERVER['DOCUMENT_ROOT'].'/ngallery.yaml';
|
||||
function renderInputs($data, $prefix = '') {
|
||||
$task = new TaskScheduler();
|
||||
$yamlFile = $_SERVER['DOCUMENT_ROOT'] . '/ngallery.yaml';
|
||||
function renderInputs($data, $prefix = '')
|
||||
{
|
||||
foreach ($data as $key => $value) {
|
||||
$name = $prefix ? "{$prefix}[{$key}]" : $key;
|
||||
$key = KeyTranslation::key($key);
|
||||
|
@ -81,27 +83,89 @@ function renderInputs($data, $prefix = '') {
|
|||
<?= \App\Controllers\AdminController::loadContent(); ?>
|
||||
|
||||
<h1><b>Настройки</b></h1>
|
||||
<div class="v-header__tabs">
|
||||
<div class="v-tabs">
|
||||
<div class="v-tabs__scroll">
|
||||
<div class="v-tabs__content"><a href="#" onclick="changeTab('config')" id="config" class="v-tab v-tab-b v-tab--active"><span class="v-tab__label">
|
||||
Конфиг сервера
|
||||
|
||||
</span></a><a href="#" onclick="changeTab('tasks')" id="tasks" class="v-tab v-tab-b"><span class="v-tab__label">
|
||||
Задачи
|
||||
|
||||
</span></a>
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="active__block" id="config__block">
|
||||
<div class="alert alert-warning" role="alert">
|
||||
Изменяйте только на свой страх и риск.
|
||||
</div>
|
||||
Изменяйте только на свой страх и риск.
|
||||
</div>
|
||||
<div class="p20w" style="display:block">
|
||||
<?php
|
||||
// Вывод формы
|
||||
echo '<form method="post">';
|
||||
<?php
|
||||
// Вывод формы
|
||||
echo '<form method="post">';
|
||||
foreach (NGALLERY as $ng) {
|
||||
renderInputs($ng);
|
||||
}
|
||||
echo '<button type="submit">Сохранить</button>';
|
||||
echo '</form>';
|
||||
?>
|
||||
echo '<button type="submit">Сохранить</button>';
|
||||
echo '</form>';
|
||||
?>
|
||||
</div><br>
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
<div style="display: none;" id="tasks__block">
|
||||
<table class="table">
|
||||
<tbody>
|
||||
<tr>
|
||||
<th width="100">ID</th>
|
||||
<th width="50%">Статус</th>
|
||||
<th>Действия</th>
|
||||
</tr>
|
||||
|
||||
|
||||
<?php
|
||||
foreach (NGALLERY_TASKS as $nt) {
|
||||
$nt = $nt;
|
||||
echo '<tr><td>
|
||||
|
||||
'.$nt['id'].'
|
||||
</td><td>
|
||||
'.$task->getTaskStatus($nt['id'], "php {$nt['handler']}").'
|
||||
</td><td class="c">
|
||||
<a onclick="taskManager(`'.$nt['id'].'`, 1)" class="btn btn-sm btn-primary">Запустить</a> <a onclick="taskManager(`'.$nt['id'].'`, 0)" class="btn btn-sm btn-danger">Остановить</a>
|
||||
</td> <tr>';
|
||||
}
|
||||
|
||||
|
||||
|
||||
?>
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
</body>
|
||||
<script>
|
||||
function taskManager(id, type) {
|
||||
$.ajax({
|
||||
type: "GET",
|
||||
url: '/api/admin/settings/taskmanager?id='+id+'&type='+type,
|
||||
success: function(response) {
|
||||
Notify.noty('success', 'OK!');
|
||||
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
</script>
|
||||
|
||||
</html>
|
Loading…
Reference in a new issue