Check the number and the max of votes before displaying the best moments.

This commit is contained in:
Olivier PEREZ 2014-12-19 00:28:20 +01:00
parent 14727bd94c
commit 3d18c208ca

View File

@ -1,3 +1,7 @@
{if !is_array($best_moments) || empty($best_moments)}
{$best_moments = [0]}
{/if}
<h3>{_('Votes of the poll')}</h3>
<div id="tableContainer" class="tableContainer">
@ -142,18 +146,20 @@
{* Line displaying best moments *}
{$count_bests = 0}
<tr id="addition">
<td>{_("Addition")}</td>
{$max = max($best_moments)}
{foreach $best_moments as $best_moment}
{if $max == $best_moment}
{$count_bests = $count_bests +1}
<td><span class="glyphicon glyphicon-star text-warning"></span><span>{$max}</span></td>
{else}
<td></td>
{/if}
{/foreach}
</tr>
{$max = max($best_moments)}
{if $max > 0}
<tr id="addition">
<td>{_("Addition")}</td>
{foreach $best_moments as $best_moment}
{if $max == $best_moment}
{$count_bests = $count_bests +1}
<td><span class="glyphicon glyphicon-star text-warning"></span><span>{$max}</span></td>
{else}
<td></td>
{/if}
{/foreach}
</tr>
{/if}
</tbody>
</table>
</form>