Skip to content
Snippets Groups Projects
Commit fcc478bb authored by Olivier PEREZ's avatar Olivier PEREZ
Browse files

Add headers to th cells when editing vote

parent 7837c01b
No related branches found
No related tags found
No related merge requests found
...@@ -48,7 +48,10 @@ if (!$poll) { ...@@ -48,7 +48,10 @@ if (!$poll) {
exit; exit;
} }
// -------------------------------
// A vote is going to be edited // A vote is going to be edited
// -------------------------------
if (!empty($_POST['edit_vote'])) { if (!empty($_POST['edit_vote'])) {
// TODO Try what does filter_input with a wrong value // TODO Try what does filter_input with a wrong value
$editingVoteId = filter_input(INPUT_POST, 'edit_vote', FILTER_VALIDATE_INT); $editingVoteId = filter_input(INPUT_POST, 'edit_vote', FILTER_VALIDATE_INT);
...@@ -57,7 +60,10 @@ if (!empty($_POST['edit_vote'])) { ...@@ -57,7 +60,10 @@ if (!empty($_POST['edit_vote'])) {
} }
// -------------------------------
// Something to save (edit or add) // Something to save (edit or add)
// -------------------------------
if (!empty($_POST['save'])) { // Save edition of an old vote if (!empty($_POST['save'])) { // Save edition of an old vote
$editedVote = filter_input(INPUT_POST, 'save', FILTER_VALIDATE_INT); $editedVote = filter_input(INPUT_POST, 'save', FILTER_VALIDATE_INT);
$choices = $inputService->filterArray($_POST['choices'], FILTER_VALIDATE_REGEXP, ['options'=>['regexp'=>'/^[012]$/']]); $choices = $inputService->filterArray($_POST['choices'], FILTER_VALIDATE_REGEXP, ['options'=>['regexp'=>'/^[012]$/']]);
......
...@@ -116,7 +116,7 @@ ...@@ -116,7 +116,7 @@
{if $editingVoteId == $vote->id} {if $editingVoteId == $vote->id}
{foreach $vote->choices as $k=>$choice} {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"> <ul class="list-unstyled choice">
<li class="yes"> <li class="yes">
<input type="radio" id="y-choice-{$k}" name="choices[{$k}]" value="2" {if $choice==2}checked {/if}/> <input type="radio" id="y-choice-{$k}" name="choices[{$k}]" value="2" {if $choice==2}checked {/if}/>
...@@ -207,7 +207,7 @@ ...@@ -207,7 +207,7 @@
{$i = $i+1} {$i = $i+1}
{/foreach} {/foreach}
{/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> </tr>
{/if} {/if}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment