2022-01-25 17:59:18 +00:00
|
|
|
<?php
|
|
|
|
/**
|
|
|
|
* Арена. Принцип: https://src.liks.pw/lopar/battles-game-test/issues/3
|
|
|
|
*/
|
|
|
|
|
|
|
|
use Battles\Arena;
|
|
|
|
use Battles\Template;
|
|
|
|
|
2022-02-12 23:46:59 +00:00
|
|
|
if (isset($_POST['startTime']) && isset($_POST['teamMembersQuantity'])) {
|
|
|
|
Arena::fight()->addNew((int)$_POST['teamMembersQuantity'], 2, (int)$_POST['startTime']);
|
|
|
|
}
|
|
|
|
if (isset($_POST['fight_id']) && isset($_POST['team_id'])) {
|
|
|
|
Arena::fight()->join((int)$_POST['fight_id'], (int)$_POST['team_id']);
|
|
|
|
}
|
2022-01-25 17:59:18 +00:00
|
|
|
Template::header('Арена');
|
2022-02-12 23:46:59 +00:00
|
|
|
?>
|
2022-01-25 17:59:18 +00:00
|
|
|
|
2022-02-12 23:46:59 +00:00
|
|
|
<?php if(Arena::fight()->hasNoPendingFights()): ?>
|
|
|
|
<form method='post' id='newbattle'></form>
|
|
|
|
<H3>Подать заявку на поединок</H3>
|
|
|
|
<label for='startTime'>Начало боя</label>
|
|
|
|
<select name='startTime' id='startTime' form='newbattle'>
|
|
|
|
<option value=1 selected>через 1 минуту</option>
|
|
|
|
<option value=3>через 3 минуты</option>
|
|
|
|
<option value=5>через 5 минут</option>
|
|
|
|
<option value=10>через 10 минут</option>
|
|
|
|
</select>
|
|
|
|
<br><br>
|
|
|
|
<label>Размер команды (1-20)
|
|
|
|
<input type='number' min='1' max='20' name='teamMembersQuantity' form='newbattle' value='5'>
|
|
|
|
</label>
|
|
|
|
<br><br>
|
|
|
|
<input type='submit' value='Подать заявку' form='newbattle'>
|
|
|
|
<?php endif; ?>
|
|
|
|
<?= Arena::fight()->getPendingList() ?>
|
|
|
|
<?php foreach (Arena::fight()->getPendingList() as $row): ?>
|
|
|
|
<!-- !!PLACEHOLDER!! -->
|
|
|
|
<div>
|
|
|
|
User1, User2, User3
|
|
|
|
<form method='post' style='display:inline'>
|
|
|
|
<input type='hidden' name='teamId' value='1'>
|
|
|
|
<input type='submit' value='Я за этих'>
|
|
|
|
</form>
|
|
|
|
<em>против</em>
|
|
|
|
User4, User5, User6
|
|
|
|
<form method='post' style='display:inline'>
|
|
|
|
<input type='hidden' name='teamId' value='2'>
|
|
|
|
<input type='submit' value='Я за этих'>
|
|
|
|
</form>
|
|
|
|
<? endforeach; ?>
|
|
|
|
</div>
|