diff --git a/studs.php b/studs.php index 042d4abbd5a4746117e2fc1ff2f1e05527e0e507..f2850be101e7ddaac91b2c53c71dd7cba9138872 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 729ea909b0f1705775681a5818ded754b1b29d46..ef7613595c586b1e1b0769cdc5f9875fb14f91d6 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}