Subversion Repositories Applications.bazar

Rev

Rev 205 | Rev 209 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 205 Rev 208
Line 17... Line 17...
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.13 2007-03-08 15:12:13 jp_milcent Exp $
22
// CVS : $Id: bazar.fonct.cal.php,v 1.14 2007-03-14 18:14:42 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.13 $ $Date: 2007-03-08 15:12:13 $
32
*@version       $Revision: 1.14 $ $Date: 2007-03-14 18:14:42 $
33
// +------------------------------------------------------------------------------------------------------+
33
// +------------------------------------------------------------------------------------------------------+
34
*/
34
*/
Line 35... Line 35...
35
 
35
 
36
// +------------------------------------------------------------------------------------------------------+
36
// +------------------------------------------------------------------------------------------------------+
Line 65... Line 65...
65
 
65
 
66
// $type : calendrier
66
// $type : calendrier
67
// $type : calendrier_appplette
67
// $type : calendrier_appplette
Line 68... Line 68...
68
function GestionAffichageCalendrier($type = 'calendrier') {
68
function GestionAffichageCalendrier($type = 'calendrier') {
Line 69... Line 69...
69
	
69
	
70
	$retour='';
70
	$retour = '';
71
	
71
	
Line 115... Line 115...
115
	$next = $url->getUrl();
115
	$next = $url->getUrl();
Line 116... Line 116...
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,
Line -... Line 118...
-
 
118
						"7"=>BAZ_JUILLET,"8"=>BAZ_AOUT,"9"=>BAZ_SEPTEMBRE,"10"=>BAZ_OCTOBRE,"11"=>BAZ_NOVEMBRE,"12"=>BAZ_DECEMBRE);
-
 
119
 
-
 
120
	// Titre
-
 
121
	if ($type=='calendrier') {
-
 
122
		// Ajout des styles du bazar
-
 
123
		if (defined('PAP_VERSION')) { //si on est dans Papyrus
-
 
124
			GEN_stockerStyleExterne( 'bazar_interne', 'client/bazar/bazar.interne.css');
-
 
125
		}
-
 
126
		$retour .= '<div id="cal_entete">';
-
 
127
		$retour .= '<span class="cal_navigation">';	
-
 
128
		$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>'; 
-
 
129
		$retour .= '&nbsp;&nbsp;';
-
 
130
		$retour .= '<span id="cal_encadre_mois_courrant"><a id="cal_mois_courrant" href="'.$cur.'">';
-
 
131
		$retour .= $fr_month[(date('n',$curStamp))]; 
-
 
132
		$retour .= '&nbsp;';
-
 
133
		$retour .= (date('Y',$curStamp));
-
 
134
		$retour .= '</a></span>';
-
 
135
		$retour .= '&nbsp;&nbsp;';
-
 
136
		$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>';
-
 
137
		$retour .= '</span>';
-
 
138
		$retour .= '<h1 id="cal_titre"><img id="cal_titre_img" src="client/bazar/images/cal_titre.png" alt="Calendrier"/></h1>';
118
						"7"=>BAZ_JUILLET,"8"=>BAZ_AOUT,"9"=>BAZ_SEPTEMBRE,"10"=>BAZ_OCTOBRE,"11"=>BAZ_NOVEMBRE,"12"=>BAZ_DECEMBRE);
139
		$retour .= '</div>';
119
 
140
	} else {
120
	$retour.= "<div class=\"navi\">";
-
 
121
	$retour.= "<a href=\"".$prev."\"> &lt;&lt; </a>"; 
141
		$retour.= "<div class=\"navi\">";
122
 
142
		$retour.= "<a href=\"".$prev."\"> &lt;&lt; </a>"; 
123
	$retour.= "&nbsp;&nbsp;";
143
		$retour.= "&nbsp;&nbsp;";
124
	$retour.= "<a href=\"".$cur;
144
		$retour.= "<a href=\"".$cur;
125
	$retour.= "\"> ";
145
		$retour.= "\"> ";
126
	$retour.= $fr_month[(date('n',$curStamp))]; 
146
		$retour.= $fr_month[(date('n',$curStamp))]; 
127
	$retour.= "&nbsp;";
147
		$retour.= "&nbsp;";
128
	$retour.= (date('Y',$curStamp));
148
		$retour.= (date('Y',$curStamp));
129
	$retour.= "</a>";
149
		$retour.= "</a>";
130
	$retour.= "&nbsp;&nbsp;";
-
 
131
	$retour.= "<a href=\"".$next."\"> &gt;&gt; </a>";
150
		$retour.= "&nbsp;&nbsp;";
132
 
-
 
133
	$retour.= "</div>";
-
 
134
 
151
		$retour.= "<a href=\"".$next."\"> &gt;&gt; </a>";
135
	$retour.="<br></br>";
152
		$retour.= "</div>";
Line 136... Line 153...
136
 
153
	}
