Blame view

orga.php 4.08 KB
97d25235   Erwan Nanrocki   ajout d un titre ...
1
2
  <h2> Organisation </h2>
  
27f3beb9   Geoffrey Bontoux-Preud-Homme   Ajout de orga.php
3
4
5
6
  <?php
  # DEBUG
  # e_ : est
  # r_ : a le droit de
f84e30e3   Geoffrey PREUD'HOMME   [Orga] Retravail
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
  
  $e_connecte = false;
  $e_modo = true;
  
  $droits  = array('voir', 'voter', 'ajouter', 'proposer', 'annuler', 'supprimer', 'modifier', 'valider');
  
  class Evenement
  {
      public $id = 0;
      public $nom = "Sans nom";
      public $description = "Sans description";
      public $annule = false;
      public $valide = false;
      public $duree = 120;
  
      public $dates = array();
  
      public function html() {
          global $droits;
  
          $html = '   <li class="list-group-item">';
  
          # Titre
          $html .= '<h3 class="list-group-item-heading">'.$this->nom;
          if ($this->annule) {
              $html .= ' <span class="label label-danger">Annulé</span>';
          }
          if (in_array('annuler', $droits) && !$this->annule) { # TODO
              $html .= ' <button type="button" class="btn btn-danger"><span class="glyphicon glyphicon glyphicon-remove"></span></button>';
          }
          if (in_array('supprimer', $droits) && !$this->valide) { # TODO
              $html .= ' <button type="button" class="btn btn-danger"><span class="glyphicon glyphicon glyphicon-trash"></span></button>';
          }
          $html .= '</h3>';
  
          # Description
          $html .= '<div class="panel panel-default">';
          $html .= '<div class="panel-heading">';
          $html .= '<h4 class="panel-title">Description';
          if (in_array('modifier', $droits)) {
              $html .= ' <button type="button" class="btn btn-default"><span class="glyphicon glyphicon-pencil"></span></button>';
          }
          $html .= '</h4>';
          $html .= '</div>';
          $html .= '<div class="panel-body">';
          $html .= '<p>';
          $html .= nl2br(htmlspecialchars($this->description));
          $html .= '</p>';
          // $html .= '<hr/>';
          $html .= '<p>';
          $html .= 'Durée : '.$this->duree.' minutes <br/>';
          if ($this->valide) {
              $html .= 'Date : '.date('c', $this->valide).'<br/>';
          }
          $html .= '</p>';
          if ($this->annule) {
              $html .= '<p class="alert alert-danger" role="alert">Annulé</p>';
  
          }
          $html .= '</div>';
          $html .= '</div>';
  
          # Dates
          if (!$this->valide && !$this->annule) {
              $html .= '<div class="panel panel-default">';
              $html .= '<div class="panel-heading">';
              $html .= '<h4 class="panel-title">Dates possibles';
              if (in_array('proposer', $droits)) {
                  $html .= '<button type="button" class="btn btn-default"><span class="glyphicon glyphicon-plus"></span></button>';
              }
              $html .= '</h4>';
              $html .= '</div>';
              $html .= '<div class="panel-body">';
              $html .= '<ul class="list-group">';
              foreach ($this->dates as $dateIndex => $date) {
                  $html .= '<li class="list-group-item">'.date('c', $date).' (6 <span class="glyphicon glyphicon-user"></span>)</li>';
              }
              $html .= '</ul>';
              if (in_array('valider', $droits) && !$this->valide) {
                  $html .= '<p><button type="button" class="btn btn-primary"><span class="glyphicon glyphicon-ok"></span> Valider la date</button></p>';
              }
              $html .= '</div>';
              $html .= '</div>';
          }
  
          $html .= '</li>';
          return $html;
      }
  }
  
27f3beb9   Geoffrey Bontoux-Preud-Homme   Ajout de orga.php
97
  ?>
27f3beb9   Geoffrey Bontoux-Preud-Homme   Ajout de orga.php
98
  
f84e30e3   Geoffrey PREUD'HOMME   [Orga] Retravail
99
100
101
102
103
104
105
106
107
  <h1>Évènements</h1>
  
  <h2>Plannifiés <button type="button" class="btn btn-primary"><span class="glyphicon glyphicon-plus"></span></button></h2>
  <ul class="list-group">
  <?
  $test1 = new Evenement;
  $test1->dates[] = time();
  $test1->valide = time();
  echo $test1->html()
27f3beb9   Geoffrey Bontoux-Preud-Homme   Ajout de orga.php
108
  ?>
f84e30e3   Geoffrey PREUD'HOMME   [Orga] Retravail
109
110
111
112
113
114
  <?
  $test2 = new Evenement;
  $test2->dates[] = time();
  $test2->valide = time();
  $test2->annule = true;
  echo $test2->html()
27f3beb9   Geoffrey Bontoux-Preud-Homme   Ajout de orga.php
115
  ?>
f84e30e3   Geoffrey PREUD'HOMME   [Orga] Retravail
116
117
  </ul>
  
27f3beb9   Geoffrey Bontoux-Preud-Homme   Ajout de orga.php
118
  
f84e30e3   Geoffrey PREUD'HOMME   [Orga] Retravail
119
120
121
122
123
124
  <h2>À plannifier <button type="button" class="btn btn-primary"><span class="glyphicon glyphicon-plus"></span></button></h2>
  <ul class="list-group">
  <?
  $test3 = new Evenement;
  $test3->dates[] = time();
  echo $test3->html()
97d25235   Erwan Nanrocki   ajout d un titre ...
125
  ?>
f84e30e3   Geoffrey PREUD'HOMME   [Orga] Retravail
126
127
128
129
130
131
132
133
134
135
136
137
  <?
  $test4 = new Evenement;
  $test4->dates[] = time();
  $test4->annule = true;
  echo $test4->html()
  ?>
  </ul>
  
  
  <h2>Évènements passés</h2>
  <ul class="list-group">
  </ul>