Subversion Repositories Applications.bazar

Rev

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

Rev 185 Rev 187
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.11 2007-02-15 14:18:38 jp_milcent Exp $
22
// CVS : $Id: bazar.fonct.cal.php,v 1.12 2007-02-15 18:16:45 jp_milcent Exp $
23
/**
23
/**
24
*
24
*
25
* Fonctions calendrier du module bazar
25
* Fonctions calendrier du module bazar
26
*
26
*
27
*@package bazar
27
*@package bazar
28
//Auteur original :
28
//Auteur original :
29
*@author        David Delon <david.delon@clapas.net>
29
*@author        David Delon <david.delon@clapas.net>
30
//Autres auteurs :
30
//Autres auteurs :
31
*@copyright     Tela-Botanica 2000-2004
31
*@copyright     Tela-Botanica 2000-2004
32
*@version       $Revision: 1.11 $ $Date: 2007-02-15 14:18:38 $
32
*@version       $Revision: 1.12 $ $Date: 2007-02-15 18:16:45 $
33
// +------------------------------------------------------------------------------------------------------+
33
// +------------------------------------------------------------------------------------------------------+
34
*/
34
*/
35
 
35
 
36
// +------------------------------------------------------------------------------------------------------+
36
// +------------------------------------------------------------------------------------------------------+
37
// |                                            ENTETE du PROGRAMME                                       |
37
// |                                            ENTETE du PROGRAMME                                       |
38
// +------------------------------------------------------------------------------------------------------+
38
// +------------------------------------------------------------------------------------------------------+
39
 
-
 
40
require_once PAP_CHEMIN_RACINE.'api/pear/Calendar/Month/Weekdays.php';
39
require_once PAP_CHEMIN_RACINE.'api/pear/Calendar/Month/Weekdays.php';
41
require_once PAP_CHEMIN_RACINE.'api/pear/Calendar/Day.php';
40
require_once PAP_CHEMIN_RACINE.'api/pear/Calendar/Day.php';
42
require_once PAP_CHEMIN_RACINE.'api/pear/Calendar/Decorator.php'; 
41
require_once PAP_CHEMIN_RACINE.'api/pear/Calendar/Decorator.php'; 
43
 
42
 
44
 
43
 
45
// +------------------------------------------------------------------------------------------------------+
44
// +------------------------------------------------------------------------------------------------------+
46
// |                                           LISTE de FONCTIONS                                         |
45
// |                                           LISTE de FONCTIONS                                         |
47
// +------------------------------------------------------------------------------------------------------+
46
// +------------------------------------------------------------------------------------------------------+
48
 
47
 
49
 
48
 
50
// Classe Utilitaire pour Calendrier
49
// Classe Utilitaire pour Calendrier
51
 
50
 
52
class DiaryEvent extends Calendar_Decorator {
51
class DiaryEvent extends Calendar_Decorator {
53
	var $entry=array();
52
	var $entry=array();
54
	function DiaryEvent($calendar) {
53
	function DiaryEvent($calendar) {
55
		Calendar_Decorator::Calendar_Decorator($calendar);
54
		Calendar_Decorator::Calendar_Decorator($calendar);
56
	}
55
	}
57
	function setEntry($entry) {
56
	function setEntry($entry) {
58
		$this->entry[]=$entry;
57
		$this->entry[]=$entry;
59
		
58
		
60
	}
59
	}
61
	function getEntry() {
60
	function getEntry() {
62
		return $this->entry;
61
		return $this->entry;
63
	}
62
	}
64
} 
63
} 
65
 
64
 
66
 
65
 
67
// $type : calendrier
66
// $type : calendrier
68
// $type : calendrier_appplette
67
// $type : calendrier_appplette
69
 
68
 
