530 |
ddelon |
1 |
<?php
|
|
|
2 |
/*vim: set expandtab tabstop=4 shiftwidth=4: */
|
|
|
3 |
// +------------------------------------------------------------------------------------------------------+
|
|
|
4 |
// | PHP version 4.1 |
|
|
|
5 |
// +------------------------------------------------------------------------------------------------------+
|
|
|
6 |
// | Copyright (C) 2004 Tela Botanica (accueil@tela-botanica.org) |
|
|
|
7 |
// +------------------------------------------------------------------------------------------------------+
|
|
|
8 |
// | This library is free software; you can redistribute it and/or |
|
|
|
9 |
// | modify it under the terms of the GNU Lesser General Public |
|
|
|
10 |
// | License as published by the Free Software Foundation; either |
|
|
|
11 |
// | version 2.1 of the License, or (at your option) any later version. |
|
|
|
12 |
// | |
|
|
|
13 |
// | This library is distributed in the hope that it will be useful, |
|
|
|
14 |
// | but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
|
|
15 |
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
|
|
16 |
// | Lesser General Public License for more details. |
|
|
|
17 |
// | |
|
|
|
18 |
// | You should have received a copy of the GNU Lesser General Public |
|
|
|
19 |
// | License along with this library; if not, write to the Free Software |
|
|
|
20 |
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|
|
|
21 |
// +------------------------------------------------------------------------------------------------------+
|
1599 |
alexandre_ |
22 |
// CVS : $Id: bazar.fonct.cal.php,v 1.24 2007-09-18 07:36:32 alexandre_tb Exp $
|
530 |
ddelon |
23 |
/**
|
|
|
24 |
*
|
|
|
25 |
* Fonctions calendrier du module bazar
|
|
|
26 |
*
|
|
|
27 |
*@package bazar
|
|
|
28 |
//Auteur original :
|
|
|
29 |
*@author David Delon <david.delon@clapas.net>
|
|
|
30 |
//Autres auteurs :
|
|
|
31 |
*@copyright Tela-Botanica 2000-2004
|
1599 |
alexandre_ |
32 |
*@version $Revision: 1.24 $ $Date: 2007-09-18 07:36:32 $
|
530 |
ddelon |
33 |
// +------------------------------------------------------------------------------------------------------+
|
|
|
34 |
*/
|
|
|
35 |
|
|
|
36 |
// +------------------------------------------------------------------------------------------------------+
|
|
|
37 |
// | ENTETE du PROGRAMME |
|
|
|
38 |
// +------------------------------------------------------------------------------------------------------+
|
1298 |
neiluj |
39 |
|
626 |
florian |
40 |
require_once PAP_CHEMIN_RACINE.'api/pear/Calendar/Month/Weekdays.php';
|
|
|
41 |
require_once PAP_CHEMIN_RACINE.'api/pear/Calendar/Day.php';
|
|
|
42 |
require_once PAP_CHEMIN_RACINE.'api/pear/Calendar/Decorator.php';
|
530 |
ddelon |
43 |
|
|
|
44 |
// +------------------------------------------------------------------------------------------------------+
|
|
|
45 |
// | LISTE de FONCTIONS |
|
|
|
46 |
// +------------------------------------------------------------------------------------------------------+
|
|
|
47 |
|
|
|
48 |
// Classe Utilitaire pour Calendrier
|
|
|
49 |
class DiaryEvent extends Calendar_Decorator {
|
1252 |
jp_milcent |
50 |
var $entry = array();
|
|
|
51 |
function DiaryEvent($calendar)
|
|
|
52 |
{
|
530 |
ddelon |
53 |
Calendar_Decorator::Calendar_Decorator($calendar);
|
|
|
54 |
}
|
1252 |
jp_milcent |
55 |
function setEntry($entry)
|
|
|
56 |
{
|
|
|
57 |
$this->entry[] = $entry;
|
530 |
ddelon |
58 |
|
|
|
59 |
}
|
1252 |
jp_milcent |
60 |
function getEntry()
|
|
|
61 |
{
|
530 |
ddelon |
62 |
return $this->entry;
|
|
|
63 |
}
|
|
|
64 |
}
|
|
|
65 |
|
|
|
66 |
|
579 |
ddelon |
67 |
// $type : calendrier
|
|
|
68 |
// $type : calendrier_appplette
|
1459 |
alexandre_ |
69 |
function GestionAffichageCalendrier($arguments = array(), $type = 'calendrier') {
|
1579 |
alexandre_ |
70 |
$script = '';
|
1459 |
alexandre_ |
71 |
// recuperation des arguments de l applette
|
|
|
72 |
$balise = isset ($arguments[0]) ? $arguments[0] : '';
|
|
|
73 |
$tab_arguments = $arguments;
|
|
|
74 |
unset($tab_arguments[0]);
|
|
|
75 |
if (is_array($tab_arguments)) {
|
|
|
76 |
foreach($tab_arguments as $argument) {
|
|
|
77 |
if ($argument != '') {
|
|
|
78 |
$tab_parametres = explode('=', $argument, 2);
|
1482 |
florian |
79 |
if (is_array($tab_parametres)) {
|
|
|
80 |
$options[$tab_parametres[0]] =
|
|
|
81 |
(isset($tab_parametres[1])? trim($tab_parametres[1], '"') : '') ;
|
|
|
82 |
}
|
1459 |
alexandre_ |
83 |
}
|
|
|
84 |
}
|
|
|
85 |
}
|
|
|
86 |
|
|
|
87 |
if (!isset($options['template'])) {
|
|
|
88 |
$options['template'] = BAZ_CHEMIN_SQUELETTE.BAZ_SQUELETTE_DEFAUT;
|
|
|
89 |
} else {
|
|
|
90 |
if (file_exists(BAZ_CHEMIN_SQUELETTE.$options['template'])) {
|
|
|
91 |
$options['template'] = BAZ_CHEMIN_SQUELETTE.$options['template'];
|
|
|
92 |
}
|
|
|
93 |
}
|
|
|
94 |
|
1262 |
jp_milcent |
95 |
$retour = '';
|
1298 |
neiluj |
96 |
|
530 |
ddelon |
97 |
$url = $GLOBALS['_GEN_commun']['url'] ;
|
1252 |
jp_milcent |
98 |
$db =& $GLOBALS['_GEN_commun']['pear_db'] ;
|
|
|
99 |
$auth =& $GLOBALS['_GEN_commun']['pear_auth'] ;
|
530 |
ddelon |
100 |
|
1521 |
alexandre_ |
101 |
// Nettoyage de l'url de la query string
|
|
|
102 |
$chaine_url = $url->getQueryString();
|
|
|
103 |
$tab_params = explode('&', $chaine_url);
|
|
|
104 |
if (count($tab_params) == 0) {
|
|
|
105 |
$tab_params = explode('&', $chaine_url);
|
|
|
106 |
}
|
|
|
107 |
foreach ($tab_params as $param) {
|
|
|
108 |
$tab_parametre = explode('=', $param);
|
|
|
109 |
$url->removeQueryString($tab_parametre[0]);
|
|
|
110 |
}
|
|
|
111 |
|
530 |
ddelon |
112 |
if (!isset($_GET['y'])) {
|
|
|
113 |
$_GET['y'] = date('Y');
|
|
|
114 |
}
|
|
|
115 |
|
|
|
116 |
if (!isset($_GET['m'])) {
|
|
|
117 |
$_GET['m'] = date('m');
|
|
|
118 |
}
|
|
|
119 |
|
|
|
120 |
// Construction Mois en Cours
|
|
|
121 |
$month = new Calendar_Month_Weekdays($_GET['y'],$_GET['m']);
|
|
|
122 |
|
1252 |
jp_milcent |
123 |
$curStamp = $month->getTimeStamp();
|
|
|
124 |
$url->addQueryString('y', date('Y',$curStamp));
|
|
|
125 |
$url->addQueryString('m', date('n',$curStamp));
|
|
|
126 |
$url->addQueryString('d', date('j',$curStamp));
|
530 |
ddelon |
127 |
$cur = $url->getUrl();
|
1521 |
alexandre_ |
128 |
|
|
|
129 |
// Gestion de l'affichage des titres des évènements
|
|
|
130 |
if (isset($_GET['ctt']) && $_GET['ctt'] == '1') {
|
|
|
131 |
$url->addQueryString('tt', '0');
|
|
|
132 |
if (isset($_GET['tt']) && $_GET['tt'] == '0') {
|
|
|
133 |
$url->addQueryString('tt', '1');
|
|
|
134 |
}
|
|
|
135 |
$tc_lien = $url->getUrl();
|
|
|
136 |
} else {
|
|
|
137 |
$url->addQueryString('tt', '0');
|
|
|
138 |
if (isset($_GET['tt']) && $_GET['tt'] == '0') {
|
|
|
139 |
$url->addQueryString('tt', '1');
|
|
|
140 |
}
|
|
|
141 |
$url->addQueryString('ctt', '1');
|
|
|
142 |
$tc_lien = $url->getUrl();
|
|
|
143 |
}
|
|
|
144 |
$url->removeQueryString('ctt');
|
|
|
145 |
$url->removeQueryString('tt');
|
|
|
146 |
$tc_txt = 'Afficher les titres complets des évènements';
|
|
|
147 |
if (isset($_GET['tt']) && $_GET['tt'] == '0') {
|
|
|
148 |
$tc_txt = 'Tronquer les titres des évènements';
|
|
|
149 |
$url->addQueryString('tt', $_GET['tt']);
|
|
|
150 |
}
|
530 |
ddelon |
151 |
|
|
|
152 |
// Navigation
|
|
|
153 |
$prevStamp = $month->prevMonth(true);
|
1252 |
jp_milcent |
154 |
$url->addQueryString('y', date('Y',$prevStamp));
|
|
|
155 |
$url->addQueryString('m', date('n',$prevStamp));
|
|
|
156 |
$url->addQueryString('d', date('j',$prevStamp));
|
530 |
ddelon |
157 |
$prev = $url->getUrl();
|
1252 |
jp_milcent |
158 |
|
530 |
ddelon |
159 |
$nextStamp = $month->nextMonth(true);
|
1252 |
jp_milcent |
160 |
$url->addQueryString('y', date('Y',$nextStamp));
|
|
|
161 |
$url->addQueryString('m', date('n',$nextStamp));
|
|
|
162 |
$url->addQueryString('d', date('j',$nextStamp));
|
530 |
ddelon |
163 |
$next = $url->getUrl();
|
1252 |
jp_milcent |
164 |
|
1521 |
alexandre_ |
165 |
// Suppression du paramêtre de troncage des titres
|
|
|
166 |
$url->removeQueryString('tt');
|
|
|
167 |
|
1252 |
jp_milcent |
168 |
$fr_month = array( "1"=>BAZ_JANVIER,"2"=>BAZ_FEVRIER,"3"=>BAZ_MARS,"4"=>BAZ_AVRIL,"5"=>BAZ_MAI,"6"=>BAZ_JUIN,
|
|
|
169 |
"7"=>BAZ_JUILLET,"8"=>BAZ_AOUT,"9"=>BAZ_SEPTEMBRE,"10"=>BAZ_OCTOBRE,"11"=>BAZ_NOVEMBRE,"12"=>BAZ_DECEMBRE);
|
530 |
ddelon |
170 |
|
1521 |
alexandre_ |
171 |
// Titre
|
|
|
172 |
if ($type == 'calendrier') {
|
|
|
173 |
// Ajout des styles du bazar
|
|
|
174 |
if (defined('PAP_VERSION')) { //si on est dans Papyrus
|
|
|
175 |
GEN_stockerStyleExterne( 'bazar_interne', 'client/bazar/bazar.interne.css');
|
|
|
176 |
GEN_stockerFichierScript('domLib', '/api/js/domtooltip/domLib.js');
|
|
|
177 |
GEN_stockerFichierScript('domTT', '/api/js/domtooltip/domTT.js');
|
|
|
178 |
// DomToolTip
|
|
|
179 |
$script = 'var domTT_styleClass = "niceTitle";'."\n";
|
|
|
180 |
$script .= 'function nicetitleDecorator(el) {'."\n";
|
|
|
181 |
$script .= ' var result = el.title;'."\n";
|
|
|
182 |
$script .= ' result = result.replace(new RegExp("\n", "g"), "<br />");'."\n";
|
|
|
183 |
$script .= ' if (el.href) {'."\n";
|
|
|
184 |
$script .= ' result += "<p>" + el.href + "</p>";'."\n";
|
|
|
185 |
$script .= ' }'."\n";
|
|
|
186 |
$script .= ' return result;'."\n";
|
|
|
187 |
$script .= '}'."\n";
|
|
|
188 |
$script .= 'domTT_replaceTitles(nicetitleDecorator);'."\n";
|
|
|
189 |
GEN_stockerCodeScript('var domTT_styleClass = "niceTitle";'."\n");
|
|
|
190 |
}
|
|
|
191 |
$retour .= '<div id="cal_entete">';
|
|
|
192 |
$retour .= '<span class="cal_navigation">';
|
|
|
193 |
$retour .= '<a id="cal_precedent_lien" href="'.$prev.'" title="Allez au mois précédent"><img id="cal_precedent_img" src="client/bazar/images/cal_precedent.png" alt="<<"/></a>';
|
|
|
194 |
$retour .= ' ';
|
|
|
195 |
$retour .= '<span id="cal_encadre_mois_courrant"><a id="cal_mois_courrant" href="'.$cur.'">';
|
|
|
196 |
$retour .= $fr_month[(date('n',$curStamp))];
|
|
|
197 |
$retour .= ' ';
|
|
|
198 |
$retour .= (date('Y',$curStamp));
|
|
|
199 |
$retour .= '</a></span>';
|
|
|
200 |
$retour .= ' ';
|
|
|
201 |
$retour .= '<a id="cal_suivant_lien" href="'.$next.'" title="Allez au mois suivant"><img id="cal_suivant_img" src="client/bazar/images/cal_suivant.png" alt=">>"/></a>';
|
|
|
202 |
$retour .= '</span>';
|
|
|
203 |
$retour .= '<h1 id="cal_titre"><img id="cal_titre_img" src="client/bazar/images/cal_titre.png" alt="Calendrier"/></h1>';
|
|
|
204 |
$retour .= '</div>';
|
|
|
205 |
|
|
|
206 |
$retour .= '<p>'.'<a href="'.$tc_lien.'">'.$tc_txt.'</a>'.'</p>';
|
|
|
207 |
} else {
|
|
|
208 |
// Appel du template
|
|
|
209 |
ob_start();
|
|
|
210 |
include $options['template'];
|
|
|
211 |
$retour .= ob_get_contents();
|
|
|
212 |
ob_end_clean();
|
|
|
213 |
}
|
579 |
ddelon |
214 |
// Vue Mois calendrier ou vue applette
|
|
|
215 |
|
1521 |
alexandre_ |
216 |
if ((!isset($_GET['id_fiche']) && $type == 'calendrier') || ($type == 'calendrier_applette')){
|
1579 |
alexandre_ |
217 |
// trigger_error('ICI', E_USER_NOTICE);
|
530 |
ddelon |
218 |
// Recherche evenement de la periode selectionnée
|
1521 |
alexandre_ |
219 |
$ts_jour_fin_mois = $month->nextMonth('timestamp');
|
|
|
220 |
$ts_jour_debut_mois = $month->thisMonth('timestamp');;
|
|
|
221 |
$requete_evenements = "SELECT DISTINCT bf_id_fiche, bf_titre, bf_lieu_evenement, DAY(bf_date_debut_evenement) AS bf_jour_debut_evenement, bf_date_debut_evenement, bf_date_fin_evenement, bf_description ".
|
1221 |
jp_milcent |
222 |
"FROM bazar_fiche, bazar_nature ".
|
1521 |
alexandre_ |
223 |
"WHERE bf_date_debut_evenement < '".date('Y-m-d', $ts_jour_fin_mois)."' ".
|
|
|
224 |
"AND bf_date_fin_evenement >= '".date('Y-m-d', $ts_jour_debut_mois)."' ".
|
1221 |
jp_milcent |
225 |
"AND bf_ce_nature = bn_id_nature ".
|
1273 |
jp_milcent |
226 |
"AND bn_id_nature IN (".BAZ_NUM_ANNONCE_CALENDRIER.") ".
|
1471 |
alexandre_ |
227 |
"AND bf_statut_fiche = 1 ".
|
|
|
228 |
"ORDER BY bf_jour_debut_evenement";
|
1298 |
neiluj |
229 |
|
530 |
ddelon |
230 |
$resultat_evenement = $db->query($requete_evenements);
|
1298 |
neiluj |
231 |
|
1521 |
alexandre_ |
232 |
(DB::isError($resultat_evenement)) ? trigger_error(BOG_afficherErreurSql(__FILE__, __LINE__, $resultat_evenement->getMessage(), $requete_evenements), E_USER_WARNING) : '';
|
|
|
233 |
|
|
|
234 |
$selection = array();
|
|
|
235 |
$evenements = array();
|
|
|
236 |
$annee = date('Y', $curStamp);
|
|
|
237 |
$mois = date('m', $curStamp);
|
|
|
238 |
$tablo_jours = array();
|
530 |
ddelon |
239 |
while ($ligne_evenements = $resultat_evenement->fetchRow(DB_FETCHMODE_OBJECT)) {
|
1521 |
alexandre_ |
240 |
list($annee_debut, $mois_debut, $jour_debut) = explode('-', $ligne_evenements->bf_date_debut_evenement);
|
|
|
241 |
list($annee_fin, $mois_fin, $jour_fin) = explode('-', $ligne_evenements->bf_date_fin_evenement);
|
530 |
ddelon |
242 |
|
1521 |
alexandre_ |
243 |
$Calendrier = new Calendar($annee_debut, $mois_debut, $jour_debut);
|
|
|
244 |
$ts_jour_suivant = $Calendrier->thisDay('timestamp');
|
|
|
245 |
$ts_jour_fin = mktime(0,0,0,$mois_fin, $jour_fin, $annee_fin);
|
530 |
ddelon |
246 |
|
1521 |
alexandre_ |
247 |
if ($ts_jour_suivant < $ts_jour_fin) {
|
|
|
248 |
//echo "$ts_jour_suivant-";
|
|
|
249 |
$naviguer = true;
|
|
|
250 |
while ($naviguer) {
|
|
|
251 |
// Si le jours suivant est inférieur à la date de fin, on continue...
|
|
|
252 |
if ($ts_jour_suivant <= $ts_jour_fin) {
|
|
|
253 |
// Si le jours suivant est inférieur à la date de fin du mois courrant, on continue...
|
|
|
254 |
if ($ts_jour_suivant < $ts_jour_fin_mois) {
|
|
|
255 |
$cle_j = date('Y-m-d', $ts_jour_suivant);
|
|
|
256 |
if (!isset($tablo_jours[$cle_j])) {
|
|
|
257 |
$tablo_jours[$cle_j]['Calendar_Day'] = new Calendar_Day(date('Y', $ts_jour_suivant),date('m', $ts_jour_suivant), date('d', $ts_jour_suivant));
|
|
|
258 |
$tablo_jours[$cle_j]['Diary_Event'] = new DiaryEvent($tablo_jours[$cle_j]['Calendar_Day']);
|
|
|
259 |
}
|
|
|
260 |
$tablo_jours[$cle_j]['Diary_Event']->setEntry($ligne_evenements);
|
|
|
261 |
|
|
|
262 |
$ts_jour_suivant = $Calendrier->nextDay('timestamp');
|
|
|
263 |
//echo "ici$ts_jour_suivant-";
|
|
|
264 |
$Calendrier->setTimestamp($ts_jour_suivant);
|
|
|
265 |
//echo "la".$Calendrier->thisDay('timestamp')."-";
|
|
|
266 |
} else {
|
|
|
267 |
$naviguer = false;
|
|
|
268 |
}
|
|
|
269 |
} else {
|
|
|
270 |
$naviguer = false;
|
|
|
271 |
}
|
|
|
272 |
}
|
|
|
273 |
} else {
|
|
|
274 |
$curday_ymd = $annee.$mois.$ligne_evenements->bf_jour_debut_evenement;
|
|
|
275 |
$cle_j = $annee.'-'.$mois.'-'.$ligne_evenements->bf_jour_debut_evenement;
|
|
|
276 |
if (!isset($tablo_jours[$cle_j])) {
|
|
|
277 |
$tablo_jours[$cle_j]['Calendar_Day'] = new Calendar_Day($annee, $mois, $ligne_evenements->bf_jour_debut_evenement);
|
|
|
278 |
$tablo_jours[$cle_j]['Diary_Event'] = new DiaryEvent($tablo_jours[$cle_j]['Calendar_Day']);
|
|
|
279 |
}
|
|
|
280 |
$tablo_jours[$cle_j]['Diary_Event']->setEntry($ligne_evenements);
|
|
|
281 |
}
|
530 |
ddelon |
282 |
}
|
1521 |
alexandre_ |
283 |
// Add the decorator to the selection
|
|
|
284 |
foreach ($tablo_jours as $jour) {
|
|
|
285 |
$selection[] = $jour['Diary_Event'];
|
|
|
286 |
}
|
|
|
287 |
|
530 |
ddelon |
288 |
// Affichage Calendrier
|
|
|
289 |
$month->build($selection);
|
1521 |
alexandre_ |
290 |
if ($type == 'calendrier') {
|
|
|
291 |
$retour.= '<table class="calendrier">'.
|
|
|
292 |
'<colgroup>'.
|
|
|
293 |
'<col class="cal_lundi"/>'.
|
|
|
294 |
'<col class="cal_mardi"/>'.
|
|
|
295 |
'<col class="cal_mercredi"/>'.
|
|
|
296 |
'<col class="cal_jeudi"/>'.
|
|
|
297 |
'<col class="cal_vendredi"/>'.
|
|
|
298 |
'<col class="cal_samedi"/>'.
|
|
|
299 |
'<col class="cal_dimanche"/>'.
|
|
|
300 |
'</colgroup>'.
|
|
|
301 |
'<thead>'.
|
|
|
302 |
"<tr>
|
579 |
ddelon |
303 |
|
|
|
304 |
<th> ". BAZ_LUNDI ."</th>
|
|
|
305 |
<th> ". BAZ_MARDI ."</th>
|
|
|
306 |
<th> ". BAZ_MERCREDI ."</th>
|
|
|
307 |
<th> ". BAZ_JEUDI ."</th>
|
|
|
308 |
<th> ". BAZ_VENDREDI ."</th>
|
|
|
309 |
<th> ". BAZ_SAMEDI ."</th>
|
|
|
310 |
<th> ". BAZ_DIMANCHE ."</th>
|
|
|
311 |
</tr>
|
1521 |
alexandre_ |
312 |
".'</thead>'.'<tbody>';
|
|
|
313 |
} else {
|
|
|
314 |
$retour.= '<table class="calendrier_applette">'.
|
|
|
315 |
'<colgroup>'.
|
|
|
316 |
'<col class="cal_lundi"/>'.
|
|
|
317 |
'<col class="cal_mardi"/>'.
|
|
|
318 |
'<col class="cal_mercredi"/>'.
|
|
|
319 |
'<col class="cal_jeudi"/>'.
|
|
|
320 |
'<col class="cal_vendredi"/>'.
|
|
|
321 |
'<col class="cal_samedi"/>'.
|
|
|
322 |
'<col class="cal_dimanche"/>'.
|
|
|
323 |
'</colgroup>'.
|
|
|
324 |
'<thead>'.
|
|
|
325 |
"<tr>
|
579 |
ddelon |
326 |
|
|
|
327 |
<th> ". BAZ_LUNDI_COURT ."</th>
|
|
|
328 |
<th> ". BAZ_MARDI_COURT ."</th>
|
|
|
329 |
<th> ". BAZ_MERCREDI_COURT ."</th>
|
|
|
330 |
<th> ". BAZ_JEUDI_COURT ."</th>
|
|
|
331 |
<th> ". BAZ_VENDREDI_COURT ."</th>
|
|
|
332 |
<th> ". BAZ_SAMEDI_COURT ."</th>
|
|
|
333 |
<th> ". BAZ_DIMANCHE_COURT ."</th>
|
|
|
334 |
</tr>
|
1521 |
alexandre_ |
335 |
".'</thead>'.'<tbody>';
|
579 |
ddelon |
336 |
}
|
530 |
ddelon |
337 |
|
|
|
338 |
$todayStamp=time();
|
|
|
339 |
$today_ymd=date('Ymd',$todayStamp);
|
1521 |
alexandre_ |
340 |
|
530 |
ddelon |
341 |
// Other month : mois
|
|
|
342 |
while ($day = $month->fetch() ) {
|
1521 |
alexandre_ |
343 |
$dayStamp = $day->thisDay(true);
|
|
|
344 |
$day_ymd = date('Ymd',$dayStamp);
|
|
|
345 |
if ( $day->isEmpty() ) {
|
|
|
346 |
$class = "cal_ma other_month";
|
|
|
347 |
} else {
|
|
|
348 |
if (($day_ymd < $today_ymd)) {
|
|
|
349 |
$class= "cal_mp previous_month";
|
|
|
350 |
} else {
|
|
|
351 |
if ($day_ymd == $today_ymd) {
|
|
|
352 |
$class= "cal_jc current_day";
|
|
|
353 |
} else {
|
|
|
354 |
$class="cal_mc current_month";
|
|
|
355 |
}
|
530 |
ddelon |
356 |
}
|
1521 |
alexandre_ |
357 |
}
|
530 |
ddelon |
358 |
|
1521 |
alexandre_ |
359 |
$url->addQueryString ('y', date('Y',$dayStamp));
|
|
|
360 |
$url->addQueryString ('m', date('n',$dayStamp));
|
|
|
361 |
$url->addQueryString ('d', date('j',$dayStamp));
|
|
|
362 |
$link = $url->getUrl();
|
|
|
363 |
|
|
|
364 |
// isFirst() to find start of week
|
|
|
365 |
if ($day->isFirst()) {
|
|
|
366 |
$retour.= ( "<tr>\n" );
|
|
|
367 |
}
|
|
|
368 |
if ($type == 'calendrier') {
|
|
|
369 |
$retour.= "<td class=\"".$class."\">".'<span class="cal_j">'.$day->thisDay().'</span>'."\n";
|
|
|
370 |
if ($day->isSelected() ) {
|
|
|
371 |
$evenements = $day->getEntry();
|
|
|
372 |
$evenements_nbre = count($evenements);
|
|
|
373 |
$evenemt_xhtml = '';
|
|
|
374 |
while ($ligne_evenement = array_pop($evenements)) {
|
|
|
375 |
$id_fiches = array();
|
|
|
376 |
$id_fiches[] = $ligne_evenement->bf_id_fiche;
|
579 |
ddelon |
377 |
$url->addQueryString ('id_fiches',$id_fiches);
|
530 |
ddelon |
378 |
$link = $url->getUrl();
|
1521 |
alexandre_ |
379 |
|
|
|
380 |
if (!isset($_GET['tt']) || (isset($_GET['tt']) && $_GET['tt'] == '1')) {
|
|
|
381 |
$titre_taille = strlen($ligne_evenement->bf_titre);
|
|
|
382 |
$titre = ($titre_taille > 20)?substr($ligne_evenement->bf_titre, 0, 20).'...':$ligne_evenement->bf_titre;
|
|
|
383 |
} else {
|
|
|
384 |
$titre = $ligne_evenement->bf_titre;
|
|
|
385 |
}
|
|
|
386 |
$evenemt_xhtml .= '<li class="tooltip" title="'.$ligne_evenement->bf_titre.'"><a class="cal_evenemt" href="'.$link.'">'.$titre.'</a></li>'."\n";
|
579 |
ddelon |
387 |
$url->removeQueryString ('id_fiches');
|
530 |
ddelon |
388 |
}
|
1521 |
alexandre_ |
389 |
if ($evenements_nbre > 0) {
|
|
|
390 |
$retour .= '<ul class="cal_evenemt_liste">';
|
|
|
391 |
$retour .= $evenemt_xhtml;
|
|
|
392 |
$retour .= '</ul>';
|
|
|
393 |
}
|
530 |
ddelon |
394 |
}
|
1521 |
alexandre_ |
395 |
} else {
|
1599 |
alexandre_ |
396 |
$lien_date= "<td class=\"".$class."\">".$day->thisDay();
|
1521 |
alexandre_ |
397 |
if ($day->isSelected() ) {
|
|
|
398 |
$evenements=$day->getEntry();
|
|
|
399 |
$id_fiches=array();
|
|
|
400 |
while ($ligne_evenement=array_pop($evenements)) {
|
|
|
401 |
$id_fiches[]=$ligne_evenement->bf_id_fiche;
|
|
|
402 |
}
|
|
|
403 |
$url->addQueryString ('id_fiches',$id_fiches);
|
|
|
404 |
$link = $url->getUrl();
|
|
|
405 |
$lien_date= "<td class=\"".$class."\"><a href=\"".$link."\">".$day->thisDay()."</a>\n";
|
|
|
406 |
$url->removeQueryString ('id_fiches');
|
|
|
407 |
}
|
|
|
408 |
$retour.=$lien_date;
|
530 |
ddelon |
409 |
}
|
1521 |
alexandre_ |
410 |
$retour.= ( "</td>\n" );
|
530 |
ddelon |
411 |
|
1521 |
alexandre_ |
412 |
// isLast() to find end of week
|
|
|
413 |
if ( $day->isLast() ) {
|
|
|
414 |
$retour.= ( "</tr>\n" );
|
|
|
415 |
}
|
579 |
ddelon |
416 |
}
|
1521 |
alexandre_ |
417 |
$retour.= "</tbody></table>";
|
|
|
418 |
}
|
|
|
419 |
$retour.= '<script type="text/javascript">//<![CDATA['."\n".$script.'//]]></script>'."\n";
|
|
|
420 |
// Vue detail
|
|
|
421 |
|
|
|
422 |
if ((isset($_GET['id_fiches']))) {
|
|
|
423 |
// Ajout d'un titre pour la page avec la date
|
|
|
424 |
$jours = array ('lundi', 'mardi', 'mercredi', 'jeudi', 'vendredi', 'samedi', 'dimanche') ;
|
|
|
425 |
$mois = array ('janvier', 'février', 'mars', 'avril', 'mai', 'juin', 'juillet', 'août', 'septembre',
|
|
|
426 |
'octobre', 'novembre', 'décembre') ;
|
|
|
427 |
$timestamp = strtotime ($_GET['y'].'/'.$_GET['m'].'/'.$_GET['d']) ;
|
1298 |
neiluj |
428 |
|
1521 |
alexandre_ |
429 |
$GLOBALS['_PAPYRUS_']['rendu']['CONTENU_NAVIGATION'] = '';
|
|
|
430 |
$GLOBALS['_PAPYRUS_']['rendu']['CONTENU_TETE'] = '';
|
|
|
431 |
$GLOBALS['_PAPYRUS_']['rendu']['CONTENU_CORPS'] = '<h1>'.$jours[date('w', $timestamp)].
|
|
|
432 |
' '.$_GET['d'].' '.$mois[$_GET['m']-1].' '.$_GET['y'].'</h1>' ;
|
|
|
433 |
$GLOBALS['_PAPYRUS_']['rendu']['CONTENU_CORPS'] .= baz_voir_fiches(0,$_GET['id_fiches'] );
|
1599 |
alexandre_ |
434 |
|
1521 |
alexandre_ |
435 |
$GLOBALS['_GEN_commun']['info_menu'] = '';
|
1599 |
alexandre_ |
436 |
|
|
|
437 |
// Un lien pour retourner au calendrier
|
|
|
438 |
$url->removeQueryString('id_fiches');
|
|
|
439 |
$url->removeQueryString('y');
|
|
|
440 |
$url->removeQueryString('m');
|
|
|
441 |
$url->removeQueryString('d');
|
|
|
442 |
$GLOBALS['_PAPYRUS_']['rendu']['CONTENU_PIED'] = '<div class="retour"><a href="'.$url->getURL().'">Retour au calendrier</a></div>';
|
1521 |
alexandre_ |
443 |
}
|
|
|
444 |
|
|
|
445 |
// Nettoyage de l'url
|
|
|
446 |
$url->removeQueryString('id_fiches');
|
|
|
447 |
$url->removeQueryString('y');
|
|
|
448 |
$url->removeQueryString('m');
|
|
|
449 |
$url->removeQueryString('d');
|
1599 |
alexandre_ |
450 |
|
|
|
451 |
|
1521 |
alexandre_ |
452 |
return $retour;
|
|
|
453 |
}
|
530 |
ddelon |
454 |
?>
|