2014-12-30 01:41:25 +01:00
|
|
|
{if !is_array($best_choices) || empty($best_choices)}
|
|
|
|
{$best_choices = [0]}
|
2014-12-19 00:28:20 +01:00
|
|
|
{/if}
|
|
|
|
|
2014-12-17 23:12:05 +01:00
|
|
|
<h3>{_('Votes of the poll')}</h3>
|
|
|
|
|
|
|
|
<div id="tableContainer" class="tableContainer">
|
2014-12-21 00:25:00 +01:00
|
|
|
<form action="" method="POST">
|
2014-12-17 23:12:05 +01:00
|
|
|
<table class="results">
|
2015-01-11 14:59:25 +01:00
|
|
|
<caption class="sr-only">{_('Votes of the poll')} {$poll->title|html}</caption>
|
2014-12-17 23:12:05 +01:00
|
|
|
<thead>
|
2014-12-21 00:45:39 +01:00
|
|
|
{if $admin}
|
2015-01-04 02:00:02 +01:00
|
|
|
<tr class="hidden-print">
|
2014-12-21 00:45:39 +01:00
|
|
|
<th role="presentation"></th>
|
|
|
|
{$headersDCount=0}
|
|
|
|
{foreach $slots as $slot}
|
|
|
|
{foreach $slot->moments as $id=>$moment}
|
|
|
|
<td headers="M{$slot@key} D{$headersDCount} H{$headersDCount}">
|
2015-01-11 14:59:25 +01:00
|
|
|
<button type="submit" name="delete_column" value="{$slot->day|html}@{$moment|html}" class="btn btn-link btn-sm" title="{_('Remove the column')} {$slot->day|date_format:$date_format.txt_short|html} - {$moment|html}"><span class="glyphicon glyphicon-remove text-danger"></span><span class="sr-only">{_('Remove')}</span></button>
|
2014-12-21 00:45:39 +01:00
|
|
|
</td>
|
|
|
|
{$headersDCount = $headersDCount+1}
|
|
|
|
{/foreach}
|
|
|
|
{/foreach}
|
|
|
|
<td>
|
|
|
|
<button type="submit" name="add_slot" class="btn btn-link btn-sm" title="{_('Add a column')}"><span class="glyphicon glyphicon-plus text-success"></span><span class="sr-only">{_("Add a column")}</span></button>
|
|
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
{/if}
|
2014-12-17 23:12:05 +01:00
|
|
|
<tr>
|
|
|
|
<th role="presentation"></th>
|
|
|
|
{foreach $slots as $id=>$slot}
|
2015-01-11 14:59:25 +01:00
|
|
|
<th colspan="{$slot->moments|count}" class="bg-primary month" id="M{$id}">{$slot->day|date_format:'%B %Y'|html}</th>
|
2014-12-17 23:12:05 +01:00
|
|
|
{for $foo=0 to ($slot->moments|count)-1}
|
|
|
|
{append var='headersM' value=$id}
|
|
|
|
{/for}
|
|
|
|
{/foreach}
|
|
|
|
<th></th>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<th role="presentation"></th>
|
|
|
|
{foreach $slots as $id=>$slot}
|
2015-01-11 14:59:25 +01:00
|
|
|
<th colspan="{$slot->moments|count}" class="bg-primary day" id="D{$id}">{$slot->day|date_format:$date_format.txt_day|html}</th>
|
2014-12-17 23:12:05 +01:00
|
|
|
{/foreach}
|
|
|
|
<th></th>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<th role="presentation"></th>
|
|
|
|
{$headersDCount=0}
|
|
|
|
{foreach $slots as $slot}
|
|
|
|
{foreach $slot->moments as $id=>$moment}
|
2015-01-11 14:59:25 +01:00
|
|
|
<th colspan="1" class="bg-info" id="H{$headersDCount}">{$moment|html}</th>
|
2014-12-17 23:12:05 +01:00
|
|
|
{append var='headersD' value=$headersDCount}
|
|
|
|
{$headersDCount = $headersDCount+1}
|
|
|
|
{/foreach}
|
|
|
|
{/foreach}
|
|
|
|
<th></th>
|
|
|
|
</tr>
|
|
|
|
</thead>
|
|
|
|
<tbody>
|
|
|
|
{foreach $votes as $vote}
|
|
|
|
<tr>
|
|
|
|
{* Edited line *}
|
|
|
|
|
|
|
|
{if $editingVoteId == $vote->id}
|
2015-01-07 23:29:46 +01:00
|
|
|
|
|
|
|
<td class="bg-info" style="padding:5px">
|
|
|
|
<div class="input-group input-group-sm">
|
|
|
|
<span class="input-group-addon"><span class="glyphicon glyphicon-user"></span></span>
|
2015-01-11 14:59:25 +01:00
|
|
|
<input type="text" id="name" name="name" value="{$vote->name|html}" class="form-control" title="{_('Your name')}" placeholder="{_('Your name')}" />
|
2015-01-07 23:29:46 +01:00
|
|
|
</div>
|
|
|
|
</td>
|
|
|
|
|
2014-12-17 23:12:05 +01:00
|
|
|
{foreach $vote->choices as $k=>$choice}
|
|
|
|
|
|
|
|
<td class="bg-info" headers="M{$headersM[$k]} D{$headersD[$k]} H{$k}">
|
|
|
|
<ul class="list-unstyled choice">
|
|
|
|
<li class="yes">
|
|
|
|
<input type="radio" id="y-choice-{$k}" name="choices[{$k}]" value="2" {if $choice==2}checked {/if}/>
|
2015-01-11 14:59:25 +01:00
|
|
|
<label class="btn btn-default btn-xs" for="y-choice-{$k}" title="{_('Vote yes for ')} . $radio_title[$k] . '">{* TODO Replace $radio_title *}
|
2014-12-17 23:12:05 +01:00
|
|
|
<span class="glyphicon glyphicon-ok"></span><span class="sr-only">{_('Yes')}</span>
|
|
|
|
</label>
|
|
|
|
</li>
|
|
|
|
<li class="ifneedbe">
|
|
|
|
<input type="radio" id="i-choice-{$k}" name="choices[{$k}]" value="1" {if $choice==1}checked {/if}/>
|
2015-01-11 14:59:25 +01:00
|
|
|
<label class="btn btn-default btn-xs" for="i-choice-{$k}" title="{_('Vote ifneedbe for ')} . $radio_title[$k] . '">{* TODO Replace $radio_title *}
|
2014-12-17 23:12:05 +01:00
|
|
|
(<span class="glyphicon glyphicon-ok"></span>)<span class="sr-only">{_('Ifneedbe')}</span>
|
|
|
|
</label>
|
|
|
|
</li>
|
|
|
|
<li class="no">
|
|
|
|
<input type="radio" id="n-choice-{$k}" name="choices[{$k}]" value="0" {if $choice==0}checked {/if}/>
|
2015-01-11 14:59:25 +01:00
|
|
|
<label class="btn btn-default btn-xs" for="n-choice-{$k}" title="{_('Vote no for ')} . $radio_title[$k] . '">{* TODO Replace $radio_title *}
|
2014-12-17 23:12:05 +01:00
|
|
|
<span class="glyphicon glyphicon-ban-circle"></span><span class="sr-only">{_('No')}</span>
|
|
|
|
</label>
|
|
|
|
</li>
|
|
|
|
</ul>
|
|
|
|
</td>
|
|
|
|
{/foreach}
|
2015-01-11 14:59:25 +01:00
|
|
|
<td style="padding:5px"><button type="submit" class="btn btn-success btn-xs" name="save" value="{$vote->id|html}" title="{_('Save the choices')} {$vote->name|html}">{_('Save')}</button></td>
|
2014-12-17 23:12:05 +01:00
|
|
|
{else}
|
|
|
|
|
|
|
|
{* Voted line *}
|
|
|
|
|
2015-01-11 14:59:25 +01:00
|
|
|
<th class="bg-info">{$vote->name|html}</th>
|
2015-01-07 23:29:46 +01:00
|
|
|
|
2014-12-17 23:12:05 +01:00
|
|
|
{foreach $vote->choices as $k=>$choice}
|
|
|
|
|
|
|
|
{if $choice==2}
|
|
|
|
<td class="bg-success text-success" headers="M{$headersM[$k]} D{$headersD[$k]} H{$k}"><span class="glyphicon glyphicon-ok"></span><span class="sr-only">{_('Yes')}</span></td>
|
|
|
|
{elseif $choice==1}
|
|
|
|
<td class="bg-warning text-warning" headers="M{$headersM[$k]} D{$headersD[$k]} H{$k}">(<span class="glyphicon glyphicon-ok"></span>)<span class="sr-only">{_('Ifneedbe')}</span></td>
|
|
|
|
{else}
|
|
|
|
<td class="bg-danger" headers="M{$headersM[$k]} D{$headersD[$k]} H{$k}"><span class="sr-only">{_('No')}</span></td>
|
|
|
|
{/if}
|
|
|
|
|
|
|
|
{/foreach}
|
|
|
|
|
|
|
|
{if $active && $poll->editable}
|
|
|
|
<td>
|
2015-01-11 14:59:25 +01:00
|
|
|
<button type="submit" class="btn btn-link btn-sm" name="edit_vote" value="{$vote->id|html}" title="{_('Edit the line:')} {$vote->name|html}">
|
2014-12-17 23:12:05 +01:00
|
|
|
<span class="glyphicon glyphicon-pencil"></span><span class="sr-only">{_('Edit')}</span>
|
|
|
|
</button>
|
2014-12-21 00:25:00 +01:00
|
|
|
{if $admin}
|
2015-01-11 14:59:25 +01:00
|
|
|
<button type="submit" class="btn btn-link btn-sm" name="delete_vote" value="{$vote->id|html}" title="{_('Remove the line:')} {$vote->name|html}">
|
2014-12-21 00:25:00 +01:00
|
|
|
<span class="glyphicon glyphicon-remove text-danger"></span><span class="sr-only">{_('Remove')}</span>
|
|
|
|
</button>
|
|
|
|
{/if}
|
2014-12-17 23:12:05 +01:00
|
|
|
</td>
|
|
|
|
{else}
|
|
|
|
<td></td>
|
|
|
|
{/if}
|
|
|
|
{/if}
|
|
|
|
</tr>
|
|
|
|
{/foreach}
|
|
|
|
|
|
|
|
{* Line to add a new vote *}
|
|
|
|
|
|
|
|
{if $active && $editingVoteId == 0}
|
|
|
|
<tr id="vote-form">
|
|
|
|
<td class="bg-info" style="padding:5px">
|
|
|
|
<div class="input-group input-group-sm">
|
|
|
|
<span class="input-group-addon"><span class="glyphicon glyphicon-user"></span></span>
|
|
|
|
<input type="text" id="name" name="name" class="form-control" title="{_('Your name')}" placeholder="{_('Your name')}" />
|
|
|
|
</div>
|
|
|
|
</td>
|
|
|
|
{$i = 0}
|
|
|
|
{foreach $slots as $slot}
|
|
|
|
{foreach $slot->moments as $moment}
|
|
|
|
<td class="bg-info" headers="M{$headersM[$i]} D{$headersD[$i]} H{$i}">
|
|
|
|
<ul class="list-unstyled choice">
|
|
|
|
<li class="yes">
|
|
|
|
<input type="radio" id="y-choice-{$i}" name="choices[{$i}]" value="2" />
|
2015-01-11 14:59:25 +01:00
|
|
|
<label class="btn btn-default btn-xs" for="y-choice-{$i}" title="{_('Vote yes for')} {$slot->day|date_format:$date_format.txt_short|html} - {$moment|html}">
|
2014-12-17 23:12:05 +01:00
|
|
|
<span class="glyphicon glyphicon-ok"></span><span class="sr-only">{_('Yes')}</span>
|
|
|
|
</label>
|
|
|
|
</li>
|
|
|
|
<li class="ifneedbe">
|
|
|
|
<input type="radio" id="i-choice-{$i}" name="choices[{$i}]" value="1" />
|
2015-01-11 14:59:25 +01:00
|
|
|
<label class="btn btn-default btn-xs" for="i-choice-{$i}" title="{_('Vote ifneedbe for')} {$slot->day|date_format:$date_format.txt_short|html} - {$moment|html}">
|
2014-12-17 23:12:05 +01:00
|
|
|
(<span class="glyphicon glyphicon-ok"></span>)<span class="sr-only">{_('Ifneedbe')}</span>
|
|
|
|
</label>
|
|
|
|
</li>
|
|
|
|
<li class="no">
|
|
|
|
<input type="radio" id="n-choice-{$i}" name="choices[{$i}]" value="0" checked/>
|
2015-01-11 14:59:25 +01:00
|
|
|
<label class="btn btn-default btn-xs" for="n-choice-{$i}" title="{_('Vote no for')} {$slot->day|date_format:$date_format.txt_short|html} - {$moment|html}">
|
2014-12-17 23:12:05 +01:00
|
|
|
<span class="glyphicon glyphicon-ban-circle"></span><span class="sr-only">{_('No')}</span>
|
|
|
|
</label>
|
|
|
|
</li>
|
|
|
|
</ul>
|
|
|
|
</td>
|
|
|
|
{$i = $i+1}
|
|
|
|
{/foreach}
|
|
|
|
{/foreach}
|
|
|
|
<td><button type="submit" class="btn btn-success btn-md" name="save" title="{_('Save the choices')}">{_('Save')}</button></td>
|
|
|
|
</tr>
|
|
|
|
{/if}
|
|
|
|
|
|
|
|
{* Line displaying best moments *}
|
|
|
|
{$count_bests = 0}
|
2014-12-30 01:41:25 +01:00
|
|
|
{$max = max($best_choices)}
|
2014-12-19 00:28:20 +01:00
|
|
|
{if $max > 0}
|
|
|
|
<tr id="addition">
|
|
|
|
<td>{_("Addition")}</td>
|
2014-12-30 01:41:25 +01:00
|
|
|
{foreach $best_choices as $best_moment}
|
2014-12-19 00:28:20 +01:00
|
|
|
{if $max == $best_moment}
|
|
|
|
{$count_bests = $count_bests +1}
|
2015-01-11 14:59:25 +01:00
|
|
|
<td><i class="glyphicon glyphicon-star text-warning"></i>{$best_moment|html}</td>
|
2014-12-19 00:28:20 +01:00
|
|
|
{else}
|
2015-01-11 14:59:25 +01:00
|
|
|
<td>{$best_moment|html}</td>
|
2014-12-19 00:28:20 +01:00
|
|
|
{/if}
|
|
|
|
{/foreach}
|
|
|
|
</tr>
|
|
|
|
{/if}
|
2014-12-17 23:12:05 +01:00
|
|
|
</tbody>
|
|
|
|
</table>
|
|
|
|
</form>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
{* Best votes listing *}
|
|
|
|
|
2014-12-30 01:41:25 +01:00
|
|
|
{$max = max($best_choices)}
|
2014-12-17 23:12:05 +01:00
|
|
|
{if $max > 0}
|
|
|
|
<div class="row">
|
|
|
|
{if $count_bests == 1}
|
2015-01-11 14:59:25 +01:00
|
|
|
<div class="col-sm-12"><h3>{_('Best choice')}</h3></div>
|
2014-12-17 23:12:05 +01:00
|
|
|
<div class="col-sm-6 col-sm-offset-3 alert alert-success">
|
2015-01-01 23:06:35 +01:00
|
|
|
<p><span class="glyphicon glyphicon-star text-warning"></span>{_('The best choice at this time is:')}</p>
|
2014-12-17 23:12:05 +01:00
|
|
|
{elseif $count_bests > 1}
|
2015-01-11 14:59:25 +01:00
|
|
|
<div class="col-sm-12"><h3>{_('Best choices')}</h3></div>
|
2014-12-17 23:12:05 +01:00
|
|
|
<div class="col-sm-6 col-sm-offset-3 alert alert-success">
|
2015-01-01 23:06:35 +01:00
|
|
|
<p><span class="glyphicon glyphicon-star text-warning"></span>{_('The bests choices at this time are:')}</p>
|
2014-12-17 23:12:05 +01:00
|
|
|
{/if}
|
|
|
|
|
|
|
|
|
|
|
|
{$i = 0}
|
|
|
|
<ul style="list-style:none">
|
|
|
|
{foreach $slots as $slot}
|
|
|
|
{foreach $slot->moments as $moment}
|
2014-12-30 01:41:25 +01:00
|
|
|
{if $best_choices[$i] == $max}
|
2015-01-11 14:59:25 +01:00
|
|
|
<li><strong>{$slot->day|date_format:$date_format.txt_full|html} - {$moment|html}</strong></li>
|
2014-12-17 23:12:05 +01:00
|
|
|
{/if}
|
|
|
|
{$i = $i+1}
|
|
|
|
{/foreach}
|
|
|
|
{/foreach}
|
|
|
|
</ul>
|
2015-01-11 14:59:25 +01:00
|
|
|
<p>{_('with')} <b>{$max|html}</b> {if $max==1}{_('vote')}{else}{_('votes')}{/if}.</p>
|
2014-12-17 23:12:05 +01:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
{/if}
|