2014-12-27 00:19:48 +01:00
|
|
|
{if !is_array($best_choices) || empty($best_choices)}
|
|
|
|
{$best_choices = [0]}
|
2014-12-19 00:28:20 +01:00
|
|
|
{/if}
|
|
|
|
|
2015-03-22 23:33:03 +01:00
|
|
|
<h3>{__('Poll results\\Votes of the poll')}</h3>
|
2014-12-17 23:12:05 +01:00
|
|
|
|
|
|
|
<div id="tableContainer" class="tableContainer">
|
2015-03-26 16:33:11 +01:00
|
|
|
<form action="" method="POST" id="poll_form">
|
2014-12-17 23:12:05 +01:00
|
|
|
<table class="results">
|
2015-03-22 23:33:03 +01:00
|
|
|
<caption class="sr-only">{__('Poll results\\Votes of the poll')} {$poll->title|html}</caption>
|
2014-12-17 23:12:05 +01:00
|
|
|
<thead>
|
2015-02-28 19:18:59 +01:00
|
|
|
{if $admin && !$expired}
|
2015-01-04 02:00:02 +01:00
|
|
|
<tr class="hidden-print">
|
2014-12-21 00:45:39 +01:00
|
|
|
<th role="presentation"></th>
|
2014-12-27 00:00:14 +01:00
|
|
|
{foreach $slots as $id=>$slot}
|
|
|
|
<td headers="C{$id}">
|
2015-03-24 17:59:52 +01:00
|
|
|
<button type="submit" name="delete_column" value="{$slot->title|html}" class="btn btn-link btn-sm" title="{__('adminstuds\\Remove the column')} {$slot->title|html}"><span class="glyphicon glyphicon-remove text-danger"></span><span class="sr-only">{__('Genric\\Remove')}</span></button>
|
2014-12-27 00:00:14 +01:00
|
|
|
</td>
|
2014-12-21 00:45:39 +01:00
|
|
|
{/foreach}
|
|
|
|
<td>
|
2015-03-24 17:59:52 +01:00
|
|
|
<button type="submit" name="add_slot" class="btn btn-link btn-sm" title="{__('adminstuds\\Add a column')}"><span class="glyphicon glyphicon-plus text-success"></span><span class="sr-only">{__('Poll results\\Add a column')}</span></button>
|
2014-12-21 00:45:39 +01:00
|
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
{/if}
|
2014-12-17 23:12:05 +01:00
|
|
|
<tr>
|
|
|
|
<th role="presentation"></th>
|
|
|
|
{foreach $slots as $id=>$slot}
|
2015-02-02 21:14:24 +01:00
|
|
|
<th class="bg-info" id="C{$id}">{$slot->title|html|markdown}</th>
|
2014-12-17 23:12:05 +01:00
|
|
|
{/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-03-24 17:59:52 +01:00
|
|
|
<input type="text" id="name" name="name" value="{$vote->name|html}" class="form-control" title="{__('Genric\\Your name')}" placeholder="{__('Genric\\Your name')}" />
|
2015-01-07 23:29:46 +01:00
|
|
|
</div>
|
|
|
|
</td>
|
|
|
|
|
2014-12-27 00:00:14 +01:00
|
|
|
{foreach $vote->choices as $id=>$choice}
|
2014-12-17 23:12:05 +01:00
|
|
|
|
2014-12-27 00:00:14 +01:00
|
|
|
<td class="bg-info" headers="C{$id}">
|
2014-12-17 23:12:05 +01:00
|
|
|
<ul class="list-unstyled choice">
|
|
|
|
<li class="yes">
|
2014-12-27 00:00:14 +01:00
|
|
|
<input type="radio" id="y-choice-{$id}" name="choices[{$id}]" value="2" {if $choice==2}checked {/if}/>
|
2015-03-24 17:59:52 +01:00
|
|
|
<label class="btn btn-default btn-xs" for="y-choice-{$id}" title="{__('Poll results\\Vote yes for')} {$slots[$id]->title|html}">
|
|
|
|
<span class="glyphicon glyphicon-ok"></span><span class="sr-only">{__('Genric\\Yes')}</span>
|
2014-12-17 23:12:05 +01:00
|
|
|
</label>
|
|
|
|
</li>
|
|
|
|
<li class="ifneedbe">
|
2014-12-27 00:00:14 +01:00
|
|
|
<input type="radio" id="i-choice-{$id}" name="choices[{$id}]" value="1" {if $choice==1}checked {/if}/>
|
2015-03-24 17:59:52 +01:00
|
|
|
<label class="btn btn-default btn-xs" for="i-choice-{$id}" title="{__('Poll results\\Vote ifneedbe for')} {$slots[$id]->title|html}">
|
|
|
|
(<span class="glyphicon glyphicon-ok"></span>)<span class="sr-only">{__('Genric\\Ifneedbe')}</span>
|
2014-12-17 23:12:05 +01:00
|
|
|
</label>
|
|
|
|
</li>
|
|
|
|
<li class="no">
|
2014-12-27 00:00:14 +01:00
|
|
|
<input type="radio" id="n-choice-{$id}" name="choices[{$id}]" value="0" {if $choice==0}checked {/if}/>
|
2015-03-24 17:59:52 +01:00
|
|
|
<label class="btn btn-default btn-xs" for="n-choice-{$id}" title="{__('Poll results\\Vote no for')} {$slots[$id]->title|html}">
|
|
|
|
<span class="glyphicon glyphicon-ban-circle"></span><span class="sr-only">{__('Genric\\No')}</span>
|
2014-12-17 23:12:05 +01:00
|
|
|
</label>
|
|
|
|
</li>
|
|
|
|
</ul>
|
|
|
|
</td>
|
|
|
|
{/foreach}
|
2015-03-24 17:59:52 +01:00
|
|
|
<td style="padding:5px"><button type="submit" class="btn btn-success btn-xs" name="save" value="{$vote->id|html}" title="{__('Poll results\\Save the choices')} {$vote->name|html}">{__('Generic\\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
|
|
|
|
2015-02-02 21:14:24 +01:00
|
|
|
{foreach $vote->choices as $id=>$choice}
|
2014-12-17 23:12:05 +01:00
|
|
|
|
|
|
|
{if $choice==2}
|
2015-03-24 17:59:52 +01:00
|
|
|
<td class="bg-success text-success" headers="C{$id}"><span class="glyphicon glyphicon-ok"></span><span class="sr-only">{__('Generic\\Yes')}</span></td>
|
2014-12-17 23:12:05 +01:00
|
|
|
{elseif $choice==1}
|
2015-03-24 17:59:52 +01:00
|
|
|
<td class="bg-warning text-warning" headers="C{$id}">(<span class="glyphicon glyphicon-ok"></span>)<span class="sr-only">{__('Generic\\Ifneedbe')}</span></td>
|
2014-12-17 23:12:05 +01:00
|
|
|
{else}
|
2015-03-24 17:59:52 +01:00
|
|
|
<td class="bg-danger" headers="C{$id}"><span class="sr-only">{__('Generic\\No')}</span></td>
|
2014-12-17 23:12:05 +01:00
|
|
|
{/if}
|
|
|
|
|
|
|
|
{/foreach}
|
|
|
|
|
2015-02-28 19:18:59 +01:00
|
|
|
{if $active && $poll->editable && !$expired}
|
2014-12-17 23:12:05 +01:00
|
|
|
<td>
|
2015-03-24 17:59:52 +01:00
|
|
|
<button type="submit" class="btn btn-link btn-sm" name="edit_vote" value="{$vote->id|html}" title="{__('Poll results\\Edit the line:')} {$vote->name|html}">
|
|
|
|
<span class="glyphicon glyphicon-pencil"></span><span class="sr-only">{__('Generic\\Edit')}</span>
|
2014-12-17 23:12:05 +01:00
|
|
|
</button>
|
2014-12-21 00:25:00 +01:00
|
|
|
{if $admin}
|
2015-03-24 17:59:52 +01:00
|
|
|
<button type="submit" class="btn btn-link btn-sm" name="delete_vote" value="{$vote->id|html}" title="{__('Poll results\\Remove the line:')} {$vote->name|html}">
|
|
|
|
<span class="glyphicon glyphicon-remove text-danger"></span><span class="sr-only">{__('Generic\\Remove')}</span>
|
2014-12-21 00:25:00 +01:00
|
|
|
</button>
|
|
|
|
{/if}
|
2014-12-17 23:12:05 +01:00
|
|
|
</td>
|
|
|
|
{else}
|
|
|
|
<td></td>
|
|
|
|
{/if}
|
|
|
|
{/if}
|
|
|
|
</tr>
|
|
|
|
{/foreach}
|
|
|
|
|
|
|
|
{* Line to add a new vote *}
|
|
|
|
|
2015-02-28 19:18:59 +01:00
|
|
|
{if $active && $editingVoteId == 0 && !$expired}
|
2014-12-17 23:12:05 +01:00
|
|
|
<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>
|
2015-03-24 17:59:52 +01:00
|
|
|
<input type="text" id="name" name="name" class="form-control" title="{__('Generic\\Your name')}" placeholder="{__('Generic\\Your name')}" />
|
2014-12-17 23:12:05 +01:00
|
|
|
</div>
|
|
|
|
</td>
|
2014-12-27 00:00:14 +01:00
|
|
|
{foreach $slots as $id=>$slot}
|
|
|
|
<td class="bg-info" headers="C{$id}">
|
|
|
|
<ul class="list-unstyled choice">
|
|
|
|
<li class="yes">
|
|
|
|
<input type="radio" id="y-choice-{$id}" name="choices[{$id}]" value="2" />
|
2015-03-24 17:59:52 +01:00
|
|
|
<label class="btn btn-default btn-xs" for="y-choice-{$id}" title="{__('Poll results\\Vote yes for')} {$slot->title|html}">
|
|
|
|
<span class="glyphicon glyphicon-ok"></span><span class="sr-only">{__('Generic\\Yes')}</span>
|
2014-12-27 00:00:14 +01:00
|
|
|
</label>
|
|
|
|
</li>
|
|
|
|
<li class="ifneedbe">
|
|
|
|
<input type="radio" id="i-choice-{$id}" name="choices[{$id}]" value="1" />
|
2015-03-24 17:59:52 +01:00
|
|
|
<label class="btn btn-default btn-xs" for="i-choice-{$id}" title="{__('Poll results\\Vote ifneedbe for')} {$slot->title|html}">
|
|
|
|
(<span class="glyphicon glyphicon-ok"></span>)<span class="sr-only">{__('Generic\\Ifneedbe')}</span>
|
2014-12-27 00:00:14 +01:00
|
|
|
</label>
|
|
|
|
</li>
|
|
|
|
<li class="no">
|
|
|
|
<input type="radio" id="n-choice-{$id}" name="choices[{$id}]" value="0" checked/>
|
2015-03-24 17:59:52 +01:00
|
|
|
<label class="btn btn-default btn-xs" for="n-choice-{$id}" title="{__('Poll results\\Vote no for')} {$slot->title|html}">
|
|
|
|
<span class="glyphicon glyphicon-ban-circle"></span><span class="sr-only">{__('Generic\\No')}</span>
|
2014-12-27 00:00:14 +01:00
|
|
|
</label>
|
|
|
|
</li>
|
|
|
|
</ul>
|
|
|
|
</td>
|
2014-12-17 23:12:05 +01:00
|
|
|
{/foreach}
|
2015-03-24 17:59:52 +01:00
|
|
|
<td><button type="submit" class="btn btn-success btn-md" name="save" title="{__('Poll results\\Save the choices')}">{__('Generic\\Save')}</button></td>
|
2014-12-17 23:12:05 +01:00
|
|
|
</tr>
|
|
|
|
{/if}
|
|
|
|
|
|
|
|
{* Line displaying best moments *}
|
|
|
|
{$count_bests = 0}
|
2014-12-27 00:19:48 +01:00
|
|
|
{$max = max($best_choices)}
|
2014-12-19 00:28:20 +01:00
|
|
|
{if $max > 0}
|
|
|
|
<tr id="addition">
|
2015-03-24 17:59:52 +01:00
|
|
|
<td>{__('Poll results\\Addition')}</td>
|
2014-12-27 00:19:48 +01:00
|
|
|
{foreach $best_choices as $best_choice}
|
|
|
|
{if $max == $best_choice}
|
2014-12-19 00:28:20 +01:00
|
|
|
{$count_bests = $count_bests +1}
|
2015-01-11 14:59:25 +01:00
|
|
|
<td><span class="glyphicon glyphicon-star text-warning"></span>{$best_choice|html}</td>
|
2015-03-24 17:59:52 +01:00
|
|
|
{elseif $best_choice > 0}
|
2015-01-11 14:59:25 +01:00
|
|
|
<td>{$best_choice|html}</td>
|
2015-03-24 17:59:52 +01:00
|
|
|
{else}
|
|
|
|
<td></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-27 00:19:48 +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-03-24 17:59:52 +01:00
|
|
|
<div class="col-sm-12"><h3>{__('Poll results\\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-03-24 17:59:52 +01:00
|
|
|
<p><span class="glyphicon glyphicon-star text-warning"></span>{__('Poll results\\The best choice at this time is:')}</p>
|
2014-12-17 23:12:05 +01:00
|
|
|
{elseif $count_bests > 1}
|
2015-03-24 17:59:52 +01:00
|
|
|
<div class="col-sm-12"><h3>{__('Poll results\\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-03-24 17:59:52 +01:00
|
|
|
<p><span class="glyphicon glyphicon-star text-warning"></span>{__('Poll results\\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}
|
2014-12-27 00:19:48 +01:00
|
|
|
{if $best_choices[$i] == $max}
|
2015-01-11 14:59:25 +01:00
|
|
|
<li><strong>{$slot->title|html|markdown:true}</strong></li>
|
2014-12-27 00:19:48 +01:00
|
|
|
{/if}
|
|
|
|
{$i = $i+1}
|
2014-12-17 23:12:05 +01:00
|
|
|
{/foreach}
|
|
|
|
</ul>
|
2015-03-24 17:59:52 +01:00
|
|
|
<p>{__('Generic\\with')} <b>{$max|html}</b> {if $max==1}{__('Generic\\vote')}{else}{__('Generic\\votes')}{/if}.</p>
|
2014-12-17 23:12:05 +01:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
{/if}
|