Subversion Repositories eFlore/Archives.herbiers

Rev

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

Rev 11 Rev 12
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: hb_rss.php,v 1.4 2006-10-31 12:42:00 jp_milcent Exp $
22
// CVS : $Id: hb_rss.php,v 1.5 2006-10-31 15:06:44 jp_milcent Exp $
23
/**
23
/**
24
* Générateur de flux RSS pour les Herbiers 
24
* Générateur de flux RSS pour les Herbiers 
25
*
25
*
26
*@package bazar
26
*@package bazar
27
//Auteur original :
27
//Auteur original :
28
*@author        Florian SCHMITT <florian@ecole-et-nature.org>
28
*@author        Florian SCHMITT <florian@ecole-et-nature.org>
29
*@author        Jean-Pascal MILCENT <jpm@tela-botanica.org>
29
*@author        Jean-Pascal MILCENT <jpm@tela-botanica.org>
30
*
30
*
31
*@copyright     Tela-Botanica 2000-2006
31
*@copyright     Tela-Botanica 2000-2006
32
*@version       $Revision: 1.4 $ $Date: 2006-10-31 12:42:00 $
32
*@version       $Revision: 1.5 $ $Date: 2006-10-31 15:06:44 $
33
// +------------------------------------------------------------------------------------------------------+
33
// +------------------------------------------------------------------------------------------------------+
34
*/
34
*/
Line 35... Line 35...
35
 
35
 
36
//==================================== LES FLUX RSS==================================
36
//==================================== LES FLUX RSS==================================
37
// Constantes liées aux flux RSS
37
// Constantes liées aux flux RSS
-
 
38
//==================================================================================
38
//==================================================================================
39
// TODO : à mettre dans un fichier de config
39
define('HBR_CREER_FICHIERS_XML', 0);//0=ne cree pas le fichier XML dans rss/; 1=cree le fichier XML dans rss/
40
define('HBR_CREER_FICHIERS_XML', 0);//0=ne cree pas le fichier XML dans rss/; 1=cree le fichier XML dans rss/
40
define('HBR_RSS_NOMSITE','tela-botanica.org');//Nom du site indiqué dans les flux rss
41
define('HBR_RSS_NOMSITE','tela-botanica.org');//Nom du site indiqué dans les flux rss
41
define('HBR_RSS_ADRESSESITE','http://www.tela-botanica.org');//Adresse Internet du site indiqué dans les flux rss
42
define('HBR_RSS_ADRESSESITE','http://www.tela-botanica.org');//Adresse Internet du site indiqué dans les flux rss
42
define('HBR_RSS_DESCRIPTIONSITE','www.tela-botanica.org, pour mutualiser l\'information sur les Herbiers.');    //Description du site indiquée dans les flux rss
43
define('HBR_RSS_DESCRIPTIONSITE','www.tela-botanica.org, pour mutualiser l\'information sur les Herbiers.');    //Description du site indiquée dans les flux rss
43
define('HBR_RSS_LOGOSITE','http://www.tela-botanica.org/sites/commun/generique/images/logos/logo_tela_ombre.png');//Logo du site indiqué dans les flux rss
44
define('HBR_RSS_LOGOSITE','http://www.tela-botanica.org/sites/commun/generique/images/logos/logo_tela_ombre.png');//Logo du site indiqué dans les flux rss
44
define('HBR_RSS_MANAGINGEDITOR', 'accueil@tela-botanica.org') ;//Managing editor du site
45
define('HBR_RSS_MANAGINGEDITOR', 'accueil@tela-botanica.org') ;//Managing editor du site
45
define('HBR_RSS_WEBMASTER', 'jpm@tela-botanica.org') ; //Mail Webmaster du site
46
define('HBR_RSS_WEBMASTER', 'jpm@tela-botanica.org') ; //Mail Webmaster du site
-
 
47
define('HBR_RSS_CATEGORIE', 'Botanique, Herbiers'); //catégorie du flux RSS
-
 
