48 lines
1.2 KiB
HTML
48 lines
1.2 KiB
HTML
{{:admin_header title="Voter"}}
|
|
|
|
{{if $_GET.id}}
|
|
{{#load assign="scrutin" id=$_GET.id|intval}}{{/load}}
|
|
|
|
{{:assign var="reponses" -1="Non" 0="" 1="Oui" }}
|
|
|
|
|
|
{{:assign user_id=$logged_user.id }}
|
|
Bonjour {{$logged_user.nom}}.
|
|
|
|
{{if $_POST.save}}
|
|
{{:assign var="scrutin.votes.%s"|args:$user_id value=$_POST.vote|intval}}
|
|
{{:save id=$scrutin.id
|
|
validate_schema="./scrutin.schema.json"
|
|
votes=$scrutin.votes
|
|
}}
|
|
|
|
{{:redirect to="./"}}
|
|
{{/if}}
|
|
|
|
<form method="post" action="">
|
|
<fieldset class"vote">
|
|
<legend>Question</legend>
|
|
<p class="vote-question">{{$scrutin.question}}</p>
|
|
{{if $scrutin.votes|has_key:$user_id}}
|
|
{{:assign var="prev" from="scrutin.votes.%s"|args:$user_id}}
|
|
{{else}}
|
|
{{:assign var="prev" value=0}}
|
|
{{/if}}
|
|
|
|
<dl>
|
|
{{:input type="select" required="false" shape="right" name="vote" label="Je vote :" options=$reponses default=$prev help=$scrutin.desc}}
|
|
</dl>
|
|
</fieldset>
|
|
|
|
|
|
<p class="submit">
|
|
{{:button type="submit" shape="right" label="Valider mon vote" name="save" class="main"}}
|
|
</p>
|
|
</form>
|
|
|
|
|
|
{{else}}
|
|
<p class="alert block">
|
|
Aucun scrutin sélectionné. Il ne devrait y avoir aucune raison d'atterir sur cette page.
|
|
</p>
|
|
{{/if}} |