Subversion Repositories Applications.bazar

Rev

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

Rev 208 Rev 209
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.14 2007-03-14 18:14:42 jp_milcent Exp $
22
// CVS : $Id: bazar.fonct.cal.php,v 1.15 2007-03-16 12:40:25 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.14 $ $Date: 2007-03-14 18:14:42 $
32
*@version       $Revision: 1.15 $ $Date: 2007-03-16 12:40:25 $
33
// +------------------------------------------------------------------------------------------------------+
33
// +------------------------------------------------------------------------------------------------------+
34
*/
34
*/
Line 35... Line 35...
35
 
35
 
36
// +------------------------------------------------------------------------------------------------------+
36
// +------------------------------------------------------------------------------------------------------+
Line 98... Line 98...
98
	$curStamp = $month->getTimeStamp();
98
	$curStamp = $month->getTimeStamp();
99
	$url->addQueryString('y', date('Y',$curStamp));
99
	$url->addQueryString('y', date('Y',$curStamp));
100
	$url->addQueryString('m', date('n',$curStamp));
100
	$url->addQueryString('m', date('n',$curStamp));
101
	$url->addQueryString('d', date('j',$curStamp));
101
	$url->addQueryString('d', date('j',$curStamp));
102
	$cur = $url->getUrl();
102
	$cur = $url->getUrl();
-
 
103
 
-
 
104
	// Gestion de l'affichage des titres des évènements
-
 
105
	if (isset($_GET['ctt']) && $_GET['ctt'] == '1') {
-
 
106
		$url->addQueryString('tt', '0');
-
 
107
		if ($_GET['tt'] == '0') {
-
 
108
			$url->addQueryString('tt', '1');
-
 
109
		}
-
 
110
		$tc_lien = $url->getUrl();
-
 
111
	} else {
-
 
112
		$url->addQueryString('tt', '0');
-
 
113
		if ($_GET['tt'] == '0') {
-
 
114
			$url->addQueryString('tt', '1');
-
 
115
		}
-
 
116
		$url->addQueryString('ctt', '1');
-
 
117
		$tc_lien = $url->getUrl();
-
 
118
	}
-
 
119
	$url->removeQueryString('ctt');
-
 
120
	$url->removeQueryString('tt');
-
 
121
	$tc_txt = 'Afficher les titres complets des évènements';
-
 
122
	if (isset($_GET['tt'])) {
-
 
123
		if ($_GET['tt'] == '0') {
-
 
124
			$tc_txt = 'Tronquer les titres des évènements';
-
 
125
			$url->addQueryString('tt', $_GET['tt']);
-
 
126
		}
-
 
127
	}
Line 103... Line 128...
103
	
128
	
104
	// Navigation 
129
	// Navigation 
105
	$prevStamp = $month->prevMonth(true);
130
	$prevStamp = $month->prevMonth(true);
106
	$url->addQueryString('y', date('Y',$prevStamp));
131
	$url->addQueryString('y', date('Y',$prevStamp));
Line 112... Line 137...
112
	$url->addQueryString('y', date('Y',$nextStamp));
137
	$url->addQueryString('y', date('Y',$nextStamp));
113
	$url->addQueryString('m', date('n',$nextStamp));
138
	$url->addQueryString('m', date('n',$nextStamp));
114
	$url->addQueryString('d', date('j',$nextStamp));
139
	$url->addQueryString('d', date('j',$nextStamp));
115
	$next = $url->getUrl();
140
	$next = $url->getUrl();
Line -... Line 141...
-
 
141
	
-
 
142
	// Suppression du paramêtre de troncage des titres
-
 
143
	$url->removeQueryString('tt');
116
	
144
	
117
	$fr_month = array(	"1"=>BAZ_JANVIER,"2"=>BAZ_FEVRIER,"3"=>BAZ_MARS,"4"=>BAZ_AVRIL,"5"=>BAZ_MAI,"6"=>BAZ_JUIN,
145
	$fr_month = array(	"1"=>BAZ_JANVIER,"2"=>BAZ_FEVRIER,"3"=>BAZ_MARS,"4"=>BAZ_AVRIL,"5"=>BAZ_MAI,"6"=>BAZ_JUIN,
Line 118... Line 146...
118
						"7"=>BAZ_JUILLET,"8"=>BAZ_AOUT,"9"=>BAZ_SEPTEMBRE,"10"=>BAZ_OCTOBRE,"11"=>BAZ_NOVEMBRE,"12"=>BAZ_DECEMBRE);
146
						"7"=>BAZ_JUILLET,"8"=>BAZ_AOUT,"9"=>BAZ_SEPTEMBRE,"10"=>BAZ_OCTOBRE,"11"=>BAZ_NOVEMBRE,"12"=>BAZ_DECEMBRE);
