当前位置: 首页>>代码示例>>PHP>>正文


PHP Contest::getClasses方法代码示例

本文整理汇总了PHP中Contest::getClasses方法的典型用法代码示例。如果您正苦于以下问题:PHP Contest::getClasses方法的具体用法?PHP Contest::getClasses怎么用?PHP Contest::getClasses使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Contest的用法示例。


在下文中一共展示了Contest::getClasses方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: readParameters

 /**
  * @see Form::readParameters()
  */
 public function readParameters()
 {
     parent::readParameters();
     // get entry
     if (isset($_REQUEST['contestID'])) {
         $this->contestID = intval($_REQUEST['contestID']);
     }
     $this->entry = new ViewableContest($this->contestID);
     if (!$this->entry->contestID) {
         throw new IllegalLinkException();
     }
     // get entry
     if (isset($_REQUEST['solutionID'])) {
         $this->solutionID = intval($_REQUEST['solutionID']);
     }
     $this->solutionObj = new ViewableContestSolution($this->solutionID);
     if (!$this->solutionObj->solutionID) {
         throw new IllegalLinkException();
     }
     if (isset($_REQUEST['sendPickNotification'])) {
         $this->sendPickNotification = true;
     }
     // init comment list
     $this->commentList = new ContestSolutionCommentList();
     $this->commentList->sqlConditions .= 'contest_solution_comment.solutionID = ' . intval($this->solutionID);
     $this->commentList->sqlOrderBy = 'contest_solution_comment.time DESC';
     // init rating list
     $this->ratingList = new ContestSolutionRatingSummaryList();
     $this->ratingList->sqlConditions .= 'contest_solution_rating.solutionID = ' . intval($this->solutionID);
     $classIDs = array_keys($this->entry->getClasses());
     $ratingoptionIDs = array_keys(ContestRatingoption::getByClassIDs($classIDs));
     $this->ratingList->sqlConditionsClasses = implode(',', $ratingoptionIDs);
 }
开发者ID:CaribeSoy,项目名称:contest-wcf,代码行数:36,代码来源:ContestSolutionEntryPage.class.php

示例2: close

 /**
  * finish the contest
  */
 public function close()
 {
     if (!($this->contest->state == 'scheduled' && $this->contest->untilTime < time())) {
         throw new Exception('contest needs to be scheduled, and time has to be over.');
     }
     // make a jury instance from the contst owner
     $jury = ContestJury::find($this->contest->contestID, $this->contest->userID, $this->contest->groupID);
     if ($jury === null) {
         $jury = ContestJuryEditor::create($this->contest->contestID, $this->contest->userID, $this->contest->groupID, $state = 'accepted');
     }
     $userID = $this->contest->userID;
     if ($userID == 0 && $this->contest->groupID > 0) {
         $sql = "SELECT          userID\n\t\t\t\tFROM            wcf" . WCF_N . "_user_to_groups\n\t\t\t\tWHERE           groupID = " . intval($this->contest->groupID);
         $row = WCF::getDB()->getFirstRow($sql);
         $userID = $row['userID'];
     }
     if (!$userID) {
         throw new Exception('cannot determine a user from which the ratings will be added.');
     }
     $classIDs = array_keys($this->contest->getClasses());
     $ratingoptionIDs = array_keys(ContestRatingoption::getByClassIDs($classIDs));
     if (empty($ratingoptionIDs)) {
         throw new Exception('cannot determine a ratingoption from classes [' . implode(',', $classIDs) . '] needed for contest ratings to be added.');
     }
     // get interactions
     $interactionList = new ContestInteractionList($this->contest);
     $interactionList->sqlLimit = 0;
     $interactionList->readObjects();
     $owners = $interactionList->getObjects();
     foreach ($owners as $owner) {
         $this->sum += $owner->c;
     }
     // get prices
     $priceList = new ContestPriceList();
     $priceList->sqlConditions .= 'contest_price.state = "accepted" AND contest_price.contestID = ' . intval($this->contest->contestID);
     $priceList->sqlLimit = 0;
     $priceList->readObjects();
     $score = 5 + $priceList->countObjects();
     foreach ($priceList->getObjects() as $price) {
         // choose a winner
         $owner = $this->chooseWinner($price, $owners);
         // error, there are more prices than participants
         if (!$owner) {
             throw new Exception('there are more prices than participants.');
         }
         $lang = 'wcf.contest.interaction.tickets.solution';
         $message = WCF::getLanguage()->getDynamicVariable($lang, array('tickets' => $owner->c));
         // create pseudo solution
         $solution = ContestSolutionEditor::create($this->contest->contestID, $owner->participantID, $message, $state = 'accepted');
         foreach ($ratingoptionIDs as $ratingOptionID) {
             // create pseudo rating
             $rating = ContestSolutionRatingEditor::create($solution->solutionID, $ratingOptionID, $score, $userID);
         }
         // decrease score
         $score--;
     }
     // close contest state
     $this->contest->getEditor()->updateState('closed');
 }
开发者ID:CaribeSoy,项目名称:contest-wcf,代码行数:62,代码来源:ContestInteraction.class.php

示例3: assignVariables

 /**
  * @see Page::assignVariables()
  */
 public function assignVariables()
 {
     parent::assignVariables();
     // display branding
     require_once WCF_DIR . 'lib/util/ContestUtil.class.php';
     ContestUtil::assignVariablesBranding();
     // init form
     if ($this->action == 'edit') {
         require_once WCF_DIR . 'lib/form/ContestCommentEditForm.class.php';
         new ContestCommentEditForm($this->entry);
     } else {
         if ($this->entry->isCommentable()) {
             require_once WCF_DIR . 'lib/form/ContestCommentAddForm.class.php';
             new ContestCommentAddForm($this->entry);
         }
     }
     $this->sidebar->assignVariables();
     WCF::getTPL()->assign(array('entry' => $this->entry, 'contestID' => $this->contestID, 'tags' => MODULE_TAGGING ? $this->entry->getTags(WCF::getSession()->getVisibleLanguageIDArray()) : array(), 'events' => $this->eventmixList->getObjects(), 'todos' => $this->todoList ? $this->todoList->getObjects() : array(), 'classes' => $this->entry->getClasses(), 'jurys' => $this->entry->getJurys(), 'participants' => $this->entry->getParticipants(), 'attachments' => $this->attachments, 'location' => $this->entry->location, 'action' => $this->action, 'commentID' => $this->commentID, 'previousEntry' => $this->previousEntry, 'nextEntry' => $this->nextEntry, 'templateName' => $this->templateName, 'allowSpidersToIndexThisPage' => true, 'contestmenu' => ContestMenu::getInstance()));
 }
开发者ID:CaribeSoy,项目名称:contest-wcf,代码行数:22,代码来源:ContestPage.class.php


注:本文中的Contest::getClasses方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。