-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcalendrier2.php
114 lines (113 loc) · 3.82 KB
/
calendrier2.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
105
106
107
108
109
110
111
112
113
114
<?php
require('date.php');
$date = new Date();
$yearActuel = date('Y');
// Année de Départ
$yearD = $yearActuel;
// Année de Fin
$yearF = $yearActuel+1;
$month = date('n');
$monthActuel = date('n');
$events = $date -> getEvents($yearD,$yearF);
$affich = 0;
if (!isset($moisP)) {$moisP = $month; }
if (!isset($moisN)) {$moisN = $month; }
?>
<div id="calendar" class="home">
<div class="wrap">
<?php
for ($i = $yearD; $i <= $yearF; $i++) {
$year = $i;
$dates = $date -> getAll($year);
$dates = current($dates);
?>
<?php foreach($dates as $m=>$days): ?>
<div class="month<?php if($m >= $month AND $m <= $month+$afficher-1 AND $year == $yearActuel) { echo ' current'; } if($m == $monthActuel AND $year == $yearActuel) { echo ' actuel'; } ?>" id="<?php echo $year; ?>month<?php echo $m; ?>">
<?php
$annee = $year; $anneeP = $year; $anneeN = $year;
if ($m == 1) { $moisP = 12; $anneeP--; $moisN = $m+$afficher; }
else { $moisP = $m-$afficher; $moisN = $m+$afficher; }
?>
<?php if ($anneeP >= $yearD) : ?>
<div class="prev" id="<?php echo $anneeP; ?>-<?php echo $moisP; ?>"><a href="#"><img src="images/fl_violet2.png" alt="precedent" /></a></div>
<?php endif; ?>
<?php
if ($m == 12) { $moisN = 1; $anneeN++; $moisP = $m-$afficher;}
else { $moisN = $m+$afficher; $moisP = $m-$afficher;}
if($moisN > 12) $moisN = $moisN-12;
if($moisP < 1) $moisP = 12+$moisP;
?>
<div class="header">
<?php echo $date->months[$m-1]; ?>
<?php echo $year; ?>
</div>
<?php if ($anneeN <= $yearF) : ?>
<div class="next" id="<?php echo $anneeN; ?>-<?php echo $moisN; ?>"><a href="#"><img src="images/fl_violet.gif" alt="suivant" /></a></div>
<?php endif; ?>
<table>
<thead>
<tr>
<?php foreach ($date->days as $d): ?>
<th><?php echo substr($d,0,3);?></th>
<?php endforeach; ?>
</tr>
</thead>
<tbody>
<tr>
<?php $end = end($days); foreach ($days as $d=>$w): ?>
<?php $time = strtotime("$year-$m-$d");
?>
<?php if($d == 1 AND $w != 1): ?>
<td colspan="<?php echo $w-1; ?>" class="vide"></td>
<?php endif; ?>
<?php if(isset($events[$time])): ?>
<td class="couleur_attente">
<?php foreach($events[$time] as $k => $e): ?>
<?php $nb = count($events[$time]);
if($nb == 1) { ?>
<div class="day id<?php echo $k; ?>">
<?php if ($_SESSION['permission'] == 'admin') { ?>
<a href="?page=prive&show=gerer_res&voir=<?php echo $k; ?>" title="Voir la réservation"><?php echo $d; ?></a>
<?php } else echo $d; ?>
</div>
<div class="event <?php echo $e; ?>">
<span class="<?php echo $e; ?>"></span>
<?php if($e == 'rose'): ?>
Réservation en cours de confirmation
<?php elseif ($e == 'rouge'): ?>
Réservation confirmée
<?php elseif ($e == 'gris'): ?>
Indisponible
<?php endif; ?>
</div>
<?php }
else { ?>
<div class="day double">
<?php echo $d; ?>
<div class="infobulle">Jour de croisement</div>
<span class="double"></span>
</div>
<?php break;}
?>
<?php endforeach;?>
</td><?php else : ?>
<td>
<div class="day"><?php echo $d; ?></div>
</td>
<?php endif; ?>
<?php if ($w == 7): ?>
</tr><tr>
<?php endif; ?>
<?php endforeach; ?>
<?php if($end != 7): ?>
<td colspan="<?php echo 7-$end; ?>" class="vide"></td>
<?php endif; ?>
</tr>
</tbody>
</table>
</div>
<?php endforeach; ?>
<?php } ?>
</div>
</div>
<div class="clear"></div>