Line 137... Line 154...
137
	// Vue Mois calendrier ou vue applette
154
	// Vue Mois calendrier ou vue applette
Line 224... Line 241...
224
//			$selection[] = $DiaryEvent;				
241
//			$selection[] = $DiaryEvent;				
225
//		}
242
//		}
Line 226... Line 243...
226
			
243
			
227
		// Affichage Calendrier
244
		// Affichage Calendrier
228
		$month->build($selection);
245
		$month->build($selection);
229
		if ($type=='calendrier') {
246
		if ($type == 'calendrier') {
-
 
247
			$retour.= '<table class="calendrier">'.
230
			$retour.= "<table class=\"calendar\">
248
				'<thead>'.
Line 231... Line 249...
231
			 <tr>
249
			 	"<tr>
232
			
250
			
233
			  <th> ". BAZ_LUNDI ."</th>
251
			  <th> ". BAZ_LUNDI ."</th>
234
			  <th> ". BAZ_MARDI ."</th>
252
			  <th> ". BAZ_MARDI ."</th>
235
			  <th> ". BAZ_MERCREDI ."</th>
253
			  <th> ". BAZ_MERCREDI ."</th>
236
			  <th> ". BAZ_JEUDI ."</th>
254
			  <th> ". BAZ_JEUDI ."</th>
237
			  <th> ". BAZ_VENDREDI ."</th>
255
			  <th> ". BAZ_VENDREDI ."</th>
238
			  <th> ". BAZ_SAMEDI ."</th>
256
			  <th> ". BAZ_SAMEDI ."</th>
239
			  <th> ". BAZ_DIMANCHE ."</th>
257
			  <th> ". BAZ_DIMANCHE ."</th>
240
			 </tr>
258
			 </tr>
241
			 ";
259
			 ".'</thead>';
242
		}
260
		}
-
 
