From fcc478bb9306eea805173fce705cb445f910aa7e Mon Sep 17 00:00:00 2001 From: Olivier PEREZ <olivier@olivierperez.fr> Date: Wed, 17 Dec 2014 13:39:12 +0100 Subject: [PATCH] Add headers to th cells when editing vote --- studs.php | 6 ++++++ tpl/studs.tpl | 4 ++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/studs.php b/studs.php index 042d4abb..f2850be1 100644 --- a/studs.php +++ b/studs.php @@ -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]$/']]); diff --git a/tpl/studs.tpl b/tpl/studs.tpl index 729ea909..ef761359 100644 --- a/tpl/studs.tpl +++ b/tpl/studs.tpl @@ -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} -- GitLab