/**
  * @see Page::assignVariables()
  */
 public function assignVariables()
 {
     parent::assignVariables();
     // display branding
     require_once WCF_DIR . 'lib/util/ContestUtil.class.php';
     ContestUtil::assignVariablesBranding();
     WCF::getTPL()->assign(array('entries' => $this->entryList->getObjects()));
 }
 /**
  * thats how the states are implemented
  *
  * - invited
  *    first jurytalk entry can be viewn
  *
  * - accepted
  *    all jurytalk entries can be viewn
  */
 public static function getStateConditions()
 {
     $userID = WCF::getUser()->userID;
     $userID = $userID ? $userID : -1;
     $groupIDs = array_keys(ContestUtil::readAvailableGroups());
     $groupIDs = empty($groupIDs) ? array(-1) : $groupIDs;
     // makes easier sql queries
     return "(\n\t\t\t-- accepted jury\n\t\t\tSELECT  COUNT(contestID) \n\t\t\tFROM \twcf" . WCF_N . "_contest_jury contest_jury\n\t\t\tWHERE\tcontest_jury.contestID = contest_jurytalk.contestID\n\t\t\tAND (\tcontest_jury.groupID IN (" . implode(",", $groupIDs) . ")\n\t\t\t  OR\tcontest_jury.userID = " . $userID . "\n\t\t\t)\n\t\t\tAND\tcontest_jury.state = 'accepted'\n\t\t) OR (\n\t\t\t-- contest owner\n\t\t\tSELECT  COUNT(contestID) \n\t\t\tFROM \twcf" . WCF_N . "_contest contest\n\t\t\tWHERE\tcontest.contestID = contest_jurytalk.contestID\n\t\t\tAND (\tcontest.groupID IN (" . implode(",", $groupIDs) . ")\n\t\t\t  OR\tcontest.userID = " . $userID . "\n\t\t\t)\n\t\t) > 0\n\t\tOR (\n\t\t\t(\n\t\t\t\t-- invited jury and current entry is first entry\n\t\t\t\tSELECT  COUNT(contestID) \n\t\t\t\tFROM \twcf" . WCF_N . "_contest_jury contest_jury\n\t\t\t\tWHERE\tcontest_jury.contestID = contest_jurytalk.contestID\n\t\t\t\tAND (\tcontest_jury.groupID IN (" . implode(",", $groupIDs) . ")\n\t\t\t\t  OR\tcontest_jury.userID = " . $userID . "\n\t\t\t\t)\n\t\t\t\tAND\tcontest_jury.state = 'invited'\n\t\t\t) AND (\n\t\t\t\t-- invited and currenty entry is first entry\n\t\t\t\tSELECT  MIN(jurytalkID)\n\t\t\t\tFROM \twcf" . WCF_N . "_contest_jurytalk x\n\t\t\t\tWHERE\tx.contestID = contest_jurytalk.contestID\n\t\t\t) = contest_jurytalk.jurytalkID\n\t\t)";
 }
 /**
  * @see Form::assignVariables()
  */
 public function assignVariables()
 {
     parent::assignVariables();
     // display branding
     require_once WCF_DIR . 'lib/util/ContestUtil.class.php';
     ContestUtil::assignVariablesBranding();
     $this->sidebar->assignVariables();
     WCF::getTPL()->assign(array('entry' => $this->entry, 'contestID' => $this->contestID, 'templateName' => $this->templateName, 'allowSpidersToIndexThisPage' => true, 'contestmenu' => ContestMenu::getInstance()));
 }
