2020-09-29 22:39:06 +00:00
|
|
|
<?php
|
2021-08-25 15:24:12 +00:00
|
|
|
|
2022-01-26 23:15:33 +00:00
|
|
|
use Battles\Database\Db;
|
2021-08-25 15:24:12 +00:00
|
|
|
use Battles\Template;
|
|
|
|
use Battles\User;
|
|
|
|
|
2020-09-29 22:39:06 +00:00
|
|
|
require_once "functions.php";
|
|
|
|
$Tournament = new Tournament();
|
2021-08-25 15:24:12 +00:00
|
|
|
Template::header('Турниры');
|
2020-09-29 22:39:06 +00:00
|
|
|
?>
|
2020-09-30 19:12:34 +00:00
|
|
|
<META HTTP-EQUIV="REFRESH" CONTENT="10">
|
2020-09-29 22:39:06 +00:00
|
|
|
<div style='color:#8F0000; font-weight:bold; font-size:16px; text-align:center; float:left;'>Турнирная</div>
|
|
|
|
<div style="float: right; padding-right: 6px;">
|
|
|
|
<input type="button" onclick="window.location='main.php?setch=1'" value="Вернуться">
|
|
|
|
</div>
|
|
|
|
<br>
|
|
|
|
<?php
|
2020-09-30 19:12:34 +00:00
|
|
|
if (!empty($_POST)) {
|
2020-09-29 22:39:06 +00:00
|
|
|
if ($_POST['newtournament']) {
|
|
|
|
$Tournament->CreateTournament("Еженедельные турниры");
|
|
|
|
}
|
|
|
|
if ($_POST['preptournament']) {
|
|
|
|
$Tournament->PrepearTournir();
|
|
|
|
}
|
|
|
|
if ($_POST['addzayvka']) {
|
|
|
|
$Tournament->AddUserInTournament($_POST['idtur']);
|
|
|
|
}
|
|
|
|
if ($_POST['dellzayvka']) {
|
|
|
|
$Tournament->DellUserInTournament($_POST['idtur']);
|
|
|
|
}
|
|
|
|
if ($_POST['expenemy']) {
|
|
|
|
$Tournament->expectationenemy((int)$_POST['expenemy']);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-01-26 23:15:33 +00:00
|
|
|
$dateD = Db::getInstance()->fetch('select datetime from turnament where old = 0 limit 1');
|
2020-09-29 22:39:06 +00:00
|
|
|
|
2021-08-25 15:24:12 +00:00
|
|
|
if (mktime() >= ($dateD['dt'] + 10)) {
|
2020-09-29 22:39:06 +00:00
|
|
|
$Tournament->UpdateTournir();
|
|
|
|
}
|
|
|
|
$Tournament->showAllTurnament();
|
|
|
|
|
2021-08-25 15:24:12 +00:00
|
|
|
if (mktime() >= ($dateD['dt'] + 10)) {
|
2020-09-29 22:39:06 +00:00
|
|
|
$Tournament->StartTournir();
|
|
|
|
}
|
|
|
|
$Tournament->ShowTournirFinaliats();
|
|
|
|
?>
|
|
|
|
<form method="post">
|
2022-01-26 23:15:33 +00:00
|
|
|
<?php if (User::getInstance()->getAdmin()) { ?>
|
2020-09-30 19:12:34 +00:00
|
|
|
<div>
|
|
|
|
<input type="submit" name="newtournament" value="Добавить новый турнир">
|
|
|
|
<input type="submit" name="preptournament" value="Приготовить турнир и запустить">
|
|
|
|
</div>
|
|
|
|
<?php } ?>
|
|
|
|
</form>
|