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: menu.php,v 1.10 2004-11-15 17:40:02 jpm Exp $ |
// CVS : $Id: menu.php,v 1.11 2004-11-26 19:02:22 jpm Exp $ |
/** |
* Applette : menu |
* |
38,7 → 38,7 |
//Autres auteurs : |
*@author Aucun |
*@copyright Tela-Botanica 2000-2004 |
*@version $Revision: 1.10 $ $Date: 2004-11-15 17:40:02 $ |
*@version $Revision: 1.11 $ $Date: 2004-11-26 19:02:22 $ |
// +------------------------------------------------------------------------------------------------------+ |
*/ |
|
47,8 → 47,8 |
// +------------------------------------------------------------------------------------------------------+ |
|
require_once 'papyrus/bibliotheque/fonctions/pap_menu.fonct.php'; |
|
$_GEN_commun['info_applette_nom_fonction'] = 'afficherMenuNiveauMultiple'; |
$GLOBALS['_MENU_']['nom_fonction'] = 'afficherMenuNiveauMultiple'; |
$_GEN_commun['info_applette_nom_fonction'] = $GLOBALS['_MENU_']['nom_fonction']; |
$_GEN_commun['info_applette_balise'] = 'MENU_?(?:(|CLASSIQUE|COMMUN)_([0-9]+)_([0-9]+)(|_ID_([0-9]+))|(UNIQUE)_([0-9]+))'; |
|
// +------------------------------------------------------------------------------------------------------+ |
74,7 → 74,8 |
// Initialisation de variable. |
$objet_pear_db = $_GEN_commun['pear_db']; |
$id_site = $_GEN_commun['info_site']->gs_id_site; |
$id_menu = $_GEN_commun['info_menu']->gm_id_menu; |
$id_menu = $_GEN_commun['info_menu']->gm_id_menu; |
$num_menu = $GLOBALS['_PAPYRUS_']['applette']['comptage'][$GLOBALS['_MENU_']['nom_fonction']]; |
$id_langue = $_GEN_commun['i18n']; |
$i18n_url = '';// Evite d'écrire l'i18n dans l'url demandée. |
if (!empty($_GEN_commun['url_i18n'])) { |
123,7 → 124,9 |
} |
|
//Construction du menu |
$xhtml_menu = afficherListeNiveauMultiple($objet_pear_db, $id_site, $id_langue, $i18n_url ,$niveau_depart, $profondeur, $menu_depart, 1, $menu_type, $indent_origine, $indent_pas, $_GEN_commun); |
$xhtml_menu = afficherListeNiveauMultiple( $objet_pear_db, $id_site, $id_langue, $i18n_url ,$niveau_depart, |
$profondeur, $menu_depart, 1, $menu_type, $indent_origine, |
$indent_pas, $_GEN_commun, $num_menu); |
|
//Si nous avons un |
if (! empty($xhtml_menu)) { |
148,7 → 151,9 |
* @param integer identifiant d'un menu pére. |
* @return string les listes de menus au format XHTML. |
*/ |
function afficherListeNiveauMultiple($objet_pear_db, $id_site, $id_langue, $i18n_url, $niveau_depart, $profondeur, $id_pere_menu_a_deployer, $position, $menu_type, $indent_origine = 12, $indent_pas = 4, $_GEN_commun) |
function afficherListeNiveauMultiple( $objet_pear_db, $id_site, $id_langue, $i18n_url, $niveau_depart, $profondeur, |
$id_pere_menu_a_deployer, $position, $menu_type, $indent_origine = 12, |
$indent_pas = 4, $_GEN_commun, $num_menu) |
{ |
// Initialisation des variables |
static $niveau_actuel = 1; |
168,7 → 173,7 |
// Nous regardons si nous devons afficher un menu racine |
if ($id_pere_menu_a_deployer != 0 && $niveau_actuel == 1) { |
$retour .= str_repeat(' ', $indent_origine + ($indent_pas * $position)). |
'<ul class="menu_commun_n'.($niveau_actuel - 1).'">'."\n"; |
'<ul class="groupe_menu_'.$num_menu.'_'.$id_pere_menu_a_deployer.'" class="menu_'.$menu_type.'_'.'n'.$niveau_actuel.'">'."\n"; |
$id_menu_selectionne = $GLOBALS['_GEN_commun']['info_menu']->gm_id_menu; |
if (!empty($id_menu_selectionne) && (GEN_etreAncetre($id_pere_menu_a_deployer, $id_menu_selectionne) || $id_pere_menu_a_deployer == $id_menu_selectionne) ) { |
$classe = 'menu_actif'; |
177,14 → 182,14 |
} |
// Pour un menu dont on spécifie l'identifiant du menu départ, on affiche ce menu. |
$retour .= str_repeat(' ', $indent_origine + ($indent_pas * ($position + 1))). |
'<li id="menu_'.$menu_type.'_'.$id_pere_menu_a_deployer.'" class="'.$classe.'">'."\n"; |
'<li id="menu_'.$num_menu.'_'.$id_pere_menu_a_deployer.'" class="'.$classe.'">'."\n"; |
$retour .= afficherEntreeListeMenu( $objet_pear_db, $id_pere_menu_a_deployer, $i18n_url, |
$niveau_actuel, 1, $position, $menu_type, $indent_origine, $indent_pas, $_GEN_commun); |
} |
|
if ($niveau_actuel >= $niveau_depart && $niveau_actuel <= $profondeur) { |
$retour .= str_repeat(' ', $indent_origine + ($indent_pas * $position)). |
'<ul id="groupe_menu_'.$menu_type.'_'.$id_pere_menu_a_deployer.'" class="menu_'.$menu_type.'_'.'n'.$niveau_actuel.'">'."\n"; |
$retour .= str_repeat(' ', $indent_origine + ($indent_pas * ($position + 1))). |
'<ul id="groupe_menu_'.$num_menu.'_'.$id_pere_menu_a_deployer.'" class="menu_'.$menu_type.'_'.'n'.$niveau_actuel.'">'."\n"; |
} |
|
$requete = 'SELECT gm_id_menu, GMR01.gmr_ordre '. |
241,8 → 246,8 |
} |
|
// Affichage du menu |
$retour .= str_repeat(' ', $indent_origine + ($indent_pas * ($position + 1))). |
'<li id="menu_'.$menu_type.'_'.$id_menu_inf.'" class="'.$classe.'">'."\n"; |
$retour .= str_repeat(' ', $indent_origine + ($indent_pas * ($position + 2))). |
'<li id="menu_'.$num_menu.'_'.$id_menu_inf.'" class="'.$classe.'">'."\n"; |
$retour .= afficherEntreeListeMenu( $objet_pear_db, $id_menu_inf, $i18n_url, $niveau_actuel, |
$ligne->gmr_ordre, $position, $menu_type, $indent_origine, $indent_pas, $_GEN_commun); |
} |
266,19 → 271,23 |
if ($resultat_fils->numRows() != 0 && $ligne->gm_id_menu == $GLOBALS['_GEN_commun']['info_menu']->gm_id_menu |
|| GEN_etreAncetre($ligne->gm_id_menu, $GLOBALS['_GEN_commun']['info_menu']->gm_id_menu)) { |
$niveau_actuel++; |
$retour .= afficherListeNiveauMultiple($objet_pear_db, $id_site, $id_langue, $i18n_url, $niveau_depart, $profondeur, $ligne->gm_id_menu, ($position + 2), $menu_type, null, null, $_GEN_commun); |
$retour .= afficherListeNiveauMultiple( $objet_pear_db, $id_site, $id_langue, $i18n_url, $niveau_depart, |
$profondeur, $ligne->gm_id_menu, ($position + 3), $menu_type, |
null, null, $_GEN_commun, $num_menu); |
// On ramène $niveau_actuel un cran plus bas |
$niveau_actuel--; |
$retour .= str_repeat(' ', $indent_origine + ($indent_pas * ($position + 1))).'</li>'."\n"; |
} else { |
$retour .= str_repeat(' ', $indent_origine + ($indent_pas * ($position + 1))).'</li>'."\n"; |
} |
} |
|
if ($niveau_actuel >= $niveau_depart && $niveau_actuel <= $profondeur) { |
$retour .= str_repeat(' ', $indent_origine + ($indent_pas * ($position + 2))).'</li>'."\n"; |
} |
|
$resultat_fils->free(); |
} |
$resultat->free(); |
|
if ($niveau_actuel >= $niveau_depart && $niveau_actuel <= $profondeur) { |
$retour .= str_repeat(' ', $indent_origine + ($indent_pas * $position)).'</ul>'."\n"; |
$retour .= str_repeat(' ', $indent_origine + ($indent_pas * $position+ 1)).'</ul>'."\n"; |
} |
|
// Nous regardons si nous avons affiché le menu racine |
364,6 → 373,9 |
/* +--Fin du code ----------------------------------------------------------------------------------------+ |
* |
* $Log: not supported by cvs2svn $ |
* Revision 1.10 2004/11/15 17:40:02 jpm |
* Changement nom balise. |
* |
* Revision 1.9 2004/11/15 16:17:40 jpm |
* Gestion des différents types de menus. |
* |