Ejemplo n.º 4
0
 /**
  * returns the groups for which the current user is admin
  */
 public static function assignVariablesBranding()
 {
     $showBranding = true;
     if (defined('CONTEST_N') || self::$BRANDED) {
         $showBranding = false;
     }
     if ($showBranding) {
         self::$BRANDED = true;
         WCF::getTPL()->append('additionalFooterOptions', '<li><a class="externalURL" href="http://trac.easy-coding.de/trac/contest"><span>' . WCF::getLanguage()->get('wcf.contest.branding') . '</span></a></li>');
     }
 }
 /**
  * @see DatabaseObjectList::readObjects()
  */
 public function readObjects()
 {
     // get currently active user or group
     $userID = WCF::getUser()->userID;
     $userID = $userID ? $userID : -1;
     $groupIDs = array_keys(ContestUtil::readAvailableGroups());
     $groupIDs = empty($groupIDs) ? array(-1) : $groupIDs;
     // makes easier sql queries
     $sql = "SELECT\t\t" . (!empty($this->sqlSelects) ? $this->sqlSelects . ',' : '') . "\n\t\t\t\t\t'participant.solution.private' AS action,\n\t\t\t\t\tcontest_participant.participantID\n\t\t\tFROM\t\twcf" . WCF_N . "_contest_participant contest_participant\n\n\t\t\tINNER JOIN\twcf" . WCF_N . "_contest_solution contest_solution\n\t\t\tON\t\tcontest_solution.contestID = contest_participant.contestID\n\t\t\t" . $this->sqlJoins . "\n\n\t\t\tWHERE\t\tIF(\n\t\t\t\tcontest_participant.groupID > 0,\n\t\t\t\tcontest_participant.groupID IN (" . implode(",", $groupIDs) . "), \n\t\t\t\tcontest_participant.userID > 0 AND contest_participant.userID = " . $userID . "\n\t\t\t)\n\t\t\tAND\t\tcontest_solution.state = 'private'\n\t\t\t" . (!empty($this->sqlConditions) ? "AND " . $this->sqlConditions : '') . "\n\t\t\t" . (!empty($this->sqlOrderBy) ? "ORDER BY " . $this->sqlOrderBy : '');
     $result = WCF::getDB()->sendQuery($sql, $this->sqlLimit, $this->sqlOffset);
     while ($row = WCF::getDB()->fetchArray($result)) {
         $this->todos[] = new ViewableContestParticipantTodo($row);
     }
 }
 /**
  * @see Page::assignVariables()
  */
 public function assignVariables()
 {
     parent::assignVariables();
     // display branding
     require_once WCF_DIR . 'lib/util/ContestUtil.class.php';
     ContestUtil::assignVariablesBranding();
     WCF::getTPL()->assign(array('topic' => $this->topic, 'text' => $this->text, 'contestRatingoption' => $this->contestRatingoption, 'languageID' => $this->languageID, 'class' => $this->contestRatingoption, 'action' => 'add', 'classes' => $this->classes, 'classID' => $this->classID));
 }
 /**
  * @see Page::assignVariables()
  */
 public function assignVariables()
 {
     parent::assignVariables();
     // display branding
     require_once WCF_DIR . 'lib/util/ContestUtil.class.php';
     ContestUtil::assignVariablesBranding();
     InlineCalendar::assignVariables();
     WCF::getTPL()->assign(array('action' => 'edit', 'userID' => WCF::getUser()->userID, 'tags' => $this->tags, 'insertQuotes' => !count($_POST) && empty($this->text) ? 1 : 0, 'availableClasses' => $this->classList->getObjects(), 'availableGroups' => $this->availableGroups, 'contestID' => $this->contestID, 'ownerID' => $this->ownerID, 'classIDArray' => $this->classIDArray, 'states' => $this->states, 'state' => $this->state, 'eventDate' => $this->eventDate, 'enableSolution' => $this->enableSolution, 'enableOpenSolution' => $this->enableOpenSolution, 'enableParticipantCheck' => $this->enableParticipantCheck, 'enablePricechoice' => $this->enablePricechoice, 'priceExpireSeconds' => $this->priceExpireSeconds, 'enableSponsorCheck' => $this->enableSponsorCheck));
 }
 /**
  * @see Form::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/ContestSponsortalkEditForm.class.php';
         new ContestSponsortalkEditForm($this->entry);
     } else {
         if ($this->entry->isSponsortalkable()) {
             require_once WCF_DIR . 'lib/form/ContestSponsortalkAddForm.class.php';
             new ContestSponsortalkAddForm($this->entry);
         }
     }
     $this->sidebar->assignVariables();
     WCF::getTPL()->assign(array('entry' => $this->entry, 'contestID' => $this->contestID, 'userID' => $this->entry->userID, 'sponsortalks' => $this->sponsortalkList->getObjects(), 'templateName' => $this->templateName, 'allowSpidersToIndexThisPage' => true, 'contestmenu' => ContestMenu::getInstance()));
 }
Ejemplo n.º 9
0
 /**
  * thats how the states are implemented
  * - private
  *    only the owner can view and edit the entry
  *    invited jurys can view the first entry of jurytalk
  *    invited sponsors can view the first entry of sponsortalk
  *    invited participants can view the first comment
  *    all invited people can view basis data (without the real entry)
  *    accepting an invitation enabled the users to reply to the talks
  *    the state can be changed by the owner
  *
  * - applied
  *    owner can view and edit the entry
  *    accepted jurys can see the full entry
  *    admin team should review the entry and schedule a time
  *    the state can be changed by the admin team
  *
  * - accepted
  *    owner cannot change the entry any more
  *    entry can be shown if start_time is over
  *    state cannot be changed any longer
  *
  * - scheduled
  *    upcoming
  *
  * - closed
  *    no ratings can be given, no jurys can be added
  */
 public static function getStateConditions()
 {
     $userID = WCF::getUser()->userID;
     $userID = $userID ? $userID : -1;
     $groupIDs = array_keys(ContestUtil::readAvailableGroups());
     $groupIDs = empty($groupIDs) ? array(-1) : $groupIDs;
     // makes easier sql queries
     return "(\n\t\t\t-- owner\n\t\t\tIF(\n\t\t\t\tcontest.groupID > 0,\n\t\t\t\tcontest.groupID IN (" . implode(",", $groupIDs) . "),\n\t\t\t\tcontest.userID > 0 AND contest.userID = " . $userID . "\n\t\t\t)\n\t\t) OR (\n\t\t\tcontest.state = 'scheduled'\n\t\t\tAND contest.fromTime <= UNIX_TIMESTAMP(NOW())\n\t\t) OR (\n\t\t\tcontest.state = 'closed'\n\t\t) OR (\n\t\t\t-- jury, sponsor, participant\n\t\t\tSELECT \tCOUNT(x.contestID)\n\t\t\tFROM (\n\t\t\t\tSELECT contestID, userID, groupID FROM wcf" . WCF_N . "_contest_jury\n\t\t\t\tUNION\n\t\t\t\tSELECT contestID, userID, groupID FROM wcf" . WCF_N . "_contest_sponsor\n\t\t\t\tUNION\n\t\t\t\tSELECT contestID, userID, groupID FROM wcf" . WCF_N . "_contest_participant\n\t\t\t) x\n\t\t\tWHERE\tx.contestID = contest.contestID\n\t\t\tAND (\tx.groupID IN (" . implode(",", $groupIDs) . ")\n\t\t\t  OR\tx.userID = " . $userID . "\n\t\t\t)\n\t\t) > 0";
 }
