/** * @see Form::assignVariables() */ public function assignVariables() { parent::assignVariables(); // display branding require_once WCF_DIR . 'lib/util/ContestUtil.class.php'; ContestUtil::assignVariablesBranding(); if ($this->entry->isOwner()) { require_once WCF_DIR . 'lib/form/ContestParticipantInviteForm.class.php'; new ContestParticipantInviteForm($this->entry); } // init form if ($this->action == 'edit') { require_once WCF_DIR . 'lib/form/ContestParticipantEditForm.class.php'; new ContestParticipantEditForm($this->entry); } else { if ($this->entry->isParticipantable()) { require_once WCF_DIR . 'lib/form/ContestParticipantAddForm.class.php'; new ContestParticipantAddForm($this->entry); } } if ($this->entry->enableParticipantCheck) { WCF::getTPL()->append('userMessages', '<p class="info">' . WCF::getLanguage()->get('wcf.contest.enableParticipantCheck.info') . '</p>'); } $this->sidebar->assignVariables(); WCF::getTPL()->assign(array('entry' => $this->entry, 'contestID' => $this->contestID, 'userID' => $this->entry->userID, 'participants' => $this->participantList->getObjects(), 'todos' => $this->todoList ? $this->todoList->getObjects() : array(), 'templateName' => $this->templateName, 'allowSpidersToIndexThisPage' => true, 'contestmenu' => ContestMenu::getInstance())); }
/** * @see DatabaseObject::handleData() */ protected function handleData($data) { parent::handleData($data); $this->owner = new ContestOwner($data, $this->userID, $this->groupID); }
/** * @see Form::save() */ public function save() { parent::save(); $participant = ContestParticipant::find($this->contest->contestID, $this->userID, $this->groupID); if ($participant === null) { require_once WCF_DIR . 'lib/data/contest/participant/ContestParticipantEditor.class.php'; $state = $this->contest->enableParticipantCheck ? 'applied' : 'accepted'; $participant = ContestParticipantEditor::create($this->contest->contestID, $this->userID, $this->groupID, $state); } // save solution $solution = ContestSolutionEditor::create($this->contest->contestID, $participant->participantID, $this->text, $this->state, $this->getOptions(), $this->attachmentListEditor); $this->saved(); // forward HeaderUtil::redirect('index.php?page=ContestSolutionEntry&contestID=' . $this->contest->contestID . '&solutionID=' . $solution->solutionID . SID_ARG_2ND_NOT_ENCODED . '#solution' . $solution->solutionID); exit; }