Subversion Repositories Applications.bazar

Rev

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

Rev 189 Rev 196
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.rss.php,v 1.60.2.9 2007-02-27 15:32:40 alexandre_tb Exp $
22
// CVS : $Id: bazar.fonct.rss.php,v 1.60.2.10 2007-03-06 09:41:15 alexandre_tb Exp $
23
/**
23
/**
24
* 
24
* 
25
*@package bazar
25
*@package bazar
26
//Auteur original :
26
//Auteur original :
27
*@author        Alexandre GRANIER <alexandre@tela-botanica.org>
27
*@author        Alexandre GRANIER <alexandre@tela-botanica.org>
28
*@author        Florian Schmitt <florian@ecole-et-nature.org>
28
*@author        Florian Schmitt <florian@ecole-et-nature.org>
29
//Autres auteurs :
29
//Autres auteurs :
30
*@copyright     Tela-Botanica 2000-2006
30
*@copyright     Tela-Botanica 2000-2006
31
*@version       $Revision: 1.60.2.9 $
31
*@version       $Revision: 1.60.2.10 $
32
// +------------------------------------------------------------------------------------------------------+
32
// +------------------------------------------------------------------------------------------------------+
33
*/
33
*/
Line 34... Line 34...
34
 
34
 
35
// +------------------------------------------------------------------------------------------------------+
35
// +------------------------------------------------------------------------------------------------------+
Line 226... Line 226...
226
		for ($i=0; $i<count($tableau); $i++) {
226
		for ($i=0; $i<count($tableau); $i++) {
227
			if (isset($ligne[$tableau[$i]['nom_bdd']]) && ( $tableau[$i]['type']=='texte' || $tableau[$i]['type']=='textelong' ) ) {
227
			if (isset($ligne[$tableau[$i]['nom_bdd']]) && ( $tableau[$i]['type']=='texte' || $tableau[$i]['type']=='textelong' ) ) {
228
				$val=$tableau[$i]['nom_bdd'];
228
				$val=$tableau[$i]['nom_bdd'];
229
				if (!in_array($val, array ('bf_titre', 'bf_description'))) {
229
				if (!in_array($val, array ('bf_titre', 'bf_description'))) {
230
					if ($ligne[$val] != '' and $ligne[$val] != BAZ_CHOISIR and $ligne[$val] != BAZ_NON_PRECISE) {
230
					if ($ligne[$val] != '' and $ligne[$val] != BAZ_CHOISIR and $ligne[$val] != BAZ_NON_PRECISE) {
231
						$res .= '<span class="rubrique">'.$tableau[$i]['label'].':</span>'."\n";
231
						$res .= '<span class="rubrique" id="'.$tableau[$i]['nom_bdd'].'_rubrique">'.$tableau[$i]['label'].':</span>'."\n";
232
						$res .= '<span class="description"> '.nl2br($ligne[$val]).'</span>'."\n".'<br />'."\n";
232
						$res .= '<span class="description" id="'.$tableau[$i]['nom_bdd'].'_description"> '.nl2br($ligne[$val]).'</span>'."\n".'<br />'."\n";
233
					}
233
					}
234
				}
234
				}
235
			}
235
			}
236
			elseif ( $tableau[$i]['type']=='liste' || $tableau[$i]['type']=='checkbox' ) {
236
			elseif ( $tableau[$i]['type']=='liste' || $tableau[$i]['type']=='checkbox' ) {
237
				//pour les champs renseignes par une liste, on va chercher le label de la liste, plutot que l'id				
237
				//pour les champs renseignes par une liste, on va chercher le label de la liste, plutot que l'id				
Line 246... Line 246...
246
					if ($nb>0) $val .= ', ';
246
					if ($nb>0) $val .= ', ';
247
					$val .= $tab[0];
247
					$val .= $tab[0];
248
					$nb++;
248
					$nb++;
249
				}				
249
				}				
250
				if ($val != '' and $val != BAZ_CHOISIR and $val != BAZ_NON_PRECISE) {
250
				if ($val != '' and $val != BAZ_CHOISIR and $val != BAZ_NON_PRECISE) {
251
					$res .= '<span class="rubrique">'.$tableau[$i]['label'].':</span>'."\n";
251
					$res .= '<span class="rubrique" id="rubrique_'.$tableau[$i]['nom_bdd'].'">'.$tableau[$i]['label'].':</span>'."\n";
252
					$res .= '<span class="description"> '.$val.'</span>'."\n".'<br />'."\n";
252
					$res .= '<span class="description" id="description_'.$tableau[$i]['nom_bdd'].'"> '.$val.'</span>'."\n".'<br />'."\n";
253
				}
253
				}
254
			}
254
			}