Ejemplo n.º 10
0
 /**
  * thats how the states are implemented
  *
  * - private
  *    the solution can be viewn by the owner
  *
  * - applied
  *    jury has to accept or decline answer
  *
  * - accepted
  *    the solution cannot be changed by anybody
  *    the state can be changed by the jury
  *
  * - declined
  *    the solution cannot be changed by anybody
  *    the state can be changed by the jury
  */
 public static function getStateConditions()
 {
     $userID = WCF::getUser()->userID;
     $userID = $userID ? $userID : -1;
     $groupIDs = array_keys(ContestUtil::readAvailableGroups());
     $groupIDs = empty($groupIDs) ? array(-1) : $groupIDs;
     // makes easier sql queries
     return "(\n\t\t\t-- owner\n\t\t\tIF(\n\t\t\t\tcontest_participant.groupID > 0,\n\t\t\t\tcontest_participant.groupID IN (" . implode(",", $groupIDs) . "), \n\t\t\t\tcontest_participant.userID > 0 AND contest_participant.userID = " . $userID . "\n\t\t\t)\n\t\t) OR (\n\t\t\t-- solution has been submitted, and user is jury\n\t\t\tcontest_solution.state IN ('applied', 'accepted', 'declined')\n\n\t\t\tAND (\n\t\t\t\tSELECT  COUNT(contestID) FROM wcf" . WCF_N . "_contest_jury contest_jury\n\t\t\t\tWHERE\tcontest_jury.contestID = contest_solution.contestID\n\t\t\t\tAND (\tcontest_jury.groupID IN (" . implode(",", $groupIDs) . ")\n\t\t\t\t  OR\tcontest_jury.userID = " . $userID . "\n\t\t\t\t)\n\t\t\t) > 0\n\n\t\t) OR (\n\t\t\t-- solution has been submitted, and contest is finished\n\t\t\tcontest_solution.state IN ('accepted', 'declined')\n\n\t\t\tAND (\n\t\t\t\tSELECT  COUNT(contestID) FROM wcf" . WCF_N . "_contest contest\n\t\t\t\tWHERE\tcontest.contestID = contest_solution.contestID\n\t\t\t\tAND ( \tcontest.state = 'closed'\n\t\t\t\t  OR (\n\t\t\t\t\tcontest.state = 'scheduled'\n\t\t\t\t\tAND \tcontest.untilTime < UNIX_TIMESTAMP(NOW())\n\t\t\t\t  )\n\t\t\t\t)\n\t\t\t) > 0\n\t\t)";
 }
 /**
  * @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()));
 }
Ejemplo n.º 12
0
 /**
  * @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()));
 }
Ejemplo n.º 13
0
 /**
  * @see Form::assignVariables()
  */
 public function assignVariables()
 {
     parent::assignVariables();
     // display branding
     require_once WCF_DIR . 'lib/util/ContestUtil.class.php';
     ContestUtil::assignVariablesBranding();
     // save invitations
     if ($this->entry->isOwner()) {
         require_once WCF_DIR . 'lib/form/ContestJuryInviteForm.class.php';
         new ContestJuryInviteForm($this->entry);
     }
     // init form
     if ($this->action == 'edit') {
         require_once WCF_DIR . 'lib/form/ContestJuryEditForm.class.php';
         new ContestJuryEditForm($this->entry);
     } else {
         if ($this->entry->isJuryable()) {
             require_once WCF_DIR . 'lib/form/ContestJuryAddForm.class.php';
             new ContestJuryAddForm($this->entry);
         }
     }
     if ($this->entry->state != 'closed') {
         WCF::getTPL()->append('userMessages', '<p class="info">' . WCF::getLanguage()->get('wcf.contest.jury.closed.info') . '</p>');
         // init todo list
         require_once WCF_DIR . 'lib/data/contest/jury/todo/ContestJuryTodoList.class.php';
         $this->todoList = new ContestJuryTodoList();
         $this->todoList->sqlConditions .= 'contest_jury.contestID = ' . $this->contestID;
         $this->todoList->readObjects();
     }
     $this->sidebar->assignVariables();
     WCF::getTPL()->assign(array('entry' => $this->entry, 'isJury' => $this->isJury, 'contestID' => $this->contestID, 'userID' => $this->entry->userID, 'jurys' => $this->juryList->getObjects(), 'todos' => $this->todoList ? $this->todoList->getObjects() : array(), 'templateName' => $this->templateName, 'allowSpidersToIndexThisPage' => true, 'contestmenu' => ContestMenu::getInstance()));
 }
 /**
  * @see Page::assignVariables()
  */
 public function assignVariables()
 {
     parent::assignVariables();
     // display branding
     require_once WCF_DIR . 'lib/util/ContestUtil.class.php';
     ContestUtil::assignVariablesBranding();
     $this->sidebar->assignVariables();
     WCF::getTPL()->assign(array('entries' => $this->entryList->getObjects(), 'description' => $this->description, 'classes' => $this->entryList->getClasses(), 'todos' => $this->todoList ? $this->todoList->getObjects() : array(), 'tags' => $this->entryList->getTags(), 'availableTags' => $this->tags, 'tagID' => $this->tagID, 'juryID' => $this->juryID, 'participantID' => $this->participantID, 'classID' => $this->classID, 'tag' => $this->tag, 'taggableID' => $this->taggable !== null ? $this->taggable->getTaggableID() : 0, 'allowSpidersToIndexThisPage' => true));
 }
    /**
     * @see Form::assignVariables()
     */
    public function assignVariables()
    {
        parent::assignVariables();
        if ($this->success) {
            $l = 'wcf.contest.price.' . StringUtil::encodeHTML($this->success) . '.success';
            WCF::getTPL()->append('userMessages', '<p class="success">' . WCF::getLanguage()->get($l) . '</p>');
        }
        // display branding
        require_once WCF_DIR . 'lib/util/ContestUtil.class.php';
        ContestUtil::assignVariablesBranding();
        // save price position
        if ($this->entry->isOwner()) {
            require_once WCF_DIR . 'lib/form/ContestPricePositionForm.class.php';
            new ContestPricePositionForm($this->entry);
        }
        // init form
        if ($this->action == 'edit') {
            require_once WCF_DIR . 'lib/form/ContestPriceEditForm.class.php';
            new ContestPriceEditForm($this->entry);
        } else {
            if ($this->entry->isPriceable()) {
                require_once WCF_DIR . 'lib/form/ContestPriceAddForm.class.php';
                new ContestPriceAddForm($this->entry);
            }
        }
        // become sponsor
        if ($this->entry->enableSponsorCheck && !$this->entry->isSponsor() && $this->entry->isSponsorable(false)) {
            WCF::getTPL()->append('additionalContentBecomeSponsor', '<p class="info">' . WCF::getLanguage()->get('wcf.contest.enableSponsorCheck.info') . '</p>');
        }
        // if contest is finished, show todo list
        // who is able to pick the prices
        $isWinner = false;
        if ($this->entry->state == 'closed') {
            // need winners
            require_once WCF_DIR . 'lib/data/contest/solution/ContestSolutionList.class.php';
            $solutionList = new ContestSolutionList();
            $solutionList->sqlConditions .= 'contest_solution.contestID = ' . intval($this->contestID);
            $solutionList->sqlLimit = $this->countItems();
            $solutionList->readObjects();
            $winners = array();
            foreach ($solutionList->getObjects() as $solution) {
                $winners[] = $solution->participantID;
                $isWinner = $isWinner || $solution->isOwner();
            }
            if (count($winners)) {
                // init todo list
                require_once WCF_DIR . 'lib/data/contest/price/todo/ContestPriceTodoList.class.php';
                $this->todoList = new ContestPriceTodoList();
                $this->todoList->sqlConditions .= '
					contest_solution.participantID IN (' . implode(',', $winners) . ')
					AND contest_solution.contestID = ' . intval($this->contestID);
                $this->todoList->sqlOrderBy = 'FIND_IN_SET(contest_solution.participantID, \'' . implode(',', $winners) . '\')';
                $this->todoList->sqlLimit = $this->countItems();
                $this->todoList->readObjects();
            }
        }
        // which price is pickable be the current user NOW?
        $solution = null;
        $didPick = false;
        if ($isWinner) {
            foreach ($this->priceList->getObjects() as $price) {
                if ($price->isPickable()) {
                    $solution = $price->pickableByWinner();
                    break;
                } else {
                    if ($price->isOwner()) {
                        $didPick = true;
                    }
                }
            }
        } else {
            if ($this->entry->state == 'scheduled' && $this->entry->untilTime > TIME_NOW) {
                WCF::getTPL()->append('userMessages', '<p class="info">' . WCF::getLanguage()->get('wcf.contest.price.closed.info') . '</p>');
            } else {
                if ($this->entry->enablePricechoice) {
                    WCF::getTPL()->append('userMessages', '<p class="info">' . WCF::getLanguage()->get('wcf.contest.price.pick.info') . '</p>');
                }
            }
        }
        $this->sidebar->assignVariables();
        WCF::getTPL()->assign(array('entry' => $this->entry, 'isSponsor' => $this->isSponsor, 'contestID' => $this->contestID, 'userID' => $this->entry->userID, 'solution' => $solution, 'isWinner' => $isWinner, 'didPick' => $didPick, 'prices' => $this->priceList->getObjects(), 'todos' => $this->todoList ? $this->todoList->getObjects() : array(), 'templateName' => $this->templateName, 'allowSpidersToIndexThisPage' => true, 'contestmenu' => ContestMenu::getInstance()));
    }
 /**
  * @see Page::assignVariables()
  */
 public function assignVariables()
 {
     parent::assignVariables();
     // display branding
     require_once WCF_DIR . 'lib/util/ContestUtil.class.php';
     ContestUtil::assignVariablesBranding();
     WCF::getTPL()->assign(array('ratingoptions' => $this->ratingoptionList->getObjects(), 'defaultRatingoptions' => $this->defaultRatingoptions, 'deletedOptionID' => $this->deletedOptionID, 'classID' => $this->classID, 'classes' => $this->classes));
 }
