1
0
mirror of https://git.cant.at/Madeorsk/PollVerlaine synced 2024-11-25 21:24:31 +01:00
PollVerlaine/views/results.php

22 lines
547 B
PHP
Raw Normal View History

<?php
$total_votes = 0;
foreach ($poll->options as $option)
$total_votes += $option->votes;
?>
<h1 class="poll"><?= $poll->title ?></h1>
<main class="results">
<div class="options">
<table>
<?php foreach ($poll->options as $option): ?>
<tr>
<td class="number"><?= $option->votes ?></td>
<td><?= $option->label ?></td>
<td><?= round($option->votes / $total_votes, 3)*100 ?>%</td>
</tr>
<?php endforeach; ?>
</table>
</div>
<div class="chart">
<?= $results_chart ?>
</div>
</main>