48
$GLOBALS['_HERBIER_']['rss']['flux'] = array('herbier', 'collection', 'equipe', 'note');
46
define('HBR_RSS_CATEGORIE', 'Botanique, Herbiers'); //catégorie du flux RSS
49
$GLOBALS['_HERBIER_']['rss']['url'] = new Net_URL('http://'.$_SERVER['HTTP_HOST'].$_SERVER['PHP_SELF']);
47
// TODO : à mettre dans le fichier de langue
50
// TODO : à mettre dans le fichier de langue
Line 48... Line 51...
48
define('HBR_PAS_D_ANNONCES', 'Pas d\'annonce'); //Message pas d'annonce
51
define('HBR_PAS_D_ANNONCES', 'Pas d\'annonce'); //Message pas d'annonce
49
 
52
 
50
if (isset($_GET['type'])) { 
53
if (isset($_GET['type'])) { 
51
	$annonce = $_GET['type'];
54
	$type = $_GET['type'];
52
} else {
55
} else {
Line 53... Line 56...
53
	$annonce = '';
56
	$type = '';
54
}
57
}
55
 
58
 
56
if (isset($_GET['nbitem'])) { 
59
if (isset($_GET['limite'])) { 
57
	$nbitem = $_GET['nbitem'];
60
	$limite = $_GET['limite'];
-
 
61
} else {
-
 
62
	$limite = '';
-
 
63
}
-
 
64
// Renseignement des méta données par défaut du flux RSS
-
 
65
$aso_meta['description'] = HBR_RSS_DESCRIPTIONSITE;
-
 
66
$aso_meta['link'] = HBR_RSS_ADRESSESITE;
-
 
67
$aso_meta['language'] = 'fr-FR';
-
 
68
$aso_meta['copyright'] = 'Copyright 2005 '.HBR_RSS_NOMSITE;
-
 
69
$aso_meta['lastBuildDate'] = strftime('%d %b %Y %H:%M:%S GMT');
-
 
70
$aso_meta['docs'] = 'http://www.stervinou.com/projets/rss/';
-
 
71
$aso_meta['category'] = HBR_RSS_CATEGORIE;
-
 
72
$aso_meta['managingEditor'] = HBR_RSS_MANAGINGEDITOR;
-
 
73
$aso_meta['webMaster'] = HBR_RSS_WEBMASTER;
-
 
74
$aso_meta['ttl'] = 60;
Line 58... Line 75...
58
} else {
75
$aso_meta['image']['title'] = HBR_RSS_NOMSITE;
59
	$nbitem = '';
76
$aso_meta['image']['url'] = HBR_RSS_LOGOSITE;
60
}
77
$aso_meta['image']['link'] = HBR_RSS_ADRESSESITE;
61
 
78
 
