New file |
0,0 → 1,208 |
<?php |
/*vim: set expandtab tabstop=4 shiftwidth=4: */ |
// +------------------------------------------------------------------------------------------------------+ |
// | PHP version 4.1 | |
// +------------------------------------------------------------------------------------------------------+ |
// | Copyright (C) 2004 Tela Botanica (accueil@tela-botanica.org) | |
// +------------------------------------------------------------------------------------------------------+ |
// | This library is free software; you can redistribute it and/or | |
// | modify it under the terms of the GNU Lesser General Public | |
// | License as published by the Free Software Foundation; either | |
// | version 2.1 of the License, or (at your option) any later version. | |
// | | |
// | This library 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 | |
// | Lesser General Public License for more details. | |
// | | |
// | You should have received a copy of the GNU Lesser General Public | |
// | 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: bbc_moteur_structure.fonct.php,v 1.1 2005-11-23 10:22:25 jp_milcent Exp $ |
/** |
* Fonctions de création du moteur de recherche des structures. |
* |
* Contient les fonctions permettant de retourner l'affichage du moteur de recherche des structures. |
* Valable pour le paramètre "structure". |
* |
*@package BiblioBota-Consultation |
*@subpackage Fonctions |
//Auteur original : |
*@author Jean-Charles GRANGER <tela@vecteur.org> |
//Autres auteurs : |
*@author Jean-Pascal MILCENT <jpm@clapas.org> |
*@copyright Tela-Botanica 2000-2004 |
*@version $Revision: 1.1 $ $Date: 2005-11-23 10:22:25 $ |
// +------------------------------------------------------------------------------------------------------+ |
*/ |
|
// +------------------------------------------------------------------------------------------------------+ |
// | ENTETE du PROGRAMME | |
// +------------------------------------------------------------------------------------------------------+ |
|
|
// +------------------------------------------------------------------------------------------------------+ |
// | LISTE de FONCTIONS | |
// +------------------------------------------------------------------------------------------------------+ |
|
/** Fonction mkengine() - Créé le moteur de recherche en XHTML pour les structures. |
* |
* Fonction créant le moteur de recherche en XHTML pour le |
* paramètre "structure". |
* |
* @return string le XHTML du moteur de recherche permettant de récupérer les structures. |
*/ |
function mkengine() |
{ |
global $label_bbota, $tbl, $TabFinder, $nbr_total; |
$retour = ''; |
|
// Comptage du nombre total de données dans la table (hors CACHER = 1) |
$requete = 'SELECT COUNT(*) AS cpt '. |
'FROM '.$tbl['str'].' '. |
'WHERE B_S_CACHER = 0'; |
$resultat = mysql_query($requete) or die(BOG_afficherErreurSql(__FILE__, __LINE__, mysql_error(), $requete)); |
|
if (mysql_num_rows($resultat) == 1) { |
$tmp_nb = mysql_fetch_object($resultat); |
$nbr_total = $tmp_nb->cpt; |
if ($nbr_total > 0) { |
$chaine = 'parmi '.$nbr_total.' adresses d\'organismes'; |
} else { |
die('<b>'.'Erreur'.'</b>'.' lors du comptage des structures ('.$nbr_total.' trouvées) : '.$requete); |
} |
} else { |
die('<b>'.'Erreur'.'</b>'.' lors du comptage des structures : '.$requete); |
} |
mysql_free_result($resultat); |
|
// Affichage du titre de la page |
$retour .= presa_mk_title('Chercher '.$chaine.' :', 1); |
|
// Construction du moteur de str |
$retour .= '<form id="bb_moteur_structure" action="'.BB_URL_COURANTE_CONSULTATION.'" method="post">'."\n"; |
$retour .= '<ul>'."\n"; |
|
// Ligne de recherche |
$retour .= '<li>'."\n"; |
$retour .= form_mk_chaine(stripslashes($TabFinder['chaine'])).' '. |
form_mk_typque($TabFinder['typque']). |
form_mk_categ($TabFinder['categ']); |
$retour .= '</li>'."\n"; |
|
// Ligne de géographie |
$retour .= '<li>'."\n".form_mk_geo(stripslashes($TabFinder['geo'])).'</li>'."\n"; |
|
if ($TabFinder['finder_mode'] == 'advance') { |
$retour .= '<li>'."\n".form_mk_since($TabFinder['since']).'</li>'."\n"; |
} |
|
// Ligne de regroupement (frequente) |
if ($TabFinder['finder_mode'] == 'advance') { |
$retour .= '<li>'."\n".form_mk_step($TabFinder['step'])."\n".form_mk_sort($TabFinder['sort'])."\n".'</li>'."\n"; |
} |
|
$retour .= '<li class="bb_aligner_droite">'."\n"; |
$retour .= form_mk_advance().' '.form_mk_submit()."\n"; |
$retour .= '</li>'."\n"; |
|
$retour .= '</ul>'."\n"; |
$retour .= '</form>'."\n\n"; |
|
// Ajout d'un lien pour les moteurs de recherche |
$link = BB_URL_COURANTE_CONSULTATION.'&TransTab=typque,1!valid,1!finder_mode,normal!sort,B_S_NOM!'; |
$link .= 'pstart,0!step,20!pend,231!plugin,!geo,!chaine,!auteur,!categ,!categ_2,!categ_3,!since,!nom,!prenom,!ville,!dept,!pays,!cotisant,!mail,!'; |
$retour .= '<a href="'.$link.'" style="visibility:hidden;">all</a>'."\n"; |
|
return $retour; |
} |
|
/** Fonction form_mk_sort() - Créé la liste déroulante XHTML de l'ordre de trie des structures. |
* |
* Fonction créant liste déroulante XHTML de l'ordre de trie des structures. |
* |
* @param string la type de trie sélectionné : valeur de TabFinder['sort']. |
* @param string la classe à appliquer à la balise <select>. |
* |
* @return string la liste déroulante XHTML de l'ordre de trie des structures. |
*/ |
function form_mk_sort($actualsort, $class = 'bb_champ') |
{ |
$retour = ''; |
$id = 'TabFinder[sort]'; |
|
$retour .= '<label for="'.$id.'">'.'Trier par : '.'</label>'; |
$retour .= '<select id="'.$id.'" name="'.$id.'" class="'.$class.'">'."\n"; |
|
$retour .= ' <option value="B_S_NOM" '; |
if ($actualsort == 'B_S_NOM') { |
$retour .= 'selected="selected"'; |
} |
$retour .= '>'.'nom'.'</option>'."\n"; |
|
$retour .= ' <option value="GC_NAME" '; |
if ($actualsort == 'GC_NAME') { |
$retour .= 'selected="selected"'; |
} |
$retour .= '>'.'pays'.'</option>'."\n"; |
|
$retour .= '</select>'."\n\n"; |
|
return $retour; |
} |
|
/** Fonction form_mk_categ() - Créé la liste déroulante XHTML des types de structures. |
* |
* Fonction créant liste déroulante XHTML des types de structures. |
* |
* @param string l'identifiant du type de structure actuellement sélectionné : valeur de TabFinder['categ']. |
* @param string la classe à appliquer à la balise <select>. |
* |
* @return string la liste déroulante XHTML des types de structures. |
*/ |
function form_mk_categ($actualcateg, $class = 'bb_champ') |
{ |
global $tbl, $label_bbota; |
$retour = ''; |
|
$retour .= ' <select name="TabFinder[categ]" class="'.$class.'">'."\n"; |
$retour .= ' <option value="tous" '; |
if ($actualcateg == 0) { |
$retour .= 'selected="selected"'; |
} |
$retour .= '>'.$label_bbota['all_typstr'].'</option>'."\n"; |
|
$requete = 'SELECT * '. |
'FROM '.$tbl['typestr'].' '. |
'ORDER BY B_TYPSTR_ID'; |
$result_str = mysql_query($requete) or die(BOG_afficherErreurSql(__FILE__, __LINE__, mysql_error(), $requete)); |
while ($row = mysql_fetch_object($result_str)) { |
$typstr_id = $row->B_TYPSTR_ID; |
$typstr_nom = $row->B_TYPSTR_LABEL; |
$retour .= '<option value="'.$typstr_id.'"'; |
if ($actualcateg == $typstr_id) { |
$retour .= ' selected="selected"'; |
} |
$retour .= '>'.$typstr_nom.'</option>'."\n"; |
} |
mysql_free_result($result_str); |
|
$retour .= '</select>'."\n\n"; |
|
return $retour; |
} |
|
/* +--Fin du code ----------------------------------------------------------------------------------------+ |
* |
* $Log: not supported by cvs2svn $ |
* Revision 1.3 2005/05/17 10:10:08 jpm |
* Correction des bogues avant mise en ligne du site v4. |
* |
* Revision 1.2 2004/09/15 11:21:07 jpm |
* Début mise en conformité avec la convention de codage et le standard XHTML Strict. |
* |
* |
* +-- Fin du code ----------------------------------------------------------------------------------------+ |
*/ |
?> |