Line 17... |
Line 17... |
17 |
// | |
|
17 |
// | |
|
18 |
// | You should have received a copy of the GNU Lesser General Public |
|
18 |
// | You should have received a copy of the GNU Lesser General Public |
|
19 |
// | License along with this library; if not, write to the Free Software |
|
19 |
// | License along with this library; if not, write to the Free Software |
|
20 |
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|
20 |
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|
21 |
// +------------------------------------------------------------------------------------------------------+
|
21 |
// +------------------------------------------------------------------------------------------------------+
|
22 |
// CVS : $Id: menu.php,v 1.11 2004-11-26 19:02:22 jpm Exp $
|
22 |
// CVS : $Id: menu.php,v 1.12 2004-12-02 10:42:15 jpm Exp $
|
23 |
/**
|
23 |
/**
|
24 |
* Applette : menu
|
24 |
* Applette : menu
|
25 |
*
|
25 |
*
|
26 |
* Génère une liste de listes comportant tous les niveaux des menus "classiques" d'un site.
|
26 |
* Génère une liste de listes comportant tous les niveaux des menus "classiques" d'un site.
|
27 |
* Nécessite :
|
27 |
* Nécessite :
|
Line 36... |
Line 36... |
36 |
//Auteur original :
|
36 |
//Auteur original :
|
37 |
*@author Jean-Pascal MILCENT <jpm@tela-botanica.org>
|
37 |
*@author Jean-Pascal MILCENT <jpm@tela-botanica.org>
|
38 |
//Autres auteurs :
|
38 |
//Autres auteurs :
|
39 |
*@author Aucun
|
39 |
*@author Aucun
|
40 |
*@copyright Tela-Botanica 2000-2004
|
40 |
*@copyright Tela-Botanica 2000-2004
|
41 |
*@version $Revision: 1.11 $ $Date: 2004-11-26 19:02:22 $
|
41 |
*@version $Revision: 1.12 $ $Date: 2004-12-02 10:42:15 $
|
42 |
// +------------------------------------------------------------------------------------------------------+
|
42 |
// +------------------------------------------------------------------------------------------------------+
|
43 |
*/
|
43 |
*/
|
Line 44... |
Line 44... |
44 |
|
44 |
|
45 |
// +------------------------------------------------------------------------------------------------------+
|
45 |
// +------------------------------------------------------------------------------------------------------+
|
Line 156... |
Line 156... |
156 |
$indent_pas = 4, $_GEN_commun, $num_menu)
|
156 |
$indent_pas = 4, $_GEN_commun, $num_menu)
|
157 |
{
|
157 |
{
|
158 |
// Initialisation des variables
|
158 |
// Initialisation des variables
|
159 |
static $niveau_actuel = 1;
|
159 |
static $niveau_actuel = 1;
|
160 |
$retour = '';
|
160 |
$retour = '';
|
- |
|
161 |
$tete = '';
|
- |
|
162 |
$corps = '';
|
- |
|
163 |
$pied = '';
|
- |
|
164 |
|
161 |
// Gestion des menus uniques
|
165 |
// Gestion des menus uniques
|
162 |
if ($menu_type == 'unique') {
|
166 |
if ($menu_type == 'unique') {
|
163 |
$retour .= afficherEntreeListeMenu( $objet_pear_db, $id_pere_menu_a_deployer, $i18n_url,
|
167 |
$retour .= afficherEntreeListeMenu( $objet_pear_db, $id_pere_menu_a_deployer, $i18n_url,
|
164 |
$niveau_actuel, 1, $position, $menu_type, $indent_origine, $indent_pas, $_GEN_commun);
|
168 |
$niveau_actuel, 1, $position, $menu_type, $indent_origine, $indent_pas, $_GEN_commun);
|
165 |
// Dans le cas, d'un menu unique, on retourne directement le résultat ici.
|
169 |
// Dans le cas, d'un menu unique, on retourne directement le résultat ici.
|
Line 170... |
Line 174... |
170 |
return null;
|
174 |
return null;
|
171 |
}
|
175 |
}
|
Line 172... |
Line 176... |
172 |
|
176 |
|
173 |
// Nous regardons si nous devons afficher un menu racine
|
177 |
// Nous regardons si nous devons afficher un menu racine
|
174 |
if ($id_pere_menu_a_deployer != 0 && $niveau_actuel == 1) {
|
178 |
if ($id_pere_menu_a_deployer != 0 && $niveau_actuel == 1) {
|
175 |
$retour .= str_repeat(' ', $indent_origine + ($indent_pas * $position)).
|
179 |
$tete .= str_repeat(' ', $indent_origine + ($indent_pas * $position)).
|
176 |
'<ul class="groupe_menu_'.$num_menu.'_'.$id_pere_menu_a_deployer.'" class="menu_'.$menu_type.'_'.'n'.$niveau_actuel.'">'."\n";
|
180 |
'<ul class="groupe_menu_'.$num_menu.'_'.$id_pere_menu_a_deployer.'" class="menu_'.$menu_type.'_'.'n'.$niveau_actuel.'">'."\n";
|
177 |
$id_menu_selectionne = $GLOBALS['_GEN_commun']['info_menu']->gm_id_menu;
|
181 |
$id_menu_selectionne = $GLOBALS['_GEN_commun']['info_menu']->gm_id_menu;
|
178 |
if (!empty($id_menu_selectionne) && (GEN_etreAncetre($id_pere_menu_a_deployer, $id_menu_selectionne) || $id_pere_menu_a_deployer == $id_menu_selectionne) ) {
|
182 |
if (!empty($id_menu_selectionne) && (GEN_etreAncetre($id_pere_menu_a_deployer, $id_menu_selectionne) || $id_pere_menu_a_deployer == $id_menu_selectionne) ) {
|
179 |
$classe = 'menu_actif';
|
183 |
$classe = 'menu_actif';
|
180 |
} else {
|
184 |
} else {
|
181 |
$classe = 'menu_inactif';
|
185 |
$classe = 'menu_inactif';
|
182 |
}
|
186 |
}
|
183 |
// Pour un menu dont on spécifie l'identifiant du menu départ, on affiche ce menu.
|
187 |
// Pour un menu dont on spécifie l'identifiant du menu départ, on affiche ce menu.
|
184 |
$retour .= str_repeat(' ', $indent_origine + ($indent_pas * ($position + 1))).
|
188 |
$corps .= str_repeat(' ', $indent_origine + ($indent_pas * ($position + 1))).
|
185 |
'<li id="menu_'.$num_menu.'_'.$id_pere_menu_a_deployer.'" class="'.$classe.'">'."\n";
|
189 |
'<li id="menu_'.$num_menu.'_'.$id_pere_menu_a_deployer.'" class="'.$classe.'">'."\n";
|
186 |
$retour .= afficherEntreeListeMenu( $objet_pear_db, $id_pere_menu_a_deployer, $i18n_url,
|
190 |
$corps .= afficherEntreeListeMenu( $objet_pear_db, $id_pere_menu_a_deployer, $i18n_url,
|
187 |
$niveau_actuel, 1, $position, $menu_type, $indent_origine, $indent_pas, $_GEN_commun);
|
191 |
$niveau_actuel, 1, $position, $menu_type, $indent_origine, $indent_pas, $_GEN_commun);
|
Line 188... |
Line 192... |
188 |
}
|
192 |
}
|
189 |
|
193 |
|
190 |
if ($niveau_actuel >= $niveau_depart && $niveau_actuel <= $profondeur) {
|
194 |
if ($niveau_actuel >= $niveau_depart && $niveau_actuel <= $profondeur) {
|
191 |
$retour .= str_repeat(' ', $indent_origine + ($indent_pas * ($position + 1))).
|
195 |
$tete .= str_repeat(' ', $indent_origine + ($indent_pas * ($position + 1))).
|
Line 192... |
Line 196... |
192 |
'<ul id="groupe_menu_'.$num_menu.'_'.$id_pere_menu_a_deployer.'" class="menu_'.$menu_type.'_'.'n'.$niveau_actuel.'">'."\n";
|
196 |
'<ul id="groupe_menu_'.$num_menu.'_'.$id_pere_menu_a_deployer.'" class="menu_'.$menu_type.'_'.'n'.$niveau_actuel.'">'."\n";
|
193 |
}
|
197 |
}
|
Line 244... |
Line 248... |
244 |
} else {
|
248 |
} else {
|
245 |
$classe = 'menu_inactif';
|
249 |
$classe = 'menu_inactif';
|
246 |
}
|
250 |
}
|
Line 247... |
Line 251... |
247 |
|
251 |
|
248 |
// Affichage du menu
|
252 |
// Affichage du menu
|
249 |
$retour .= str_repeat(' ', $indent_origine + ($indent_pas * ($position + 2))).
|
253 |
$corps .= str_repeat(' ', $indent_origine + ($indent_pas * ($position + 2))).
|
250 |
'<li id="menu_'.$num_menu.'_'.$id_menu_inf.'" class="'.$classe.'">'."\n";
|
254 |
'<li id="menu_'.$num_menu.'_'.$id_menu_inf.'" class="'.$classe.'">'."\n";
|
251 |
$retour .= afficherEntreeListeMenu( $objet_pear_db, $id_menu_inf, $i18n_url, $niveau_actuel,
|
255 |
$corps .= afficherEntreeListeMenu( $objet_pear_db, $id_menu_inf, $i18n_url, $niveau_actuel,
|
252 |
$ligne->gmr_ordre, $position, $menu_type, $indent_origine, $indent_pas, $_GEN_commun);
|
256 |
$ligne->gmr_ordre, $position, $menu_type, $indent_origine, $indent_pas, $_GEN_commun);
|
253 |
}
|
257 |
}
|
254 |
// Pour chaque menu on regarde s'il y a des fils. Si oui, on les déploie.
|
258 |
// Pour chaque menu on regarde s'il y a des fils. Si oui, on les déploie.
|
255 |
$requete_fils = 'SELECT gm_id_menu '.
|
259 |
$requete_fils = 'SELECT gm_id_menu '.
|
Line 269... |
Line 273... |
269 |
: '';
|
273 |
: '';
|
Line 270... |
Line 274... |
270 |
|
274 |
|
271 |
if ($resultat_fils->numRows() != 0 && $ligne->gm_id_menu == $GLOBALS['_GEN_commun']['info_menu']->gm_id_menu
|
275 |
if ($resultat_fils->numRows() != 0 && $ligne->gm_id_menu == $GLOBALS['_GEN_commun']['info_menu']->gm_id_menu
|
272 |
|| GEN_etreAncetre($ligne->gm_id_menu, $GLOBALS['_GEN_commun']['info_menu']->gm_id_menu)) {
|
276 |
|| GEN_etreAncetre($ligne->gm_id_menu, $GLOBALS['_GEN_commun']['info_menu']->gm_id_menu)) {
|
273 |
$niveau_actuel++;
|
277 |
$niveau_actuel++;
|
274 |
$retour .= afficherListeNiveauMultiple( $objet_pear_db, $id_site, $id_langue, $i18n_url, $niveau_depart,
|
278 |
$corps .= afficherListeNiveauMultiple( $objet_pear_db, $id_site, $id_langue, $i18n_url, $niveau_depart,
|
275 |
$profondeur, $ligne->gm_id_menu, ($position + 3), $menu_type,
|
279 |
$profondeur, $ligne->gm_id_menu, ($position + 3), $menu_type,
|
276 |
null, null, $_GEN_commun, $num_menu);
|
280 |
null, null, $_GEN_commun, $num_menu);
|
277 |
// On ramène $niveau_actuel un cran plus bas
|
281 |
// On ramène $niveau_actuel un cran plus bas
|
278 |
$niveau_actuel--;
|
282 |
$niveau_actuel--;
|
Line 279... |
Line 283... |
279 |
}
|
283 |
}
|
280 |
|
284 |
|
281 |
if ($niveau_actuel >= $niveau_depart && $niveau_actuel <= $profondeur) {
|
285 |
if ($niveau_actuel >= $niveau_depart && $niveau_actuel <= $profondeur) {
|
Line 282... |
Line 286... |
282 |
$retour .= str_repeat(' ', $indent_origine + ($indent_pas * ($position + 2))).'</li>'."\n";
|
286 |
$corps .= str_repeat(' ', $indent_origine + ($indent_pas * ($position + 2))).'</li>'."\n";
|
283 |
}
|
287 |
}
|
284 |
|
288 |
|
Line 285... |
Line 289... |
285 |
$resultat_fils->free();
|
289 |
$resultat_fils->free();
|
286 |
}
|
290 |
}
|
287 |
$resultat->free();
|
291 |
$resultat->free();
|
Line 288... |
Line 292... |
288 |
|
292 |
|
289 |
if ($niveau_actuel >= $niveau_depart && $niveau_actuel <= $profondeur) {
|
293 |
if ($niveau_actuel >= $niveau_depart && $niveau_actuel <= $profondeur) {
|
290 |
$retour .= str_repeat(' ', $indent_origine + ($indent_pas * $position+ 1)).'</ul>'."\n";
|
294 |
$pied .= str_repeat(' ', $indent_origine + ($indent_pas * $position+ 1)).'</ul>'."\n";
|
291 |
}
|
295 |
}
|
292 |
|
296 |
|
293 |
// Nous regardons si nous avons affiché le menu racine
|
297 |
// Nous regardons si nous avons affiché le menu racine
|
- |
|
298 |
if ($id_pere_menu_a_deployer != 0 && $niveau_actuel == 1) {
|
- |
|
299 |
$corps .= str_repeat(' ', $indent_origine + ($indent_pas * ($position + 1))).'</li>'."\n";
|
- |
|
300 |
$pied .= str_repeat(' ', $indent_origine + ($indent_pas * $position)).'</ul>'."\n";
|
- |
|
301 |
}
|
294 |
if ($id_pere_menu_a_deployer != 0 && $niveau_actuel == 1) {
|
302 |
|
- |
|
303 |
if (empty($corps)) {
|
295 |
$retour .= str_repeat(' ', $indent_origine + ($indent_pas * ($position + 1))).'</li>'."\n";
|
304 |
return $retour;
|
Line 296... |
Line 305... |
296 |
$retour .= str_repeat(' ', $indent_origine + ($indent_pas * $position)).'</ul>'."\n";
|
305 |
} else {
|
297 |
}
|
306 |
$retour = $tete.$corps.$pied;
|
298 |
|
307 |
return $retour;
|
Line 371... |
Line 380... |
371 |
|
380 |
|
372 |
|
381 |
|
373 |
/* +--Fin du code ----------------------------------------------------------------------------------------+
|
382 |
/* +--Fin du code ----------------------------------------------------------------------------------------+
|
- |
|
383 |
*
|
- |
|
384 |
* $Log: not supported by cvs2svn $
|
- |
|
385 |
* Revision 1.11 2004/11/26 19:02:22 jpm
|
374 |
*
|
386 |
* Correction bogue li surnuméraires.
|
375 |
* $Log: not supported by cvs2svn $
|
387 |
*
|
376 |
* Revision 1.10 2004/11/15 17:40:02 jpm
|
388 |
* Revision 1.10 2004/11/15 17:40:02 jpm
|
377 |
* Changement nom balise.
|
389 |
* Changement nom balise.
|
378 |
*
|
390 |
*
|