19,7 → 19,7 |
// | License along with this library; if not, write to the Free Software | |
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
// +------------------------------------------------------------------------------------------------------+ |
// CVS : $Id: hb_rss.php,v 1.4 2006-10-31 12:42:00 jp_milcent Exp $ |
// CVS : $Id: hb_rss.php,v 1.5 2006-10-31 15:06:44 jp_milcent Exp $ |
/** |
* Générateur de flux RSS pour les Herbiers |
* |
29,7 → 29,7 |
*@author Jean-Pascal MILCENT <jpm@tela-botanica.org> |
* |
*@copyright Tela-Botanica 2000-2006 |
*@version $Revision: 1.4 $ $Date: 2006-10-31 12:42:00 $ |
*@version $Revision: 1.5 $ $Date: 2006-10-31 15:06:44 $ |
// +------------------------------------------------------------------------------------------------------+ |
*/ |
|
36,6 → 36,7 |
//==================================== LES FLUX RSS================================== |
// Constantes liées aux flux RSS |
//================================================================================== |
// TODO : à mettre dans un fichier de config |
define('HBR_CREER_FICHIERS_XML', 0);//0=ne cree pas le fichier XML dans rss/; 1=cree le fichier XML dans rss/ |
define('HBR_RSS_NOMSITE','tela-botanica.org');//Nom du site indiqué dans les flux rss |
define('HBR_RSS_ADRESSESITE','http://www.tela-botanica.org');//Adresse Internet du site indiqué dans les flux rss |
44,23 → 45,39 |
define('HBR_RSS_MANAGINGEDITOR', 'accueil@tela-botanica.org') ;//Managing editor du site |
define('HBR_RSS_WEBMASTER', 'jpm@tela-botanica.org') ; //Mail Webmaster du site |
define('HBR_RSS_CATEGORIE', 'Botanique, Herbiers'); //catégorie du flux RSS |
$GLOBALS['_HERBIER_']['rss']['flux'] = array('herbier', 'collection', 'equipe', 'note'); |
$GLOBALS['_HERBIER_']['rss']['url'] = new Net_URL('http://'.$_SERVER['HTTP_HOST'].$_SERVER['PHP_SELF']); |
// TODO : à mettre dans le fichier de langue |
define('HBR_PAS_D_ANNONCES', 'Pas d\'annonce'); //Message pas d'annonce |
|
if (isset($_GET['type'])) { |
$annonce = $_GET['type']; |
$type = $_GET['type']; |
} else { |
$annonce = ''; |
$type = ''; |
} |
|
if (isset($_GET['nbitem'])) { |
$nbitem = $_GET['nbitem']; |
if (isset($_GET['limite'])) { |
$limite = $_GET['limite']; |
} else { |
$nbitem = ''; |
$limite = ''; |
} |
// Renseignement des méta données par défaut du flux RSS |
$aso_meta['description'] = HBR_RSS_DESCRIPTIONSITE; |
$aso_meta['link'] = HBR_RSS_ADRESSESITE; |
$aso_meta['language'] = 'fr-FR'; |
$aso_meta['copyright'] = 'Copyright 2005 '.HBR_RSS_NOMSITE; |
$aso_meta['lastBuildDate'] = strftime('%d %b %Y %H:%M:%S GMT'); |
$aso_meta['docs'] = 'http://www.stervinou.com/projets/rss/'; |
$aso_meta['category'] = HBR_RSS_CATEGORIE; |
$aso_meta['managingEditor'] = HBR_RSS_MANAGINGEDITOR; |
$aso_meta['webMaster'] = HBR_RSS_WEBMASTER; |
$aso_meta['ttl'] = 60; |
$aso_meta['image']['title'] = HBR_RSS_NOMSITE; |
$aso_meta['image']['url'] = HBR_RSS_LOGOSITE; |
$aso_meta['image']['link'] = HBR_RSS_ADRESSESITE; |
|
// Generation de la requete MySQL personnalisee |
switch ('type') { |
switch ($type) { |
case 'herbier' : |
$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 '. |
'FROM HERBIERS_ORGANISATION, '.HB_BDD_NOM_ANNUAIRE.'.annuaire_tela '. |
70,7 → 87,8 |
$aso_meta['titre'] = 'Flux des Organisations'; |
break; |
case 'collection' : |
$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 '. |
$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 '. |
'FROM HERBIERS_COLLECTION, '.HB_BDD_NOM_ANNUAIRE.'.annuaire_tela '. |
'WHERE CE_MODIFIER_PAR = U_ID '. |
'ORDER BY DATE_DERNIERE_MODIF DESC'; |
77,13 → 95,36 |
$url = HB_URL_COURANTE_CONSULTATION_FICHE_COLECTION_ID; |
$aso_meta['titre'] = 'Flux des Collections'; |
break; |
case 'equipe' : |
$requete = 'SELECT DISTINCT HOS.ID_ORG AS id_org, HS.ID_STAFF AS id_equipe, PRENOM as titre_prenom, NOM AS titre_nom, '. |
'DATE_DERNIERE_MODIF AS date_derniere_modif, U_NAME AS nom, U_SURNAME AS prenom '. |
'FROM HERBIERS_STAFF AS HS, '.HB_BDD_NOM_ANNUAIRE.'.annuaire_tela, HERBIERS_ont_un_staff AS HOS '. |
'WHERE CE_MODIFIER_PAR = U_ID '. |
'AND HOS.ID_STAFF = HS.ID_STAFF '. |
'ORDER BY DATE_DERNIERE_MODIF DESC'; |
$url = HB_URL_COURANTE_ADMIN_ACTION_ORG_EQUIPE; |
$aso_meta['titre'] = 'Flux des Équipes'; |
break; |
case 'note' : |
$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, '. |
'HI.TXT_INDIC AS description, HI.MAJ_INDIC AS date_derniere_modif, U_NAME AS nom, U_SURNAME AS prenom '. |
'FROM HERBIERS_INDIC AS HI, HERBIERS_INDIC_HISTORIQUE AS HIH, '. |
HB_BDD_NOM_ANNUAIRE.'.annuaire_tela, HERBIERS_COLLECTION AS HC '. |
'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 '. |
'ORDER BY HI.MAJ_INDIC DESC'; |
$url = HB_URL_COURANTE_ADMIN_ACTION_ORG_COLL_NOTE; |
$aso_meta['titre'] = 'Flux des Notes'; |
break; |
default : |
$requete = ''; |
$aso_meta['titre'] = 'Liste des flux RSS de l\'application Herbiers'; |
$aso_meta['description'] = 'Veuillez sélectionner un des flux RSS ci-dessous pour obtenir la liste '. |
'des dernières modifications correspondantes.'; |
} |
$tab_infos = array(); |
if ($requete != '') { |
if ($nbitem != '') { |
$requete .= ' LIMIT 0,'.$nbitem; |
if ($limite != '') { |
$requete .= ' LIMIT 0,'.$limite; |
} |
$resultat = $GLOBALS['_HERBIER_']['bdd']->query($requete) ; |
if (DB::isError($resultat)) { |
91,38 → 132,44 |
} |
while ($ligne = $resultat->fetchRow(DB_FETCHMODE_ASSOC)) { |
$aso_infos = array(); |
switch ($type) { |
case 'equipe' : |
$aso_infos['title'] = $ligne['titre_prenom'].' '.$ligne['titre_nom']; |
$aso_infos['link'] = str_replace('&', '&', sprintf($url, 32, $ligne['id_org'], $ligne['id_equipe'])); |
$aso_infos['description'] = 'Modifié par '.$ligne['prenom'].' '.$ligne['nom'].' le '.$ligne['date_derniere_modif']; |
$aso_infos['pubdate'] = strftime('%d %b %Y %H:%M:%S GMT', $ligne['date_derniere_modif']); |
break; |
case 'note' : |
if ($ligne['titre'] != '') { |
$aso_infos['title'] = $ligne['titre']; |
} else { |
$aso_infos['title'] = strtoupper($ligne['nom']).' '.date('j.m.Y', $ligne['date_derniere_modif']); |
} |
$aso_infos['link'] = str_replace('&', '&', sprintf($url, 42, $ligne['id_org'], $ligne['id_coll'], $ligne['id_note'])); |
$aso_infos['description'] = 'Modifié par '.$ligne['prenom'].' '.$ligne['nom']. |
' le '.date('Y-m-j H:i:s', $ligne['date_derniere_modif']).'<br />'. |
$ligne['description']; |
$aso_infos['pubdate'] = strftime('%d %b %Y %H:%M:%S GMT', $ligne['date_derniere_modif']); |
break; |
default : |
$aso_infos['title'] = $ligne['titre']; |
$aso_infos['link'] = str_replace('&', '&', sprintf($url, $ligne['id'])); |
$aso_infos['description'] = 'Modifié par '.$ligne['prenom'].' '.$ligne['nom'].' le '.$ligne['date_derniere_modif']; |
$aso_infos['pubdate'] = strftime('%d %b %Y %H:%M:%S GMT', strtotime($ligne['date_derniere_modif'])); |
} |
$tab_infos[] = $aso_infos; |
} |
} else { |
$aso_flux = array('herbier', 'collection'); |
foreach ($aso_flux as $flux) { |
foreach ($GLOBALS['_HERBIER_']['rss']['flux'] as $flux) { |
$aso_infos = array(); |
$aso_infos['title'] = 'Flux RSS : '.$flux; |
$GLOBALS['_HERBIER_']['url_rss']->addQueryString('type', $flux); |
$aso_infos['link'] = str_replace('&', '&', $GLOBALS['_HERBIER_']['url_rss']->getURL()); |
$aso_infos['description'] = 'Modifié par '.$ligne['prenom'].' '.$ligne['nom'].' le '.$ligne['date_derniere_modif']; |
$aso_infos['pubdate'] = strftime('%d %b %Y %H:%M:%S GMT', strtotime(str_replace('$', '', str_replace('Date: ', '', '$Date: 2006-10-31 12:42:00 $')))); |
$GLOBALS['_HERBIER_']['rss']['url']->addQueryString('type', $flux); |
$aso_infos['link'] = str_replace('&', '&', $GLOBALS['_HERBIER_']['rss']['url']->getURL()); |
$aso_infos['description'] = 'Flux RSS sur les '.$flux.'s.'; |
$aso_infos['pubdate'] = strftime('%d %b %Y %H:%M:%S GMT', strtotime(str_replace('$', '', str_replace('Date: ', '', '$Date: 2006-10-31 15:06:44 $')))); |
$tab_infos[] = $aso_infos; |
} |
} |
$aso_meta['description'] = HBR_RSS_DESCRIPTIONSITE; |
$aso_meta['link'] = HBR_RSS_ADRESSESITE; |
$aso_meta['language'] = 'fr-FR'; |
$aso_meta['copyright'] = 'Copyright 2005 '.HBR_RSS_NOMSITE; |
$aso_meta['lastBuildDate'] = strftime('%d %b %Y %H:%M:%S GMT'); |
$aso_meta['docs'] = 'http://www.stervinou.com/projets/rss/'; |
$aso_meta['category'] = HBR_RSS_CATEGORIE; |
$aso_meta['managingEditor'] = HBR_RSS_MANAGINGEDITOR; |
$aso_meta['webMaster'] = HBR_RSS_WEBMASTER; |
$aso_meta['ttl'] = 60; |
$aso_meta['image']['title'] = HBR_RSS_NOMSITE; |
$aso_meta['image']['url'] = HBR_RSS_LOGOSITE; |
$aso_meta['image']['link'] = HBR_RSS_ADRESSESITE; |
|
echo html_entity_decode(gen_RSS($aso_meta, $tab_infos, $nbitem)); |
|
|
187,6 → 234,9 |
/* +--Fin du code ----------------------------------------------------------------------------------------+ |
* |
* $Log: not supported by cvs2svn $ |
* Revision 1.4 2006/10/31 12:42:00 jp_milcent |
* Amélioration de la gestion de la date des flux via les infos cvs. |
* |
* Revision 1.3 2006/10/31 12:39:23 jp_milcent |
* Modification de la gestion de la date des flux via les infos cvs. |
* |