Subversion Repositories Applications.bazar

Rev

Rev 383 | Rev 399 | Go to most recent revision | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

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