Ejemplo n.º 17
0
 /**
  * @see Page::assignVariables()
  */
 public function assignVariables()
 {
     parent::assignVariables();
     // display branding
     ContestUtil::assignVariablesBranding();
     WCF::getTPL()->assign(array('action' => 'add', 'userID' => WCF::getUser()->userID, 'tags' => $this->tags, 'insertQuotes' => !count($_POST) && empty($this->text) ? 1 : 0, 'availableClasses' => $this->classList->getObjects(), 'availableGroups' => $this->availableGroups, 'ownerID' => $this->ownerID, 'classIDArray' => $this->classIDArray, 'sponsors' => $this->sponsors, 'participants' => $this->participants, 'jurys' => $this->jurys, 'prices' => $this->prices, 'jurytalk_trigger' => $this->jurytalk_trigger, 'sponsortalk_trigger' => $this->sponsortalk_trigger, 'comment_trigger' => $this->comment_trigger, 'enableSolution' => $this->enableSolution, 'enableOpenSolution' => $this->enableOpenSolution, 'enableParticipantCheck' => $this->enableParticipantCheck, 'enablePricechoice' => $this->enablePricechoice, 'priceExpireSeconds' => $this->priceExpireSeconds, 'enableSponsorCheck' => $this->enableSponsorCheck));
 }
