This repository has been archived by the owner on Sep 20, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathformulaire.inc.php
104 lines (95 loc) · 3.86 KB
/
formulaire.inc.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
<?php
/**
* Formualaire de vote
*/
$admin = isset($_GET['admin']);
$users = get_users_candidat_au_ca();
if (ag_depouillement()) {
ag_log_message('Accede au dépouillement du vote', 'depouillement');
// Si la page est celle du dépouillement, la liste des utilisateurs est modifiée pour ne conserver que les élus
$users = ag_faire_depouillement($users);
} else if(get_current_user_id()) {
ag_log_message('Accede au portail de vote','access');
}
?>
<center>
<strong>Association Coworking Metz</strong>
<h2>Élection du conseil d'administration</h2>
<p>Assemblée générale du
<?= date('d/m/Y', strtotime(ag_date())); ?>
</p>
</center>
<?php if (!get_current_user_id()) {?>
<center>
<p>Vous devez être connecté(e) avec votre compte coworker pour pouvoir voter.</p>
<a class="btn btn-solid btn-xlg semi-round btn-bordered border-thin ld_button_653a54d4ec23e lqd-unit-animation-done" href="/mon-compte/?redirect=/election-ca/"><span class="btn-txt">Connexion</span></a>
</center>
<?php } else {
?>
<form class="candidats" method="post" action="/election-ca" data-depouillement="<?=ag_depouillement()?'true':'false';?>">
<input type="hidden" name="action" value="election-ca">
<?php if (ag_depouillement()) { ?>
<?php ag_recap_depouillement($users); ?>
<?php } else { ?>
<center>
<?= pluriel(count($users),'candidat(e)'); ?> au total
</center>
<?php if (ag_voter()) { ?>
<div class="vote-status">
<div class="contenu">
<?php if (!is_user_electeur()) { ?>
<strong>Vous ne pouvez pas participer à ce vote</strong>
<?php } ?>
<?php if (a_deja_vote()) { ?>
<strong>Votre vote pour cette élection a été pris en compte.</strong>
<?php } ?>
</div>
<div>
<?php if (is_user_electeur() && !a_deja_vote()) { ?>
<button class="btn" type="submit">Valider votre choix</button>
<?php } ?>
</div>
</div>
<?php } ?>
<?php } ?>
<ul>
<?php
foreach ($users as $user) { ?>
<li>
<?php if (ag_voter() && !a_deja_vote()) { ?>
<input type="checkbox" name="candidats[]" value="<?= $user->ID; ?>"
title="Sélectionner <?= $user->display_name; ?>">
<?php } ?>
<span>
<strong>
<?= $user->display_name; ?>
</strong>
<?php if (ag_depouillement()) { ?>
<p>
<?= pluriel(ag_candidat_votes($user),'vote') ?>
</p>
<?php } ?>
</span>
<figure><span style="background-image:<?=ag_micro_pola_content($user->ID);?>"></span>
<img src="https://photos.coworking-metz.fr/polaroid/size/medium/<?= $user->ID; ?>.jpg">
</figure>
<?php if($admin) {?>
<a href="/wp-admin/user-edit.php?user_id=<?=$user->ID;?>">Editer</a>
<?php }?>
</li>
<?php } ?>
</ul>
</form>
<br><br>
<br><br>
<br><br>
<script>
// Variables mises à disposition de vote.js
const a_deja_vote = <?=json_encode(a_deja_vote());?>;
const ag_voter = <?= json_encode(ag_voter()); ?>;
const ag_max = <?= ag_max(); ?>;
const ag_min = <?= ag_min(); ?>;
</script>
<?php }?>
<style>
</style>