Rev 22 | Blame | Compare with Previous | Last modification | View Log | RSS feed
<?php/*vim: set expandtab tabstop=4 shiftwidth=4: */// +------------------------------------------------------------------------------------------------------+// | PHP version 4.1 |// +------------------------------------------------------------------------------------------------------+// | Copyright (C) 2005 Tela Botanica (accueil@tela-botanica.org) |// +------------------------------------------------------------------------------------------------------+// | This file is part of Herbier - Consultation. |// | |// | Foobar is free software; you can redistribute it and/or modify |// | it under the terms of the GNU General Public License as published by |// | the Free Software Foundation; either version 2 of the License, or |// | (at your option) any later version. |// | |// | Foobar is distributed in the hope that it will be useful, |// | but WITHOUT ANY WARRANTY; without even the implied warranty of |// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |// | GNU General Public License for more details. |// | |// | You should have received a copy of the GNU General Public License |// | along with Foobar; if not, write to the Free Software |// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |// +------------------------------------------------------------------------------------------------------+// CVS : $Id: hb_consultation.php,v 1.3 2007-08-27 15:56:50 jp_milcent Exp $/*** Application fournissant un moteur de recherche sur les herbiers** Fournit la liste des herbiers enregistrés dans la base de données.**@package Herbier-Consultation//Auteur original :*@author Alexandre GRANIER <alexandre@tela-botanica.org>//Autres auteurs :*@author Jean-Pascal MILCENT <jpm@clapas.org>*@copyright Tela-Botanica 2000-2005*@version $Revision: 1.3 $ $Date: 2007-08-27 15:56:50 $// +------------------------------------------------------------------------------------------------------+*/// +------------------------------------------------------------------------------------------------------+// | ENTETE du PROGRAMME |// +------------------------------------------------------------------------------------------------------+/** Inclusion du fichier de configuration de l'application Herbier - Consultation. */require_once HB_CHEMIN_MODULE.'hb_consultation'.GEN_SEP.'configuration'.GEN_SEP.'hbc_config.inc.php';/** Inclusion du fichier de configuration de l'application Herbier - Administration. */require_once HB_CHEMIN_MODULE.'hb_admin'.GEN_SEP.'configuration'.GEN_SEP.'hba_config.inc.php';/** Inclusion de l'API Fragmenteur */require_once HB_CHEMIN_API_FRAGMENTEUR.'FRAG_fragmenteur.fonct.php';/** Inclusion de l'API Formulaire - classe : Form */require_once HB_CHEMIN_API_FORM.'FORM_formulaire.class.php';/** Inclusion de l'API Formulaire - classe : formFromTable */require_once HB_CHEMIN_API_FORM.'FORM_formulaire_table.class.php';/** Inclusion de la classe principale d'Herbier : herbier */require_once HB_CHEMIN_BIBLIO.'hb_herbier.class.php';/** Inclusion de la classe Herbier : collection */require_once HB_CHEMIN_BIBLIO.'hb_collection.class.php';/** Inclusion de la classe Herbier : indic */require_once HB_CHEMIN_BIBLIO.'hb_indic.class.php';/** Inclusion de la classe Herbier : indic_hist */require_once HB_CHEMIN_BIBLIO.'hb_indic_hist.class.php';/** Inclusion de la classe Herbier : organisation */require_once HB_CHEMIN_BIBLIO.'hb_organisation.class.php';/** Inclusion de la classe Herbier : type */require_once HB_CHEMIN_BIBLIO.'hb_type.class.php';/** Inclusion de la classe Herbier : equipe */require_once HB_CHEMIN_BIBLIO.'hb_equipe.class.php';// Appel du fichier de traduction des textes de l'application Consultation de Herbierif (file_exists(HBC_CHEMIN_LANGUES.'hbc_langue_'.HB_I18N.'.inc.php')) {/** Inclusion du fichier de traduction de l'application Consultation de Herbier. */include_once HBC_CHEMIN_LANGUES.'hbc_langue_'.HB_I18N.'.inc.php';} else {/** Inclusion du fichier de traduction fr par défaut. */include_once HBC_CHEMIN_LANGUES.'hbc_langue_fr.inc.php';}// Initialisation de la variable à retourner$sortie .= '<!-- Herbier - Consultation : DEBUT -->'."\n";// +------------------------------------------------------------------------------------------------------+// | CORPS du PROGRAMME |// +------------------------------------------------------------------------------------------------------+global $project;global $TransTab;global $RECHERCHE, $INSTITUTION, $T_REPONSE, $TYPE_R;if (!isset($_GET['consultation'])) {// ici on écrase les valeurs des variables globales précédentes au cas où// on vient de cliquez sur un chiffre du fragmenteurif (empty($T_REPONSE)) {$T_REPONSE = 20;}if ($TransTab) {$values = FRAG_decoupageChaine($TransTab);}if (!empty($values)) {foreach ($values as $key => $val) {if ($val != '') {$GLOBALS[$key] = $val ;}}}$sortie .= '<h1>'.'Rechercher un herbier :'.'</h1>'."\n";$form_1 = new form($GLOBALS['_HERBIER_']['bdd']);$sortie .= '<form action="'.$GLOBALS['_HERBIER_']['url']->getURL().'" method="post">'."\n";$sortie .= '<p>'."\n";$sortie .= '<label for="RECHERCHE">'.'Recherche : '.'</label>'."\n";$sortie .= '<input id="RECHERCHE" type="text" name="RECHERCHE" class="insInputForm"';if (!empty($RECHERCHE)) {$sortie .= ' value="'.$RECHERCHE.'"';}$sortie .= '/>'."\n";$sortie .= '<label for="">'.'Grouper les résultats : '.'</label>'."\n";$sortie .= $form_1->selectFromTableau('T_REPONSE',array(10, 'par 10', 20, 'par 20', 50, 'par 50'), $T_REPONSE);$sortie .= $form_1->submit('rechercher')."\n";$sortie .= '</p>'."\n";$sortie .= '</form>'."\n";$sortie .= '<p>'.'Le moteur recherche dans tous les champs de la de la base :'.'</p>'."\n";'<ul>'."\n".'<li>'.'Nom d\'institution, adresse, ville, région'.'</li>'."\n".'<li>'.'Index herbariorum'.'</li>'."\n".'<li>'.'Nom de collection, description, collecteurs, notes'.'</li>'."\n".'<li>'.'Indications taxonomiques, historiques, géographiques'.'</li>'."\n".'</ul>'."\n";$sortie .= '<p>'.'Vous pouvez utiliser le caractère % pour remplacer n\'importe quelle chaine.'.'</p>'."\n";if (!empty($T_REPONSE) ) {//&& !empty($RECHERCHE)$query_data = 'SELECT DISTINCT ID_ORG '.'FROM HERBIERS_COLLECTION AS HC LEFT JOIN HERBIERS_INDIC AS HI ON HC.ID = HI.ID, HERBIERS_ORGANISATION AS HO '.'WHERE HC.PARENT_ID = HO.ID_ORG '.'AND ( '.' HI.REM_INDIC LIKE "%'.$RECHERCHE.'%" '.' OR HI.TXT_INDIC LIKE "%'.$RECHERCHE.'%" '.' OR HC.DESCRIPTION LIKE "%'.$RECHERCHE.'%" '.' OR HC.NOTES LIKE "%'.$RECHERCHE.'%" '.' OR HC.COLLECTION_FOCUS LIKE "%'.$RECHERCHE.'%" '.' OR HC.PURPOSE LIKE "%'.$RECHERCHE.'%" '.' OR HC.COLLECTEURS LIKE "%'.$RECHERCHE.'%" '.' OR HC.STRENGTH LIKE "%'.$RECHERCHE.'%" '.' OR HC.NOM_COLLECTION LIKE "%'.$RECHERCHE.'%" '.' OR HC.COLLECTION_CODE LIKE "%'.$RECHERCHE.'%" '.' OR HO.INSTITUTION_NAME LIKE "%'.$RECHERCHE.'%" '.' OR HO.ADRESS_LINE LIKE "%'.$RECHERCHE.'%" '.' OR HO.TOWN LIKE "%'.$RECHERCHE.'%" '.' OR HO.REGION LIKE "%'.$RECHERCHE.'%" '.' OR HO.INDEX_HERB LIKE "%'.$RECHERCHE.'%" '.') '.'ORDER BY TOWN';if (empty($values['pstart'])) {$values['pstart'] = 0 ;}// Autre requete pour obtenir le nombre total de réponse// car la clause limit x,y limite le nombre de résultat$query_nombre = $query_data;// Ajout de la clause limit pour les données à afficher$query_data .= ' LIMIT '.$values['pstart'].','.$T_REPONSE;$result_data = mysql_query($query_data) or die (BOG_afficherErreurSql(__FILE__, __LINE__, mysql_error(), $query_data));$result_nombre = mysql_query($query_nombre) or die (BOG_afficherErreurSql(__FILE__, __LINE__, mysql_error(), $query_nombre));$nombre = mysql_num_rows($result_nombre);mysql_free_result($result_nombre);// Utilisation du fragmentateur$mon_frag = new fragmenteur();$tableau = array();$tableau['pstart'] = $values['pstart'];$tableau['step'] = $T_REPONSE;$tableau['pend'] = $nombre;// Construction de la variable TransTab$tableau['TYPE_R'] = $TYPE_R;$tableau['T_REPONSE'] = $T_REPONSE;$sortie .= '<p id="frag_nbre_resultat">'.FRAG_afficherTxtNbreResultat('', $tableau, mysql_num_rows($result_data), $nombre).'</p>'."\n";if ((mysql_num_rows($result_data) > 0) && ($tableau['step'] < $nombre)) {$sortie .= '<p id="frag_navigation">';$sortie .= $mon_frag->fragmente($tableau, $nombre);$sortie .= '</p>'."\n";}$sortie .= '<ul>'."\n";while ($row1 = mysql_fetch_object($result_data)) {$resultat = new H_organisation() ;$resultat->getFromSQL($row1->ID_ORG);$sortie .= '<li>'.$resultat->TOWN.' - ';$sortie .= '<a href="'.HB_URL_COURANTE_CONSULTATION_FICHE_HERBIER.'&id_org='.$row1->ID_ORG.'">'.$resultat->INSTITUTION_NAME.'</a>';$sortie .= '</li>'."\n";}$sortie .= '</ul>'."\n";if ((mysql_num_rows($result_data) > 0) && ($tableau['step'] < $nombre)) {$sortie .= '<p>'.$mon_frag->fragmente($tableau, $nombre).'</p>'."\n";}}} elseif (isset($_GET['consultation']) && $_GET['consultation'] == 'herbier') {include_once 'hbc_info_herbier.inc.php';} elseif (isset($_GET['consultation']) && $_GET['consultation'] == 'collection') {include_once 'hbc_info_collection.inc.php';}// +------------------------------------------------------------------------------------------------------+// | PIED du PROGRAMME |// +------------------------------------------------------------------------------------------------------+$sortie .= '<!-- Herbier - Consultation : FIN -->'."\n";/* +--Fin du code ----------------------------------------------------------------------------------------+** $Log: not supported by cvs2svn $* Revision 1.2 2006-10-31 10:31:36 jp_milcent* Gestion des chemins rendu compatibles avec une utilisation de l'appli Herbiers hors de Papyrus.** Revision 1.1 2005/11/23 10:32:32 jp_milcent* Ajout au dépot de l'application Herbiers.* Elle doit à terme migrer dans eFlore.** Revision 1.3 2005/03/30 09:48:58 jpm* Début gestion des raccourcis vers l'administration.** Revision 1.2 2005/03/09 15:55:17 jpm* Changement du nom de l'appli.** Revision 1.1 2005/03/08 13:49:17 jpm* Ajout de l'application de consultation sous forme de moteur de recherche.*** +-- Fin du code ----------------------------------------------------------------------------------------+*/?>