Ejemplo n.º 18
0
 /**
  * thats how the states are implemented
  *
  * - invited
  * - declined
  * - applied
  *    contest owner, the rest of the jury and the user/group itself can view entry
  *
  * - accepted
  *    everybody can see the entry
  */
 public static function getStateConditions()
 {
     $userID = WCF::getUser()->userID;
     $userID = $userID ? $userID : -1;
     $groupIDs = array_keys(ContestUtil::readAvailableGroups());
     $groupIDs = empty($groupIDs) ? array(-1) : $groupIDs;
     // makes easier sql queries
     return "(\n\t\t\t-- entry is accepted\n\t\t\tcontest_jury.state = 'accepted'\n\t\t) OR (\n\t\t\t-- entry owner\n\t\t\tIF(\n\t\t\t\tcontest_jury.groupID > 0,\n\t\t\t\tcontest_jury.groupID IN (" . implode(",", $groupIDs) . "), \n\t\t\t\tcontest_jury.userID = " . $userID . "\n\t\t\t)\n\t\t) OR (\n\t\t\t-- contest owner\n\t\t\tSELECT  COUNT(contestID) \n\t\t\tFROM \twcf" . WCF_N . "_contest contest\n\t\t\tWHERE\tcontest.contestID = contest_jury.contestID\n\t\t\tAND (\tcontest.groupID IN (" . implode(",", $groupIDs) . ")\n\t\t\t  OR\tcontest.userID = " . $userID . "\n\t\t\t)\n\t\t) > 0\n\t\tOR (\n\t\t\t-- in the jury\n\t\t\tSELECT  COUNT(contestID) \n\t\t\tFROM \twcf" . WCF_N . "_contest_jury x\n\t\t\tWHERE\tx.contestID = contest_jury.contestID\n\t\t\tAND (\tx.groupID IN (" . implode(",", $groupIDs) . ")\n\t\t\t  OR\tx.userID = " . $userID . "\n\t\t\t)\n\t\t\tAND\tx.state = 'accepted'\n\t\t) > 0";
 }
 /**
  * @see Page::assignVariables()
  */
 public function assignVariables()
 {
     parent::assignVariables();
     // display branding
     require_once WCF_DIR . 'lib/util/ContestUtil.class.php';
     ContestUtil::assignVariablesBranding();
     WCF::getTPL()->assign(array('contestClasses' => $this->contestClassList, 'deletedClassID' => $this->deletedClassID, 'successfullSorting' => $this->successfullSorting));
 }
 /**
  * @see Page::assignVariables()
  */
 public function assignVariables()
 {
     parent::assignVariables();
     // display branding
     require_once WCF_DIR . 'lib/util/ContestUtil.class.php';
     ContestUtil::assignVariablesBranding();
     WCF::getTPL()->assign(array('states' => $this->states, 'state' => $this->state, 'ownerGroups' => $this->ownerGroups, 'ownerSponsors' => $this->ownerSponsors, 'ownerID' => $this->ownerID, 'secretMessage' => $this->secretMessage, 'maxTextLength' => WCF::getUser()->getPermission('user.contest.maxSolutionLength')));
 }