255
			elseif ( $tableau[$i]['type']=='listedatedeb' || $tableau[$i]['type']=='listedatefin' ) {
255
			elseif ( $tableau[$i]['type']=='listedatedeb' || $tableau[$i]['type']=='listedatefin' ) {
256
				$val=$tableau[$i]['nom_bdd'];
256
				$val=$tableau[$i]['nom_bdd'];
257
				if (!in_array($val, array ('bf_date_debut_validite_fiche', 'bf_date_fin_validite_fiche'))) {
257
				if (!in_array($val, array ('bf_date_debut_validite_fiche', 'bf_date_fin_validite_fiche'))) {
258
					if ($ligne[$val] != '' && $ligne[$val] != '0000-00-00') {
258
					if ($ligne[$val] != '' && $ligne[$val] != '0000-00-00') {
259
						$res .= '<span class="rubrique">'.$tableau[$i]['label'].':</span>'."\n";
259
						$res .= '<span class="rubrique" id="'.$tableau[$i]['nom_bdd'].'_rubrique">'.$tableau[$i]['label'].':</span>'."\n";
260
						$res .= '<span class="description"> '.strftime('%d.%m.%Y',strtotime($ligne[$val])).'</span>'."\n".'<br />'."\n";
260
						$res .= '<span class="description" id="'.$tableau[$i]['nom_bdd'].'_description"> '.strftime('%d.%m.%Y',strtotime($ligne[$val])).'</span>'."\n".'<br />'."\n";
261
					}
261
					}
262
				}		
262
				}		
263
			}
263
			}
264
			elseif ( $tableau[$i]['type']=='wikini' ) {
264
			elseif ( $tableau[$i]['type']=='wikini' ) {
265
				$res .= '<div class="lien_wikini"><a href="wikini/'.baz_titre_wiki($ligne["bf_titre"]).'">'.BAZ_ENTRER_PROJET.'</a></div>'."\n";
265
				$res .= '<div class="lien_wikini"><a href="wikini/'.baz_titre_wiki($ligne["bf_titre"]).'">'.BAZ_ENTRER_PROJET.'</a></div>'."\n";
Line 563... Line 563...
563
		if ($req_where==1) {$requete .= ' AND ';}
563
		if ($req_where==1) {$requete .= ' AND ';}
564
		$requete .= 'bf_ce_nature IN (' ;
564
		$requete .= 'bf_ce_nature IN (' ;
565
		$chaine = '';
565
		$chaine = '';
566
		foreach ($typeannonce as $valeur) $chaine .= '"'.$valeur.'",' ;
566
		foreach ($typeannonce as $valeur) $chaine .= '"'.$valeur.'",' ;
567
		$requete .= substr ($chaine, 0, strlen ($chaine)-1) ; 
567
		$requete .= substr ($chaine, 0, strlen ($chaine)-1) ; 
568
		$requete .= ') ';
568
		$requete .= ') and bf_ce_nature=bn_id_nature ';
569
	}
569
	}
570
	$utilisateur = new Administrateur_bazar ($GLOBALS['AUTH']) ;
570
	$utilisateur = new Administrateur_bazar ($GLOBALS['AUTH']) ;
571
	if ($valide!=0) {
571
	if ($valide!=0) {
Line 572... Line 572...
572
		
572
		
Line 600... Line 600...
600
		$requete .= '('.$requeteSQL.')';
600
		$requete .= '('.$requeteSQL.')';
601
		$req_where=1;
601
		$req_where=1;
602
	}
602
	}
603
	if ($categorie_nature!='') {
603
	if ($categorie_nature!='') {
604
		if ($req_where==1) {$requete .= ' AND ';}
604
		if ($req_where==1) {$requete .= ' AND ';}
605
		$requete .= 'bn_ce_id_menu IN ('.$categorie_nature.') ';
605
		$requete .= 'bn_ce_id_menu IN ('.$categorie_nature.') and bf_ce_nature=bn_id_nature ';
606
		$req_where=1;
606
		$req_where=1;
607
	}
607
	}
Line 608... Line 608...
608
	
608
	
609
	$requete .= ' ORDER BY   bf_date_creation_fiche DESC, bf_date_fin_validite_fiche DESC, bf_date_maj_fiche DESC';
609
	$requete .= ' ORDER BY   bf_date_creation_fiche DESC, bf_date_fin_validite_fiche DESC, bf_date_maj_fiche DESC';
Line 653... Line 653...
653
	$xml .= XML_Util::createEndElement ('image');
653
	$xml .= XML_Util::createEndElement ('image');