62
// Generation de la requete MySQL personnalisee
79
// Generation de la requete MySQL personnalisee
63
switch ('type') {
80
switch ($type) {
64
	case 'herbier' :
81
	case 'herbier' :
65
		$requete = 	'SELECT DISTINCT ID_ORG AS id, INSTITUTION_NAME AS titre, DATE_DERNIERE_MODIF AS date_derniere_modif, U_NAME AS nom, U_SURNAME AS prenom '.
82
		$requete = 	'SELECT DISTINCT ID_ORG AS id, INSTITUTION_NAME AS titre, DATE_DERNIERE_MODIF AS date_derniere_modif, U_NAME AS nom, U_SURNAME AS prenom '.
66
					'FROM HERBIERS_ORGANISATION, '.HB_BDD_NOM_ANNUAIRE.'.annuaire_tela '.
83
					'FROM HERBIERS_ORGANISATION, '.HB_BDD_NOM_ANNUAIRE.'.annuaire_tela '.
67
					'WHERE CE_MODIFIER_PAR = U_ID '.
84
					'WHERE CE_MODIFIER_PAR = U_ID '.
68
					'ORDER BY DATE_DERNIERE_MODIF DESC';
85
					'ORDER BY DATE_DERNIERE_MODIF DESC';
-
 
86
		$url = 	HB_URL_COURANTE_CONSULTATION_FICHE_HERBIER_ID;
69
		$url = 	HB_URL_COURANTE_CONSULTATION_FICHE_HERBIER_ID;
87
		$aso_meta['titre'] = 'Flux des Organisations';
70
		$aso_meta['titre'] = 'Flux des Organisations';
88
		break;
71
		break;
89
	case 'collection' :
72
	case 'collection' :
90
		$requete = 	'SELECT DISTINCT ID AS id, NOM_COLLECTION AS titre, '.
73
		$requete = 	'SELECT DISTINCT ID AS id, NOM_COLLECTION AS titre, DATE_DERNIERE_MODIF AS date_derniere_modif, U_NAME AS nom, U_SURNAME AS prenom '.
91
					'DATE_DERNIERE_MODIF AS date_derniere_modif, U_NAME AS nom, U_SURNAME AS prenom '.
74
					'FROM HERBIERS_COLLECTION, '.HB_BDD_NOM_ANNUAIRE.'.annuaire_tela '.
92
					'FROM HERBIERS_COLLECTION, '.HB_BDD_NOM_ANNUAIRE.'.annuaire_tela '.
75
					'WHERE CE_MODIFIER_PAR = U_ID '.
93
					'WHERE CE_MODIFIER_PAR = U_ID '.
-
 
94
					'ORDER BY DATE_DERNIERE_MODIF DESC';
-
 
95
		$url = 	HB_URL_COURANTE_CONSULTATION_FICHE_COLECTION_ID;
-
 
96
		$aso_meta['titre'] = 'Flux des Collections';
-
 
97
		break;
-
 
98
	case 'equipe' :
-
 
99
		$requete = 	'SELECT DISTINCT HOS.ID_ORG AS id_org, HS.ID_STAFF AS id_equipe, PRENOM as titre_prenom, NOM AS titre_nom, '.
-
 
100
					'DATE_DERNIERE_MODIF AS date_derniere_modif, U_NAME AS nom, U_SURNAME AS prenom '.
-
 
101
					'FROM HERBIERS_STAFF AS HS, '.HB_BDD_NOM_ANNUAIRE.'.annuaire_tela, HERBIERS_ont_un_staff AS HOS '.
-
 
102
					'WHERE CE_MODIFIER_PAR = U_ID '.
-
 
103
					'AND HOS.ID_STAFF = HS.ID_STAFF '.
-
 
104
					'ORDER BY DATE_DERNIERE_MODIF DESC';
-
 
105
		$url = 	HB_URL_COURANTE_ADMIN_ACTION_ORG_EQUIPE;
-
 
106
		$aso_meta['titre'] = 'Flux des Équipes';
-
 
107
		break;
-
 
108
	case 'note' :
-
 
109
		$requete = 	'SELECT DISTINCT HC.PARENT_ID AS id_org, HC.ID AS id_coll, HI.ID_INDIC AS id_note, HI.REM_INDIC AS titre, '.
-
 
110
					'HI.TXT_INDIC AS description, HI.MAJ_INDIC AS date_derniere_modif, U_NAME AS nom, U_SURNAME AS prenom '.
-
 
111
					'FROM HERBIERS_INDIC AS HI, HERBIERS_INDIC_HISTORIQUE AS HIH, '.
-
 
112
					HB_BDD_NOM_ANNUAIRE.'.annuaire_tela, HERBIERS_COLLECTION AS HC '.
-
 
113
					'WHERE HI.ID_INDIC = HIH.ID_INDIC AND HI.MAJ_INDIC = HIH.DATE_INDIC AND HIH.ID_INDICATEUR = U_ID AND HI.ID = HC.ID '.
76
					'ORDER BY DATE_DERNIERE_MODIF DESC';
114
					'ORDER BY HI.MAJ_INDIC DESC';
77
		$url = 	HB_URL_COURANTE_CONSULTATION_FICHE_COLECTION_ID;
115
		$url = 	HB_URL_COURANTE_ADMIN_ACTION_ORG_COLL_NOTE;
-
 
116
		$aso_meta['titre'] = 'Flux des Notes';
-
 
117
		break;
-
 
118
	default :
78
		$aso_meta['titre'] = 'Flux des Collections';
119
		$requete = '';
79
		break;
120
		$aso_meta['titre'] = 'Liste des flux RSS de l\'application Herbiers';
80
	default :
121
		$aso_meta['description'] = 	'Veuillez sélectionner un des flux RSS ci-dessous pour obtenir la liste '.
81
		$requete = '';
122
									'des dernières modifications correspondantes.';
82
}
123
}
83
$tab_infos = array();
124
$tab_infos = array();
84
if ($requete != '') {
125
if ($requete != '') {
85
	if ($nbitem != '') {
126
	if ($limite != '') {
86
		$requete .= ' LIMIT 0,'.$nbitem;	
127
		$requete .= ' LIMIT 0,'.$limite;	
87
	}
128
	}
88
	$resultat = $GLOBALS['_HERBIER_']['bdd']->query($requete) ;
129
	$resultat = $GLOBALS['_HERBIER_']['bdd']->query($requete) ;
89
	if (DB::isError($resultat)) {
130
	if (DB::isError($resultat)) {
-
 
131
		die ($resultat->getMessage().$resultat->getDebugInfo()) ;
-
 
132
	}
-
 
133
	while ($ligne = $resultat->fetchRow(DB_FETCHMODE_ASSOC)) {
-
 
134
		$aso_infos = array();
-
 
135
		switch ($type) {
-
 
136
			case 'equipe' :
-
 
137
				$aso_infos['title'] = $ligne['titre_prenom'].' '.$ligne['titre_nom'];
-
 
138
				$aso_infos['link'] = str_replace('&', '&amp;', sprintf($url, 32, $ligne['id_org'], $ligne['id_equipe']));
-
 
139
				$aso_infos['description'] = 'Modifié par '.$ligne['prenom'].' '.$ligne['nom'].' le '.$ligne['date_derniere_modif'];
-
 
140
				$aso_infos['pubdate'] = strftime('%d %b %Y %H:%M:%S GMT', $ligne['date_derniere_modif']);		
-
 
141
				break;
-
 
142
			case 'note' :
-
 
143
				if ($ligne['titre'] != '') {
-
 
144
					$aso_infos['title'] = $ligne['titre'];
-
 
145
				} else {
-
 
146
					$aso_infos['title'] = strtoupper($ligne['nom']).' '.date('j.m.Y', $ligne['date_derniere_modif']);
-
 
147
				}
-
 
148
				$aso_infos['link'] = str_replace('&', '&amp;', sprintf($url, 42, $ligne['id_org'], $ligne['id_coll'], $ligne['id_note']));
-
 
149
				$aso_infos['description'] = 'Modifié par '.$ligne['prenom'].' '.$ligne['nom'].
-
 
150
											' le '.date('Y-m-j H:i:s', $ligne['date_derniere_modif']).'<br />'.
90
		die ($resultat->getMessage().$resultat->getDebugInfo()) ;
151
											$ligne['description'];
91
	}
152
				$aso_infos['pubdate'] = strftime('%d %b %Y %H:%M:%S GMT', $ligne['date_derniere_modif']);		
92
	while ($ligne = $resultat->fetchRow(DB_FETCHMODE_ASSOC)) {
153
				break;
93
		$aso_infos = array();
154
			default :
-
 
155
				$aso_infos['title'] = $ligne['titre'];
94
		$aso_infos['title'] = $ligne['titre'];
156
				$aso_infos['link'] = str_replace('&', '&amp;', sprintf($url, $ligne['id']));
95
		$aso_infos['link'] = str_replace('&', '&amp;', sprintf($url, $ligne['id']));
157
				$aso_infos['description'] = 'Modifié par '.$ligne['prenom'].' '.$ligne['nom'].' le '.$ligne['date_derniere_modif'];
96
		$aso_infos['description'] = 'Modifié par '.$ligne['prenom'].' '.$ligne['nom'].' le '.$ligne['date_derniere_modif'];
158
				$aso_infos['pubdate'] = strftime('%d %b %Y %H:%M:%S GMT', strtotime($ligne['date_derniere_modif']));		
97
		$aso_infos['pubdate'] = strftime('%d %b %Y %H:%M:%S GMT', strtotime($ligne['date_derniere_modif']));
-
 
98
		$tab_infos[] = $aso_infos; 
159
		}		
99
	}
160
		$tab_infos[] = $aso_infos; 
100
} else {
161
	}
101
	$aso_flux = array('herbier', 'collection');
162
} else {
102
	foreach ($aso_flux as $flux) {
163
	foreach ($GLOBALS['_HERBIER_']['rss']['flux'] as $flux) {
103
		$aso_infos = array();
164
		$aso_infos = array();
104
		$aso_infos['title'] = 'Flux RSS : '.$flux;
165
		$aso_infos['title'] = 'Flux RSS : '.$flux;
105
		$GLOBALS['_HERBIER_']['url_rss']->addQueryString('type', $flux);
166
		$GLOBALS['_HERBIER_']['rss']['url']->addQueryString('type', $flux);
106
		$aso_infos['link'] = str_replace('&', '&amp;', $GLOBALS['_HERBIER_']['url_rss']->getURL());
167
		$aso_infos['link'] = str_replace('&', '&amp;', $GLOBALS['_HERBIER_']['rss']['url']->getURL());
107
		$aso_infos['description'] = 'Modifié par '.$ligne['prenom'].' '.$ligne['nom'].' le '.$ligne['date_derniere_modif'];
168
		$aso_infos['description'] = 'Flux RSS sur les '.$flux.'s.';
108
		$aso_infos['pubdate'] = strftime('%d %b %Y %H:%M:%S GMT', strtotime(str_replace('$', '', str_replace('Date: ', '', '$Date: 2006-10-31 12:42:00 $'))));
-
 
109
		$tab_infos[] = $aso_infos;
-
 
110
	} 
-
 
111
}
-
 
112
$aso_meta['description'] = HBR_RSS_DESCRIPTIONSITE;
-
 
113
$aso_meta['link'] = HBR_RSS_ADRESSESITE;
-
 
114
$aso_meta['language'] = 'fr-FR';
-
 
115
$aso_meta['copyright'] = 'Copyright 2005 '.HBR_RSS_NOMSITE;
-
 
116
$aso_meta['lastBuildDate'] = strftime('%d %b %Y %H:%M:%S GMT');
-
 
117
$aso_meta['docs'] = 'http://www.stervinou.com/projets/rss/';
-
 
118
$aso_meta['category'] = HBR_RSS_CATEGORIE;
-
 
119
$aso_meta['managingEditor'] = HBR_RSS_MANAGINGEDITOR;
-
 
120
$aso_meta['webMaster'] = HBR_RSS_WEBMASTER;
-
 
121
$aso_meta['ttl'] = 60;
-
 
122
$aso_meta['image']['title'] = HBR_RSS_NOMSITE;
169
		$aso_infos['pubdate'] = strftime('%d %b %Y %H:%M:%S GMT', strtotime(str_replace('$', '', str_replace('Date: ', '', '$Date: 2006-10-31 15:06:44 $'))));
Line 123... Line 170...
123
$aso_meta['image']['url'] = HBR_RSS_LOGOSITE;
170
		$tab_infos[] = $aso_infos;
124
$aso_meta['image']['link'] = HBR_RSS_ADRESSESITE;
171
	} 
Line 185... Line 232...
185
	return $xml;
232
	return $xml;
186
}
233
}
187
/* +--Fin du code ----------------------------------------------------------------------------------------+
234
/* +--Fin du code ----------------------------------------------------------------------------------------+
188
*
235
*
189
* $Log: not supported by cvs2svn $
236
* $Log: not supported by cvs2svn $
-
 
237
* Revision 1.4  2006/10/31 12:42:00  jp_milcent
-
 
238
* Amélioration de la gestion de la date des flux via les infos cvs.
-
 
239
*
190
* Revision 1.3  2006/10/31 12:39:23  jp_milcent
240
* Revision 1.3  2006/10/31 12:39:23  jp_milcent
191
* Modification de la gestion de la date des flux via les infos cvs.
241
* Modification de la gestion de la date des flux via les infos cvs.
192
*
242
*
193
* Revision 1.2  2006/10/31 12:38:12  jp_milcent
243
* Revision 1.2  2006/10/31 12:38:12  jp_milcent
194
* Début gestion des différents type de flux.
244
* Début gestion des différents type de flux.