Ejemplo n.º 21
0
 /**
  * thats how the states are implemented
  */
 public static function getStateConditions()
 {
     $userID = WCF::getUser()->userID;
     $userID = $userID ? $userID : -1;
     $groupIDs = array_keys(ContestUtil::readAvailableGroups());
     $groupIDs = empty($groupIDs) ? array(-1) : $groupIDs;
     // makes easier sql queries
     return "(\n\t\t\t-- entry is accepted\n\t\t\tcontest_price.state IN ('accepted', 'sent', 'received')\n\t\t) OR (\n\t\t\t-- sponsor\n\t\t\tIF(\n\t\t\t\tcontest_sponsor.groupID > 0,\n\t\t\t\tcontest_sponsor.groupID IN (" . implode(",", $groupIDs) . "), \n\t\t\t\tcontest_sponsor.userID = " . $userID . "\n\t\t\t)\n\t\t) OR (\n\t\t\t-- is owner\n\t\t\tSELECT  COUNT(contestID) \n\t\t\tFROM \twcf" . WCF_N . "_contest contest\n\t\t\tWHERE\tcontest.contestID = contest_price.contestID\n\t\t\tAND (\tcontest.groupID IN (" . implode(",", $groupIDs) . ")\n\t\t\t  OR\tcontest.userID = " . $userID . "\n\t\t\t)\n\t\t) > 0";
 }
 /**
  * @see Page::assignVariables()
  */
 public function assignVariables()
 {
     parent::assignVariables();
     // display branding
     require_once WCF_DIR . 'lib/util/ContestUtil.class.php';
     ContestUtil::assignVariablesBranding();
     WCF::getTPL()->assign(array('comment' => $this->comment, 'username' => $this->username, 'maxTextLength' => WCF::getUser()->getPermission('user.contest.maxSolutionLength')));
 }
 /**
  * @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 Page::assignVariables()
  */
 public function assignVariables()
 {
     parent::assignVariables();
     // display branding
     require_once WCF_DIR . 'lib/util/ContestUtil.class.php';
     ContestUtil::assignVariablesBranding();
     WCF::getTPL()->assign(array('states' => $this->states, 'state' => $this->state, 'availableGroups' => $this->availableGroups, 'ownerID' => $this->ownerID));
 }
 /**
  * @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()));
 }