New file |
0,0 → 1,77 |
<?php |
|
class Text_Wiki_Render_Xhtml_Plan extends Text_Wiki_Render { |
|
/** |
* |
* Renders a token into text matching the requested format. |
* |
* @access public |
* |
* @param array $options The "options" portion of the token (second |
* element). |
* |
* @return string The text rendered from the token options. |
* |
*/ |
|
function token($options) |
{ |
// Initialisation des variables |
$sortie = ''; |
$sites = $options['site']; |
// Récupération de l'affichage ou pas des raccourcis |
if (isset($options['permalien'])) { |
$permalien = $options['permalien']; |
} |
$tab_site = array_map('trim', explode(',', $sites)); |
$sortie .= '<ul class="plan_site_'.$site.'" >'."\n"; |
foreach ($tab_site as $cle => $site) { |
$aso_menus = GEN_retournerTableauMenusSiteCodeAlpha($GLOBALS['_GEN_commun']['pear_db'], $site); |
$sortie .= $this->parserTableauMenus($aso_menus, $permalien); |
} |
$sortie .= '</ul>'."\n"; |
|
return $sortie; |
} |
|
function parserTableauMenus($aso_menus, $permalien) |
{ |
$sortie = ''; |
// Création de l'url |
foreach ($aso_menus as $menu_id => $menu_valeur) { |
$sortie .= '<li>'; |
// Création de l'url |
$une_url =& new Pap_URL(); |
$une_url->setId($menu_id); |
|
// Construction de l'attribut title |
$title = ''; |
if (!empty($menu_valeur['gm_titre'])) { |
$title = ' title="'.$menu_valeur['gm_titre'].'"'; |
} elseif (!empty($menu_valeur['gm_titre_alternatif'])) { |
$title = ' title="'.$menu_valeur['gm_titre_alternatif'].'"'; |
} |
|
// Construction du lien |
$sortie .= '<a href="'.$une_url->getURL().'"'.$title.'>'.$menu_valeur['gm_nom'].'</a>'; |
|
// Nous affichons ou pas le permalien |
if ($permalien) { |
$une_url->setPermalien(true); |
$sortie .= ' <span class="plan_permalien">'.'('.$une_url->getURL().')'.'</span>'; |
$une_url->setPermalien(false); |
} |
|
// Nous ajoutons les sous-menus s'il y en a. |
$retour = $this->parserTableauMenus($menu_valeur['sous_menus'], $permalien); |
if ($retour != '') { |
$sortie .= "\n".'<ul>'."\n".$retour."\n".'</ul>'."\n"; |
} |
|
$sortie .= '</li>'."\n"; |
} |
return $sortie; |
} |
} |
?> |