119
 
147
 
120
	// Titre
148
	// Titre
121
	if ($type=='calendrier') {
149
	if ($type=='calendrier') {
122
		// Ajout des styles du bazar
150
		// Ajout des styles du bazar
-
 
151
		if (defined('PAP_VERSION')) { //si on est dans Papyrus
-
 
152
			GEN_stockerStyleExterne( 'bazar_interne', 'client/bazar/bazar.interne.css');
-
 
153
			GEN_stockerFichierScript('domLib', '/api/js/domtooltip/domLib.js');
-
 
154
			GEN_stockerFichierScript('domTT', '/api/js/domtooltip/domTT.js');
-
 
155
			// DomToolTip
-
 
156
			$script = 'var domTT_styleClass = "niceTitle";'."\n";
-
 
157
			$script .= 'function nicetitleDecorator(el) {'."\n";
-
 
158
			$script .= '	var result = el.title;'."\n";
-
 
159
			$script .= '	result = result.replace(new RegExp("\n", "g"), "<br />");'."\n";
-
 
160
			$script .= '	if (el.href) {'."\n";
-
 
161
			$script .= '		result += "<p>" + el.href + "</p>";'."\n";
-
 
162
			$script .= '	}'."\n";
-
 
163
			$script .= '	return result;'."\n";
-
 
164
			$script .= '}'."\n";
123
		if (defined('PAP_VERSION')) { //si on est dans Papyrus
165
			$script .= 'domTT_replaceTitles(nicetitleDecorator);'."\n";
124
			GEN_stockerStyleExterne( 'bazar_interne', 'client/bazar/bazar.interne.css');
166
			GEN_stockerCodeScript('var domTT_styleClass = "niceTitle";'."\n");
125
		}
167
		}
126
		$retour .= '<div id="cal_entete">';
168
		$retour .= '<div id="cal_entete">';
127
		$retour .= '<span class="cal_navigation">';	
169
		$retour .= '<span class="cal_navigation">';	
Line 135... Line 177...
135
		$retour .= '&nbsp;&nbsp;';
177
		$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>';
178
		$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>';
179
		$retour .= '</span>';
138
		$retour .= '<h1 id="cal_titre"><img id="cal_titre_img" src="client/bazar/images/cal_titre.png" alt="Calendrier"/></h1>';
180
		$retour .= '<h1 id="cal_titre"><img id="cal_titre_img" src="client/bazar/images/cal_titre.png" alt="Calendrier"/></h1>';
139
		$retour .= '</div>';
181
		$retour .= '</div>';
-
 
182
		
-
 
183
		$retour .= '<p>'.'<a href="'.$tc_lien.'">'.$tc_txt.'</a>'.'</p>';
140
	} else {
184
	} else {
141
		$retour.= "<div class=\"navi\">";
185
		$retour.= "<div class=\"navi\">";
142
		$retour.= "<a href=\"".$prev."\"> &lt;&lt; </a>"; 
186
		$retour.= "<a href=\"".$prev."\"> &lt;&lt; </a>"; 
143
		$retour.= "&nbsp;&nbsp;";
187
		$retour.= "&nbsp;&nbsp;";
144
		$retour.= "<a href=\"".$cur;
188
		$retour.= "<a href=\"".$cur;
Line 243... Line 287...
243
			
287
			
244
		// Affichage Calendrier
288
		// Affichage Calendrier
245
		$month->build($selection);
289
		$month->build($selection);
246
		if ($type == 'calendrier') {
290
		if ($type == 'calendrier') {
-
 
291
			$retour.= '<table class="calendrier">'.
-
 
292
				'<colgroup>'.
-
 
293
					'<col class="cal_lundi"/>'.
-
 
294
					'<col class="cal_mardi"/>'.
-
 
295
					'<col class="cal_mercredi"/>'.
-
 
296
					'<col class="cal_jeudi"/>'.
-
 
297
					'<col class="cal_vendredi"/>'.
-
 
298
					'<col class="cal_samedi"/>'.
-
 
299
					'<col class="cal_dimanche"/>'.
247
			$retour.= '<table class="calendrier">'.
300
				'</colgroup>'.
248
				'<thead>'.
301
				'<thead>'.
Line 249... Line 302...
249
			 	"<tr>
302
			 	"<tr>
250
			
303
			
Line 254... Line 307...
254
			  <th> ". BAZ_JEUDI ."</th>
307
			  <th> ". BAZ_JEUDI ."</th>
255
			  <th> ". BAZ_VENDREDI ."</th>
308
			  <th> ". BAZ_VENDREDI ."</th>
256
			  <th> ". BAZ_SAMEDI ."</th>
309
			  <th> ". BAZ_SAMEDI ."</th>
257
			  <th> ". BAZ_DIMANCHE ."</th>
310
			  <th> ". BAZ_DIMANCHE ."</th>
258
			 </tr>
311
			 </tr>
259
			 ".'</thead>';
312
			 ".'</thead>'.'<tbody>';
260
		}
313
		}
261
		else {
314
		else {
262
			$retour.= '<table class="calendrier_applette">'.
315
			$retour.= '<table class="calendrier_applette">'.
-
 
316
				'<colgroup>'.
-
 
317
					'<col class="cal_lundi"/>'.
-
 
318
					'<col class="cal_mardi"/>'.
-
 
319
					'<col class="cal_mercredi"/>'.
-
 
320
					'<col class="cal_jeudi"/>'.
-
 
321
					'<col class="cal_vendredi"/>'.
-
 
322
					'<col class="cal_samedi"/>'.
-
 
323
					'<col class="cal_dimanche"/>'.
-
 
324
				'</colgroup>'.
263
				'<thead>'."
325
				'<thead>'.
264
			 <tr>
326
			 "<tr>
Line 265... Line 327...
265
			
327
			
266
			  <th> ". BAZ_LUNDI_COURT ."</th>
328
			  <th> ". BAZ_LUNDI_COURT ."</th>
267
			  <th> ". BAZ_MARDI_COURT ."</th>
329
			  <th> ". BAZ_MARDI_COURT ."</th>
268
			  <th> ". BAZ_MERCREDI_COURT ."</th>
330
			  <th> ". BAZ_MERCREDI_COURT ."</th>
Line 322... Line 384...
322
						while ($ligne_evenement = array_pop($evenements)) {
384
						while ($ligne_evenement = array_pop($evenements)) {
323
							$id_fiches = array();
385
							$id_fiches = array();
324
							$id_fiches[] = $ligne_evenement->bf_id_fiche;
386
							$id_fiches[] = $ligne_evenement->bf_id_fiche;
325
							$url->addQueryString ('id_fiches',$id_fiches);
387
							$url->addQueryString ('id_fiches',$id_fiches);
326
							$link = $url->getUrl();
388
							$link = $url->getUrl();
-
 
389
							
-
 
390
							if (!isset($_GET['tt']) || (isset($_GET['tt']) && $_GET['tt'] == '1')) {
-
 
391
								$titre_taille = strlen($ligne_evenement->bf_titre);
-
 
392
								$titre = ($titre_taille > 20)?substr($ligne_evenement->bf_titre, 0, 20).'...':$ligne_evenement->bf_titre;
-
 
393
							} else {
-
 
394
								$titre = $ligne_evenement->bf_titre;
-
 
395
							}
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";
396
							$evenemt_xhtml .= '<li class="tooltip" title="'.$ligne_evenement->bf_titre.'"><a class="cal_evenemt" href="'.$link.'">'.$titre.'</a></li>'."\n";
328
							$url->removeQueryString ('id_fiches');
397
							$url->removeQueryString ('id_fiches');
329
						}
398
						}
330
						if ($evenements_nbre > 0) {
399
						if ($evenements_nbre > 0) {
331
							$retour .= '<ul class="cal_evenemt_liste">';
400
							$retour .= '<ul class="cal_evenemt_liste">';
332
							$retour .= $evenemt_xhtml;
401
							$retour .= $evenemt_xhtml;
Line 358... Line 427...
358
		
427
		
Line 359... Line 428...
359
			$retour.= "</tbody></table>";
428
			$retour.= "</tbody></table>";
360
			
-
 
-
 
429
			
361
			
430
			
Line 362... Line 431...
362
		}
431
		}
363
		
432
		$retour.= '<script type="text/javascript">//<![CDATA['."\n".$script.'//]]></script>'."\n";
364
		// Vue detail
433
		// Vue detail