/**
  * @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 Form::assignVariables()
  */
 public function assignVariables()
 {
     parent::assignVariables();
     // display branding
     require_once WCF_DIR . 'lib/util/ContestUtil.class.php';
     ContestUtil::assignVariablesBranding();
     // save ratings
     if ($this->solutionObj->isRateable()) {
         require_once WCF_DIR . 'lib/form/ContestSolutionRatingUpdateForm.class.php';
         new ContestSolutionRatingUpdateForm($this->solutionObj);
     }
     // init form
     if ($this->action == 'edit') {
         require_once WCF_DIR . 'lib/form/ContestSolutionCommentEditForm.class.php';
         new ContestSolutionCommentEditForm($this->solutionObj);
     } else {
         if ($this->entry->isCommentable()) {
             require_once WCF_DIR . 'lib/form/ContestSolutionCommentAddForm.class.php';
             new ContestSolutionCommentAddForm($this->solutionObj);
         }
     }
     if (!$this->entry->enableOpenSolution && $this->entry->state != 'closed' && ($this->entry->state != 'scheduled' || !($this->entry->fromTime < TIME_NOW && TIME_NOW < $this->entry->untilTime))) {
         WCF::getTPL()->append('userMessages', '<p class="info">' . WCF::getLanguage()->get('wcf.contest.enableOpenSolution.info') . '</p>');
     }
     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, 'solutionObj' => $this->solutionObj, 'contestID' => $this->contestID, 'solutionID' => $this->solutionID, 'userID' => $this->entry->userID, 'comments' => $this->commentList->getObjects(), 'ratings' => $this->ratingList->getObjects(), 'todos' => $this->todoList ? $this->todoList->getObjects() : array(), 'templateName' => $this->templateName, 'allowSpidersToIndexThisPage' => true, 'attachments' => $this->attachments, 'contestmenu' => ContestMenu::getInstance()));
 }
 /**
  * @see Form::assignVariables()
  */
 public function assignVariables()
 {
     parent::assignVariables();
     // display branding
     require_once WCF_DIR . 'lib/util/ContestUtil.class.php';
     ContestUtil::assignVariablesBranding();
     if (!$this->entry->enableOpenSolution && $this->entry->state != 'closed' && ($this->entry->state != 'scheduled' || !($this->entry->fromTime < TIME_NOW && TIME_NOW < $this->entry->untilTime))) {
         WCF::getTPL()->append('userMessages', '<p class="info">' . WCF::getLanguage()->get('wcf.contest.enableOpenSolution.info') . '</p>');
     }
     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, 'solutions' => $this->solutionList->getObjects(), 'todos' => $this->todoList ? $this->todoList->getObjects() : array(), 'templateName' => $this->templateName, 'allowSpidersToIndexThisPage' => true, 'contestmenu' => ContestMenu::getInstance()));
 }
 public function testCreate()
 {
     require_once WCF_DIR . 'lib/data/contest/solution/ContestSolutionEditor.class.php';
     require_once WCF_DIR . 'lib/data/contest/participant/ContestParticipantEditor.class.php';
     require_once WCF_DIR . 'lib/data/contest/ContestEditor.class.php';
     $this->deleteArray[] = $contest = ContestEditor::create($userID = 0, $groupID = 0, $subject = __METHOD__ . ' subject', $message = __METHOD__ . ' message', $options = array());
     $this->deleteArray[] = $user = $this->createUser();
     $this->deleteArray[] = $participant = ContestParticipantEditor::create($contestID = $contest->contestID, $userID = $user->userID, $groupID = 0, $state = 'accepted');
     $this->deleteArray[] = $solution = ContestSolutionEditor::create($contestID = $contest->contestID, $participantID = $participant->participantID, $message = __METHOD__ . ' message', $state = 'private');
     // basic checks
     $this->assertType('ContestSolution', $solution);
     $this->assertGreaterThan(0, $solution->solutionID);
     // owner check
     $this->assertFalse($solution->isOwner());
     $this->setCurrentUser($user);
     $this->assertTrue($solution->isOwner());
     // solution owner should have task to publish his private solution
     require_once WCF_DIR . 'lib/data/contest/participant/todo/ContestParticipantTodoList.class.php';
     $todo = new ContestParticipantTodoList();
     $todo->sqlConditions .= 'contest_participant.contestID = ' . intval($contest->contestID);
     $todo->readObjects();
     $task = array_pop($todo->getObjects());
     $this->assertEquals($task->action, 'participant.solution.private');
 }