mirror of
https://github.com/openvk/openvk
synced 2024-11-11 01:19:53 +03:00
Allow unregistered users to see ended poll results
This commit is contained in:
parent
6345a62744
commit
efbb6a74e7
1 changed files with 9 additions and 4 deletions
|
@ -28,16 +28,21 @@ final class PollPresenter extends OpenVKPresenter
|
||||||
$this->template->until = $poll->endsAt();
|
$this->template->until = $poll->endsAt();
|
||||||
$this->template->votes = $poll->getVoterCount();
|
$this->template->votes = $poll->getVoterCount();
|
||||||
$this->template->meta = $poll->getMetaDescription();
|
$this->template->meta = $poll->getMetaDescription();
|
||||||
if(is_null($this->user) || $poll->canVote($this->user->identity)) {
|
$this->template->ended = $ended = $poll->hasEnded();
|
||||||
|
if((is_null($this->user) || $poll->canVote($this->user->identity)) && !$ended) {
|
||||||
$this->template->options = $poll->getOptions();
|
$this->template->options = $poll->getOptions();
|
||||||
|
|
||||||
$this->template->_template = "Poll/Poll.xml";
|
$this->template->_template = "Poll/Poll.xml";
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->template->voted = $poll->hasVoted($this->user->identity);
|
if(is_null($this->user)) {
|
||||||
$this->template->ended = $poll->hasEnded();
|
$this->template->voted = false;
|
||||||
$this->template->results = $poll->getResults($this->user->identity);
|
$this->template->results = $poll->getResults();
|
||||||
|
} else {
|
||||||
|
$this->template->voted = $poll->hasVoted($this->user->identity);
|
||||||
|
$this->template->results = $poll->getResults($this->user->identity);
|
||||||
|
}
|
||||||
|
|
||||||
$this->template->_template = "Poll/PollResults.xml";
|
$this->template->_template = "Poll/PollResults.xml";
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue