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-10-13 00:42:33 +02:00
<h3>
2016-05-03 20:59:45 +02:00
{ __ ( 'Poll results' , 'Votes of the poll' ) } { if $hidden } <i>( { __ ( 'PollInfo' , 'Results are hidden' ) } )</i> { /if }
2015-10-30 20:45:18 +01:00
{ if $accessGranted }
<a href="" data-toggle="modal" data-target="#hint_modal"><i class="glyphicon glyphicon-info-sign"></i></a>
{ /if }
2015-10-13 00:42:33 +02:00
</h3>
2014-12-17 23:12:05 +01:00
2015-04-11 17:03:10 +02:00
2018-02-18 12:50:07 +01:00
{ include 'part/scroll_left_right.tpl' }
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">
2015-12-08 22:53:51 +01:00
<input type="hidden" name="control" value=" { $slots_hash } "/>
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-11-05 22:43:54 +01:00
<a href=" { poll_url id = $admin_poll_id admin = true action = 'delete_column' action_value = $slot - > day | cat : '@' | cat : $moment } "
2016-05-09 17:59:42 +02:00
data-remove-confirmation=" { __ ( 'adminstuds' , 'Confirm removal of the column.' ) } "
class="btn btn-link btn-sm remove-column"
2015-04-13 12:33:43 +02:00
title=" { __ ( 'adminstuds' , 'Remove the column' ) } { $slot - > day | date_format : $date_format.txt_short | html } - { $moment | html } ">
2015-06-17 23:13:44 +02:00
<i class="glyphicon glyphicon-remove text-danger"></i><span class="sr-only"> { __ ( 'Generic' , 'Remove' ) } </span>
2015-04-13 12:33:43 +02:00
</a>
2014-12-21 00:45:39 +01:00
</td>
{ $headersDCount = $headersDCount + 1 }
{ /foreach }
{ /foreach }
<td>
2015-11-30 20:38:53 +01:00
<a href=" { poll_url id = $admin_poll_id admin = true action = 'add_column' } "
2015-11-25 01:35:10 +01:00
class="btn btn-link btn-sm" title=" { __ ( 'adminstuds' , 'Add a column' ) } ">
2015-06-17 23:13:44 +02:00
<i class="glyphicon glyphicon-plus text-success"></i><span class="sr-only"> { __ ( 'Poll results' , 'Add a column' ) } </span>
2015-04-13 12:33:43 +02:00
</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 }
2018-07-09 12:17:59 +02:00
{ $count_same = $count_same + ( $slot - > moments | count ) }
2015-02-02 23:25:50 +01:00
{ 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 }
2015-05-29 12:00:56 +02:00
{ * Edited line * }
2015-01-07 23:29:46 +01:00
2015-05-29 12:00:56 +02:00
{ if $editingVoteId = = = $vote - > uniqId & & ! $expired }
<tr class="hidden-print">
2018-02-20 12:42:27 +01:00
<td class="bg-info btn-edit">
2015-05-29 12:00:56 +02:00
<div class="input-group input-group-sm" id="edit">
2015-06-17 23:13:44 +02:00
<span class="input-group-addon"><i class="glyphicon glyphicon-user"></i></span>
2015-05-29 12:00:56 +02:00
<input type="hidden" name="edited_vote" value=" { $vote - > uniqId } "/>
<input type="text" id="name" name="name" value=" { $vote - > name | html } " class="form-control" title=" { __ ( 'Generic' , 'Your name' ) } " placeholder=" { __ ( 'Generic' , 'Your name' ) } " />
2018-02-20 12:42:27 +01:00
2015-05-29 12:00:56 +02:00
</div>
</td>
2014-12-17 23:12:05 +01:00
2017-12-09 13:55:49 +01:00
2016-04-27 00:59:20 +02:00
{ $k = 0 }
2016-03-19 10:30:49 +01:00
{ foreach $slots as $slot }
{ foreach $slot - > moments as $moment }
{ $choice = $vote - > choices [ $k ] }
2015-05-29 12:00:56 +02:00
<td class="bg-info" headers="M { $headersM [ $k ] } D { $headersD [ $k ] } H { $headersH [ $k ] } ">
<ul class="list-unstyled choice">
<li class="yes">
2016-03-06 20:50:59 +01:00
<input type="radio" id="y-choice- { $k } " name="choices[ { $k } ]" value="2" { if $choice = = '2' } checked { /if } />
2015-05-29 12:00:56 +02:00
<label class="btn btn-default btn-xs" for="y-choice- { $k } " title=" { __ ( 'Poll results' , 'Vote yes for' ) | html } { $slots_raw [ $k ] } ">
2015-06-17 23:13:44 +02:00
<i class="glyphicon glyphicon-ok"></i><span class="sr-only"> { __ ( 'Generic' , 'Yes' ) } </span>
2015-05-29 12:00:56 +02:00
</label>
</li>
<li class="ifneedbe">
2016-03-06 20:50:59 +01:00
<input type="radio" id="i-choice- { $k } " name="choices[ { $k } ]" value="1" { if $choice = = '1' } checked { /if } />
2015-05-29 12:00:56 +02:00
<label class="btn btn-default btn-xs" for="i-choice- { $k } " title=" { __ ( 'Poll results' , 'Vote ifneedbe for' ) | html } { $slots_raw [ $k ] } ">
2015-06-17 23:13:44 +02:00
(<i class="glyphicon glyphicon-ok"></i>)<span class="sr-only"> { __ ( 'Generic' , 'Ifneedbe' ) } </span>
2015-05-29 12:00:56 +02:00
</label>
</li>
<li class="no">
2016-03-06 20:50:59 +01:00
<input type="radio" id="n-choice- { $k } " name="choices[ { $k } ]" value="0" { if $choice = = '0' } checked { /if } />
2015-05-29 12:00:56 +02:00
<label class="btn btn-default btn-xs" for="n-choice- { $k } " title=" { __ ( 'Poll results' , 'Vote no for' ) | html } { $slots_raw [ $k ] } ">
2015-06-17 23:13:44 +02:00
<i class="glyphicon glyphicon-ban-circle"></i><span class="sr-only"> { __ ( 'Generic' , 'No' ) } </span>
2015-05-29 12:00:56 +02:00
</label>
</li>
2018-02-20 12:42:27 +01:00
<li class="hide">
2016-03-13 16:20:38 +01:00
<input type="radio" id="n-choice- { $k } " name="choices[ { $k } ]" value=" " { if $choice ! = '2' & & $choice ! = '1' & & $choice ! = '0' } checked { /if } />
</li>
2015-05-29 12:00:56 +02:00
</ul>
</td>
2016-03-19 10:30:49 +01:00
{ $k = $k + 1 }
{ /foreach }
2015-05-29 12:00:56 +02:00
{ /foreach }
2016-03-19 10:30:49 +01:00
2018-02-20 12:42:27 +01:00
<td class="btn-edit"><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
2015-05-29 12:00:56 +02:00
</tr>
{ elseif ! $hidden }
<tr>
2015-01-07 23:29:46 +01:00
2015-05-29 12:00:56 +02:00
{ * Voted line * }
2017-12-09 13:55:49 +01:00
<th class="bg-info"> { $vote - > name | html }
2018-03-21 15:29:14 +01:00
{ if $active & & ! $expired & & $accessGranted & &
(
$poll->editable == constant('Framadate\Editable::EDITABLE_BY_ALL')
or $admin
or ($poll->editable == constant('Framadate\Editable::EDITABLE_BY_OWN') && $editedVoteUniqueId == $vote->uniqId)
) &&
$slots|count gt 4
}
2018-02-20 12:42:27 +01:00
<span class="edit-username-left">
2017-12-13 10:40:10 +01: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-default btn-sm" title=" { __f ( 'Poll results' , 'Edit the line: %s' , $vote - > name ) | html } ">
<i class="glyphicon glyphicon-pencil"></i><span class="sr-only"> { __ ( 'Generic' , 'Edit' ) } </span>
</a>
2017-12-09 13:55:49 +01:00
</span>
2017-12-11 11:32:45 +01:00
{ /if }
2017-12-09 13:55:49 +01:00
</th>
2014-12-17 23:12:05 +01:00
2018-02-20 12:42:27 +01:00
2016-04-27 00:59:20 +02:00
{ $k = 0 }
2016-03-19 10:30:49 +01:00
{ foreach $slots as $slot }
{ foreach $slot - > moments as $moment }
{ $choice = $vote - > choices [ $k ] }
2014-12-17 23:12:05 +01:00
2016-03-06 20:50:59 +01:00
{ if $choice = = '2' }
2015-06-17 23:13:44 +02:00
<td class="bg-success text-success" headers="M { $headersM [ $k ] } D { $headersD [ $k ] } H { $k } "><i class="glyphicon glyphicon-ok"></i><span class="sr-only"> { __ ( 'Generic' , 'Yes' ) } </span></td>
2016-03-06 20:50:59 +01:00
{ elseif $choice = = '1' }
2015-06-17 23:13:44 +02:00
<td class="bg-warning text-warning" headers="M { $headersM [ $k ] } D { $headersD [ $k ] } H { $k } ">(<i class="glyphicon glyphicon-ok"></i>)<span class="sr-only"> { __ ( 'Generic' , 'Ifneedbe' ) } </span></td>
2016-03-06 20:50:59 +01:00
{ elseif $choice = = '0' }
2015-06-17 23:13:44 +02:00
<td class="bg-danger text-danger" headers="M { $headersM [ $k ] } D { $headersD [ $k ] } H { $k } "><i class="glyphicon glyphicon-ban-circle"></i><span class="sr-only"> { __ ( 'Generic' , 'No' ) } </span></td>
2016-04-27 00:59:20 +02:00
{ else }
2016-04-27 01:03:59 +02:00
<td class="bg-info" headers="M { $headersM [ $k ] } D { $headersD [ $k ] } H { $k } "><span class="sr-only"> { __ ( 'Generic' , 'Unknown' ) } </span></td>
2014-12-17 23:12:05 +01:00
{ /if }
2015-05-29 12:00:56 +02:00
2016-03-19 10:30:49 +01:00
{ $k = $k + 1 }
{ /foreach }
2015-05-29 12:00:56 +02:00
{ /foreach }
2015-11-30 21:55:56 +01:00
{ if $active & & ! $expired & & $accessGranted & &
2015-11-05 21:37:51 +01:00
(
$poll->editable == constant('Framadate\Editable::EDITABLE_BY_ALL')
or $admin
2016-01-19 22:28:34 +01:00
or ($poll->editable == constant('Framadate\Editable::EDITABLE_BY_OWN') && $editedVoteUniqueId == $vote->uniqId)
2015-11-05 21:37:51 +01:00
)
}
2015-05-29 12:00:56 +02:00
<td class="hidden-print">
2016-05-03 21:09:41 +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-default btn-sm" title=" { __f ( 'Poll results' , 'Edit the line: %s' , $vote - > name ) | html } ">
2015-06-17 23:13:44 +02:00
<i class="glyphicon glyphicon-pencil"></i><span class="sr-only"> { __ ( 'Generic' , 'Edit' ) } </span>
2015-05-29 12:00:56 +02:00
</a>
{ if $admin }
2020-12-11 17:20:19 +01:00
<a href=" { poll_url id = $poll - > id vote_id = $vote - > uniqId } " class="btn btn-default btn-sm clipboard-url" data-toggle="popover" data-trigger="manual" title=" { __ ( 'Poll results' , 'Link to edit this particular line' ) } " data-content=" { __ ( 'Poll results' , 'Link to edit this particular line has been copied inside the clipboard!' ) } ">
2018-04-06 11:44:11 +02:00
<i class="glyphicon glyphicon-link"></i><span class="sr-only"> { __ ( 'Generic' , 'Link' ) } </span>
</a>
2015-05-29 12:00:56 +02:00
<a href=" { poll_url id = $admin_poll_id admin = true action = 'delete_vote' action_value = $vote - > id } "
class="btn btn-default btn-sm"
title=" { __ ( 'Poll results' , 'Remove the line:' ) } { $vote - > name | html } ">
2015-06-17 23:13:44 +02:00
<i class="glyphicon glyphicon-remove text-danger"></i><span class="sr-only"> { __ ( 'Generic' , 'Remove' ) } </span>
2015-05-29 12:00:56 +02:00
</a>
2018-04-06 11:44:11 +02:00
2015-05-29 12:00:56 +02:00
{ /if }
</td>
{ else }
<td></td>
2014-12-17 23:12:05 +01:00
{ /if }
</tr>
2015-05-29 12:00:56 +02:00
{ /if }
2014-12-17 23:12:05 +01:00
{ /foreach }
{ * Line to add a new vote * }
2016-03-05 16:17:18 +01:00
{ if $active & & $editingVoteId = = = 0 & & ! $expired & & $accessGranted }
2015-05-29 12:00:56 +02:00
<tr id="vote-form" class="hidden-print">
2018-02-20 12:42:27 +01:00
<td class="bg-info btn-edit">
2014-12-17 23:12:05 +01:00
<div class="input-group input-group-sm">
2015-06-17 23:13:44 +02:00
<span class="input-group-addon"><i class="glyphicon glyphicon-user"></i></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>
2018-02-20 15:17:14 +01:00
2014-12-17 23:12:05 +01:00
{ $i = 0 }
2018-02-20 15:17:14 +01:00
{ foreach $slots as $slot }
2014-12-17 23:12:05 +01:00
{ foreach $slot - > moments as $moment }
2018-02-20 13:06:58 +01:00
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">
2018-03-21 15:29:14 +01:00
{ if $poll - > ValueMax eq NULL | | $best_choices [ 'y' ] [ $i ] lt $poll - > ValueMax }
2014-12-17 23:12:05 +01:00
<li class="yes">
2018-04-04 22:18:53 +02:00
<input type="radio" id="y-choice- { $i } " name="choices[ { $i } ]" value="2"
2018-04-08 10:46:46 +02:00
{ ( ! isset ( $selectedNewVotes [ $i ] ) | | ( "2" ! = = $selectedNewVotes [ $i ] ) ) ? "" : " checked" }
2018-04-04 22:18:53 +02:00
/>
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 } ">
2015-06-17 23:13:44 +02:00
<i class="glyphicon glyphicon-ok"></i><span class="sr-only"> { __ ( 'Generic' , 'Yes' ) } </span>
2014-12-17 23:12:05 +01:00
</label>
</li>
<li class="ifneedbe">
2018-04-04 22:18:53 +02:00
<input type="radio" id="i-choice- { $i } " name="choices[ { $i } ]" value="1"
2018-04-08 10:46:46 +02:00
{ ( ! isset ( $selectedNewVotes [ $i ] ) | | ( "1" ! = = $selectedNewVotes [ $i ] ) ) ? "" : " checked" }
2018-04-04 22:18:53 +02:00
/>
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 } ">
2015-06-17 23:13:44 +02:00
(<i class="glyphicon glyphicon-ok"></i>)<span class="sr-only"> { __ ( 'Generic' , 'Ifneedbe' ) } </span>
2014-12-17 23:12:05 +01:00
</label>
</li>
2018-04-04 22:18:53 +02:00
{ /if }
2018-02-20 13:06:58 +01:00
2014-12-17 23:12:05 +01:00
<li class="no">
2018-04-04 22:18:53 +02:00
<input type="radio" id="n-choice- { $i } " name="choices[ { $i } ]" value="0"
2018-04-08 10:46:46 +02:00
{ ( ! isset ( $selectedNewVotes [ $i ] ) | | ( "0" ! = = $selectedNewVotes [ $i ] ) ) ? "" : " checked" }
2018-04-04 22:18:53 +02:00
/>
2018-04-08 10:46:46 +02:00
<label class="btn btn-default btn-xs { ( ! isset ( $selectedNewVotes [ $i ] ) | | ( "0" ! = = $selectedNewVotes [ $i ] ) ) ? "startunchecked" : "" } " for="n-choice- { $i } " title=" { __ ( 'Poll results' , 'Vote no for' ) | html } { $slot - > day | date_format : $date_format.txt_short | html } - { $moment | html } ">
2015-06-17 23:13:44 +02:00
<i class="glyphicon glyphicon-ban-circle"></i><span class="sr-only"> { __ ( 'Generic' , 'No' ) } </span>
2014-12-17 23:12:05 +01:00
</label>
</li>
2018-02-20 12:42:27 +01:00
<li class="hide">
2018-04-04 22:18:53 +02:00
<input type="radio" id="n-choice- { $i } " name="choices[ { $i } ]" value=" "
2018-04-14 17:47:22 +02:00
{ ( isset ( $selectedNewVotes [ $i ] ) & & ( "" ! = = $selectedNewVotes [ $i ] ) ) ? "" : " checked" }
2018-04-04 22:18:53 +02:00
/>
2016-03-19 10:30:49 +01:00
</li>
2014-12-17 23:12:05 +01:00
</ul>
</td>
2018-02-20 13:06:58 +01:00
2014-12-17 23:12:05 +01:00
{ $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 }
2015-04-23 23:18:31 +02:00
{ $max = max ( $best_choices [ 'y' ] ) }
2015-04-06 12:39:58 +02:00
{ if $max > 0 }
<tr id="addition">
2015-06-17 22:39:14 +02:00
<td> { __ ( 'Poll results' , 'Addition' ) } <br/> { $votes | count } { if ( $votes | count ) = = 1 } { __ ( 'Poll results' , 'polled user' ) } { else } { __ ( 'Poll results' , 'polled users' ) } { /if } </td>
2015-04-23 23:18:31 +02:00
{ foreach $best_choices [ 'y' ] as $i = > $best_moment }
2015-04-06 12:39:58 +02:00
{ if $max = = $best_moment }
{ $count_bests = $count_bests + 1 }
2015-06-17 22:39:14 +02:00
<td><i class="glyphicon glyphicon-star text-info"></i><span class="yes-count"> { $best_moment | html } </span> { if $best_choices [ 'inb' ] [ $i ] > 0 } <br/><span class="small text-muted">(+<span class="inb-count"> { $best_choices [ 'inb' ] [ $i ] | html } </span>)</span> { /if } </td>
2015-04-06 12:39:58 +02:00
{ elseif $best_moment > 0 }
2015-06-17 22:39:14 +02:00
<td><span class="yes-count"> { $best_moment | html } </span> { if $best_choices [ 'inb' ] [ $i ] > 0 } <br/><span class="small text-muted">(+<span class="inb-count"> { $best_choices [ 'inb' ] [ $i ] | html } </span>)</span> { /if } </td>
{ elseif $best_choices [ 'inb' ] [ $i ] > 0 }
<td><br/><span class="small text-muted">(+<span class="inb-count"> { $best_choices [ 'inb' ] [ $i ] | html } </span>)</span></td>
2015-04-06 12:39:58 +02:00
{ 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-06-17 22:39:14 +02:00
{ if ! $hidden & & $max > 0 }
<div class="row" aria-hidden="true">
<div class="col-xs-12">
<p class="text-center" id="showChart">
<button class="btn btn-lg btn-default">
<span class="fa fa-fw fa-bar-chart"></span> { __ ( 'Poll results' , 'Display the chart of the results' ) }
</button>
</p>
</div>
</div>
2021-12-17 14:05:19 +01:00
<script>
2015-06-17 22:39:14 +02:00
$(document).ready(function () {
$('#showChart').on('click', function() {
2015-06-23 21:54:39 +02:00
$('#showChart')
.after("<h3> { __ ( 'Poll results' , 'Chart' ) } </h3><canvas id=\"Chart\"></canvas>")
.remove();
2018-02-20 12:42:27 +01:00
2015-06-17 22:39:14 +02:00
var resIfneedbe = [];
var resYes = [];
2018-02-20 12:42:27 +01:00
2015-06-23 21:54:39 +02:00
$('#addition').find('td').each(function () {
var inbCountText = $(this).find('.inb-count').text();
if(inbCountText != '' && inbCountText != undefined) {
resIfneedbe.push(inbCountText)
2015-06-17 22:39:14 +02:00
} else {
resIfneedbe.push(0);
}
2015-06-23 21:54:39 +02:00
var yesCountText = $(this).find('.yes-count').text();
if(yesCountText != '' && yesCountText != undefined) {
resYes.push(yesCountText)
2015-06-17 22:39:14 +02:00
} else {
resYes.push(0);
}
});
var cols = [
{ foreach $slots as $slot }
{ foreach $slot - > moments as $moment }
2018-02-20 12:42:27 +01:00
$('<div/>').html(' { $slot - > day | date_format : $date_format.txt_short | html } - { $moment | html } ').text(),
2015-06-17 22:39:14 +02:00
{ /foreach }
{ /foreach }
];
2015-06-23 21:54:39 +02:00
resIfneedbe.shift();
resYes.shift();
2015-06-17 23:13:44 +02:00
2015-06-17 22:39:14 +02:00
var barChartData = {
labels : cols,
datasets : [
{
label: " { __ ( 'Generic' , 'Ifneedbe' ) } ",
fillColor : "rgba(255,207,79,0.8)",
highlightFill: "rgba(255,207,79,1)",
barShowStroke : false,
data : resIfneedbe
},
{
label: " { __ ( 'Generic' , 'Yes' ) } ",
fillColor : "rgba(103,120,53,0.8)",
highlightFill : "rgba(103,120,53,1)",
barShowStroke : false,
data : resYes
}
]
};
var ctx = document.getElementById("Chart").getContext("2d");
window.myBar = new Chart(ctx).StackedBar(barChartData, {
responsive : true
});
return false;
});
});
</script>
2018-02-20 12:42:27 +01:00
2015-06-17 22:39:14 +02:00
{ /if }
2015-04-06 12:39:58 +02:00
{ if ! $hidden }
{ * Best votes listing * }
2015-04-23 23:18:31 +02:00
{ $max = max ( $best_choices [ 'y' ] ) }
2015-04-06 12:39:58 +02:00
{ if $max > 0 }
2021-10-18 16:50:51 +02:00
<div class="row best-choice">
2015-04-06 12:39:58 +02:00
{ if $count_bests = = 1 }
<div class="col-sm-12"><h3> { __ ( 'Poll results' , 'Best choice' ) } </h3></div>
2015-06-17 22:39:14 +02:00
<div class="col-sm-6 col-sm-offset-3 alert alert-info">
<p><i class="glyphicon glyphicon-star text-info"></i> { __ ( 'Poll results' , 'The best choice at this time is:' ) } </p>
2015-04-06 12:39:58 +02:00
{ elseif $count_bests > 1 }
<div class="col-sm-12"><h3> { __ ( 'Poll results' , 'Best choices' ) } </h3></div>
2015-06-17 22:39:14 +02:00
<div class="col-sm-6 col-sm-offset-3 alert alert-info">
<p><i class="glyphicon glyphicon-star text-info"></i> { __ ( 'Poll results' , 'The bests choices at this time are:' ) } </p>
2015-04-06 12:39:58 +02:00
{ /if }
2014-12-17 23:12:05 +01:00
2015-04-06 12:39:58 +02:00
{ $i = 0 }
2018-02-20 12:42:27 +01:00
<ul class="list-unstyled">
2015-04-06 12:39:58 +02:00
{ foreach $slots as $slot }
{ foreach $slot - > moments as $moment }
2015-04-23 23:18:31 +02:00
{ if $best_choices [ 'y' ] [ $i ] = = $max }
2021-03-25 09:48:24 +01:00
{ assign var = "space" value = "`$slot->day|date_format:'d-m-Y'|html`|`$moment`" }
<li><strong> { $slot - > day | date_format : $date_format.txt_full | html } - { $moment | html } </strong>
2021-10-18 16:50:51 +02:00
<a href=" { poll_url id = $poll_id action = 'get_ical_file' action_value = ( $space ) } " class="btn btn-default btn-sm" title=" { __ ( 'studs' , 'Download as ical/ics file' ) } ">
<span class="fa fa-calendar text-muted"></span>
<span class="sr-only"> { __ ( 'studs' , 'Download as ical/ics file' ) } </span>
</a>
</li>
2015-04-06 12:39:58 +02:00
{ /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 }
2015-06-17 22:39:14 +02:00
{ /if }