Rev 214 | Rev 465 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed
<?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: vous_etes_ici.php,v 1.6 2005-04-14 16:38:02 jpm Exp $/*** Applette : Vous Etes Ici** Affiche les liens contenant la suite des menus visités pour arriver* au menu courant visioné par l'utilisateur.* Nécessite :* - Constantes et variable de Papyrus.* - Base de données de Papyrus* - Pear Net_URL* - Pear DB* - API Débogage 1.0**@package Applette*@subpackage Vous_Etes_Ici//Auteur original :*@author Jean-Pascal MILCENT <jpm@tela-botanica.org>//Autres auteurs :*@author Aucun*@copyright Tela-Botanica 2000-2004*@version $Revision: 1.6 $ $Date: 2005-04-14 16:38:02 $// +------------------------------------------------------------------------------------------------------+*/// +------------------------------------------------------------------------------------------------------+// | ENTÊTE du PROGRAMME |// +------------------------------------------------------------------------------------------------------+// Inclusion de la bibliothèque defonction sur les menu : inutile car inclue par Papyrus// require_once GEN_CHEMIN_BIBLIO.'pap_menu.fonct.php';$GLOBALS['_VEI_']['nom_fonction'] = 'afficherVousEtesIci';$_GEN_commun['info_applette_nom_fonction'] = $GLOBALS['_VEI_']['nom_fonction'];$_GEN_commun['info_applette_balise'] = 'VOUS_ETES_ICI';// +------------------------------------------------------------------------------------------------------+// | CORPS du PROGRAMME |// +------------------------------------------------------------------------------------------------------+// +------------------------------------------------------------------------------------------------------+// | LISTE de FONCTIONS |// +------------------------------------------------------------------------------------------------------+/** Fonction afficherVousEtesIci() - Déploie le "vous êtes ici" d'un menu.** Affiche la suite des menus visité, sous forme de lien, pour arriver* au menu courant visioné par l'utilisateur.* Necessite :* - Constantes et variable de Papyrus.* - Pear Net_URL* - Pear DB** @param array tableau d'éventuel arguments présent dans la balise transmis à la fonction.* @param array tableau global de Papyrus.* @param int identifiant du menu courant qui représentent la fin du "vous êtes ici".* @param boolean indique que nous avons à faire au premier appel de cette fonction récursive.* @return string une liste de listes XHTML représentant le plan du site.*/function afficherVousEtesIci($tab_arguments, $_GEN_commun, $menu_courant_id = '', $premier_appel = true){// Initialisation de variable.$objet_pear_db =& $GLOBALS['_GEN_commun']['pear_db'];$vei_numero = $GLOBALS['_PAPYRUS_']['applette']['comptage'][$GLOBALS['_VEI_']['nom_fonction']];(empty($menu_courant_id)) ? $menu_courant_id = $GLOBALS['_GEN_commun']['info_menu']->gm_id_menu : '';$vei = '';// Gestion des erreursif (empty($menu_courant_id)) {if (isset($GLOBALS['_VEI_']['usurpation'])) {$vei = $GLOBALS['_VEI_']['usurpation'];}return $vei;}// Début contruction du vei$menu_pere_id = GEN_lireIdentifiantMenuPere($menu_courant_id, $objet_pear_db);// Récupération des infos sur sur l'entrée du menu à afficher$menu_info = GEN_lireInfoMenu($objet_pear_db, $menu_courant_id, DB_FETCHMODE_ASSOC);// Préparation d'une entrée dans la liste du menu$menu_nom = htmlentities($menu_info['gm_nom']);$menu_hreflang = htmlentities($menu_info['gm_ce_i18n']);$menu_accesskey = '';$raccourci_txt = '';if (($menu_accesskey = htmlentities($menu_info['gm_raccourci_clavier'])) != '') {$raccourci_txt = '(Raccourci : '.$menu_accesskey.' ).';$menu_accesskey = 'accesskey="'.$menu_accesskey.'" ';}$menu_texte_title = '';if (($menu_texte_title = htmlentities($menu_info['gm_description_resume'])) != '') {$menu_texte_title = 'title="'.$raccourci_txt.$menu_texte_title.'" ';;}// Création de l'url du menu courant$une_url =& new Pap_URL('http://'.$_SERVER['HTTP_HOST'].$_SERVER['PHP_SELF']);$une_url->setId($menu_courant_id);$menu_url = $une_url->getURL();if ($menu_pere_id != 0) {// Ce n'est pas le menu racine : nous continuons$vei .= '<a id="menu_'.$vei_numero.'_'.$menu_courant_id.'" href="'.$menu_url.'" ';$vei .= 'hreflang="'.$menu_hreflang.'" '.$menu_texte_title.$menu_accesskey.'>'.$menu_nom.'</a> >>> '."\n";$vei .= afficherVousEtesIci($tab_arguments, $_GEN_commun, $menu_pere_id, false);} else {// C'est le menu racine : nous nous arrêtons$vei .= '<a id="menu_'.$vei_numero.'_'.$menu_courant_id.'" href="'.$menu_url.'" ';$vei .= 'hreflang="'.$menu_hreflang.'" '.$menu_texte_title.$menu_accesskey.'>'.$menu_nom.'</a>'."\n";}// Retour du VEI après la recherche récursive des liensif ($premier_appel) {$tab_vei = explode(' >>> ', $vei);// Récupération des liens pour les inverser et créer le VEI$retour = '';for ($i = (count($tab_vei) - 1); $i >= 0 ;$i--) {if ($i == 0) {// Supprime le lien pour le nom du menu courantpreg_match("/>(.*)<\/a>/", $tab_vei[$i], $tab_txt_capture);$retour .= $tab_txt_capture[1];} else {$retour .= $tab_vei[$i];}// Ajout du séparateur$retour .= ($i != 0) ? "\n".'<span class="separateur_vei"> > </span>'."\n" : '' ;}// Retour de la chaine de liens et de textes du VEIreturn $retour;}return $vei;}// +------------------------------------------------------------------------------------------------------+// | PIED du PROGRAMME |// +------------------------------------------------------------------------------------------------------+/* +--Fin du code ----------------------------------------------------------------------------------------+** $Log: not supported by cvs2svn $* Revision 1.5 2004/12/06 19:39:57 jpm* Gestion de l'usurpation de VEI.** Revision 1.4 2004/11/10 19:41:27 jpm* Correction bogue quand pas de menu par défaut.** Revision 1.3 2004/09/23 17:57:19 jpm* La page active n'est pas afficher sous forme de lien mais sous forme de texte.** Revision 1.2 2004/07/06 17:07:21 jpm* Modification de la documentation pour une mailleur analyse par PhpDocumentor.** Revision 1.1 2004/06/15 15:06:25 jpm* Changement de nom et d'arborescence de Genesia en Papyrus.** Revision 1.4 2004/05/05 14:33:19 jpm* Gestion de l'indication de langue dans l'url.* Utile que si on veut forcer la langue.** Revision 1.2 2004/05/05 06:44:33 jpm* Complément des commentaires indiquant les paquetages nécessaire à l'applette.** Revision 1.1 2004/05/05 06:39:18 jpm* Transformation en applette de la fonction générant le "vous êtes ici".*** +-- Fin du code ----------------------------------------------------------------------------------------+*/?>