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 ''; |
} |
} |
} |
?> |