261
		else {
243
		else {
262
			$retour.= '<table class="calendrier_applette">'.
Line 244... Line 263...
244
			$retour.= "<table class=\"calendar\">
263
				'<thead>'."
245
			 <tr>
264
			 <tr>
246
			
265
			
247
			  <th> ". BAZ_LUNDI_COURT ."</th>
266
			  <th> ". BAZ_LUNDI_COURT ."</th>
248
			  <th> ". BAZ_MARDI_COURT ."</th>
267
			  <th> ". BAZ_MARDI_COURT ."</th>
249
			  <th> ". BAZ_MERCREDI_COURT ."</th>
268
			  <th> ". BAZ_MERCREDI_COURT ."</th>
250
			  <th> ". BAZ_JEUDI_COURT ."</th>
269
			  <th> ". BAZ_JEUDI_COURT ."</th>
251
			  <th> ". BAZ_VENDREDI_COURT ."</th>
270
			  <th> ". BAZ_VENDREDI_COURT ."</th>
252
			  <th> ". BAZ_SAMEDI_COURT ."</th>
271
			  <th> ". BAZ_SAMEDI_COURT ."</th>
253
			  <th> ". BAZ_DIMANCHE_COURT ."</th>
272
			  <th> ". BAZ_DIMANCHE_COURT ."</th>
Line 254... Line 273...
254
			 </tr>
273
			 </tr>
Line 267... Line 286...
267
				
286
				
268
				$dayStamp = $day->thisDay(true);
287
				$dayStamp = $day->thisDay(true);
Line 269... Line 288...
269
				$day_ymd=date('Ymd',$dayStamp);
288
				$day_ymd=date('Ymd',$dayStamp);
270
				
289
				
271
				if ( $day->isEmpty() ) {
290
				if ( $day->isEmpty() ) {
272
						$class = "other_month";
291
						$class = "cal_ma";
273
				}
292
				}
274
				else {
293
				else {
275
					if (($day_ymd < $today_ymd)) {
294
					if (($day_ymd < $today_ymd)) {
276
						$class= "previous_month";
295
						$class= "cal_mp";
277
					}
296
					}
278
					else {
297
					else {
279
						 if ($day_ymd == $today_ymd) {
298
						 if ($day_ymd == $today_ymd) {
280
						 	$class= "current_day";
299
						 	$class= "cal_jc";
281
						 }
300
						 }
282
						 else {
301
						 else {
283
							$class="current_month";
302
							$class="cal_mc";
284
						 }
303
						 }
Line 285... Line 304...
285
					}
304
					}
286
				}
305
				}
287
				
306
				
288
				$url->addQueryString ('y', date('Y',$dayStamp));
-
 
289
				$url->addQueryString ('m', date('n',$dayStamp));
307
				$url->addQueryString ('y', date('Y',$dayStamp));
Line 290... Line 308...
290
				$url->addQueryString ('d', date('j',$dayStamp));
308
				$url->addQueryString ('m', date('n',$dayStamp));
291
				
309
				$url->addQueryString ('d', date('j',$dayStamp));
292
				$link = $url->getUrl();
310
				$link = $url->getUrl();
293
			
-
 
294
				// isFirst() to find start of week
-
 
295
				if ($day->isFirst())
311
			
296
					$retour.= ( "<tr>\n" );
312
				// isFirst() to find start of week
297
				
313
				if ($day->isFirst()) {
298
				//$retour.= ( "<td class=\"".$class."\"><a href=\"".$link."\">".$day->thisDay()."</a>\n" );
314
					$retour.= ( "<tr>\n" );
299
				
315
				}
-
 
316
				if ($type == 'calendrier') {
-
 
317
					$retour.= "<td class=\"".$class."\">".'<span class="cal_j">'.$day->thisDay().'</span>'."\n";
300
				if ($type=='calendrier') {
318
					if ($day->isSelected() ) {
301
					$retour.= "<td class=\"".$class."\">".$day->thisDay()."\n";
319
						$evenements = $day->getEntry();
302
					if ($day->isSelected() ) {
320
						$evenements_nbre = count($evenements);
303
						$evenements=$day->getEntry();
321
						$evenemt_xhtml = '';
304
						while ($ligne_evenement=array_pop($evenements)) {
322
						while ($ligne_evenement = array_pop($evenements)) {
305
							$id_fiches=array();
323
							$id_fiches = array();
306
							$id_fiches[]=$ligne_evenement->bf_id_fiche;
324
							$id_fiches[] = $ligne_evenement->bf_id_fiche;
307
							$url->addQueryString ('id_fiches',$id_fiches);
325
							$url->addQueryString ('id_fiches',$id_fiches);
-
 
326
							$link = $url->getUrl();
-
 
327
							$evenemt_xhtml .= '<li><a class="cal_evenemt" href="'.$link.'" title="'.$ligne_evenement->bf_titre.'">'.substr($ligne_evenement->bf_titre, 0, 20).'...</a></li>'."\n";
-
 
328
							$url->removeQueryString ('id_fiches');
-
 
329
						}
-
 
330
						if ($evenements_nbre > 0) {
308
							$link = $url->getUrl();
331
							$retour .= '<ul class="cal_evenemt_liste">';
309
							$retour.= "<a href=\"".$link."\">".$ligne_evenement->bf_titre."</a>\n";
-
 
310
							$url->removeQueryString ('id_fiches');
332
							$retour .= $evenemt_xhtml;
311
						}
333
							$retour .= '</ul>';
312
					}
334
						}
313
				}
335
					}
314
				else {
336
				} else {
315
					$lien_date= "<td class=\"".$class."\">".$day->thisDay()."\n";
337
					$lien_date= "<td class=\"".$class."\">".$day->thisDay()."\n";
Line 332... Line 354...
332
				// isLast() to find end of week
354
				// isLast() to find end of week
333
				if ( $day->isLast() )
355
				if ( $day->isLast() )
334
					$retour.= ( "</tr>\n" );
356
					$retour.= ( "</tr>\n" );
335
			}
357
			}
Line 336... Line 358...
336
		
358
		
Line 337... Line 359...
337
			$retour.= "</table>";
359
			$retour.= "</tbody></table>";
Line 338... Line 360...
338
			
360
			
Line 339... Line 361...
339
			
361
			
340
		}
-
 
341
		
-
 
342
		// Vue detail
-
 
343
		
-
 
344
		if ((isset($_GET['id_fiches']))) {
-
 
345
				// Ajout des styles du bazar
362
		}
346
				if (defined('PAP_VERSION')) { //si on est dans Papyrus
363
		
347
					//GEN_stockerStyleExterne( 'bazar_interne', 'client/bazar/bazar.interne.css');
364
		// Vue detail
348
				}
365
		
349
			
366
		if ((isset($_GET['id_fiches']))) {