Add headers to th cells when editing vote

This commit is contained in:
Olivier PEREZ 2014-12-17 13:39:12 +01:00
parent 7837c01ba0
commit fcc478bb93
2 changed files with 8 additions and 2 deletions

View File

@ -48,7 +48,10 @@ if (!$poll) {
exit;
}
// -------------------------------
// A vote is going to be edited
// -------------------------------
if (!empty($_POST['edit_vote'])) {
// TODO Try what does filter_input with a wrong value
$editingVoteId = filter_input(INPUT_POST, 'edit_vote', FILTER_VALIDATE_INT);
@ -57,7 +60,10 @@ if (!empty($_POST['edit_vote'])) {
}
// -------------------------------
// Something to save (edit or add)
// -------------------------------
if (!empty($_POST['save'])) { // Save edition of an old vote
$editedVote = filter_input(INPUT_POST, 'save', FILTER_VALIDATE_INT);
$choices = $inputService->filterArray($_POST['choices'], FILTER_VALIDATE_REGEXP, ['options'=>['regexp'=>'/^[012]$/']]);

View File

@ -116,7 +116,7 @@
{if $editingVoteId == $vote->id}
{foreach $vote->choices as $k=>$choice}
<td class="bg-info" headers="'.$td_headers[$k].'">
<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}/>
@ -207,7 +207,7 @@
{$i = $i+1}
{/foreach}
{/foreach}
<td><button type="submit" class="btn btn-success btn-sm" name="save" title="{_('Save the choices')}">{_('Save')}</button></td>
<td><button type="submit" class="btn btn-success btn-md" name="save" title="{_('Save the choices')}">{_('Save')}</button></td>
</tr>
{/if}