/**
  * 
  */
 public function testCreate()
 {
     require_once WCF_DIR . 'lib/data/contest/crew/ContestCrew.class.php';
     // create group
     $this->deleteArray[] = $group = $this->createGroup(array(array('optionID' => ContestCrew::getOptionID(), 'optionValue' => true)));
     $this->deleteArray[] = $user = $this->createUser($group->groupID);
     require_once WCF_DIR . 'lib/data/contest/ContestEditor.class.php';
     $this->deleteArray[] = $user = $this->createUser();
     $this->deleteArray[] = $contest = ContestEditor::create($userID = $user->userID, $groupID = 0, $subject = __METHOD__ . ' subject', $message = __METHOD__ . ' message', $options = array(), $state = 'applied');
     require_once WCF_DIR . 'lib/data/contest/jury/ContestJuryEditor.class.php';
     $this->deleteArray[] = $jury = ContestJuryEditor::create($contestID = 0, $userID = $user->userID, $groupID = 0, $state = 'private');
 }
Beispiel #2
0
 /**
  * when entry is applied, there should be a todo for the contest crew to check it
  */
 public function testTodoCrew()
 {
     require_once WCF_DIR . 'lib/data/contest/crew/ContestCrew.class.php';
     // create group
     $this->deleteArray[] = $group = $this->createGroup(array(array('optionID' => ContestCrew::getOptionID(), 'optionValue' => true)));
     $this->deleteArray[] = $user = $this->createUser($group->groupID);
     $this->setCurrentUser($user);
     $this->contest->update($userID = 0, $groupID = 0, $subject = '', $message = '', $fromTime = '', $untilTime = '', $state = 'applied');
     require_once WCF_DIR . 'lib/data/contest/crew/todo/ContestCrewTodoList.class.php';
     $todo = new ContestCrewTodoList();
     $todo->readObjects();
     $task = array_pop($todo->getObjects());
     $this->assertEquals($task->action, 'crew.contest.applied');
 }
 /**
  * @see DatabaseObjectList::readObjects()
  */
 public function readObjects()
 {
     if (ContestCrew::isMember() == false) {
         return;
     }
     $sql = "SELECT\t\t*,\n\t\t\t\t\t'crew.contest.applied' AS action\n\t\t\tFROM\t\twcf" . WCF_N . "_contest contest\n\t\t\tWHERE\t\tstate = 'applied'\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 ViewableContestCrewTodo($row);
     }
     // say hello to all crew members, even when no contest needs to be accepted
     if (count($this->todos) == 0) {
         $this->todos[] = new ViewableContestCrewTodo(array('action' => 'crew.contest.applied.none'));
     }
 }
 /**
  * @see ContestNotificationInterface::getRecipients()
  */
 public function getRecipients()
 {
     $ids = array();
     switch ($this->state) {
         // tell contest crew that new contest applied
         case 'applied':
             require_once WCF_DIR . 'lib/data/contest/crew/ContestCrew.class.php';
             $ids = array_merge($ids, ContestCrew::getUserIDs());
             break;
             // tell contest owner, that moderator did interaction
         // tell contest owner, that moderator did interaction
         case 'accepted':
         case 'declined':
         case 'scheduled':
         case 'closed':
             $ids = array_merge($ids, $this->getInstance()->getOwner()->getUserIDs());
             break;
     }
     return array_unique($ids);
 }
 /**
  * returns available states
  */
 protected function getStates()
 {
     $flags = (!isset($this->entry) || $this->entry->isOwner() ? ContestState::FLAG_USER : 0) + ($this->contest->isOwner() ? ContestState::FLAG_CONTESTOWNER : 0) + (ContestCrew::isMember() ? ContestState::FLAG_CREW : 0);
     $default = 'applied';
     return ContestJuryEditor::getStates(isset($this->entry) ? $this->entry->state : $default, $flags);
 }
 /**
  * returns available states
  */
 protected function getStates()
 {
     $flags = (!isset($this->entry) || $this->entry->isOwner() ? ContestState::FLAG_USER : 0) | ($this->contest->isOwner() ? ContestState::FLAG_CONTESTOWNER : 0) | (ContestCrew::isMember() ? ContestState::FLAG_CREW : 0) | ($this->contest->enableParticipantCheck ? ContestParticipantEditor::FLAG_PARTICIPANTCHECK : 0);
     $default = $this->contest->enableParticipantCheck ? 'applied' : 'accepted';
     return ContestParticipantEditor::getStates(isset($this->entry) ? $this->entry->state : $default, $flags);
 }
 /**
  * returns owner states
  */
 protected function getStates()
 {
     $flags = (!isset($this->entry) || $this->entry->isOwner() ? ContestState::FLAG_USER : 0) + ($this->contest->isOwner() ? ContestState::FLAG_CONTESTOWNER : 0) + (ContestCrew::isMember() ? ContestState::FLAG_CREW : 0);
     return ContestPriceEditor::getStates(isset($this->entry) ? $this->entry->state : '', $flags);
 }
 /**
  * Returns true, if the active user can delete this entry.
  *
  * @return	boolean
  */
 public function isDeletable()
 {
     return ContestCrew::isMember() || in_array($this->state, array('private', 'applied')) && $this->isOwner();
 }
 /**
  * returns available states
  */
 protected function getStates()
 {
     $flags = (!isset($this->entry) || $this->entry->isOwner() ? ContestState::FLAG_USER : 0) + ($this->contest->isOwner() ? ContestState::FLAG_CONTESTOWNER : 0) + (ContestCrew::isMember() ? ContestState::FLAG_CREW : 0);
     if (isset($this->entry) && $this->entry->enableOpenSolution) {
         $flags += ContestSolutionEditor::FLAG_OPENSOLUTION;
     }
     return ContestSolutionEditor::getStates(isset($this->entry) ? $this->entry->state : '', $flags);
 }
 /**
  * returns available states
  */
 protected function getStates()
 {
     $flags = ContestState::FLAG_USER | ContestState::FLAG_CONTESTOWNER | (ContestCrew::isMember() ? ContestState::FLAG_CREW : 0);
     return ContestEditor::getStates($this->state, $flags);
 }
 /**
  * returns available states
  */
 protected function getStates()
 {
     $flags = ($this->entry->isOwner() ? ContestState::FLAG_USER : 0) | ($this->entry->isOwner() ? ContestState::FLAG_CONTESTOWNER : 0) | (ContestCrew::isMember() ? ContestState::FLAG_CREW : 0);
     return ContestEditor::getStates($this->state, $flags, $this->entry->isClosable());
 }