/** * @see \wcf\data\IGroupedUserListAction::validateGetGroupedUserList() */ public function validateGetGroupedUserList() { $this->readInteger('pollID'); // read poll $this->poll = new Poll($this->parameters['pollID']); if (!$this->poll->pollID) { throw new UserInputException('pollID'); } else { if (!$this->poll->canViewParticipants()) { throw new PermissionDeniedException(); } } }
/** * Returns a poll object for a news entry. * * @return \wcf\data\poll\Poll */ public function getPoll() { if ($this->pollID && !$this->poll) { // new poll object $this->poll = new Poll($this->pollID); if ($this->poll->pollID) { $this->poll->setRelatedObject($this); } else { $this->poll = null; } } return $this->poll; }
/** * Adds a user vote. * * @param array<mixed> $returnValues */ protected function vote(array &$returnValues) { $pollAction = new \wcf\data\poll\PollAction(array($this->poll), 'vote', array('optionIDs' => $this->optionIDs)); $pollAction->executeAction(); // update poll object $polls = PollManager::getInstance()->getPolls(array($this->pollID)); $this->poll = $polls[$this->pollID]; if ($this->relatedObject !== null) { $this->poll->setRelatedObject($this->relatedObject); } // render result template $this->getResult($returnValues); // render vote template if votes are changeable if ($this->poll->isChangeable) { $this->getVote($returnValues); } $returnValues['canVote'] = $this->poll->isChangeable ? 1 : 0; }