Subversion Repositories Applications.bazar

Rev

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

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