mirror of
https://git.cant.at/Madeorsk/PollVerlaine
synced 2024-11-25 11:24:31 +01:00
Madeorsk
b763b1d9e6
* Moved colors to $VERLAINE configuration variable. * Colors in the options table result. * Organized CSS in several files. + Responsive design!
23 lines
667 B
PHP
23 lines
667 B
PHP
<?php
|
|
$chart_colors_number = count($chart_colors);
|
|
$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 $index => $option): ?>
|
|
<tr>
|
|
<td class="number"><?= $option->votes ?></td>
|
|
<td style="color: <?= $chart_colors[$index%$chart_colors_number] ?>"><?= $option->label ?></td>
|
|
<td><?= round($option->votes / $total_votes, 3)*100 ?>%</td>
|
|
</tr>
|
|
<?php endforeach; ?>
|
|
</table>
|
|
</div>
|
|
<div class="chart">
|
|
<?= $results_chart ?>
|
|
</div>
|
|
</main>
|