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}
|
|
|
|
|
|
2015-04-06 12:39:58 +02:00
|
|
|
|
<h3>{__('Poll results', 'Votes of the poll')} {if $hidden}<i>({__('PollInfo', 'Results are hidden.')})</i>{/if}</h3>
|
2014-12-17 23:12:05 +01:00
|
|
|
|
|
2015-04-11 17:03:10 +02:00
|
|
|
|
|
2014-12-17 23:12:05 +01:00
|
|
|
|
<div id="tableContainer" class="tableContainer">
|
2015-04-11 17:03:10 +02:00
|
|
|
|
<form action="{if $admin}{poll_url id=$admin_poll_id admin=true}{else}{poll_url id=$poll_id}{/if}" method="POST" id="poll_form">
|
2014-12-17 23:12:05 +01:00
|
|
|
|
<table class="results">
|
2015-03-30 15:19:56 +02: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>
|
|
|
|
|
{$headersDCount=0}
|
|
|
|
|
{foreach $slots as $slot}
|
|
|
|
|
{foreach $slot->moments as $id=>$moment}
|
|
|
|
|
<td headers="M{$slot@key} D{$headersDCount} H{$headersDCount}">
|
2015-04-13 12:33:43 +02:00
|
|
|
|
<a href="{poll_url id=$admin_poll_id admin=true action='delete_column' action_value=$slot->day|cat:'@'|cat:$moment}"
|
|
|
|
|
class="btn btn-link btn-sm"
|
|
|
|
|
title="{__('adminstuds', '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">{__('Genric', 'Remove')}</span>
|
|
|
|
|
</a>
|
2014-12-21 00:45:39 +01:00
|
|
|
|
</td>
|
|
|
|
|
{$headersDCount = $headersDCount+1}
|
|
|
|
|
{/foreach}
|
|
|
|
|
{/foreach}
|
|
|
|
|
<td>
|
2015-04-13 12:33:43 +02:00
|
|
|
|
<a href="{poll_url id=$admin_poll_id admin=true action='add_slot' action_value=true}"
|
2015-04-14 13:34:15 +02:00
|
|
|
|
class="btn btn-link btn-sm" title="{__('adminstuds', 'Add a column')} {$slot->day|html}">
|
2015-04-13 12:33:43 +02:00
|
|
|
|
<span class="glyphicon glyphicon-plus text-success"></span><span class="sr-only">{__('Poll results', 'Add a column')}</span>
|
|
|
|
|
</a>
|
2014-12-21 00:45:39 +01:00
|
|
|
|
</td>
|
|
|
|
|
</tr>
|
|
|
|
|
{/if}
|
2014-12-17 23:12:05 +01:00
|
|
|
|
<tr>
|
|
|
|
|
<th role="presentation"></th>
|
2015-02-02 23:25:50 +01:00
|
|
|
|
{$count_same = 0}
|
|
|
|
|
{$previous = 0}
|
2014-12-17 23:12:05 +01:00
|
|
|
|
{foreach $slots as $id=>$slot}
|
2015-03-24 17:59:52 +01:00
|
|
|
|
{$display = $slot->day|date_format:$date_format.txt_month_year|html}
|
2015-02-02 23:25:50 +01:00
|
|
|
|
{if $previous !== 0 && $previous != $display}
|
|
|
|
|
<th colspan="{$count_same}" class="bg-primary month" id="M{$id}">{$previous}</th>
|
|
|
|
|
{$count_same = 0}
|
|
|
|
|
{/if}
|
|
|
|
|
|
|
|
|
|
{$count_same = $count_same + $slot->moments|count}
|
|
|
|
|
|
|
|
|
|
{if $slot@last}
|
|
|
|
|
<th colspan="{$count_same}" class="bg-primary month" id="M{$id}">{$display}</th>
|
|
|
|
|
{/if}
|
|
|
|
|
|
|
|
|
|
{$previous = $display}
|
|
|
|
|
|
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>
|
2015-02-02 21:14:24 +01:00
|
|
|
|
{for $foo=0 to ($slot->moments|count)-1}
|
|
|
|
|
{append var='headersD' value=$id}
|
|
|
|
|
{/for}
|
2014-12-17 23:12:05 +01:00
|
|
|
|
{/foreach}
|
|
|
|
|
<th></th>
|
|
|
|
|
</tr>
|
|
|
|
|
<tr>
|
|
|
|
|
<th role="presentation"></th>
|
|
|
|
|
{$headersDCount=0}
|
2015-03-24 17:59:52 +01:00
|
|
|
|
{$slots_raw = array()}
|
2014-12-17 23:12:05 +01:00
|
|
|
|
{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>
|
2015-02-02 21:14:24 +01:00
|
|
|
|
{append var='headersH' value=$headersDCount}
|
2014-12-17 23:12:05 +01:00
|
|
|
|
{$headersDCount = $headersDCount+1}
|
2015-03-24 17:59:52 +01:00
|
|
|
|
{$slots_raw[] = $slot->day|date_format:$date_format.txt_full|cat:' - '|cat:$moment}
|
2014-12-17 23:12:05 +01:00
|
|
|
|
{/foreach}
|
|
|
|
|
{/foreach}
|
|
|
|
|
<th></th>
|
|
|
|
|
</tr>
|
|
|
|
|
</thead>
|
|
|
|
|
<tbody>
|
|
|
|
|
{foreach $votes as $vote}
|
|
|
|
|
<tr>
|
|
|
|
|
{* Edited line *}
|
|
|
|
|
|
2015-04-02 16:52:46 +02:00
|
|
|
|
{if $editingVoteId === $vote->uniqId && !$expired}
|
2015-01-07 23:29:46 +01:00
|
|
|
|
<td class="bg-info" style="padding:5px">
|
2015-04-05 17:44:29 +02:00
|
|
|
|
<div class="input-group input-group-sm" id="edit">
|
2015-01-07 23:29:46 +01:00
|
|
|
|
<span class="input-group-addon"><span class="glyphicon glyphicon-user"></span></span>
|
2015-04-07 17:58:45 +02:00
|
|
|
|
<input type="hidden" name="edited_vote" value="{$vote->uniqId}"/>
|
2015-03-30 15:19:56 +02:00
|
|
|
|
<input type="text" id="name" name="name" value="{$vote->name|html}" class="form-control" title="{__('Generic', 'Your name')}" placeholder="{__('Generic', '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}
|
|
|
|
|
|
2015-02-02 21:14:24 +01:00
|
|
|
|
<td class="bg-info" headers="M{$headersM[$k]} D{$headersD[$k]} H{$headersH[$k]}">
|
2014-12-17 23:12:05 +01:00
|
|
|
|
<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-03-30 15:19:56 +02:00
|
|
|
|
<label class="btn btn-default btn-xs" for="y-choice-{$k}" title="{__('Poll results', 'Vote yes for')|html} {$slots_raw[$k]}">
|
|
|
|
|
<span class="glyphicon glyphicon-ok"></span><span class="sr-only">{__('Generic', 'Yes')}</span>
|
2014-12-17 23:12:05 +01:00
|
|
|
|
</label>
|
|
|
|
|
</li>
|
|
|
|
|
<li class="ifneedbe">
|
|
|
|
|
<input type="radio" id="i-choice-{$k}" name="choices[{$k}]" value="1" {if $choice==1}checked {/if}/>
|
2015-03-30 15:19:56 +02:00
|
|
|
|
<label class="btn btn-default btn-xs" for="i-choice-{$k}" title="{__('Poll results', 'Vote ifneedbe for')|html} {$slots_raw[$k]}">
|
|
|
|
|
(<span class="glyphicon glyphicon-ok"></span>)<span class="sr-only">{__('Generic', 'Ifneedbe')}</span>
|
2014-12-17 23:12:05 +01:00
|
|
|
|
</label>
|
|
|
|
|
</li>
|
|
|
|
|
<li class="no">
|
|
|
|
|
<input type="radio" id="n-choice-{$k}" name="choices[{$k}]" value="0" {if $choice==0}checked {/if}/>
|
2015-03-30 15:19:56 +02:00
|
|
|
|
<label class="btn btn-default btn-xs" for="n-choice-{$k}" title="{__('Poll results', 'Vote no for')|html} {$slots_raw[$k]}">
|
|
|
|
|
<span class="glyphicon glyphicon-ban-circle"></span><span class="sr-only">{__('Generic', 'No')}</span>
|
2014-12-17 23:12:05 +01:00
|
|
|
|
</label>
|
|
|
|
|
</li>
|
|
|
|
|
</ul>
|
|
|
|
|
</td>
|
|
|
|
|
{/foreach}
|
2015-04-02 17:25:01 +02: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>
|
2015-04-06 12:39:58 +02:00
|
|
|
|
{elseif !$hidden}
|
2014-12-17 23:12:05 +01:00
|
|
|
|
|
|
|
|
|
{* 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}
|
2015-03-30 15:19:56 +02:00
|
|
|
|
<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">{__('Generic', 'Yes')}</span></td>
|
2014-12-17 23:12:05 +01:00
|
|
|
|
{elseif $choice==1}
|
2015-03-30 15:19:56 +02:00
|
|
|
|
<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">{__('Generic', 'Ifneedbe')}</span></td>
|
2014-12-17 23:12:05 +01:00
|
|
|
|
{else}
|
2015-03-30 15:19:56 +02:00
|
|
|
|
<td class="bg-danger" headers="M{$headersM[$k]} D{$headersD[$k]} H{$k}"><span class="sr-only">{__('Generic', 'No')}</span></td>
|
2014-12-17 23:12:05 +01:00
|
|
|
|
{/if}
|
|
|
|
|
|
|
|
|
|
{/foreach}
|
|
|
|
|
|
2015-04-05 17:44:29 +02:00
|
|
|
|
{if $active && !$expired && ($poll->editable == constant('Framadate\Editable::EDITABLE_BY_ALL') or $admin)}
|
2014-12-17 23:12:05 +01:00
|
|
|
|
<td>
|
2015-04-11 17:03:10 +02:00
|
|
|
|
<a href="{if $admin}{poll_url id=$poll->admin_id vote_id=$vote->uniqId admin=true}{else}{poll_url id=$poll->id vote_id=$vote->uniqId}{/if}" class="btn btn-link btn-sm" title="{__('Poll results', 'Edit the line:')|escape} {$vote->name|html}">
|
2015-03-30 15:19:56 +02:00
|
|
|
|
<span class="glyphicon glyphicon-pencil"></span><span class="sr-only">{__('Generic', 'Edit')}</span>
|
2015-04-02 16:52:46 +02:00
|
|
|
|
</a>
|
2014-12-21 00:25:00 +01:00
|
|
|
|
{if $admin}
|
2015-04-13 12:33:43 +02:00
|
|
|
|
<a href="{poll_url id=$admin_poll_id admin=true action='delete_vote' action_value=$vote->id}"
|
|
|
|
|
class="btn btn-link btn-sm"
|
|
|
|
|
title="{__('Poll results', 'Remove the line:')} {$vote->name|html}">
|
2015-03-30 15:19:56 +02:00
|
|
|
|
<span class="glyphicon glyphicon-remove text-danger"></span><span class="sr-only">{__('Generic', 'Remove')}</span>
|
2015-04-13 12:33:43 +02:00
|
|
|
|
</a>
|
2014-12-21 00:25:00 +01:00
|
|
|
|
{/if}
|
2014-12-17 23:12:05 +01:00
|
|
|
|
</td>
|
|
|
|
|
{else}
|
|
|
|
|
<td></td>
|
|
|
|
|
{/if}
|
|
|
|
|
{/if}
|
|
|
|
|
</tr>
|
|
|
|
|
{/foreach}
|
|
|
|
|
|
|
|
|
|
{* Line to add a new vote *}
|
|
|
|
|
|
2015-04-02 16:52:46 +02: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-30 15:19:56 +02: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>
|
|
|
|
|
{$i = 0}
|
|
|
|
|
{foreach $slots as $slot}
|
|
|
|
|
{foreach $slot->moments as $moment}
|
2015-02-02 21:14:24 +01:00
|
|
|
|
<td class="bg-info" headers="M{$headersM[$i]} D{$headersD[$i]} H{$headersH[$i]}">
|
2014-12-17 23:12:05 +01:00
|
|
|
|
<ul class="list-unstyled choice">
|
|
|
|
|
<li class="yes">
|
|
|
|
|
<input type="radio" id="y-choice-{$i}" name="choices[{$i}]" value="2" />
|
2015-03-30 15:19:56 +02:00
|
|
|
|
<label class="btn btn-default btn-xs" for="y-choice-{$i}" title="{__('Poll results', 'Vote yes for')|html} {$slot->day|date_format:$date_format.txt_short|html} - {$moment|html}">
|
|
|
|
|
<span class="glyphicon glyphicon-ok"></span><span class="sr-only">{__('Generic', 'Yes')}</span>
|
2014-12-17 23:12:05 +01:00
|
|
|
|
</label>
|
|
|
|
|
</li>
|
|
|
|
|
<li class="ifneedbe">
|
|
|
|
|
<input type="radio" id="i-choice-{$i}" name="choices[{$i}]" value="1" />
|
2015-03-30 15:19:56 +02:00
|
|
|
|
<label class="btn btn-default btn-xs" for="i-choice-{$i}" title="{__('Poll results', 'Vote ifneedbe for')|html} {$slot->day|date_format:$date_format.txt_short|html} - {$moment|html}">
|
|
|
|
|
(<span class="glyphicon glyphicon-ok"></span>)<span class="sr-only">{__('Generic', 'Ifneedbe')}</span>
|
2014-12-17 23:12:05 +01:00
|
|
|
|
</label>
|
|
|
|
|
</li>
|
|
|
|
|
<li class="no">
|
|
|
|
|
<input type="radio" id="n-choice-{$i}" name="choices[{$i}]" value="0" checked/>
|
2015-03-30 15:19:56 +02:00
|
|
|
|
<label class="btn btn-default btn-xs" for="n-choice-{$i}" title="{__('Poll results', 'Vote no for')|html} {$slot->day|date_format:$date_format.txt_short|html} - {$moment|html}">
|
|
|
|
|
<span class="glyphicon glyphicon-ban-circle"></span><span class="sr-only">{__('Generic', 'No')}</span>
|
2014-12-17 23:12:05 +01:00
|
|
|
|
</label>
|
|
|
|
|
</li>
|
|
|
|
|
</ul>
|
|
|
|
|
</td>
|
|
|
|
|
{$i = $i+1}
|
|
|
|
|
{/foreach}
|
|
|
|
|
{/foreach}
|
2015-04-02 17:25:01 +02: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}
|
|
|
|
|
|
2015-04-06 12:39:58 +02:00
|
|
|
|
{if !$hidden}
|
|
|
|
|
{* Line displaying best moments *}
|
|
|
|
|
{$count_bests = 0}
|
|
|
|
|
{$max = max($best_choices)}
|
|
|
|
|
{if $max > 0}
|
|
|
|
|
<tr id="addition">
|
|
|
|
|
<td>{__('Poll results', 'Addition')}</td>
|
|
|
|
|
{foreach $best_choices as $best_moment}
|
|
|
|
|
{if $max == $best_moment}
|
|
|
|
|
{$count_bests = $count_bests +1}
|
|
|
|
|
<td><i class="glyphicon glyphicon-star text-warning"></i>{$best_moment|html}</td>
|
|
|
|
|
{elseif $best_moment > 0}
|
|
|
|
|
<td>{$best_moment|html}</td>
|
|
|
|
|
{else}
|
|
|
|
|
<td></td>
|
|
|
|
|
{/if}
|
|
|
|
|
{/foreach}
|
|
|
|
|
</tr>
|
|
|
|
|
{/if}
|
2014-12-19 00:28:20 +01:00
|
|
|
|
{/if}
|
2014-12-17 23:12:05 +01:00
|
|
|
|
</tbody>
|
|
|
|
|
</table>
|
|
|
|
|
</form>
|
|
|
|
|
</div>
|
|
|
|
|
|
2015-04-06 12:39:58 +02:00
|
|
|
|
{if !$hidden}
|
|
|
|
|
{* Best votes listing *}
|
|
|
|
|
{$max = max($best_choices)}
|
|
|
|
|
{if $max > 0}
|
|
|
|
|
<div class="row">
|
|
|
|
|
{if $count_bests == 1}
|
|
|
|
|
<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-04-06 12:39:58 +02:00
|
|
|
|
<p><span class="glyphicon glyphicon-star text-warning"></span>{__('Poll results', 'The best choice at this time is:')}</p>
|
|
|
|
|
{elseif $count_bests > 1}
|
|
|
|
|
<div class="col-sm-12"><h3>{__('Poll results', 'Best choices')}</h3></div>
|
|
|
|
|
<div class="col-sm-6 col-sm-offset-3 alert alert-success">
|
|
|
|
|
<p><span class="glyphicon glyphicon-star text-warning"></span>{__('Poll results', 'The bests choices at this time are:')}</p>
|
|
|
|
|
{/if}
|
2014-12-17 23:12:05 +01:00
|
|
|
|
|
|
|
|
|
|
2015-04-06 12:39:58 +02:00
|
|
|
|
{$i = 0}
|
|
|
|
|
<ul style="list-style:none">
|
|
|
|
|
{foreach $slots as $slot}
|
|
|
|
|
{foreach $slot->moments as $moment}
|
|
|
|
|
{if $best_choices[$i] == $max}
|
|
|
|
|
<li><strong>{$slot->day|date_format:$date_format.txt_full|html} - {$moment|html}</strong></li>
|
|
|
|
|
{/if}
|
|
|
|
|
{$i = $i+1}
|
|
|
|
|
{/foreach}
|
2014-12-17 23:12:05 +01:00
|
|
|
|
{/foreach}
|
2015-04-06 12:39:58 +02:00
|
|
|
|
</ul>
|
|
|
|
|
<p>{__('Generic', 'with')} <b>{$max|html}</b> {if $max==1}{__('Generic', 'vote')}{else}{__('Generic', 'votes')}{/if}.</p>
|
|
|
|
|
</div>
|
2014-12-17 23:12:05 +01:00
|
|
|
|
</div>
|
2015-04-06 12:39:58 +02:00
|
|
|
|
{/if}
|
2014-12-17 23:12:05 +01:00
|
|
|
|
{/if}
|