Exemplo n.º 1
0
    public function __construct($seasonId, $requestedWeek = null) {

        $this->season = Season::getByLink($seasonId);
        $this->week = 1;
        $time = time();

        while($this->week < $this->season->getWeeksCount()
            && $this->season->weekIsPublished($this->week)) {
            $this->week++;
        }

        $maxWeekMatch = Match::findOne('seasonid = ? order by week desc limit 1', [$this->season->seasonid]);
        $this->maxWeek = $maxWeekMatch->week;

        if (!Team::isMember()) {
            while (!$this->season->weekIsPublic($this->maxWeek)) {
                $this->maxWeek--;
            }
        }

        if ($requestedWeek && $requestedWeek <= $this->maxWeek) {
            $this->week = $requestedWeek;
        }
        else if ($requestedWeek) {
            HTMLResponse::exitWithRoute("/");
        }

        $this->canVote = ($this->season->getPublishTimeForWeek($this->week) - $time > 3600);
    }
Exemplo n.º 2
0
    public function __construct($seasonLink, $dir) {
        $this->season = Season::getByLink($seasonLink);

        $this->team = Team::fromLink($dir);

        if (!$this->team) HTMLResponse::exitWithRoute("/$seasonLink/equipos/");
        if (!Team::isSuperAdmin()
            && !SeasonTeam::findOne('seasonid = ? and teamid = ? and ispublic', [$this->season->seasonid, $this->team->teamid])
        ) HTMLResponse::exitWithRoute("/$seasonLink/equipos/");

        $this->tiers = $this->season->getPlayerNames();
    }
Exemplo n.º 3
0
 public function __construct($seasonLink) {
     $this->season = Season::getByLink($seasonLink);
 }