468 |
mathias |
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 |
// +------------------------------------------------------------------------------------------------------+
|
|
|
22 |
// CVS : $Id: bazar.fonct.cal.php,v 1.29 2008-10-29 10:38:51 alexandre_tb Exp $
|
|
|
23 |
/**
|
|
|
24 |
*
|
|
|
25 |
* Fonctions calendrier du module bazar
|
|
|
26 |
*
|
|
|
27 |
* TODO : ajouter la gestion du multilinguisme
|
|
|
28 |
*
|
|
|
29 |
*@package bazar
|
|
|
30 |
//Auteur original :
|
|
|
31 |
*@author David Delon <david.delon@clapas.net>
|
|
|
32 |
//Autres auteurs :
|
|
|
33 |
*@copyright Tela-Botanica 2000-2004
|
|
|
34 |
*@version $Revision: 1.29 $ $Date: 2008-10-29 10:38:51 $
|
|
|
35 |
// +------------------------------------------------------------------------------------------------------+
|
|
|
36 |
*/
|
|
|
37 |
|
|
|
38 |
// +------------------------------------------------------------------------------------------------------+
|
|
|
39 |
// | ENTETE du PROGRAMME |
|
|
|
40 |
// +------------------------------------------------------------------------------------------------------+
|
|
|
41 |
|
|
|
42 |
require_once PAP_CHEMIN_RACINE.'api/pear/Calendar/Month/Weekdays.php';
|
|
|
43 |
require_once PAP_CHEMIN_RACINE.'api/pear/Calendar/Day.php';
|
|
|
44 |
require_once PAP_CHEMIN_RACINE.'api/pear/Calendar/Decorator.php';
|
|
|
45 |
|
|
|
46 |
// +------------------------------------------------------------------------------------------------------+
|
|
|
47 |
// | LISTE de FONCTIONS |
|
|
|
48 |
// +------------------------------------------------------------------------------------------------------+
|
|
|
49 |
|
|
|
50 |
// Classe Utilitaire pour Calendrier
|
|
|
51 |
class DiaryEvent extends Calendar_Decorator {
|
|
|
52 |
var $entry = array();
|
|
|
53 |
function DiaryEvent($calendar)
|
|
|
54 |
{
|
|
|
55 |
Calendar_Decorator::Calendar_Decorator($calendar);
|
|
|
56 |
}
|
|
|
57 |
function setEntry($entry)
|
|
|
58 |
{
|
|
|
59 |
$this->entry[] = $entry;
|
|
|
60 |
|
|
|
61 |
}
|
|
|
62 |
function getEntry()
|
|
|
63 |
{
|
|
|
64 |
return $this->entry;
|
|
|
65 |
}
|
|
|
66 |
}
|
|
|
67 |
|
|
|
68 |
|
|
|
69 |
// $type : calendrier
|
|
|
70 |
// $type : calendrier_appplette
|
|
|
71 |
function GestionAffichageCalendrier($arguments = array(), $type = 'calendrier') {
|
|
|
72 |
$script = '';
|
|
|
73 |
// recuperation des arguments de l applette
|
|
|
74 |
$balise = isset ($arguments[0]) ? $arguments[0] : '';
|
|
|
75 |
$tab_arguments = $arguments;
|
|
|
76 |
if (is_string ($tab_arguments)) {
|
|
|
77 |
$tab_arguments = substr($tab_arguments, 1);
|
|
|
78 |
} else {
|
|
|
79 |
unset($tab_arguments[0]);
|
|
|
80 |
}
|
|
|
81 |
if (is_array($tab_arguments)) {
|
|
|
82 |
foreach($tab_arguments as $argument) {
|
|
|
83 |
if ($argument != '') {
|
|
|
84 |
$tab_parametres = explode('=', $argument, 2);
|
|
|
85 |
if (is_array($tab_parametres)) {
|
|
|
86 |
$options[$tab_parametres[0]] =
|
|
|
87 |
(isset($tab_parametres[1])? trim($tab_parametres[1], '"') : '') ;
|
|
|
88 |
}
|
|
|
89 |
}
|
|
|
90 |
}
|
|
|
91 |
}
|
|
|
92 |
|
|
|
93 |
if (!isset($options['template'])) {
|
|
|
94 |
$options['template'] = BAZ_CHEMIN_SQUELETTE.BAZ_SQUELETTE_DEFAUT;
|
|
|
95 |
} else {
|
|
|
96 |
if (file_exists(BAZ_CHEMIN_SQUELETTE.$options['template'])) {
|
|
|
97 |
$options['template'] = BAZ_CHEMIN_SQUELETTE.$options['template'];
|
|
|
98 |
}
|
|
|
99 |
}
|
|
|
100 |
|
|
|
101 |
$retour = '';
|
|
|
102 |
|
|
|
103 |
$url = $GLOBALS['_GEN_commun']['url'] ;
|
|
|
104 |
$db =& $GLOBALS['_GEN_commun']['pear_db'] ;
|
|
|
105 |
$auth =& $GLOBALS['_GEN_commun']['pear_auth'] ;
|
|
|
106 |
|
|
|
107 |
// Nettoyage de l'url de la query string
|
|
|
108 |
$chaine_url = $url->getQueryString();
|
|
|
109 |
$tab_params = explode('&', $chaine_url);
|
|
|
110 |
if (count($tab_params) == 0) {
|
|
|
111 |
$tab_params = explode('&', $chaine_url);
|
|
|
112 |
}
|
|
|
113 |
foreach ($tab_params as $param) {
|
|
|
114 |
$tab_parametre = explode('=', $param);
|
479 |
mathias |
115 |
// note d'Aur�lien, si on nettoie l'URL on perd la vue en cours
|
468 |
mathias |
116 |
//$url->removeQueryString($tab_parametre[0]);
|
|
|
117 |
}
|
|
|
118 |
|
|
|
119 |
if (!isset($_GET['y'])) {
|
|
|
120 |
$_GET['y'] = date('Y');
|
|
|
121 |
}
|
|
|
122 |
|
|
|
123 |
if (!isset($_GET['m'])) {
|
|
|
124 |
$_GET['m'] = date('m');
|
|
|
125 |
}
|
|
|
126 |
|
|
|
127 |
// Construction Mois en Cours
|
|
|
128 |
$month = new Calendar_Month_Weekdays($_GET['y'],$_GET['m']);
|
|
|
129 |
|
|
|
130 |
$curStamp = $month->getTimeStamp();
|
|
|
131 |
$url->addQueryString('y', date('Y',$curStamp));
|
|
|
132 |
$url->addQueryString('m', date('n',$curStamp));
|
|
|
133 |
$url->addQueryString('d', date('j',$curStamp));
|
|
|
134 |
$cur = $url->getUrl();
|
|
|
135 |
|
479 |
mathias |
136 |
// Gestion de l'affichage du filtre des natures d'�v�nements
|
468 |
mathias |
137 |
$cal_num_annonce = BAZ_NUM_ANNONCE_CALENDRIER;
|
|
|
138 |
$ficnat_id = null;
|
|
|
139 |
if (isset($_GET['ficnat']) && $_GET['ficnat'] != '*') {
|
|
|
140 |
$ficnat_id = $_GET['ficnat'];
|
|
|
141 |
$url->addQueryString('ficnat', $_GET['ficnat']);
|
|
|
142 |
$cal_num_annonce = $_GET['ficnat'];
|
|
|
143 |
}
|
|
|
144 |
|
479 |
mathias |
145 |
// Gestion de l'affichage des titres des �v�nements
|
468 |
mathias |
146 |
if (isset($_GET['ctt']) && $_GET['ctt'] == '1') {
|
|
|
147 |
$url->addQueryString('tt', '0');
|
|
|
148 |
if (isset($_GET['tt']) && $_GET['tt'] == '0') {
|
|
|
149 |
$url->addQueryString('tt', '1');
|
|
|
150 |
}
|
|
|
151 |
$tc_lien = $url->getUrl();
|
|
|
152 |
} else {
|
|
|
153 |
$url->addQueryString('tt', '0');
|
|
|
154 |
if (isset($_GET['tt']) && $_GET['tt'] == '0') {
|
|
|
155 |
$url->addQueryString('tt', '1');
|
|
|
156 |
}
|
|
|
157 |
$url->addQueryString('ctt', '1');
|
|
|
158 |
$tc_lien = $url->getUrl();
|
|
|
159 |
}
|
|
|
160 |
$url->removeQueryString('ctt');
|
|
|
161 |
$url->removeQueryString('tt');
|
490 |
mathias |
162 |
$tc_txt = 'Afficher les titres complets des événements';
|
468 |
mathias |
163 |
if (isset($_GET['tt']) && $_GET['tt'] == '0') {
|
479 |
mathias |
164 |
$tc_txt = 'Tronquer les titres des �v�nements';
|
468 |
mathias |
165 |
$url->addQueryString('tt', $_GET['tt']);
|
|
|
166 |
}
|
|
|
167 |
|
479 |
mathias |
168 |
// Gestion des champs cach�s pour le formulaire de filtre
|
|
|
169 |
// Attention � la position dans le fichier...
|
468 |
mathias |
170 |
$ficnat_chps_cache = $url->querystring;
|
|
|
171 |
unset($ficnat_chps_cache['ficnat']);
|
|
|
172 |
|
|
|
173 |
// Navigation
|
|
|
174 |
$prevStamp = $month->prevMonth(true);
|
|
|
175 |
$url->addQueryString('y', date('Y',$prevStamp));
|
|
|
176 |
$url->addQueryString('m', date('n',$prevStamp));
|
|
|
177 |
$url->addQueryString('d', date('j',$prevStamp));
|
|
|
178 |
$prev = $url->getUrl();
|
|
|
179 |
|
|
|
180 |
$nextStamp = $month->nextMonth(true);
|
|
|
181 |
$url->addQueryString('y', date('Y',$nextStamp));
|
|
|
182 |
$url->addQueryString('m', date('n',$nextStamp));
|
|
|
183 |
$url->addQueryString('d', date('j',$nextStamp));
|
|
|
184 |
$next = $url->getUrl();
|
|
|
185 |
|
479 |
mathias |
186 |
// Suppression du param�tre de troncage des titres
|
468 |
mathias |
187 |
$url->removeQueryString('tt');
|
|
|
188 |
|
|
|
189 |
$fr_month = array( "1"=>BAZ_JANVIER,"2"=>BAZ_FEVRIER,"3"=>BAZ_MARS,"4"=>BAZ_AVRIL,"5"=>BAZ_MAI,"6"=>BAZ_JUIN,
|
|
|
190 |
"7"=>BAZ_JUILLET,"8"=>BAZ_AOUT,"9"=>BAZ_SEPTEMBRE,"10"=>BAZ_OCTOBRE,"11"=>BAZ_NOVEMBRE,"12"=>BAZ_DECEMBRE);
|
|
|
191 |
|
479 |
mathias |
192 |
// R�cup�ration des infos sur les natures des fiches pour le filtre
|
468 |
mathias |
193 |
$requete_nature_fiche = 'SELECT DISTINCT bn_id_nature, bn_ce_i18n, bn_label_nature '.
|
|
|
194 |
'FROM bazar_nature '.
|
|
|
195 |
'WHERE bn_id_nature IN ('.BAZ_NUM_ANNONCE_CALENDRIER.') ';
|
|
|
196 |
$resultat_nature_fiche = $db->query($requete_nature_fiche);
|
|
|
197 |
(DB::isError($resultat_nature_fiche)) ? trigger_error(BOG_afficherErreurSql(__FILE__, __LINE__, $resultat_nature_fiche->getMessage(), $requete_nature_fiche), E_USER_WARNING) : '';
|
|
|
198 |
|
|
|
199 |
// Ajout du javascript et des styles du bazar
|
|
|
200 |
if (defined('PAP_VERSION')) { //si on est dans Papyrus
|
479 |
mathias |
201 |
GEN_stockerStyleExterne( 'bazar_interne', 'reseau/bazar/bazar.interne.css');
|
468 |
mathias |
202 |
GEN_stockerFichierScript('domLib', '/api/js/domtooltip/domLib.js');
|
|
|
203 |
GEN_stockerFichierScript('domTT', '/api/js/domtooltip/domTT.js');
|
|
|
204 |
|
|
|
205 |
// DomToolTip
|
|
|
206 |
$script = 'var domTT_styleClass = "niceTitle";'."\n";
|
|
|
207 |
$script .= 'function nicetitleDecorator(el) {'."\n";
|
|
|
208 |
$script .= ' var result = el.title;'."\n";
|
|
|
209 |
$script .= ' result = result.replace(new RegExp("\n", "g"), "<br />");'."\n";
|
|
|
210 |
$script .= ' //if (el.href) {'."\n";
|
|
|
211 |
$script .= ' //result += "<p>" + el.href + "<\/p>";'."\n";
|
|
|
212 |
$script .= ' //}'."\n";
|
|
|
213 |
$script .= ' return result;'."\n";
|
|
|
214 |
$script .= '}'."\n";
|
|
|
215 |
$script .= 'domTT_replaceTitles(nicetitleDecorator);'."\n";
|
|
|
216 |
GEN_stockerCodeScript('var domTT_styleClass = "niceTitle";'."\n");
|
|
|
217 |
}
|
|
|
218 |
|
|
|
219 |
// Titre
|
|
|
220 |
if ($type == 'calendrier') {
|
|
|
221 |
$retour .= '<div id="cal_entete">'."\n";
|
|
|
222 |
$retour .= '<span class="cal_navigation">'."\n";
|
479 |
mathias |
223 |
$retour .= '<a id="cal_precedent_lien" href="'.$prev.'" title="Allez au mois pr�c�dent"><img id="cal_precedent_img" src="reseau/bazar/images/cal_precedent.png" alt="<<"/></a>'."\n";
|
468 |
mathias |
224 |
$retour .= ' '."\n";
|
|
|
225 |
$retour .= '<span id="cal_encadre_mois_courrant"><a id="cal_mois_courrant" href="'.$cur.'">';
|
|
|
226 |
$retour .= $fr_month[(date('n',$curStamp))];
|
|
|
227 |
$retour .= ' ';
|
|
|
228 |
$retour .= (date('Y',$curStamp));
|
|
|
229 |
$retour .= '</a></span>'."\n";
|
|
|
230 |
$retour .= ' '."\n";
|
479 |
mathias |
231 |
$retour .= '<a id="cal_suivant_lien" href="'.$next.'" title="Allez au mois suivant"><img id="cal_suivant_img" src="reseau/bazar/images/cal_suivant.png" alt=">>"/></a>'."\n";
|
468 |
mathias |
232 |
$retour .= '</span>'."\n";
|
479 |
mathias |
233 |
$retour .= '<h1 id="cal_titre"><img id="cal_titre_img" src="reseau/bazar/images/cal_titre.png" alt="Calendrier"/></h1>'."\n";
|
468 |
mathias |
234 |
$retour .= '</div>'."\n";
|
|
|
235 |
|
|
|
236 |
$retour .= '<form action="'.$tc_lien.'" method="get">'."\n";
|
|
|
237 |
$retour .= '<a href="'.$tc_lien.'">'.$tc_txt.'</a>'."\n";
|
|
|
238 |
$retour .= '<fieldset>'."\n";
|
|
|
239 |
$retour .= '<legend>'.'Filtrer : '.'</legend>'."\n";
|
|
|
240 |
$retour .= '<select id="ficnat" name="ficnat" class="filtre_'.((!is_null($ficnat_id)) ? $ficnat_id: 'tous').'" onchange="javascript:this.form.submit();">'."\n";
|
|
|
241 |
|
|
|
242 |
$retour .= '<option id="filtre_tous" value="*" ';
|
|
|
243 |
if (isset($_GET['ficnat']) && '*' == $_GET['ficnat']) {
|
|
|
244 |
$retour .= 'selected="selected" ';
|
|
|
245 |
}
|
|
|
246 |
$retour .= '>'.'Tout afficher'.'</option>';
|
|
|
247 |
|
|
|
248 |
while ($ligne_nature_fiche = $resultat_nature_fiche->fetchRow(DB_FETCHMODE_OBJECT)) {
|
|
|
249 |
$opt = '<option class="filtre_'.$ligne_nature_fiche->bn_id_nature.'" value="'.$ligne_nature_fiche->bn_id_nature.'" ';
|
|
|
250 |
if (isset($_GET['ficnat']) && $ligne_nature_fiche->bn_id_nature == $_GET['ficnat']) {
|
|
|
251 |
$opt .= 'selected="selected" ';
|
|
|
252 |
}
|
|
|
253 |
$opt .= '>';
|
|
|
254 |
|
|
|
255 |
$retour .= $opt.$ligne_nature_fiche->bn_label_nature.'</option>'."\n";
|
|
|
256 |
}
|
|
|
257 |
|
|
|
258 |
$retour .= '</select>'."\n";
|
|
|
259 |
$retour .= '<input id="ficnat_ok" type="submit" value="'.'OK'.'" onload="javascript:this.setAttribute(\'style\', \'display:none;\')"/>'."\n";
|
|
|
260 |
$script_ok = 'if (document.getElementById(\'ficnat_ok\')) {'.
|
|
|
261 |
' document.getElementById(\'ficnat_ok\').style.display = \'none\';'.
|
|
|
262 |
'}';
|
|
|
263 |
$retour.= '<script type="text/javascript">//<![CDATA['."\n".$script_ok.'//]]></script>'."\n";
|
|
|
264 |
foreach ($ficnat_chps_cache as $cle => $val) {
|
|
|
265 |
$retour .= '<input id="'.$cle.'" name="'.$cle.'" type="hidden" value="'.$val.'" />'."\n";
|
|
|
266 |
}
|
|
|
267 |
$retour .= '</fieldset>'."\n";
|
|
|
268 |
$retour .= '</form>'."\n";
|
|
|
269 |
|
|
|
270 |
} else {
|
|
|
271 |
// Appel du template
|
|
|
272 |
ob_start();
|
|
|
273 |
include $options['template'];
|
|
|
274 |
$retour .= ob_get_contents();
|
|
|
275 |
ob_end_clean();
|
|
|
276 |
}
|
|
|
277 |
// Vue Mois calendrier ou vue applette
|
|
|
278 |
|
|
|
279 |
if ((!isset($_GET['id_fiche']) && $type == 'calendrier') || ($type == 'calendrier_applette')){
|
|
|
280 |
// trigger_error('ICI', E_USER_NOTICE);
|
479 |
mathias |
281 |
// Recherche evenement de la periode selectionn�e
|
468 |
mathias |
282 |
$ts_jour_fin_mois = $month->nextMonth('timestamp');
|
|
|
283 |
$ts_jour_debut_mois = $month->thisMonth('timestamp');;
|
|
|
284 |
$requete_evenements = "SELECT DISTINCT bf_id_fiche, bf_titre, bf_lieu_evenement, ".
|
|
|
285 |
" DAY(bf_date_debut_evenement) AS bf_jour_debut_evenement, bf_date_debut_evenement, ".
|
|
|
286 |
" bf_date_fin_evenement, bf_description, bn_id_nature ".
|
|
|
287 |
"FROM bazar_fiche, bazar_nature ".
|
|
|
288 |
"WHERE bf_date_debut_evenement < '".date('Y-m-d', $ts_jour_fin_mois)."' ".
|
|
|
289 |
"AND bf_date_fin_evenement >= '".date('Y-m-d', $ts_jour_debut_mois)."' ".
|
|
|
290 |
"AND bf_ce_nature = bn_id_nature ".
|
|
|
291 |
"AND bn_id_nature IN (".$cal_num_annonce.") ".
|
|
|
292 |
"AND bf_statut_fiche = 1 ".
|
|
|
293 |
"ORDER BY bf_jour_debut_evenement";
|
|
|
294 |
|
|
|
295 |
$resultat_evenement = $db->query($requete_evenements);
|
|
|
296 |
|
|
|
297 |
(DB::isError($resultat_evenement)) ? trigger_error(BOG_afficherErreurSql(__FILE__, __LINE__, $resultat_evenement->getMessage(), $requete_evenements), E_USER_WARNING) : '';
|
|
|
298 |
|
|
|
299 |
$selection = array();
|
|
|
300 |
$evenements = array();
|
|
|
301 |
$annee = date('Y', $curStamp);
|
|
|
302 |
$mois = date('m', $curStamp);
|
|
|
303 |
$tablo_jours = array();
|
|
|
304 |
while ($ligne_evenements = $resultat_evenement->fetchRow(DB_FETCHMODE_OBJECT)) {
|
|
|
305 |
list($annee_debut, $mois_debut, $jour_debut) = explode('-', $ligne_evenements->bf_date_debut_evenement);
|
|
|
306 |
list($annee_fin, $mois_fin, $jour_fin) = explode('-', $ligne_evenements->bf_date_fin_evenement);
|
|
|
307 |
|
|
|
308 |
$Calendrier = new Calendar($annee_debut, $mois_debut, $jour_debut);
|
|
|
309 |
$ts_jour_suivant = $Calendrier->thisDay('timestamp');
|
|
|
310 |
$ts_jour_fin = mktime(0,0,0,$mois_fin, $jour_fin, $annee_fin);
|
|
|
311 |
|
|
|
312 |
$naviguer = true;
|
|
|
313 |
while ($naviguer && ($ts_jour_suivant <= $ts_jour_fin)) {
|
|
|
314 |
// Si le jours suivant est inferieur a la date de fin du mois courrant, on continue...
|
|
|
315 |
if ($ts_jour_suivant < $ts_jour_fin_mois) {
|
|
|
316 |
$cle_j = date('Y-m-d', $ts_jour_suivant);
|
|
|
317 |
if (!isset($tablo_jours[$cle_j])) {
|
|
|
318 |
$tablo_jours[$cle_j]['Calendar_Day'] = new Calendar_Day(date('Y', $ts_jour_suivant),date('m', $ts_jour_suivant), date('d', $ts_jour_suivant));
|
|
|
319 |
$tablo_jours[$cle_j]['Diary_Event'] = new DiaryEvent($tablo_jours[$cle_j]['Calendar_Day']);
|
|
|
320 |
}
|
|
|
321 |
$tablo_jours[$cle_j]['Diary_Event']->setEntry($ligne_evenements);
|
|
|
322 |
|
|
|
323 |
$ts_jour_suivant = $Calendrier->nextDay('timestamp');
|
|
|
324 |
//echo "ici$ts_jour_suivant-";
|
|
|
325 |
$Calendrier->setTimestamp($ts_jour_suivant);
|
|
|
326 |
//echo "la".$Calendrier->thisDay('timestamp')."-";
|
|
|
327 |
} else {
|
|
|
328 |
$naviguer = false;
|
|
|
329 |
}
|
|
|
330 |
}
|
|
|
331 |
}
|
|
|
332 |
// Add the decorator to the selection
|
|
|
333 |
foreach ($tablo_jours as $jour) {
|
|
|
334 |
$selection[] = $jour['Diary_Event'];
|
|
|
335 |
}
|
|
|
336 |
|
|
|
337 |
// Affichage Calendrier
|
|
|
338 |
$month->build($selection);
|
|
|
339 |
if ($type == 'calendrier') {
|
|
|
340 |
$retour.= '<table class="calendrier">'.
|
|
|
341 |
'<colgroup>'.
|
|
|
342 |
'<col class="cal_lundi"/>'.
|
|
|
343 |
'<col class="cal_mardi"/>'.
|
|
|
344 |
'<col class="cal_mercredi"/>'.
|
|
|
345 |
'<col class="cal_jeudi"/>'.
|
|
|
346 |
'<col class="cal_vendredi"/>'.
|
|
|
347 |
'<col class="cal_samedi"/>'.
|
|
|
348 |
'<col class="cal_dimanche"/>'.
|
|
|
349 |
'</colgroup>'.
|
|
|
350 |
'<thead>'.
|
|
|
351 |
"<tr>
|
|
|
352 |
|
|
|
353 |
<th> ". BAZ_LUNDI ."</th>
|
|
|
354 |
<th> ". BAZ_MARDI ."</th>
|
|
|
355 |
<th> ". BAZ_MERCREDI ."</th>
|
|
|
356 |
<th> ". BAZ_JEUDI ."</th>
|
|
|
357 |
<th> ". BAZ_VENDREDI ."</th>
|
|
|
358 |
<th> ". BAZ_SAMEDI ."</th>
|
|
|
359 |
<th> ". BAZ_DIMANCHE ."</th>
|
|
|
360 |
</tr>
|
|
|
361 |
".'</thead>'.'<tbody>';
|
|
|
362 |
} else {
|
|
|
363 |
$retour.= '<table class="calendrier_applette">'.
|
|
|
364 |
'<colgroup>'.
|
|
|
365 |
'<col class="cal_lundi"/>'.
|
|
|
366 |
'<col class="cal_mardi"/>'.
|
|
|
367 |
'<col class="cal_mercredi"/>'.
|
|
|
368 |
'<col class="cal_jeudi"/>'.
|
|
|
369 |
'<col class="cal_vendredi"/>'.
|
|
|
370 |
'<col class="cal_samedi"/>'.
|
|
|
371 |
'<col class="cal_dimanche"/>'.
|
|
|
372 |
'</colgroup>'.
|
|
|
373 |
'<thead>'.
|
|
|
374 |
"<tr>
|
|
|
375 |
|
|
|
376 |
<th> ". BAZ_LUNDI_COURT ."</th>
|
|
|
377 |
<th> ". BAZ_MARDI_COURT ."</th>
|
|
|
378 |
<th> ". BAZ_MERCREDI_COURT ."</th>
|
|
|
379 |
<th> ". BAZ_JEUDI_COURT ."</th>
|
|
|
380 |
<th> ". BAZ_VENDREDI_COURT ."</th>
|
|
|
381 |
<th> ". BAZ_SAMEDI_COURT ."</th>
|
|
|
382 |
<th> ". BAZ_DIMANCHE_COURT ."</th>
|
|
|
383 |
</tr>
|
|
|
384 |
".'</thead>'.'<tbody>';
|
|
|
385 |
}
|
|
|
386 |
|
|
|
387 |
$todayStamp=time();
|
|
|
388 |
$today_ymd=date('Ymd',$todayStamp);
|
|
|
389 |
|
|
|
390 |
// Other month : mois
|
|
|
391 |
while ($day = $month->fetch() ) {
|
|
|
392 |
$dayStamp = $day->thisDay(true);
|
|
|
393 |
$day_ymd = date('Ymd',$dayStamp);
|
|
|
394 |
if ( $day->isEmpty() ) {
|
|
|
395 |
$class = "cal_ma other_month";
|
|
|
396 |
} else {
|
|
|
397 |
if (($day_ymd < $today_ymd)) {
|
|
|
398 |
$class= "cal_mp previous_month";
|
|
|
399 |
} else {
|
|
|
400 |
if ($day_ymd == $today_ymd) {
|
|
|
401 |
$class= "cal_jc current_day";
|
|
|
402 |
} else {
|
|
|
403 |
$class="cal_mc current_month";
|
|
|
404 |
}
|
|
|
405 |
}
|
|
|
406 |
}
|
|
|
407 |
|
|
|
408 |
$url->addQueryString ('y', date('Y',$dayStamp));
|
|
|
409 |
$url->addQueryString ('m', date('n',$dayStamp));
|
|
|
410 |
$url->addQueryString ('d', date('j',$dayStamp));
|
|
|
411 |
$link = $url->getUrl();
|
|
|
412 |
|
|
|
413 |
// isFirst() to find start of week
|
|
|
414 |
if ($day->isFirst()) {
|
|
|
415 |
$retour.= ( "<tr>\n" );
|
|
|
416 |
}
|
|
|
417 |
if ($type == 'calendrier') {
|
|
|
418 |
$retour.= "<td class=\"".$class."\">".'<span class="cal_j">'.$day->thisDay().'</span>'."\n";
|
|
|
419 |
if ($day->isSelected() ) {
|
|
|
420 |
$evenements = $day->getEntry();
|
|
|
421 |
$evenements_nbre = count($evenements);
|
|
|
422 |
$evenemt_xhtml = '';
|
|
|
423 |
while ($ligne_evenement = array_pop($evenements)) {
|
|
|
424 |
|
|
|
425 |
$id_fiches = array();
|
|
|
426 |
$id_fiches[] = $ligne_evenement->bf_id_fiche;
|
|
|
427 |
$url->addQueryString ('id_fiches',$id_fiches);
|
|
|
428 |
|
|
|
429 |
$lien_voir = new Net_Url(BAZ_URL_BASE_APPLI);
|
|
|
430 |
$lien_voir->addQueryString(BAZ_VARIABLE_ACTION, BAZ_VOIR_FICHE);
|
|
|
431 |
$lien_voir->addQueryString('id_fiche', $ligne_evenement->bf_id_fiche);
|
|
|
432 |
$lien_voir->addQueryString('typeannonce', $ligne_evenement->bn_id_nature);
|
|
|
433 |
$link=$lien_voir->getURL();
|
|
|
434 |
|
|
|
435 |
if (!isset($_GET['tt']) || (isset($_GET['tt']) && $_GET['tt'] == '1')) {
|
|
|
436 |
$titre_taille = strlen($ligne_evenement->bf_titre);
|
|
|
437 |
$titre = ($titre_taille > 20)?substr($ligne_evenement->bf_titre, 0, 20).'...':$ligne_evenement->bf_titre;
|
|
|
438 |
} else {
|
|
|
439 |
$titre = $ligne_evenement->bf_titre;
|
|
|
440 |
}
|
|
|
441 |
$evenemt_xhtml .= '<li class="tooltip nature_'.$ligne_evenement->bn_id_nature.'" title="'.str_replace('"', '\'', $ligne_evenement->bf_titre).'"><a class="cal_evenemt" href="'.$link.'">'.$titre.'</a></li>'."\n";
|
|
|
442 |
$url->removeQueryString ('id_fiches');
|
|
|
443 |
}
|
|
|
444 |
if ($evenements_nbre > 0) {
|
|
|
445 |
$retour .= '<ul class="cal_evenemt_liste">';
|
|
|
446 |
$retour .= $evenemt_xhtml;
|
|
|
447 |
$retour .= '</ul>';
|
|
|
448 |
}
|
|
|
449 |
}
|
|
|
450 |
} else {
|
|
|
451 |
$lien_date= "<td class=\"".$class."\">".$day->thisDay();
|
|
|
452 |
if ($day->isSelected() ) {
|
|
|
453 |
$evenements = $day->getEntry();
|
|
|
454 |
$id_fiches = array();
|
|
|
455 |
$info_fiches = null;
|
|
|
456 |
while ($ligne_evenement = array_pop($evenements)) {
|
|
|
457 |
$id_fiches[] = $ligne_evenement->bf_id_fiche;
|
|
|
458 |
$info_fiches .= '⇒ '.str_replace('"', '\'', $ligne_evenement->bf_titre)."\n";
|
|
|
459 |
}
|
|
|
460 |
$url->addQueryString('id_fiches', $id_fiches);
|
|
|
461 |
$link = $url->getUrl();
|
|
|
462 |
$lien_date = '<td class="'.$class.'"><a href="'.$link.'" class="tooltip" title="'.$info_fiches.'">'.$day->thisDay()."</a>\n";
|
|
|
463 |
$url->removeQueryString('id_fiches');
|
|
|
464 |
}
|
|
|
465 |
$retour .= $lien_date;
|
|
|
466 |
}
|
|
|
467 |
$retour.= ( "</td>\n" );
|
|
|
468 |
|
|
|
469 |
// isLast() to find end of week
|
|
|
470 |
if ( $day->isLast() ) {
|
|
|
471 |
$retour.= ( "</tr>\n" );
|
|
|
472 |
}
|
|
|
473 |
}
|
|
|
474 |
$retour.= "</tbody></table>";
|
|
|
475 |
}
|
|
|
476 |
$retour.= '<script type="text/javascript">//<![CDATA['."\n".$script.'//]]></script>'."\n";
|
|
|
477 |
// Vue detail
|
|
|
478 |
|
|
|
479 |
if ((isset($_GET['id_fiches']))) {
|
|
|
480 |
// Ajout d'un titre pour la page avec la date
|
|
|
481 |
$jours = array ('dimanche', 'lundi', 'mardi', 'mercredi', 'jeudi', 'vendredi', 'samedi') ;
|
479 |
mathias |
482 |
$mois = array ('janvier', 'f�vrier', 'mars', 'avril', 'mai', 'juin', 'juillet', 'ao�t', 'septembre',
|
|
|
483 |
'octobre', 'novembre', 'd�cembre') ;
|
468 |
mathias |
484 |
$timestamp = strtotime ($_GET['y'].'/'.$_GET['m'].'/'.$_GET['d']) ;
|
|
|
485 |
|
|
|
486 |
$GLOBALS['_PAPYRUS_']['rendu']['CONTENU_NAVIGATION'] = '';
|
|
|
487 |
$GLOBALS['_PAPYRUS_']['rendu']['CONTENU_TETE'] = '';
|
|
|
488 |
$GLOBALS['_PAPYRUS_']['rendu']['CONTENU_CORPS'] = '<h1>'.$jours[date('w', $timestamp)].
|
|
|
489 |
' '.$_GET['d'].' '.$mois[$_GET['m']-1].' '.$_GET['y'].'</h1>' ;
|
|
|
490 |
$GLOBALS['_PAPYRUS_']['rendu']['CONTENU_CORPS'] .= baz_voir_fiches(1,$_GET['id_fiches'] );
|
|
|
491 |
|
|
|
492 |
$GLOBALS['_GEN_commun']['info_menu'] = '';
|
|
|
493 |
|
|
|
494 |
// Un lien pour retourner au calendrier
|
|
|
495 |
$url->removeQueryString('id_fiches');
|
|
|
496 |
$url->removeQueryString('y');
|
|
|
497 |
$url->removeQueryString('m');
|
|
|
498 |
$url->removeQueryString('d');
|
|
|
499 |
$GLOBALS['_PAPYRUS_']['rendu']['CONTENU_PIED'] = '<div class="retour"><a href="'.$url->getURL().'">Retour au calendrier</a></div>';
|
|
|
500 |
}
|
|
|
501 |
|
|
|
502 |
// Nettoyage de l'url
|
|
|
503 |
$url->removeQueryString('id_fiches');
|
|
|
504 |
$url->removeQueryString('y');
|
|
|
505 |
$url->removeQueryString('m');
|
|
|
506 |
$url->removeQueryString('d');
|
|
|
507 |
|
|
|
508 |
|
|
|
509 |
return $retour;
|
|
|
510 |
}
|
30 |
ddelon |
511 |
?>
|