findById($threadId);
if (is_null($poll)) {
Error404::error("No reference to that poll found");
}
if ($poll->isClosed()) {
Error403::error("Sorry, the poll is closed");
}
$answerList = $poll->answerList();
$vote = $poll->vote();
if (!isset($_POST['vote']) || !is_number($_POST['vote'])) {
?>
Please select an option.
addVote($Viewer, $response)) {
Error400::error('Cannot add your vote to the poll');
}
$vote = $poll->vote(); // need to refresh the results to take the vote into account
?>
hasRevealVotes()) {
$totalStaff = 0;
$totalVoted = 0;
$staffVote = $poll->staffVote(new Manager\User());
$staffVoteReordered = array_slice($staffVote, 1, null, true) + [0 => $staffVote[0]];
foreach ($staffVoteReordered as $response => $info) {
if ($response !== 'missing') {
$totalStaff += count($info['who']);
$totalVoted += count($info['who']);
?>
- =empty($info['answer']) ? 'Abstain' : display_str($info['answer'])?> =
count ($info['who'])
? (" – " . implode(', ', array_map(fn ($u) => $u->link(), $info['who'])))
: "none"
?>
Missing: = implode(', ', array_map(fn ($u) => $u->link(), $staffVote['missing']['who'])) ?>
Voted: = number_format($totalVoted) ?> of = number_format($totalStaff) ?> total. (You may click on a choice to change your vote).
+
$answer) {
$choice = $vote[$i];
?>
=$response === $i ? '➔ ' : ''?>=display_str($answer)?> (=number_format($choice['percent'], 1)?>%)
➔ (Abstain)
Votes: = number_format($poll->total()) ?>