2020-09-29 22:39:06 +00:00
|
|
|
<?php
|
2021-08-25 15:24:12 +00:00
|
|
|
|
|
|
|
use Battles\Database\DBPDO;
|
|
|
|
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']);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-08-25 15:24:12 +00:00
|
|
|
$dateD = DBPDO::$db->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">
|
2021-08-25 15:24:12 +00:00
|
|
|
<?php if (User::$current->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>
|