70
function GestionAffichageCalendrier($type='calendrier') {
69
function GestionAffichageCalendrier($type='calendrier') {
71
	
-
 
72
	
70
	
73
	$retour='';
71
	$retour='';
74
 
72
	
75
	$url = $GLOBALS['_GEN_commun']['url'] ;
73
	$url = $GLOBALS['_GEN_commun']['url'] ;
76
	$db = &$GLOBALS['_GEN_commun']['pear_db'] ;
74
	$db = &$GLOBALS['_GEN_commun']['pear_db'] ;
77
	$auth = &$GLOBALS['_GEN_commun']['pear_auth'] ;
75
	$auth = &$GLOBALS['_GEN_commun']['pear_auth'] ;
-
 
76
	
-
 
77
	// Nettoyage de l'url de la query string
-
 
78
	$chaine_url = $url->getQueryString();
-
 
79
	$tab_params = explode('&amp;', $chaine_url);
-
 
80
	if (count($tab_params) == 0) {
-
 
81
		$tab_params = explode('&', $chaine_url);
-
 
82
	}
-
 
83
	foreach ($tab_params as $param) {
-
 
84
		$tab_parametre = explode('=', $param);
-
 
85
		$url->removeQueryString($tab_parametre[0]);
-
 
86
	}
78
	
87
	
79
	if (!isset($_GET['y'])) { 
88
	if (!isset($_GET['y'])) { 
80
		$_GET['y'] = date('Y');
89
		$_GET['y'] = date('Y');
81
	}
90
	}
82
	
91
	
83
	if (!isset($_GET['m'])) { 
92
	if (!isset($_GET['m'])) { 
84
		$_GET['m'] = date('m');
93
		$_GET['m'] = date('m');
85
	}
94
	}
86
	
-
 
87
	
95
	
88
	// 	Construction Mois en Cours 
96
	// 	Construction Mois en Cours 
89
	$month = new Calendar_Month_Weekdays($_GET['y'],$_GET['m']);
97
	$month = new Calendar_Month_Weekdays($_GET['y'],$_GET['m']);
90
 
98
 
91
	$curStamp=$month->getTimeStamp();
99
	$curStamp=$month->getTimeStamp();
92
	$url->addQueryString ('y', date('Y',$curStamp));
100
	$url->addQueryString ('y', date('Y',$curStamp));
93
	$url->addQueryString ('m', date('n',$curStamp));
101
	$url->addQueryString ('m', date('n',$curStamp));
94
	$url->addQueryString ('d', date('j',$curStamp));
102
	$url->addQueryString ('d', date('j',$curStamp));
95
	$cur = $url->getUrl();
103
	$cur = $url->getUrl();
96
	
104
	
97
	// Navigation 
105
	// Navigation 
98
	$prevStamp = $month->prevMonth(true);
106
	$prevStamp = $month->prevMonth(true);
99
	$url->addQueryString ('y', date('Y',$prevStamp));
107
	$url->addQueryString ('y', date('Y',$prevStamp));
100
	$url->addQueryString ('m', date('n',$prevStamp));
108
	$url->addQueryString ('m', date('n',$prevStamp));
101
	$url->addQueryString ('d', date('j',$prevStamp));
109
	$url->addQueryString ('d', date('j',$prevStamp));
102
	$prev = $url->getUrl();
110
	$prev = $url->getUrl();
103
	$nextStamp = $month->nextMonth(true);
111
	$nextStamp = $month->nextMonth(true);
104
	$url->addQueryString ('y', date('Y',$nextStamp));
112
	$url->addQueryString ('y', date('Y',$nextStamp));
105
	$url->addQueryString ('m', date('n',$nextStamp));
113
	$url->addQueryString ('m', date('n',$nextStamp));
106
	$url->addQueryString ('d', date('j',$nextStamp));
114
	$url->addQueryString ('d', date('j',$nextStamp));
107
	$next = $url->getUrl();
115
	$next = $url->getUrl();
108
 
116
 
109
	$fr_month=array("1"=>BAZ_JANVIER,"2"=>BAZ_FEVRIER,"3"=>BAZ_MARS,"4"=>BAZ_AVRIL,"5"=>BAZ_MAI,"6"=>BAZ_JUIN,"7"=>BAZ_JUILLET,"8"=>BAZ_AOUT,"9"=>BAZ_SEPTEMBRE,"10"=>BAZ_OCTOBRE,"11"=>BAZ_NOVEMBRE,"12"=>BAZ_DECEMBRE);
117
	$fr_month=array("1"=>BAZ_JANVIER,"2"=>BAZ_FEVRIER,"3"=>BAZ_MARS,"4"=>BAZ_AVRIL,"5"=>BAZ_MAI,"6"=>BAZ_JUIN,"7"=>BAZ_JUILLET,"8"=>BAZ_AOUT,"9"=>BAZ_SEPTEMBRE,"10"=>BAZ_OCTOBRE,"11"=>BAZ_NOVEMBRE,"12"=>BAZ_DECEMBRE);
110
 
118
 
111
	$retour.= "<div class=\"navi\">";
119
	$retour.= "<div class=\"navi\">";
112
	$retour.= "<a href=\"".$prev."\"> &lt;&lt; </a>"; 
120
	$retour.= "<a href=\"".$prev."\"> &lt;&lt; </a>"; 
113
 
121
 
114
	$retour.= "&nbsp;&nbsp;";
122
	$retour.= "&nbsp;&nbsp;";
115
	$retour.= "<a href=\"".$cur;
123
	$retour.= "<a href=\"".$cur;
116
	$retour.= "\"> ";
124
	$retour.= "\"> ";
117
	$retour.= $fr_month[(date('n',$curStamp))]; 
125
	$retour.= $fr_month[(date('n',$curStamp))]; 
118
	$retour.= "&nbsp;";
126
	$retour.= "&nbsp;";
119
	$retour.= (date('Y',$curStamp));
127
	$retour.= (date('Y',$curStamp));
120
	$retour.= "</a>";
128
	$retour.= "</a>";
121
	$retour.= "&nbsp;&nbsp;";
129
	$retour.= "&nbsp;&nbsp;";
122
	$retour.= "<a href=\"".$next."\"> &gt;&gt; </a>";
130
	$retour.= "<a href=\"".$next."\"> &gt;&gt; </a>";
123
 
131
 
124
	$retour.= "</div>";
132
	$retour.= "</div>";
125
 
133
 
126
	$retour.="<br></br>";
134
	$retour.="<br></br>";
127
 
135
 
128
	// Vue Mois calendrier ou vue applette
136
	// Vue Mois calendrier ou vue applette
129
		
137
		
130
	if ((!isset($_GET['id_fiche']) && ($type=='calendrier')) || ($type=='calendrier_applette')){
138
	if ((!isset($_GET['id_fiche']) && ($type=='calendrier')) || ($type=='calendrier_applette')){
131
			
139
			
132
		// Recherche evenement de la periode selectionnée 
140
		// Recherche evenement de la periode selectionnée 
133
		
-
 
-
 
141
		$ts_jour_fin_mois = $month->nextMonth('timestamp');
134
	 	// TODO : Selectionner element du mois en cours 
142
		$ts_jour_debut_mois = $month->thisMonth('timestamp');; 
135
	 	
-
 
136
	    $requete_evenements = 	"SELECT DISTINCT bf_id_fiche, bf_titre, bf_lieu_evenement, DAY(bf_date_debut_evenement) AS bf_jour_debut_evenement , bf_date_fin_evenement, bf_description ".
143
	    $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 ".
137
								"FROM bazar_fiche, bazar_nature ".
144
								"FROM bazar_fiche, bazar_nature ".
138
								"WHERE YEAR(bf_date_debut_evenement) = ".date('Y',$curStamp)." ".
145
								"WHERE bf_date_debut_evenement < '".date('Y-m-d', $ts_jour_fin_mois)."' ".
139
								"AND month(bf_date_debut_evenement) = ".date('m',$curStamp)." ".
146
								"AND bf_date_fin_evenement >= '".date('Y-m-d', $ts_jour_debut_mois)."' ".
140
								"AND bf_ce_nature = bn_id_nature ".
147
								"AND bf_ce_nature = bn_id_nature ".
141
								"AND bn_id_nature IN (".BAZ_NUM_ANNONCE_CALENDRIER.")";
148
								"AND bn_id_nature IN (".BAZ_NUM_ANNONCE_CALENDRIER.")";
142
		
-
 
143
	   	$resultat_evenement = $db->query($requete_evenements);
149
	   	$resultat_evenement = $db->query($requete_evenements);
144
	   	
-
 
145
	    (DB::isError($resultat_evenement))
150
	    (DB::isError($resultat_evenement))
146
	    ? die(BOG_afficherErreurSql(__FILE__, __LINE__, $resultat_evenement->getMessage(), $requete_evenements))
151
	    ? die(BOG_afficherErreurSql(__FILE__, __LINE__, $resultat_evenement->getMessage(), $requete_evenements))
147
	    : '';
152
	    : '';
148
	
153
 
149
		$calcom="";
-
 
150
		
-
 
151
		$selection=array();
154
		$selection = array();
152
		$evenements=array();
155
		$evenements = array();
153
		 
-
 
-
 
156
		$annee = date('Y', $curStamp);
-
 
157
		$mois = date('m', $curStamp);
154
		$prev_curday_ymd=0;
158
		$tablo_jours = array();
155
		
-
 
156
	    while ($ligne_evenements = $resultat_evenement->fetchRow(DB_FETCHMODE_OBJECT)) {
159
	    while ($ligne_evenements = $resultat_evenement->fetchRow(DB_FETCHMODE_OBJECT)) {
157
	    	
-
 
158
			$curday_ymd=date('Ym',$curStamp).$ligne_evenements->bf_jour_debut_evenement;
160
			list($annee_debut, $mois_debut, $jour_debut) = explode('-', $ligne_evenements->bf_date_debut_evenement);
159
			if ($curday_ymd!=$prev_curday_ymd) {
-
 
160
				$Day = new Calendar_Day(date('Y',$curStamp),date('m',$curStamp), $ligne_evenements->bf_jour_debut_evenement);
161
			list($annee_fin, $mois_fin, $jour_fin) = explode('-', $ligne_evenements->bf_date_fin_evenement);
161
				$DiaryEvent = new DiaryEvent($Day);
-
 
162
				$prev_curday_ymd=$curday_ymd;
-
 
163
			}
-
 
164
			
-
 
165
			$DiaryEvent->setEntry($ligne_evenements);
-
 
-
 
162
			
-
 
163
			$Calendrier = new Calendar($annee_debut, $mois_debut, $jour_debut);
-
 
164
			$ts_jour_suivant = $Calendrier->thisDay('timestamp');
-
 
165
			$ts_jour_fin = mktime(0,0,0,$mois_fin, $jour_fin, $annee_fin);
-
 
166
			
166
			
167
	    	if ($ts_jour_suivant < $ts_jour_fin) {
167
			// Add the decorator to the selection
168
				//echo "$ts_jour_suivant-";
-
 
169
				$naviguer = true;
-
 
170
				while ($naviguer) {
-
 
171
					// Si le jours suivant est inférieur à la date de fin, on continue...
-
 
172
					if ($ts_jour_suivant <= $ts_jour_fin) {
-
 
173
						// Si le jours suivant est inférieur à la date de fin du mois courrant, on continue...
-
 
174
						if ($ts_jour_suivant < $ts_jour_fin_mois) {
-
 
175
							$cle_j = date('Y-m-d', $ts_jour_suivant);
-
 
176
							if (!isset($tablo_jours[$cle_j])) {
-
 
177
								$tablo_jours[$cle_j]['Calendar_Day'] = new Calendar_Day(date('Y', $ts_jour_suivant),date('m', $ts_jour_suivant), date('d', $ts_jour_suivant));
-
 
178
								$tablo_jours[$cle_j]['Diary_Event'] = new DiaryEvent($tablo_jours[$cle_j]['Calendar_Day']);
-
 
179
							}
168
			$selection[] = $DiaryEvent;
180
							$tablo_jours[$cle_j]['Diary_Event']->setEntry($ligne_evenements);
-
 
181
							
-
 
182
							$ts_jour_suivant = $Calendrier->nextDay('timestamp');
-
 
183
							//echo "ici$ts_jour_suivant-";
-
 
184
							$Calendrier->setTimestamp($ts_jour_suivant);
-
 
185
							//echo "la".$Calendrier->thisDay('timestamp')."-";
-
 
186
						} else {
-
 
187
							$naviguer = false;
-
 
188
						}
-
 
189
					} else {
-
 
190
						$naviguer = false;
-
 
191
					}
-
 
192
				}
-
 
193
	    	} else { 
-
 
194
				$curday_ymd = $annee.$mois.$ligne_evenements->bf_jour_debut_evenement;
-
 
195
				$cle_j = $annee.'-'.$mois.'-'.$ligne_evenements->bf_jour_debut_evenement;
-
 
196
				if (!isset($tablo_jours[$cle_j])) {
-
 
197
					$tablo_jours[$cle_j]['Calendar_Day'] = new Calendar_Day($annee, $mois, $ligne_evenements->bf_jour_debut_evenement);
-
 
198
					$tablo_jours[$cle_j]['Diary_Event'] = new DiaryEvent($tablo_jours[$cle_j]['Calendar_Day']);
-
 
199
				}
-
 
200
				$tablo_jours[$cle_j]['Diary_Event']->setEntry($ligne_evenements);
169
				
201
	    	}
-
 
202
		}
-
 
203
		// Add the decorator to the selection
-
 
204
		foreach ($tablo_jours as $jour) {
-
 
205
			$selection[] = $jour['Diary_Event'];				
-
 
206
		}
-
 
207
		
-
 
208
//		$calcom = "";
-
 
209
//		$selection = array();
-
 
210
//		$evenements = array();		 
-
 
211
//		$prev_curday_ymd=0;		
-
 
212
//	    while ($ligne_evenements = $resultat_evenement->fetchRow(DB_FETCHMODE_OBJECT)) {
-
 
213
//	    	
-
 
214
//			$curday_ymd=date('Ym',$curStamp).$ligne_evenements->bf_jour_debut_evenement;
-
 
215
//			if ($curday_ymd!=$prev_curday_ymd) {
-
 
216
//				$Day = new Calendar_Day(date('Y',$curStamp),date('m',$curStamp), $ligne_evenements->bf_jour_debut_evenement);
-
 
217
//				$DiaryEvent = new DiaryEvent($Day);
-
 
218
//				$prev_curday_ymd=$curday_ymd;
-
 
219
//			}
-
 
220
//			$DiaryEvent->setEntry($ligne_evenements);
-
 
221
//			
-
 
222
//			// Add the decorator to the selection
-
 
223
//			$selection[] = $DiaryEvent;				
170
		}
224
//		}
171
			
-
 
172
		// Affichage Calendrier
-
 
173
		
225
			
174
		
-
 
175
		$month->build($selection);
226
		// Affichage Calendrier
176
	
227
		$month->build($selection);
177
		if ($type=='calendrier') {
228
		if ($type=='calendrier') {
178
			$retour.= "<table class=\"calendar\">
229
			$retour.= "<table class=\"calendar\">
179
			 <tr>
230
			 <tr>
180
			
231
			
181
			  <th> ". BAZ_LUNDI ."</th>
232
			  <th> ". BAZ_LUNDI ."</th>
182
			  <th> ". BAZ_MARDI ."</th>
233
			  <th> ". BAZ_MARDI ."</th>
183
			  <th> ". BAZ_MERCREDI ."</th>
234
			  <th> ". BAZ_MERCREDI ."</th>
184
			  <th> ". BAZ_JEUDI ."</th>
235
			  <th> ". BAZ_JEUDI ."</th>
185
			  <th> ". BAZ_VENDREDI ."</th>
236
			  <th> ". BAZ_VENDREDI ."</th>
186
			  <th> ". BAZ_SAMEDI ."</th>
237
			  <th> ". BAZ_SAMEDI ."</th>
187
			  <th> ". BAZ_DIMANCHE ."</th>
238
			  <th> ". BAZ_DIMANCHE ."</th>
188
			 </tr>
239
			 </tr>
189
			 ";
240
			 ";
190
		}
241
		}
191
		else {
242
		else {
192
			$retour.= "<table class=\"calendar\">
243
			$retour.= "<table class=\"calendar\">
193
			 <tr>
244
			 <tr>
194
			
245
			
195
			  <th> ". BAZ_LUNDI_COURT ."</th>
246
			  <th> ". BAZ_LUNDI_COURT ."</th>
196
			  <th> ". BAZ_MARDI_COURT ."</th>
247
			  <th> ". BAZ_MARDI_COURT ."</th>
197
			  <th> ". BAZ_MERCREDI_COURT ."</th>
248
			  <th> ". BAZ_MERCREDI_COURT ."</th>
198
			  <th> ". BAZ_JEUDI_COURT ."</th>
249
			  <th> ". BAZ_JEUDI_COURT ."</th>
199
			  <th> ". BAZ_VENDREDI_COURT ."</th>
250
			  <th> ". BAZ_VENDREDI_COURT ."</th>
200
			  <th> ". BAZ_SAMEDI_COURT ."</th>
251
			  <th> ". BAZ_SAMEDI_COURT ."</th>
201
			  <th> ". BAZ_DIMANCHE_COURT ."</th>
252
			  <th> ". BAZ_DIMANCHE_COURT ."</th>
202
			 </tr>
253
			 </tr>
203
			 ";
254
			 ";
204
		}
255
		}
205
		
256
		
206
			
257
			
207
		$todayStamp=time();
258
		$todayStamp=time();
208
		
259
		
209
		$today_ymd=date('Ymd',$todayStamp);
260
		$today_ymd=date('Ymd',$todayStamp);
210
	
261
	
211
		// Other month : mois 
262
		// Other month : mois 
212
		//
263
		//
213
		
264
		
214
		while ($day = $month->fetch() ) {
265
		while ($day = $month->fetch() ) {
215
				
266
				
216
				$dayStamp = $day->thisDay(true);
267
				$dayStamp = $day->thisDay(true);
217
				$day_ymd=date('Ymd',$dayStamp);
268
				$day_ymd=date('Ymd',$dayStamp);
218
				
269
				
219
				if ( $day->isEmpty() ) {
270
				if ( $day->isEmpty() ) {
220
						$class = "other_month";
271
						$class = "other_month";
221
				}
272
				}
222
				else {
273
				else {
223
					if (($day_ymd < $today_ymd)) {
274
					if (($day_ymd < $today_ymd)) {
224
						$class= "previous_month";
275
						$class= "previous_month";
225
					}
276
					}
226
					else {
277
					else {
227
						 if ($day_ymd == $today_ymd) {
278
						 if ($day_ymd == $today_ymd) {
228
						 	$class= "current_day";
279
						 	$class= "current_day";
229
						 }
280
						 }
230
						 else {
281
						 else {
231
							$class="current_month";
282
							$class="current_month";
232
						 }
283
						 }
233
					}
284
					}
234
				}
285
				}
235
				
286
				
236
				$url->addQueryString ('y', date('Y',$dayStamp));
287
				$url->addQueryString ('y', date('Y',$dayStamp));
237
				$url->addQueryString ('m', date('n',$dayStamp));
288
				$url->addQueryString ('m', date('n',$dayStamp));
238
				$url->addQueryString ('d', date('j',$dayStamp));
289
				$url->addQueryString ('d', date('j',$dayStamp));
239
				
290
				
240
				$link = $url->getUrl();
291
				$link = $url->getUrl();
241
			
292
			
242
				// isFirst() to find start of week
293
				// isFirst() to find start of week
243
				if ($day->isFirst())
294
				if ($day->isFirst())
244
					$retour.= ( "<tr>\n" );
295
					$retour.= ( "<tr>\n" );
245
				
296
				
246
				//$retour.= ( "<td class=\"".$class."\"><a href=\"".$link."\">".$day->thisDay()."</a>\n" );
297
				//$retour.= ( "<td class=\"".$class."\"><a href=\"".$link."\">".$day->thisDay()."</a>\n" );
247
				
298
				
248
				if ($type=='calendrier') {
299
				if ($type=='calendrier') {
249
					$retour.= "<td class=\"".$class."\">".$day->thisDay()."\n";
300
					$retour.= "<td class=\"".$class."\">".$day->thisDay()."\n";
250
					if ($day->isSelected() ) {
301
					if ($day->isSelected() ) {
251
						$evenements=$day->getEntry();
302
						$evenements=$day->getEntry();
252
						while ($ligne_evenement=array_pop($evenements)) {
303
						while ($ligne_evenement=array_pop($evenements)) {
253
							$id_fiches=array();
304
							$id_fiches=array();
254
							$id_fiches[]=$ligne_evenement->bf_id_fiche;
305
							$id_fiches[]=$ligne_evenement->bf_id_fiche;
255
							$url->addQueryString ('id_fiches',$id_fiches);
306
							$url->addQueryString ('id_fiches',$id_fiches);
256
							$link = $url->getUrl();
307
							$link = $url->getUrl();
257
							$retour.= "<a href=\"".$link."\">".$ligne_evenement->bf_titre."</a>\n";
308
							$retour.= "<a href=\"".$link."\">".$ligne_evenement->bf_titre."</a>\n";
258
							$url->removeQueryString ('id_fiches');
309
							$url->removeQueryString ('id_fiches');
259
						}
310
						}
260
					}
311
					}
261
				}
312
				}
262
				else {
313
				else {
263
					$lien_date= "<td class=\"".$class."\">".$day->thisDay()."\n";
314
					$lien_date= "<td class=\"".$class."\">".$day->thisDay()."\n";
264
					if ($day->isSelected() ) {
315
					if ($day->isSelected() ) {
265
						$evenements=$day->getEntry();
316
						$evenements=$day->getEntry();
266
						$id_fiches=array();
317
						$id_fiches=array();
267
						while ($ligne_evenement=array_pop($evenements)) {
318
						while ($ligne_evenement=array_pop($evenements)) {
268
							$id_fiches[]=$ligne_evenement->bf_id_fiche;
319
							$id_fiches[]=$ligne_evenement->bf_id_fiche;
269
						}
320
						}
270
						$url->addQueryString ('id_fiches',$id_fiches);
321
						$url->addQueryString ('id_fiches',$id_fiches);
271
						$link = $url->getUrl();
322
						$link = $url->getUrl();
272
						$lien_date= "<td class=\"".$class."\"><a href=\"".$link."\">".$day->thisDay()."</a>\n";
323
						$lien_date= "<td class=\"".$class."\"><a href=\"".$link."\">".$day->thisDay()."</a>\n";
273
						$url->removeQueryString ('id_fiches');
324
						$url->removeQueryString ('id_fiches');
274
					}
325
					}
275
					$retour.=$lien_date;
326
					$retour.=$lien_date;
276
				}
327
				}
277
				
328
				
278
				$retour.= ( "</td>\n" );
329
				$retour.= ( "</td>\n" );
279
				
330
				
280
				// isLast() to find end of week
331
				// isLast() to find end of week
281
				if ( $day->isLast() )
332
				if ( $day->isLast() )
282
					$retour.= ( "</tr>\n" );
333
					$retour.= ( "</tr>\n" );
283
			}
334
			}
284
		
335
		
285
			$retour.= "</table>";
336
			$retour.= "</table>";
286
			
337
			
287
			
338
			
288
		}
339
		}
289
		
340
		
290
		// Vue detail
341
		// Vue detail
291
		
342
		
292
		if ((isset($_GET['id_fiches']))) {
343
		if ((isset($_GET['id_fiches']))) {
293
				// Ajout des styles du bazar
344
				// Ajout des styles du bazar
294
				if (defined('PAP_VERSION')) { //si on est dans Papyrus
345
				if (defined('PAP_VERSION')) { //si on est dans Papyrus
295
					GEN_stockerStyleExterne( 'bazar_interne', 'client/bazar/bazar.interne.css');
346
					//GEN_stockerStyleExterne( 'bazar_interne', 'client/bazar/bazar.interne.css');
296
				}
347
				}
297
			
348
			
298
				// Ajout d'un titre pour la page avec la date
349
				// Ajout d'un titre pour la page avec la date
299
				$jours = array ('lundi', 'mardi', 'mercredi', 'jeudi', 'vendredi', 'samedi', 'dimanche') ;
350
				$jours = array ('lundi', 'mardi', 'mercredi', 'jeudi', 'vendredi', 'samedi', 'dimanche') ;
300
				$mois = array ('janvier', 'février', 'mars', 'avril', 'mai', 'juin', 'juillet', 'août', 'septembre',
351
				$mois = array ('janvier', 'février', 'mars', 'avril', 'mai', 'juin', 'juillet', 'août', 'septembre',
301
								'octobre', 'novembre', 'décembre') ;
352
								'octobre', 'novembre', 'décembre') ;
302
				$timestamp = strtotime ($_GET['y'].'/'.$_GET['m'].'/'.$_GET['d']) ;
353
				$timestamp = strtotime ($_GET['y'].'/'.$_GET['m'].'/'.$_GET['d']) ;
-
 
354
				
-
 
355
				$GLOBALS['_PAPYRUS_']['rendu']['CONTENU_NAVIGATION'] = '';
-
 
356
				$GLOBALS['_PAPYRUS_']['rendu']['CONTENU_TETE'] = '';
303
				$GLOBALS['_PAPYRUS_']['rendu']['CONTENU_CORPS'] = '<h1>'.$jours[date('w', $timestamp)].
357
				$GLOBALS['_PAPYRUS_']['rendu']['CONTENU_CORPS'] = '<h1>'.$jours[date('w', $timestamp)].
304
								' '.$_GET['d'].' '.$mois[$_GET['m']-1].' '.$_GET['y'].'</h1>' ;
358
								' '.$_GET['d'].' '.$mois[$_GET['m']-1].' '.$_GET['y'].'</h1>' ;
305
				$GLOBALS['_PAPYRUS_']['rendu']['CONTENU_CORPS'] .= baz_voir_fiches(0,$_GET['id_fiches'] );
359
				$GLOBALS['_PAPYRUS_']['rendu']['CONTENU_CORPS'] .= baz_voir_fiches(0,$_GET['id_fiches'] );
-
 
360
				$GLOBALS['_PAPYRUS_']['rendu']['CONTENU_PIED'] = '';
-
 
361
				$GLOBALS['_GEN_commun']['info_menu'] = '';
306
		}
362
		}
307
			
363
			
308
		return $retour;
364
		return $retour;
309
		
365
		
310
	}
366
	}
311
 
367
 
312
?>
368
?>