/** * @see Page::readParameters() */ public function readParameters() { parent::readParameters(); // get contest if (!$this->contest->isOwner()) { throw new PermissionDeniedException(); } }
/** * @see Page::show() */ public function show() { if (!MODULE_CONTEST) { echo "Das Contest Modul ist komplett deaktiviert, " . "aktiviere es im Admin Control Panel unter System > Optionen > Module an/aus<br />"; } if (WCF::getUser()->getPermission('user.contest.canViewContest') == false) { echo "Deine Benutzergruppe darf keine Contests nutzen, überprüfe die Benutzerrechte unter " . "Benutzer > Benutzergruppen auflisten > bearbeiten > Allgemeine Rechte > Wettbewerb<br />"; } // get entry if (isset($_REQUEST['contestID'])) { $this->contestID = intval($_REQUEST['contestID']); } $this->entry = new ViewableContest($this->contestID); if (!$this->entry->contestID) { echo "Der angegebene Contest existiert nicht, überprüfe den aufgerufenen Link<br />"; } if ($this->entry->state != 'scheduled') { echo "Damit der Contest für andere Benutzer sichtbar ist, musst du den Status auf 'geplant' ändern.<br />"; } if ($this->entry->fromTime > TIME_NOW) { echo "Damit der Contest für andere Benutzer sichtbar ist, muss die Startzeit erreicht werden.<br />"; } if ($this->entry->isOwner()) { echo "Du bist selbst der Besitzer, daher kannst du nicht am Contest teilnehmen.<br />"; } if ($this->entry->state == 'closed' || !($this->entry->state == 'scheduled' && $this->entry->untilTime > TIME_NOW)) { echo "Der Contest ist beendet, daher kannst du nicht am Contest teilnehmen.<br />"; } if ($this->entry->state == 'closed' || !($this->entry->state == 'scheduled' && $this->entry->untilTime > TIME_NOW)) { echo "Der Contest ist beendet, daher kannst du nicht am Contest teilnehmen.<br />"; } foreach ($this->entry->getJurys() as $jury) { if ($jury->isOwner()) { echo "Du bist in der Jury und kannst deswegen nicht am Contest teilnehmen.<br />"; } } // alreay participant $isParticipant = false; foreach ($this->entry->getParticipants() as $participant) { if ($participant->isOwner()) { $isParticipant = true; echo "Du bist bereits Teilnehmer am am Contest.<br />"; } } if (!$isParticipant && !$this->entry->isParticipantable()) { echo "Du kannst nicht am Contest teilnehmen!<br />"; } if (!$this->entry->isViewable()) { echo "Du kannst den Contest nicht sehen!<br />"; } parent::show(); }
/** * returns available states */ protected function getStates() { $flags = (!isset($this->entry) || $this->entry->isOwner() ? ContestState::FLAG_USER : 0) + ($this->contest->isOwner() ? ContestState::FLAG_CONTESTOWNER : 0) + (ContestCrew::isMember() ? ContestState::FLAG_CREW : 0); if (isset($this->entry) && $this->entry->enableOpenSolution) { $flags += ContestSolutionEditor::FLAG_OPENSOLUTION; } return ContestSolutionEditor::getStates(isset($this->entry) ? $this->entry->state : '', $flags); }
/** * @see Page::readData() */ public function readData() { parent::readData(); // show 5 entries on first page, but 20 on the following pages $this->eventmixList->sqlLimit = $this->pageNo <= 1 ? $this->itemsOnLandingpage : $this->itemsPerPage; $this->eventmixList->sqlOffset = $this->pageNo <= 1 ? 0 : ($this->pageNo - 2) * $this->itemsPerPage + $this->itemsOnLandingpage; // fire sql query $this->eventmixList->readObjects(); // get previous entry $sql = "SELECT\t\t*\n\t\t\tFROM\t\twcf" . WCF_N . "_contest\n\t\t\tWHERE\t\tuserID = " . intval($this->entry->userID) . "\n\t\t\t\t\tAND (\n\t\t\t\t\t\ttime > " . intval($this->entry->time) . "\n\t\t\t\t\t\tOR (time = " . intval($this->entry->time) . " AND contestID < " . intval($this->entry->contestID) . ")\n\t\t\t\t\t)\n\t\t\tORDER BY\ttime ASC, contestID DESC"; $this->previousEntry = new Contest(null, WCF::getDB()->getFirstRow($sql)); if (!$this->previousEntry->contestID) { $this->previousEntry = null; } // get next entry $sql = "SELECT\t\t*\n\t\t\tFROM\t\twcf" . WCF_N . "_contest\n\t\t\tWHERE\t\tuserID = " . intval($this->entry->userID) . "\n\t\t\t\t\tAND (\n\t\t\t\t\t\ttime < " . intval($this->entry->time) . "\n\t\t\t\t\t\tOR (time = " . intval($this->entry->time) . " AND contestID > " . intval($this->entry->contestID) . ")\n\t\t\t\t\t)\n\t\t\tORDER BY\ttime DESC, contestID ASC"; $this->nextEntry = new Contest(null, WCF::getDB()->getFirstRow($sql)); if (!$this->nextEntry->contestID) { $this->nextEntry = null; } // read attachments if (MODULE_ATTACHMENT == 1 && $this->entry->attachments > 0) { require_once WCF_DIR . 'lib/data/attachment/MessageAttachmentList.class.php'; $this->attachmentList = new MessageAttachmentList($this->contestID, 'contestEntry', '', WCF::getPackageID('de.easy-coding.wcf.contest')); $this->attachmentList->readObjects(); $this->attachments = $this->attachmentList->getSortedAttachments(WCF::getUser()->getPermission('user.contest.canViewAttachmentPreview')); // set embedded attachments if (WCF::getUser()->getPermission('user.contest.canViewAttachmentPreview')) { require_once WCF_DIR . 'lib/data/message/bbcode/AttachmentBBCode.class.php'; AttachmentBBCode::setAttachments($this->attachments); } // remove embedded attachments from list if (count($this->attachments) > 0) { MessageAttachmentList::removeEmbeddedAttachments($this->attachments); } } if ($this->entry->isOwner()) { // init todo list require_once WCF_DIR . 'lib/data/contest/owner/todo/ContestOwnerTodoList.class.php'; $this->todoList = new ContestOwnerTodoList(); $this->todoList->sqlConditions .= 'contest.contestID = ' . intval($this->contestID); $this->todoList->readObjects(); } // init sidebar $this->sidebar = new ContestSidebar($this->entry); }
/** * returns available states */ protected function getStates() { $flags = (!isset($this->entry) || $this->entry->isOwner() ? ContestState::FLAG_USER : 0) + ($this->contest->isOwner() ? ContestState::FLAG_CONTESTOWNER : 0) + (ContestCrew::isMember() ? ContestState::FLAG_CREW : 0); $default = 'applied'; return ContestJuryEditor::getStates(isset($this->entry) ? $this->entry->state : $default, $flags); }
/** * returns available states */ protected function getStates() { $flags = (!isset($this->entry) || $this->entry->isOwner() ? ContestState::FLAG_USER : 0) | ($this->contest->isOwner() ? ContestState::FLAG_CONTESTOWNER : 0) | (ContestCrew::isMember() ? ContestState::FLAG_CREW : 0) | ($this->contest->enableParticipantCheck ? ContestParticipantEditor::FLAG_PARTICIPANTCHECK : 0); $default = $this->contest->enableParticipantCheck ? 'applied' : 'accepted'; return ContestParticipantEditor::getStates(isset($this->entry) ? $this->entry->state : $default, $flags); }
/** * returns owner states */ protected function getStates() { $flags = (!isset($this->entry) || $this->entry->isOwner() ? ContestState::FLAG_USER : 0) + ($this->contest->isOwner() ? ContestState::FLAG_CONTESTOWNER : 0) + (ContestCrew::isMember() ? ContestState::FLAG_CREW : 0); return ContestPriceEditor::getStates(isset($this->entry) ? $this->entry->state : '', $flags); }