/trunk/api/text/wiki_papyrus/Render/Xhtml/Nouveaute.php |
---|
New file |
0,0 → 1,164 |
<?php |
class Text_Wiki_Render_Xhtml_Nouveaute 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 = ''; |
$type = ''; |
$site = ''; |
$nombre = $options['nombre']; |
// Récupération du type |
if (isset($options['type'])) { |
$type = $options['type']; |
} |
// Récupération du site |
if (isset($options['site'])) { |
$site = $options['site']; |
} |
// Récupération de la catégorie |
if (isset($options['categorie'])) { |
$categorie = $options['categorie']; |
} |
$aso_info_menu = GEN_lireInfoMenuContenuDate($GLOBALS['_GEN_commun']['pear_db'], $type, $site, $categorie); |
// Formatage des infos en XHTML |
$sortie .= '<ul class="page_liste">'."\n"; |
$i = 0; |
foreach ($aso_info_menu as $menu_id => $un_menu) { |
if ($i == $nombre) { |
break; |
} |
// Création de l'url |
$une_url =& new Pap_URL(); |
$une_url->setId($menu_id); |
// Début affichage d'une entrée de la liste des pages modifiées |
if ($un_menu->gmc_ce_type_modification = 1) { |
$type_modif = 'mineure'; |
} elseif ($un_menu->gmc_ce_type_modification = 2) { |
$type_modif = 'majeure'; |
} |
$sortie .= '<li class="page_modification_'.$type_modif.'">'."\n"; |
// Affichage du titre |
$sortie .= '<h2 class="page_titre"><a href="'.$une_url->getURL().'">'; |
if (!empty($un_menu->gm_titre)) { |
$sortie .= $un_menu->gm_titre; |
} elseif (!empty($un_menu->gm_titre_alternatif)) { |
$sortie .= $un_menu->gm_titre_alternatif; |
} else { |
$sortie .= $un_menu->gm_nom; |
} |
$sortie .= '</a></h2>'."\n".'<dl>'."\n"; |
// Affichage de l'auteur(s) |
if (!empty($un_menu->gm_auteur)) { |
$sortie .= '<dt class="page_auteur"> Auteur(s) : '.'</dt>'."\n"; |
$sortie .= '<dd>'.$un_menu->gm_auteur.'</dd>'."\n"; |
} |
// Affichage des contributeur(s) |
if (!empty($un_menu->gm_contributeur)) { |
$sortie .= '<dt class="page_contributeur"> Contributeur(s) : '.'</dt>'."\n"; |
$sortie .= '<dd>'.$un_menu->gm_contributeur.'</dd>'."\n"; |
} |
// Affichage de la date de la modification de la page |
$sortie .= '<dt class="page_modification_date"> '.'Modifié le : '.'</dt>'."\n"; |
$sortie .= '<dd>'."\n"; |
if (($jour = date('d', strtotime($un_menu->gmc_date_modification)) ) != 0 ) { |
$sortie .= '<span class="page_modification_jour"> '.$jour.'</span>'."\n"; |
} |
if (($mois = $this->_traduireMois(date('m', strtotime($un_menu->gmc_date_modification))) ) != '' ) { |
$sortie .= '<span class="page_modification_mois"> '.$mois.'</span>'."\n"; |
} |
if (($annee = date('Y', strtotime($un_menu->gmc_date_modification)) ) != 0 ) { |
$sortie .= '<span class="page_modification_annee"> '.$annee.'</span>'."\n"; |
} |
$sortie .= '<span class="page_separateur_date_heure"> - </span>'."\n"; |
// Affichage de l'horaire de la modification de la page |
if (($heure = date('G', strtotime($un_menu->gmc_date_modification)) ) != 0 ) { |
$sortie .= '<span class="page_modification_heure">'.$heure.'</span>'; |
$sortie .= '<span class="page_separateur_heure">:</span>'; |
$minute = date('i', strtotime($un_menu->gmc_date_modification)); |
$sortie .= '<span class="page_modification_minute">'.$minute.'</span>'."\n"; |
/* |
if (($seconde = date('s', strtotime($un_menu->gm_date_creation)) ) != 0 ) { |
$sortie .= '<span class="page_separateur_heure">:</span>'; |
$sortie .= '<span class="page_creation_seconde">'.$seconde.'</span>'; |
} |
*/ |
} |
$sortie .= '</dd>'."\n"; |
// Affichage de la description |
if (!empty($un_menu->gm_description_libre)) { |
$sortie .= '<dt class="page_description"> Description : '.'</dt>'."\n"; |
$sortie .= '<dd>'.$un_menu->gm_description_libre.'</dd>'."\n"; |
} |
// Affichage du résumé de la modification |
if (!empty($un_menu->gmc_resume_modification)) { |
$sortie .= '<dt class="page_resumer_modification_'.$type_modif.'"> Résumer modification : '.'</dt>'."\n"; |
$sortie .= '<dd>'.$un_menu->gmc_resume_modification.'</dd>'."\n"; |
} |
$sortie .= '</dl>'."\n"; |
$sortie .= '</li>'."\n"; |
$i++; |
} |
$sortie .= '</ul>'."\n"; |
return $sortie; |
} |
function _traduireMois($mois_numerique) |
{ |
switch ($mois_numerique) { |
case '01' : |
return 'janvier'; |
case '02' : |
return 'février'; |
case '03' : |
return 'mars'; |
case '04' : |
return 'avril'; |
case '05' : |
return 'mai'; |
case '06' : |
return 'juin'; |
case '07' : |
return 'juillet'; |
case '08' : |
return 'août'; |
case '09' : |
return 'septembre'; |
case '10' : |
return 'octobre'; |
case '11' : |
return 'novembre'; |
case '12' : |
return 'décembre'; |
default: |
return ''; |
} |
} |
} |
?> |
/trunk/api/text/wiki_papyrus/Render/Xhtml/Inclure.php |
---|
New file |
0,0 → 1,69 |
<?php |
class Text_Wiki_Render_Xhtml_Inclure extends Text_Wiki_Render { |
var $conf = array( |
'sites' => array( |
'Wikipedia' => array('preg' => '/<!-- start content -->(.*)<!-- end content -->/Umsi', 'url' => 'http://fr.wikipedia.org/wiki/%s'), |
'Wikipedia_fr' => array('preg' => '/<!-- start content -->(.*)<!-- end content -->/Umsi', 'url' => 'http://fr.wikipedia.org/wiki/%s'), |
'Wikipedia_en' => array('preg' => '/<!-- start content -->(.*)<!-- end content -->/Umsi', 'url' => 'http://en.wikipedia.org/wiki/%s'), |
'Wikini_eFlore' => array('preg' => '/<div class="page">(.*)<\/div>.*<div class="commentsheader">/Umsi', 'url' => 'http://wiki.tela-botanica.org/eflore/wakka.php?wiki=%s') |
), |
'css' => null, |
'encodage' => 'iso-8859-15' |
); |
/** |
* |
* 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) |
{ |
$site = $options['site']; |
$page = $options['page']; |
$text = $options['text']; |
$css = $this->formatConf(' class="%s"', 'css'); |
if (isset($this->conf['sites'][$site])) { |
$href = $this->conf['sites'][$site]['url']; |
} else { |
return $text; |
} |
// old form where page is at end, |
// or new form with %s placeholder for sprintf()? |
if (strpos($href, '%s') === false) { |
// use the old form |
$href = $href . $page; |
} else { |
// use the new form |
$href = sprintf($href, $page); |
} |
$output = ''; |
$contenu = file_get_contents($href); |
$tab_matches=''; |
preg_match($this->conf['sites'][$site]['preg'], $contenu, $tab_matches); |
$tab_encodage=''; |
preg_match('/<meta +http-equiv="Content-Type" +content="text\/html; *charset=(.+)"\/>/Ui', $contenu, $tab_encodage); |
if (preg_match('/^(?:iso-8859-1|iso-8859-15)$/i', $this->conf['encodage']) && preg_match('/utf-8/i', $tab_encodage[1])) { |
$output = utf8_decode($tab_matches[1]); |
} else { |
$output = $tab_matches[1]; |
} |
return $output; |
} |
} |
?> |
/trunk/api/text/wiki_papyrus/Render/Xhtml/Categorie.php |
---|
New file |
0,0 → 1,116 |
<?php |
class Text_Wiki_Render_Xhtml_Categorie 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 = ''; |
if (isset($options['mots'])) { |
$mots = $options['mots']; |
} else { |
return '<p>'.' Aucune catégorie passé en paramêtre! '.'</p>'; |
} |
// Récupération des infos |
$tab_mots = explode(',', $mots); |
for ($i = 0; $i < count($tab_mots); $i++) { |
// Suppression des espaces, tabulations... en début et fin de chaine |
$tab_mots[$i] = trim($tab_mots[$i]); |
} |
$aso_info_menu = GEN_lireInfoMenuCategorie($GLOBALS['_GEN_commun']['pear_db'], $tab_mots); |
// Formatage des infos en XHTML |
$sortie .= '<ul class="page_liste">'."\n"; |
foreach ($aso_info_menu as $id_menu => $un_menu) { |
// Création de l'url |
$une_url =& new Pap_URL(); |
$une_url->setId($id_menu); |
$sortie .= '<li>'."\n"; |
// Affichage de l'auteur(s) |
$sortie .= '<span class="page_auteur"> '.$un_menu->gm_auteur.'</span>'; |
$sortie .= '<span class="page_separateur_auteur"> - </span>'; |
// Affichage du titre |
$sortie .= '<a href="'.$une_url->getURL().'">'; |
$sortie .= '<span class="page_titre"> '.$un_menu->gm_titre.'</span>'; |
$sortie .= '</a>'; |
$sortie .= '<span class="page_separateur_titre"> - </span>'; |
// Affichage de l'horaire de la création de la page |
if (($heure = date('G', strtotime($un_menu->gm_date_creation)) ) != 0 ) { |
$sortie .= '<span class="page_creation_heure">'.$heure.'</span>'; |
$sortie .= '<span class="page_separateur_heure">:</span>'; |
$minute = date('i', strtotime($un_menu->gm_date_creation)); |
$sortie .= '<span class="page_creation_minute">'.$minute.'</span>'; |
if (($seconde = date('s', strtotime($un_menu->gm_date_creation)) ) != 0 ) { |
$sortie .= '<span class="page_separateur_heure">:</span>'; |
$sortie .= '<span class="page_creation_seconde">'.$seconde.'</span>'; |
} |
} |
$sortie .= '<span class="page_separateur_date_heure"> - </span>'."\n"; |
// Affichage de la date de la création de la page |
if (($jour = date('d', strtotime($un_menu->gm_date_creation)) ) != 0 ) { |
$sortie .= '<span class="page_creation_jour"> '.$jour.'</span>'; |
} |
if (($mois = $this->_traduireMois(date('m', strtotime($un_menu->gm_date_creation))) ) != '' ) { |
$sortie .= '<span class="page_creation_mois"> '.$mois.'</span>'; |
} |
if (($annee = date('Y', strtotime($un_menu->gm_date_creation)) ) != 0 ) { |
$sortie .= '<span class="page_creation_annee"> '.$annee.'</span>'; |
} |
$sortie .= '</li>'."\n"; |
} |
$sortie .= '</ul>'."\n"; |
return $sortie; |
} |
function _traduireMois($mois_numerique) |
{ |
switch ($mois_numerique) { |
case '01' : |
return 'janvier'; |
case '02' : |
return 'février'; |
case '03' : |
return 'mars'; |
case '04' : |
return 'avril'; |
case '05' : |
return 'mai'; |
case '06' : |
return 'juin'; |
case '07' : |
return 'juillet'; |
case '08' : |
return 'août'; |
case '09' : |
return 'septembre'; |
case '10' : |
return 'octobre'; |
case '11' : |
return 'novembre'; |
case '12' : |
return 'décembre'; |
default: |
return ''; |
} |
} |
} |
?> |
/trunk/api/text/wiki_papyrus/Render/Xhtml/Syndication.php |
---|
New file |
0,0 → 1,37 |
<?php |
require_once GEN_CHEMIN_API.'syndication_rss/syndication_rss.php'; |
class Text_Wiki_Render_Xhtml_Syndication 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 = ''; |
$titre = $options['titre']; |
$urls = $options['url']; |
$nblimite = $options['nb']; |
$nouvellefenetre = $options['nouvellefenetre']; |
$formatdate = $options['formatdate']; |
if (isset($options['template'])) $template = $options['template']; else $template = ''; |
$tab_url = array_map('trim', explode(',', $urls)); |
foreach ($tab_url as $cle => $url) { |
$url = str_replace('&', '&', $url) ; |
$sortie .= voir_rss($titre, $url, $nblimite, $nouvellefenetre, $formatdate, $template); |
} |
return $sortie; |
} |
} |
?> |
/trunk/api/text/wiki_papyrus/Render/Xhtml/Motcles.php |
---|
New file |
0,0 → 1,138 |
<?php |
class Text_Wiki_Render_Xhtml_Motcles 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 = ''; |
if (isset($options['mots'])) { |
$mots = $options['mots']; |
} else { |
return '<p>'.' Aucun mot-clés passé en paramêtre! '.'</p>'; |
} |
$condition = 'OR'; |
if (isset($options['condition'])) { |
$condition = $options['condition']; |
} |
$condition2 = 'OR'; |
if (isset($options['condition2'])) { |
$condition2 = $options['condition2']; |
} |
$ordre = 'ASC'; |
if (isset($options['ordre'])) { |
$ordre = $options['ordre']; |
} |
if (isset($options['categorie'])) { |
$categorie = $options['categorie'] ; |
} |
// Récupération des infos sur les mots |
$tab_mots = explode(',', $mots); |
for ($i = 0; $i < count($tab_mots); $i++) { |
// Suppression des espaces, tabulations... en début et fin de chaine |
$tab_mots[$i] = trim($tab_mots[$i]); |
} |
// Récupération des infos sur les catégories |
$tab_cat = explode(',', $categorie) ; |
for ($i = 0; $i < count($tab_cat); $i++) { |
// Suppression des espaces, tabulations... en début et fin de chaine |
$tab_cat[$i] = trim($tab_cat[$i]); |
} |
$aso_info_menu = GEN_lireInfoMenuMeta($GLOBALS['_GEN_commun']['pear_db'], $tab_mots, $tab_cat, $condition, $condition2, $ordre); |
// Formatage des infos en XHTML |
$sortie .= '<ul class="page_liste">'."\n"; |
foreach ($aso_info_menu as $id_menu => $un_menu) { |
// Création de l'url |
$une_url =& new Pap_URL(); |
$une_url->setId($id_menu); |
$sortie .= '<li>'."\n"; |
// Affichage de l'auteur(s) |
$sortie .= '<span class="page_auteur"> '.$un_menu->gm_auteur.'</span>'."\n"; |
$sortie .= '<span class="page_separateur_auteur"> - </span>'."\n"; |
// Affichage du titre |
$sortie .= '<a href="'.$une_url->getURL().'">'; |
$sortie .= '<span class="page_titre"> '.$un_menu->gm_titre.'</span>'; |
$sortie .= '</a>'."\n"; |
$sortie .= '<span class="page_separateur_titre"> - </span>'."\n"; |
// Affichage de l'horaire de la création de la page |
if (($heure = date('G', strtotime($un_menu->gm_date_creation)) ) != 0 ) { |
$sortie .= '<span class="page_creation_heure">'.$heure.'</span>'; |
$sortie .= '<span class="page_separateur_heure">:</span>'; |
$minute = date('i', strtotime($un_menu->gm_date_creation)); |
$sortie .= '<span class="page_creation_minute">'.$minute.'</span>'; |
if (($seconde = date('s', strtotime($un_menu->gm_date_creation)) ) != 0 ) { |
$sortie .= '<span class="page_separateur_heure">:</span>'; |
$sortie .= '<span class="page_creation_seconde">'.$seconde.'</span>'; |
} |
} |
$sortie .= "\n".'<span class="page_separateur_date_heure"> - </span>'."\n"; |
// Affichage de la date de la création de la page |
if (($jour = date('d', strtotime($un_menu->gm_date_creation)) ) != 0 ) { |
$sortie .= '<span class="page_creation_jour"> '.$jour.'</span>'."\n"; |
} |
if (($mois = $this->_traduireMois(date('m', strtotime($un_menu->gm_date_creation))) ) != '' ) { |
$sortie .= '<span class="page_creation_mois"> '.$mois.'</span>'."\n"; |
} |
if (($annee = date('Y', strtotime($un_menu->gm_date_creation)) ) != 0 ) { |
$sortie .= '<span class="page_creation_annee"> '.$annee.'</span>'."\n"; |
} |
$sortie .= '</li>'."\n"; |
} |
$sortie .= '</ul>'."\n"; |
return $sortie; |
} |
function _traduireMois($mois_numerique) |
{ |
switch ($mois_numerique) { |
case '01' : |
return 'janvier'; |
case '02' : |
return 'février'; |
case '03' : |
return 'mars'; |
case '04' : |
return 'avril'; |
case '05' : |
return 'mai'; |
case '06' : |
return 'juin'; |
case '07' : |
return 'juillet'; |
case '08' : |
return 'août'; |
case '09' : |
return 'septembre'; |
case '10' : |
return 'octobre'; |
case '11' : |
return 'novembre'; |
case '12' : |
return 'décembre'; |
default: |
return ''; |
} |
} |
} |
?> |
/trunk/api/text/wiki_papyrus/Render/Xhtml/Lien.php |
---|
New file |
0,0 → 1,143 |
<?php |
class Text_Wiki_Render_Xhtml_Lien 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 = ''; |
$niveau = $options['niveau']; |
$identifiant = $options['identifiant']; |
$titre = $options['titre']; |
$bdd =& $GLOBALS['_GEN_commun']['pear_db']; |
$id_langue = $GLOBALS['_GEN_commun']['i18n']; //identifiant de la langue choisie |
if (isset($id_langue) && ($id_langue!='')) { |
$langue_url=$id_langue; |
} else { |
$langue_url=GEN_I18N_ID_DEFAUT; |
} |
$une_url =& new Pap_URL('http://'.$_SERVER['HTTP_HOST'].$_SERVER['PHP_SELF']); |
$nom=''; |
if ($niveau=="site") { |
$requete = 'SELECT distinct * '. |
'FROM gen_site '; |
if (is_numeric($identifiant)) { |
$requete .= 'WHERE gs_code_num = '.$identifiant.' '; |
$une_url->addQueryString(GEN_URL_CLE_SITE, $identifiant); |
} |
$resultat = $bdd->query($requete); |
(DB::isError($resultat)) ? die(BOG_afficherErreurSql(__FILE__, __LINE__, $resultat->getMessage(), $requete)) : ''; |
$aso_site = $resultat->fetchRow(DB_FETCHMODE_ASSOC); |
$resultat->free(); |
$requete_traduction = 'SELECT * '. |
'FROM gen_site_relation, gen_site '. |
'WHERE gs_id_site = gsr_id_site_02 ' . |
'AND '.$identifiant.' = gs_code_num '. |
'AND gsr_id_valeur = 1 '.// 1 = "avoir traduction" |
'AND gs_ce_i18n = "'.$langue_url.'" '; |
$resultat_traduction = $bdd->query($requete_traduction); |
(DB::isError($resultat_traduction)) ? die(BOG_afficherErreurSql(__FILE__, __LINE__, $resultat_traduction->getMessage(), $requete_traduction)) |
: ''; |
if ( $resultat_traduction->numRows() > 0 ) { |
$aso_site=$resultat_traduction->fetchRow(DB_FETCHMODE_ASSOC); |
} |
if ($titre=='') { |
if (!empty($aso_site['gs_nom'])) { |
$titre = $aso_site['gs_nom']; |
} else { |
$titre = $aso_site['gs_titre']; |
} |
} |
} |
// Menu |
else { |
$requete = 'SELECT distinct * '. |
'FROM gen_menu '; |
if (is_numeric($identifiant)) { |
$requete .= 'WHERE gm_code_num = '.$identifiant.' '; |
$une_url->addQueryString(GEN_URL_CLE_MENU, $identifiant); |
} |
$resultat = $bdd->query($requete); |
(DB::isError($resultat)) ? die(BOG_afficherErreurSql(__FILE__, __LINE__, $resultat->getMessage(), $requete)) : ''; |
$aso_menu = $resultat->fetchRow(DB_FETCHMODE_ASSOC); |
$resultat->free(); |
$requete_traduction = 'SELECT * '. |
'FROM gen_menu_relation, gen_menu '. |
'WHERE '.$identifiant.' = gm_code_num ' . |
'AND gmr_id_menu_02 = gm_id_menu '. |
'AND gmr_id_valeur = 2 '.// 2 = "avoir traduction" |
'AND gm_ce_i18n = "'.$langue_url.'" '; |
$resultat_traduction = $bdd->query($requete_traduction); |
(DB::isError($resultat_traduction)) ? die(BOG_afficherErreurSql(__FILE__, __LINE__, $resultat_traduction->getMessage(), $requete_traduction)) |
: ''; |
if ($resultat_traduction->numRows() > 0) { |
$aso_menu=$resultat_traduction->fetchRow(DB_FETCHMODE_ASSOC); |
} |
if ($titre=='') { |
if (!empty($aso_menu['gm_nom'])) { |
$titre = $aso_menu['gm_nom']; |
} |
elseif (!empty($menu_valeur['gm_titre'])) { |
$titre = $aso_menu['gm_titre']; |
} |
} |
} |
if ($langue_url != GEN_I18N_ID_DEFAUT) { |
$une_url->addQueryString(GEN_URL_CLE_I18N, $langue_url); |
} |
// Construction du lien |
$sortie = '<a href="'.$une_url->getURL().'">'.htmlentities($titre).'</a>'; |
return $sortie; |
} |
} |
?> |
/trunk/api/text/wiki_papyrus/Render/Xhtml/Redirection.php |
---|
New file |
0,0 → 1,27 |
<?php |
class Text_Wiki_Render_Xhtml_Redirection 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 = ''; |
$url = $options['url']; |
$url=ereg_replace('&','&',$url); |
header("Location: $url"); |
exit; |
} |
} |
?> |
/trunk/api/text/wiki_papyrus/Render/Xhtml/Plan.php |
---|
New file |
0,0 → 1,92 |
<?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 |
$bdd =& $GLOBALS['_GEN_commun']['pear_db']; |
$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)); |
foreach ($tab_site as $cle => $site) { |
if (count($tab_site) > 1) { |
$aso_site = GEN_lireInfoSitePrincipalCodeAlpha($bdd, $site, DB_FETCHMODE_ASSOC); |
if (!empty($aso_site['gs_titre'])) { |
$titre = $aso_site['gs_titre']; |
} else { |
$titre = $aso_site['gs_nom']; |
} |
$sortie .= '<h2>'.htmlentities($titre).'</h2>'."\n"; |
} |
$sortie .= '<ul class="plan_site_'.$site.'" >'."\n"; |
$aso_menus = GEN_retournerTableauMenusSiteCodeAlpha($bdd, $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) { |
if ( $menu_valeur['gm_date_fin_validite'] == '' |
|| $menu_valeur['gm_date_fin_validite'] == '0000-00-00 00:00:00' |
|| strtotime($menu_valeur['gm_date_fin_validite']) > time()) { |
$sortie .= '<li>'; |
// Création de l'url |
$une_url =& new Pap_URL('http://'.$_SERVER['HTTP_HOST'].$_SERVER['PHP_SELF']); |
$une_url->setId($menu_id); |
// Construction de l'attribut title |
$title = ''; |
if (!empty($menu_valeur['gm_titre'])) { |
$title = ' title="'.htmlentities($menu_valeur['gm_titre']).'"'; |
} elseif (!empty($menu_valeur['gm_titre_alternatif'])) { |
$title = ' title="'.htmlentities($menu_valeur['gm_titre_alternatif']).'"'; |
} |
// Construction du lien |
$sortie .= '<a href="'.$une_url->getURL().'"'.$title.'>'.htmlentities($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; |
} |
} |
?> |