tournaments 2.0
This commit is contained in:
@@ -0,0 +1,54 @@
|
||||
<?php
|
||||
|
||||
namespace Insallah\Tournaments\View;
|
||||
|
||||
use Insallah\Tournaments\Config;
|
||||
use Insallah\Tournaments\Model\GameConnector;
|
||||
use Insallah\Tournaments\Model\Tournament;
|
||||
use Insallah\Tournaments\Model\User;
|
||||
|
||||
class TList
|
||||
{
|
||||
private string $str;
|
||||
|
||||
public function __construct($user)
|
||||
{
|
||||
if (!Config::IS_ENABLED) {
|
||||
$this->str = '<div><strong style="color: crimson;">Â äàííûé ìîìåíò òóðíèðû íå ïðîâîäÿòñÿ!</strong></div>';
|
||||
return;
|
||||
}
|
||||
$tournamentstatus = new Tournament();
|
||||
$this->str = '<div>
|
||||
<strong style="color: crimson;">Âíèìàíèå!</strong>
|
||||
<ul>
|
||||
<li>Ïðèñîåäèíÿÿñü ê òóðíèðó ïîêèíóòü çàÿâêó <u>íåâîçìîæíî</u>!</li>';
|
||||
if ((new GameConnector())->setUser($user->info['id'])->isEkrOverpriced()) {
|
||||
$this->str .= '<li>Ñòîèìîñòü ïðåäìåòîâ, îäåòûõ íà âàñ íå äîëæíà
|
||||
ïðåâûøàòü ' . Config::ekrOverpriceFormula($user->info['level']) . ' åâðîêðåäèòîâ.
|
||||
</li>';
|
||||
}
|
||||
if ($user->info['exp'] < Config::MIN_EXP) {
|
||||
$this->str .= '<li>Ó âàñ äîëæíî áûòü íå ìåíåå ' . Config::MIN_EXP . ' îïûòà.</li>';
|
||||
}
|
||||
$this->str .= '<li>Òóðíèð íà÷í¸òñÿ, êîãäà â çàÿâêå
|
||||
íàáåð¸òñÿ ' . Config::START_TOURNAMENT . ' ÷åëîâåê.</li>';
|
||||
$this->str .= '<li>Èãðîêè çàíÿâøèå 1, 2 è 3 ìåñòà ïîëó÷àò ' . Config::PRIZE1 . ', ' . Config::PRIZE2 . ',
|
||||
' . Config::PRIZE3 . ' Ðåëèêâèé Àíãåëà, à òàê æå çàäåðæêè íà ó÷àñòèå â òóðíèðå
|
||||
12 ÷àñîâ, 6 è 3 ÷àñà ñîîòâåòñòâåííî!</li>';
|
||||
$this->str .= '</ul></div>';
|
||||
$this->str .= $tournamentstatus->getList();
|
||||
if (!User::getTournamentIdByUserId($user->info['id']) || !$tournamentstatus->isStarted($user->info['level'])) {
|
||||
$this->str .= '<form method="post">
|
||||
<input type="submit" name="tournament_start" value="Ïðèíÿòü ó÷àñòèå â òóðíèðå">
|
||||
<input type="hidden" name="key" value="' . $_SESSION['bypass'] . '">
|
||||
</form>';
|
||||
} else {
|
||||
$this->str .= 'Âû ó÷àâñòâóåòå.';
|
||||
}
|
||||
}
|
||||
|
||||
public function __toString()
|
||||
{
|
||||
return $this->str;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user