/**
  * @see Page::readData()
  */
 public function readData()
 {
     parent::readData();
     $this->availableClasses = ContestClass::getClasses();
     // get classes
     $this->classList = new ContestClassTree();
     $this->classList->readObjects();
     $this->availableGroups = ContestUtil::readAvailableGroups();
     // default values
     if (!count($_POST)) {
         $this->classIDArray = array_keys($this->availableClasses);
     }
 }
 /**
  * @see Page::readData()
  */
 public function readData()
 {
     parent::readData();
     // default values
     if (!count($_POST)) {
         $this->subject = $this->entry->subject;
         $this->text = $this->entry->message;
         $this->enableSmilies = $this->entry->enableSmilies;
         $this->enableHtml = $this->entry->enableHtml;
         $this->enableBBCodes = $this->entry->enableBBCodes;
         $this->enableSolution = $this->entry->enableSolution;
         $this->enableOpenSolution = $this->entry->enableOpenSolution;
         $this->enableParticipantCheck = $this->entry->enableParticipantCheck;
         $this->enablePricechoice = $this->entry->enablePricechoice;
         $this->priceExpireSeconds = $this->entry->priceExpireSeconds;
         $this->enableSponsorCheck = $this->entry->enableSponsorCheck;
         $this->userID = $this->entry->userID;
         $this->groupID = $this->entry->groupID;
         $this->state = $this->entry->state;
         $this->isFullDay = $this->entry->isFullDay;
         $this->fromTime = $this->entry->fromTime;
         $this->untilTime = $this->entry->untilTime;
         $this->classIDArray = array_keys($this->entry->getClasses());
         if ($this->groupID > 0) {
             $this->ownerID = $this->groupID;
         }
         // tags
         if (MODULE_TAGGING) {
             $this->tags = TaggingUtil::buildString($this->entry->getTags(array(count(Language::getAvailableContentLanguages()) > 0 ? WCF::getLanguage()->getLanguageID() : 0)));
         }
     }
     $from = $this->fromTime == 0 ? time() : $this->fromTime;
     $until = $this->untilTime == 0 ? time() : $this->untilTime;
     $this->eventDate = new ContestDate(array('isFullDay' => $this->isFullDay, 'fromDay' => date('d', $from), 'fromMonth' => date('m', $from), 'fromYear' => date('Y', $from), 'fromHour' => date('h', $from), 'fromMinute' => date('i', $from), 'untilDay' => date('d', $until), 'untilMonth' => date('m', $until), 'untilYear' => date('Y', $until), 'untilHour' => date('h', $until), 'untilMinute' => date('i', $until)));
     // get classes
     $this->classList = new ContestClassTree();
     $this->classList->readObjects();
     $this->availableClasses = ContestClass::getClasses();
     $this->states = $this->getStates();
     $this->availableGroups = ContestUtil::readAvailableGroups();
 }
 /**
  * returns all sidebar data in format, which can be cached
  */
 protected function _init()
 {
     // get classes
     $classList = new ContestClassTree();
     $classList->readObjects();
     // get jurys
     if (!$this->contest || $this->contest->isEnabledJury()) {
         $juryList = new ContestJuryList();
         if ($this->contest !== null) {
             $juryList->sqlConditions .= 'contest_jury.contestID = ' . $this->contest->contestID . ' AND contest_jury.state = "accepted" ';
         } else {
             $juryList->sqlJoins .= " INNER JOIN wcf" . WCF_N . "_contest contest ON contest.contestID = contest_jury.contestID ";
             $juryList->sqlConditions .= 'contest.state IN ("scheduled", "closed") AND contest_jury.state = "accepted" ';
         }
         $juryList->sqlOrderBy = 'juryID DESC';
         $juryList->readObjects();
     } else {
         $juryList = null;
     }
     // get participants
     $participantList = new ContestParticipantList();
     if ($this->contest !== null) {
         $participantList->sqlConditions .= 'contest_participant.contestID = ' . $this->contest->contestID . ' AND contest_participant.state = "accepted" ';
     } else {
         $participantList->sqlJoins .= " INNER JOIN wcf" . WCF_N . "_contest contest ON contest.contestID = contest_participant.contestID ";
         $participantList->sqlConditions .= 'contest.state IN ("scheduled", "closed") AND contest_participant.state = "accepted" ';
     }
     $participantList->sqlLimit = 10;
     $participantList->sqlOrderBy = 'participantID DESC';
     $participantList->readObjects();
     // get sponsors
     $sponsorList = new ContestSponsorList();
     if ($this->contest !== null) {
         $sponsorList->sqlConditions .= 'contest_sponsor.contestID = ' . $this->contest->contestID . ' AND contest_sponsor.state = "accepted" ';
     } else {
         $sponsorList->sqlJoins .= " INNER JOIN wcf" . WCF_N . "_contest contest ON contest.contestID = contest_sponsor.contestID ";
         $sponsorList->sqlConditions .= 'contest.state IN ("scheduled", "closed") AND contest_sponsor.state = "accepted" ';
     }
     $sponsorList->sqlOrderBy = 'sponsorID DESC';
     $sponsorList->readObjects();
     // get prices
     $priceList = new ContestPriceList();
     if ($this->contest !== null) {
         $priceList->sqlConditions .= 'contest_price.contestID = ' . $this->contest->contestID . ' AND contest_price.state != "declined" ';
     } else {
         $priceList->sqlJoins .= " INNER JOIN wcf" . WCF_N . "_contest contest ON contest.contestID = contest_price.contestID ";
         $priceList->sqlConditions .= 'contest.state IN ("scheduled", "closed") AND contest_price.state != "declined" ';
     }
     $priceList->sqlOrderBy = 'position ASC';
     $priceList->readObjects();
     // get tag cloud
     $tagList = null;
     if (MODULE_TAGGING) {
         $tagList = new ContestTagList($this->contest, WCF::getSession()->getVisibleLanguageIDArray());
         $tagList->readObjects();
     }
     // get latest entries
     $latestEntryList = new ContestList();
     if ($this->contest !== null) {
         $latestEntryList->sqlConditions .= 'contest.contestID != ' . $this->contest->contestID;
     }
     $latestEntryList->sqlLimit = 10;
     $latestEntryList->readObjects();
     // get latest solutions
     if (!$this->contest || $this->contest->enableSolution) {
         $latestSolutionList = new ContestSolutionList();
         if ($this->contest !== null) {
             $latestSolutionList->sqlConditions .= 'contest_solution.contestID = ' . $this->contest->contestID;
         }
         $latestSolutionList->sqlOrderBy = 'solutionID DESC';
         $latestSolutionList->sqlLimit = 5;
         $latestSolutionList->readObjects();
     } else {
         $latestSolutionList = null;
     }
     return array('classList' => $classList, 'juryList' => $juryList, 'participantList' => $participantList, 'sponsorList' => $sponsorList, 'priceList' => $priceList, 'tagList' => $tagList, 'latestEntryList' => $latestEntryList, 'latestSolutionList' => $latestSolutionList);
 }