/**
  * @see Form::readData()
  */
 public function readData()
 {
     parent::readData();
     if ($this->sendPickNotification) {
         $this->solutionObj->getEditor()->sendPickNotification();
     }
     // init todo list
     $this->todoList = new ContestParticipantTodoList();
     $this->todoList->sqlConditions .= 'contest_participant.contestID = ' . intval($this->contestID);
     $this->todoList->readObjects();
     // read comments
     $this->commentList->sqlOffset = ($this->pageNo - 1) * $this->itemsPerPage;
     $this->commentList->sqlLimit = $this->itemsPerPage;
     $this->commentList->readObjects();
     // read ratings
     $this->ratingList->readObjects();
     // read attachments
     if (MODULE_ATTACHMENT == 1 && $this->solutionObj->attachments > 0) {
         require_once WCF_DIR . 'lib/data/attachment/MessageAttachmentList.class.php';
         $this->attachmentList = new MessageAttachmentList($this->solutionObj->solutionID, 'contestSolutionEntry', '', 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);
         }
     }
     // init sidebar
     $this->sidebar = new ContestSidebar($this->entry);
 }
 /**
  * @see Form::readData()
  */
 public function readData()
 {
     parent::readData();
     // read objects
     $this->participantList->sqlOffset = ($this->pageNo - 1) * $this->itemsPerPage;
     $this->participantList->sqlLimit = $this->itemsPerPage;
     $this->participantList->readObjects();
     // init todo list
     require_once WCF_DIR . 'lib/data/contest/participant/todo/ContestParticipantTodoList.class.php';
     $this->todoList = new ContestParticipantTodoList();
     $this->todoList->sqlConditions .= 'contest_participant.contestID = ' . intval($this->contestID);
     $this->todoList->readObjects();
     // init sidebar
     $this->sidebar = new ContestSidebar($this->entry, array('participantList', 'advertiseParticipant'));
 }
 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');
 }