1
0
mirror of https://git.cant.at/Madeorsk/PollVerlaine synced 2024-11-01 13:14:32 +01:00
PollVerlaine/views/results.php
Madeorsk ec3a86cc33 Result view & pie chart generation
+ Result view;
+ Pie chart generation (TODO: Add values for each color).

TODO: Organize JSON results.
2018-08-13 17:02:06 +02:00

22 lines
547 B
PHP

<?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>