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;
}
}
|
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()
|