/** * @see Page::readParameters() */ public function readParameters() { parent::readParameters(); // get entry if (isset($_REQUEST['contestID'])) { $this->contestID = intval($_REQUEST['contestID']); } $this->entry = new ViewableContest($this->contestID); if (!$this->entry->contestID) { throw new IllegalLinkException(); } if (isset($_REQUEST['errorField'])) { $this->errorField = $_REQUEST['errorField']; } if (isset($_REQUEST['action'])) { $this->action = $_REQUEST['action']; } if (isset($_REQUEST['commentID'])) { $this->commentID = intval($_REQUEST['commentID']); } if ($this->commentID != 0) { $this->comment = new ContestComment($this->commentID); if (!$this->comment->commentID || $this->comment->contestID != $this->contestID) { throw new IllegalLinkException(); } // check permissions if ($this->action == 'edit' && !$this->comment->isEditable()) { throw new PermissionDeniedException(); } // get page number $pagennumber = new ContestEventMixList(); $pagennumber->sqlConditions .= 'contestID = ' . intval($this->contestID); $pagennumber->sqlConditions .= ' AND time < ' . intval($this->comment->time); $count = $pagennumber->countObjects(); $this->pageNo = $count > $this->itemsOnLandingpage ? 1 : 0; $this->pageNo += ceil(($count - $this->itemsOnLandingpage) / $this->itemsPerPage); } // init eventmix list $this->eventmixList = new ContestEventMixList(); $this->eventmixList->sqlConditions .= 'contestID = ' . intval($this->contestID); $this->eventmixList->sqlOrderBy = 'contest_eventmix.time DESC'; }