mirror of
https://git.cant.at/Madeorsk/PollVerlaine
synced 2024-11-22 12:54:31 +01:00
Madeorsk
ec3a86cc33
+ Result view; + Pie chart generation (TODO: Add values for each color). TODO: Organize JSON results.
22 lines
547 B
PHP
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>
|