Commit e4f5453d7c418a02565951c3bab095dffbcdb139

Authored by Geoffrey PREUD'HOMME
1 parent 7797ea9c

[Orga] Meilleure lisibilitée

- Des labels avec les boutons !
- Droits selon l'utilisateur
Showing 1 changed file with 65 additions and 26 deletions   Show diff stats
1 -<h2> Organisation </h2> 1 +<h3> Organisation </h3>
2 2
3 <?php 3 <?php
4 4
  5 +$time = time();
  6 +
5 # DEBUG 7 # DEBUG
6 # e_ : est 8 # e_ : est
7 -$e_connecte = false; 9 +$e_connecte = true;
8 $e_modo = true; 10 $e_modo = true;
9 11
10 -$droits = array('voir', 'voter', 'ajouter', 'proposer', 'annuler', 'supprimer', 'modifier', 'valider');  
11 -$time = time(); 12 +if ($e_connecte) {
  13 + if ($e_modo) {
  14 + $droits = array('voir', 'voter', 'ajouter', 'proposer', 'annuler', 'supprimer', 'modifier', 'valider');
  15 + } else {
  16 + $droits = array('voir', 'voter');
  17 + }
  18 +} else {
  19 + $droits = array('voir');
  20 +}
  21 +
12 22
13 class Evenement 23 class Evenement
14 { 24 {
@@ -26,26 +36,30 @@ class Evenement @@ -26,26 +36,30 @@ class Evenement
26 public $datesVotes = array(); 36 public $datesVotes = array();
27 37
28 public function html() { 38 public function html() {
29 - $html = ' <li class="list-group-item">'; 39 + $html = '<li class="list-group-item';
  40 + if ($this->annule) {
  41 + $html .= ' list-group-item-danger';
  42 + }
  43 + $html .= '">';
30 44
31 # Titre 45 # Titre
32 - $html .= '<h3 class="list-group-item-heading">'.$this->nom; 46 + $html .= '<h4 class="list-group-item-heading">'.$this->nom;
33 if ($this->p_annuler()) { 47 if ($this->p_annuler()) {
34 - $html .= ' <button type="button" class="btn btn-danger"><span class="glyphicon glyphicon glyphicon-remove"></span></button>'; 48 + $html .= ' <button type="button" class="btn btn-warning"><span class="glyphicon glyphicon glyphicon-remove"></span> Annuler</button>';
35 } 49 }
36 if ($this->p_supprimer()) { 50 if ($this->p_supprimer()) {
37 - $html .= ' <button type="button" class="btn btn-danger"><span class="glyphicon glyphicon glyphicon-trash"></span></button>'; 51 + $html .= ' <button type="button" class="btn btn-danger"><span class="glyphicon glyphicon glyphicon-trash"></span> Supprimer</button>';
38 } 52 }
39 - $html .= '</h3>'; 53 + $html .= '</h4>';
40 54
41 # Description 55 # Description
42 $html .= '<div class="panel panel-default">'; 56 $html .= '<div class="panel panel-default">';
43 $html .= '<div class="panel-heading">'; 57 $html .= '<div class="panel-heading">';
44 - $html .= '<h4 class="panel-title">Description'; 58 + $html .= '<h5 class="panel-title">Informations';
45 if ($this->p_modifier()) { 59 if ($this->p_modifier()) {
46 - $html .= ' <button type="button" class="btn btn-default"><span class="glyphicon glyphicon-pencil"></span></button>'; 60 + $html .= ' <button type="button" class="btn btn-default"><span class="glyphicon glyphicon-pencil"></span> Modifier</button>';
47 } 61 }
48 - $html .= '</h4>'; 62 + $html .= '</h5>';
49 $html .= '</div>'; 63 $html .= '</div>';
50 $html .= '<div class="panel-body">'; 64 $html .= '<div class="panel-body">';
51 $html .= '<p>'; 65 $html .= '<p>';
@@ -62,7 +76,7 @@ class Evenement @@ -62,7 +76,7 @@ class Evenement
62 } 76 }
63 $html .= '</p>'; 77 $html .= '</p>';
64 if ($this->annule) { 78 if ($this->annule) {
65 - $html .= '<p class="alert alert-danger" role="alert">Annulé</p>'; 79 + $html .= '<p><span class="label label-danger">Annulé</span></p>';
66 80
67 } 81 }
68 $html .= '</div>'; 82 $html .= '</div>';
@@ -72,13 +86,16 @@ class Evenement @@ -72,13 +86,16 @@ class Evenement
72 if (!$this->valide && !$this->annule) { 86 if (!$this->valide && !$this->annule) {
73 $html .= '<div class="panel panel-default">'; 87 $html .= '<div class="panel panel-default">';
74 $html .= '<div class="panel-heading">'; 88 $html .= '<div class="panel-heading">';
75 - $html .= '<h4 class="panel-title">Dates possibles'; 89 + $html .= '<h5 class="panel-title">Dates possibles';
76 if ($this->p_proposer()) { 90 if ($this->p_proposer()) {
77 - $html .= ' <button type="button" class="btn btn-default"><span class="glyphicon glyphicon-plus"></span></button>'; 91 + $html .= ' <button type="button" class="btn btn-default"><span class="glyphicon glyphicon-plus"></span> Proposer une date</button>';
78 } 92 }
79 - $html .= '</h4>'; 93 + $html .= '</h5>';
80 $html .= '</div>'; 94 $html .= '</div>';
81 $html .= '<div class="panel-body">'; 95 $html .= '<div class="panel-body">';
  96 + if ($this->p_voter()) {
  97 + $html .= '<p>Sélectionnez les dates qui vous conviennent.</p>';
  98 + }
82 $html .= '<div class="list-group">'; 99 $html .= '<div class="list-group">';
83 $time = time(); 100 $time = time();
84 foreach ($this->dates as $dateIndex => $date) { 101 foreach ($this->dates as $dateIndex => $date) {
@@ -125,13 +142,19 @@ class Evenement @@ -125,13 +142,19 @@ class Evenement
125 return in_array('modifier', $droits); 142 return in_array('modifier', $droits);
126 } 143 }
127 144
  145 + function p_voter() {
  146 + global $droits;
  147 + return in_array('voter', $droits) && !$this->valide;
  148 + }
  149 +
128 function p_proposer() { 150 function p_proposer() {
129 global $droits; 151 global $droits;
130 - return in_array('proposer', $droits); 152 + return in_array('proposer', $droits) && !$this->valide;
131 } 153 }
132 154
133 function p_valider() { 155 function p_valider() {
134 global $droits; 156 global $droits;
  157 + # TODO Et si un nombre suffisant de personnes est ok avec la date la plus disponible
135 return in_array('valider', $droits) && !$this->valide; 158 return in_array('valider', $droits) && !$this->valide;
136 } 159 }
137 160
@@ -204,11 +227,19 @@ foreach ($evenements as $evenement) { @@ -204,11 +227,19 @@ foreach ($evenements as $evenement) {
204 227
205 ?> 228 ?>
206 229
207 -<h1>Évènements</h1>  
208 -  
209 -<h2>Plannifiés <button type="button" class="btn btn-primary"><span class="glyphicon glyphicon-plus"></span></button></h2> 230 +<?php
  231 +if (!$e_connecte) {
  232 +?>
  233 +<div class="alert alert-warning" role="alert">Connectez-vous afin de pouvoir agir sur les évènements.</div>
  234 +<?php
  235 +}
  236 +?>
  237 +<?php
  238 +if (in_array('voir', $droits)) {
  239 +?>
  240 +<h3>Évènements plannifiés <?php if (in_array('ajouter', $droits)) { ?><button type="button" class="btn btn-primary"><span class="glyphicon glyphicon-plus"></span> Ajouter un évènement avec une date fixée</button><?php } ?></h3>
210 <ul class="list-group"> 241 <ul class="list-group">
211 -<? 242 +<?php
212 foreach ($evenementsPlanifies as $evenement) { 243 foreach ($evenementsPlanifies as $evenement) {
213 echo $evenement->html(); 244 echo $evenement->html();
214 } 245 }
@@ -216,9 +247,9 @@ foreach ($evenementsPlanifies as $evenement) { @@ -216,9 +247,9 @@ foreach ($evenementsPlanifies as $evenement) {
216 </ul> 247 </ul>
217 248
218 249
219 -<h2>À plannifier <button type="button" class="btn btn-primary"><span class="glyphicon glyphicon-plus"></span></button></h2> 250 +<h3>Évènements à plannifier <?php if (in_array('ajouter', $droits)) { ?><button type="button" class="btn btn-primary"><span class="glyphicon glyphicon-plus"></span> Ajouter un évènement avec une date à choisir</button><?php } ?></h3>
220 <ul class="list-group"> 251 <ul class="list-group">
221 -<? 252 +<?php
222 foreach ($evenementsAPlanifier as $evenement) { 253 foreach ($evenementsAPlanifier as $evenement) {
223 echo $evenement->html(); 254 echo $evenement->html();
224 } 255 }
@@ -226,11 +257,19 @@ foreach ($evenementsAPlanifier as $evenement) { @@ -226,11 +257,19 @@ foreach ($evenementsAPlanifier as $evenement) {
226 </ul> 257 </ul>
227 258
228 259
229 -<h2>Évènements passés</h2> 260 +<h3>Évènements passés</h3>
230 <ul class="list-group"> 261 <ul class="list-group">
231 -<? 262 +<?php
232 foreach ($evenementsPasses as $evenement) { 263 foreach ($evenementsPasses as $evenement) {
233 echo $evenement->html(); 264 echo $evenement->html();
234 } 265 }
235 ?> 266 ?>
236 -</ul>  
237 \ No newline at end of file 267 \ No newline at end of file
  268 +</ul>
  269 +
  270 +<?php
  271 +} else {
  272 +?>
  273 +<div class="alert alert-danger" role="alert">Vous ne pouvez pas voir les évènements.</div>
  274 +<?php
  275 +}
  276 +?>
238 \ No newline at end of file 277 \ No newline at end of file