654
	if ($resultat->numRows()>0) {
654
	if ($resultat->numRows()>0) {
655
		// Creation des items : titre + lien + description + date de publication
655
		// Creation des items : titre + lien + description + date de publication
656
		while ($ligne = $resultat->fetchRow(DB_FETCHMODE_ASSOC)) {
656
		while ($ligne = $resultat->fetchRow(DB_FETCHMODE_ASSOC)) {
657
			$xml .= XML_Util::createStartElement ('item');
657
			$xml .= XML_Util::createStartElement ('item');
658
			
-
 
-
 
658
			$caractere = array('/\x92/', '/\x85/', '/\x80/', '/\x97/', '/\x96/');
-
 
659
			$caractere_remplacement = array ('&#8217;', '&#8230;', '&#8364;', '&#8212;', '&#8211;');
659
			$xml .= XML_Util::createTag ('title', null, xmlEntities($ligne['bf_titre']));
660
			$xml .= XML_Util::createTag ('title', null, preg_replace ($caractere, $caractere_remplacement,
660
			
-
 
-
 
661
													XML_Util::replaceEntities($ligne['bf_titre'])));
661
			$lien=$GLOBALS['_BAZAR_']['url'];
662
			$lien=$GLOBALS['_BAZAR_']['url'];
662
			$lien->addQueryString('action', BAZ_VOIR_FICHE);
663
			$lien->addQueryString('action', BAZ_VOIR_FICHE);
663
			$lien->addQueryString('id_fiche', $ligne['bf_id_fiche']);
664
			$lien->addQueryString('id_fiche', $ligne['bf_id_fiche']);
664
			$xml .= XML_Util::createTag ('link', null, $lien->getURL());
665
			$xml .= XML_Util::createTag ('link', null, $lien->getURL());
665
			$xml .= XML_Util::createTag ('guid', null, $lien->getURL());
666
			$xml .= XML_Util::createTag ('guid', null, $lien->getURL());
666
			$xml .= XML_Util::createStartElement ('description');
667
			$xml .= XML_Util::createStartElement ('description');
667
			if ($_GET['action'] != BAZ_VOIR_TOUTES_ANNONCES) {
668
			if ($_GET['action'] != BAZ_VOIR_TOUTES_ANNONCES) {
668
				$xml .= XML_Util::createCDataSection ($ligne['bf_description']);
669
				$xml .= XML_Util::createCDataSection (preg_replace ($caractere, $caractere_remplacement, $ligne['bf_description']));
669
			}
670
			}
670
			$xml .= XML_Util::createEndElement ('description');
671
			$xml .= XML_Util::createEndElement ('description');
671
			if ($ligne['bf_date_debut_validite_fiche'] == '0000-00-00') $date_pub = $ligne[' bf_date_creation_fiche'] ; else 
672
			if ($ligne['bf_date_debut_validite_fiche'] == '0000-00-00') $date_pub = $ligne[' bf_date_creation_fiche'] ; else 
672
					$date_pub =  $ligne['bf_date_debut_validite_fiche'];
673
					$date_pub =  $ligne['bf_date_debut_validite_fiche'];
673
			$xml .= XML_Util::createTag ('pubDate', null, strftime('%d %b %Y %H:%M:%S GMT',strtotime($date_pub)));
674
			$xml .= XML_Util::createTag ('pubDate', null, strftime('%d %b %Y %H:%M:%S GMT',strtotime($date_pub)));
Line 679... Line 680...
679
		$xml .= XML_Util::createTag ('title', null, BAZ_PAS_D_ANNONCES);
680
		$xml .= XML_Util::createTag ('title', null, BAZ_PAS_D_ANNONCES);
680
		$xml .= XML_Util::createTag ('link', null, '#');
681
		$xml .= XML_Util::createTag ('link', null, '#');
681
		$xml .= XML_Util::createTag ('description', null, BAZ_PAS_D_ANNONCES);
682
		$xml .= XML_Util::createTag ('description', null, BAZ_PAS_D_ANNONCES);
682
		$xml .= XML_Util::createTag ('pubDate', null, strftime('%d %b %Y %H:%M:%S GMT',strtotime('12/12/2004')));
683
		$xml .= XML_Util::createTag ('pubDate', null, strftime('%d %b %Y %H:%M:%S GMT',strtotime('12/12/2004')));
683
		$xml .= XML_Util::createEndElement ('item');
684
		$xml .= XML_Util::createEndElement ('item');
684
		$xml .= '</item>'."\n";
-
 
-
 
685
 
685
	}
686
	}
686
	$xml .= XML_Util::createEndElement ('channel');
687
	$xml .= XML_Util::createEndElement ('channel');
687
	$xml .= XML_Util::createEndElement('rss') ;
688
	$xml .= XML_Util::createEndElement('rss') ;
688
	return $xml;
689
	return $xml;
689
}
690
}
Line 1051... Line 1052...
1051
}
1052
}
Line 1052... Line 1053...
1052
 
1053
 
1053
/* +--Fin du code ----------------------------------------------------------------------------------------+
1054
/* +--Fin du code ----------------------------------------------------------------------------------------+
1054
*
1055
*
-
 
1056
* $Log: not supported by cvs2svn $
-
 
1057
* Revision 1.60.2.9  2007/02/27 15:32:40  alexandre_tb
-
 
1058
* utilisation de la fonction xmlEntities pour transformer les &amp; en &#...;
-
 
1059
* fixe les plantages des flux rss lorsque des guillemets ou des esperluettes étaient présents
1055
* $Log: not supported by cvs2svn $
1060
*
1056
* Revision 1.60.2.8  2007/02/27 15:11:00  alexandre_tb
1061
* Revision 1.60.2.8  2007/02/27 15:11:00  alexandre_tb
1057
* correction d une jointure dans la requete pour les flux rss
1062
* correction d une jointure dans la requete pour les flux rss
1058
* utilisation de la librairie XML_Util de pear pour generer le flux RSS -> plus clair
1063
* utilisation de la librairie XML_Util de pear pour generer le flux RSS -> plus clair
1059
*
1064
*