| 335 | jpm | 1 | <?php
 | 
        
           |  |  | 2 |   | 
        
           |  |  | 3 | class Text_Wiki_Render_Xhtml_Categorie extends Text_Wiki_Render {
 | 
        
           |  |  | 4 |   | 
        
           |  |  | 5 |     /**
 | 
        
           |  |  | 6 |     *
 | 
        
           |  |  | 7 |     * Renders a token into text matching the requested format.
 | 
        
           |  |  | 8 |     *
 | 
        
           |  |  | 9 |     * @access public
 | 
        
           |  |  | 10 |     *
 | 
        
           |  |  | 11 |     * @param array $options The "options" portion of the token (second
 | 
        
           |  |  | 12 |     * element).
 | 
        
           |  |  | 13 |     *
 | 
        
           |  |  | 14 |     * @return string The text rendered from the token options.
 | 
        
           |  |  | 15 |     *
 | 
        
           |  |  | 16 |     */
 | 
        
           |  |  | 17 |   | 
        
           |  |  | 18 |     function token($options)
 | 
        
           |  |  | 19 |     {
 | 
        
           |  |  | 20 |         // Initialisation des variables
 | 
        
           |  |  | 21 |         $sortie = '';
 | 
        
           |  |  | 22 |         if (isset($options['mots'])) {
 | 
        
           |  |  | 23 |             $mots = $options['mots'];
 | 
        
           |  |  | 24 |         } else {
 | 
        
           |  |  | 25 |             return '<p>'.' Aucune catégorie passé en paramêtre! '.'</p>';
 | 
        
           |  |  | 26 |         }
 | 
        
           |  |  | 27 |   | 
        
           |  |  | 28 |         // Récupération des infos
 | 
        
           |  |  | 29 |         $tab_mots = explode(',', $mots);
 | 
        
           |  |  | 30 |         for ($i = 0; $i < count($tab_mots); $i++) {
 | 
        
           |  |  | 31 |             // Suppression des espaces, tabulations... en début et fin de chaine
 | 
        
           |  |  | 32 |             $tab_mots[$i] = trim($tab_mots[$i]);
 | 
        
           |  |  | 33 |         }
 | 
        
           |  |  | 34 |         $aso_info_menu = GEN_lireInfoMenuCategorie($GLOBALS['_GEN_commun']['pear_db'], $tab_mots);
 | 
        
           |  |  | 35 |   | 
        
           |  |  | 36 |         // Formatage des infos en XHTML
 | 
        
           |  |  | 37 |         $sortie .= '<ul class="page_liste">'."\n";
 | 
        
           |  |  | 38 |         foreach ($aso_info_menu as $id_menu => $un_menu) {
 | 
        
           |  |  | 39 |             // Création de l'url
 | 
        
           |  |  | 40 |             $une_url =& new Pap_URL();
 | 
        
           |  |  | 41 |             $une_url->setId($id_menu);
 | 
        
           |  |  | 42 |   | 
        
           |  |  | 43 |             $sortie .= '<li>'."\n";
 | 
        
           |  |  | 44 |   | 
        
           |  |  | 45 |             // Affichage de l'auteur(s)
 | 
        
           |  |  | 46 |             $sortie .= '<span class="page_auteur"> '.$un_menu->gm_auteur.'</span>';
 | 
        
           |  |  | 47 |             $sortie .= '<span class="page_separateur_auteur"> - </span>';
 | 
        
           |  |  | 48 |   | 
        
           |  |  | 49 |             // Affichage du titre
 | 
        
           |  |  | 50 |             $sortie .= '<a href="'.$une_url->getURL().'">';
 | 
        
           |  |  | 51 |             $sortie .= '<span class="page_titre"> '.$un_menu->gm_titre.'</span>';
 | 
        
           |  |  | 52 |             $sortie .= '</a>';
 | 
        
           |  |  | 53 |             $sortie .= '<span class="page_separateur_titre"> - </span>';
 | 
        
           |  |  | 54 |   | 
        
           |  |  | 55 |             // Affichage de l'horaire de la création de la page
 | 
        
           |  |  | 56 |             if (($heure = date('G', strtotime($un_menu->gm_date_creation)) ) != 0 ) {
 | 
        
           |  |  | 57 |                 $sortie .= '<span class="page_creation_heure">'.$heure.'</span>';
 | 
        
           |  |  | 58 |                 $sortie .= '<span class="page_separateur_heure">:</span>';
 | 
        
           |  |  | 59 |                 $minute = date('i', strtotime($un_menu->gm_date_creation));
 | 
        
           |  |  | 60 |                 $sortie .= '<span class="page_creation_minute">'.$minute.'</span>';
 | 
        
           |  |  | 61 |                 if (($seconde = date('s', strtotime($un_menu->gm_date_creation)) ) != 0 ) {
 | 
        
           |  |  | 62 |                     $sortie .= '<span class="page_separateur_heure">:</span>';
 | 
        
           |  |  | 63 |                     $sortie .= '<span class="page_creation_seconde">'.$seconde.'</span>';
 | 
        
           |  |  | 64 |                 }
 | 
        
           |  |  | 65 |             }
 | 
        
           |  |  | 66 |             $sortie .= '<span class="page_separateur_date_heure"> - </span>'."\n";
 | 
        
           |  |  | 67 |   | 
        
           |  |  | 68 |             // Affichage de la date de la création de la page
 | 
        
           |  |  | 69 |             if (($jour = date('d', strtotime($un_menu->gm_date_creation)) ) != 0 ) {
 | 
        
           |  |  | 70 |                 $sortie .= '<span class="page_creation_jour"> '.$jour.'</span>';
 | 
        
           |  |  | 71 |             }
 | 
        
           |  |  | 72 |             if (($mois = $this->_traduireMois(date('m', strtotime($un_menu->gm_date_creation))) ) != '' ) {
 | 
        
           |  |  | 73 |                 $sortie .= '<span class="page_creation_mois"> '.$mois.'</span>';
 | 
        
           |  |  | 74 |             }
 | 
        
           |  |  | 75 |             if (($annee = date('Y', strtotime($un_menu->gm_date_creation)) ) != 0 ) {
 | 
        
           |  |  | 76 |                 $sortie .= '<span class="page_creation_annee"> '.$annee.'</span>';
 | 
        
           |  |  | 77 |             }
 | 
        
           |  |  | 78 |             $sortie .= '</li>'."\n";
 | 
        
           |  |  | 79 |         }
 | 
        
           |  |  | 80 |         $sortie .= '</ul>'."\n";
 | 
        
           |  |  | 81 |         return $sortie;
 | 
        
           |  |  | 82 |     }
 | 
        
           |  |  | 83 |   | 
        
           |  |  | 84 |     function _traduireMois($mois_numerique)
 | 
        
           |  |  | 85 |     {
 | 
        
           |  |  | 86 |         switch ($mois_numerique) {
 | 
        
           |  |  | 87 |             case '01' :
 | 
        
           |  |  | 88 |                 return 'janvier';
 | 
        
           |  |  | 89 |                 break;
 | 
        
           |  |  | 90 |             case '02' :
 | 
        
           |  |  | 91 |                 return 'février';
 | 
        
           |  |  | 92 |                 break;
 | 
        
           |  |  | 93 |             case '03' :
 | 
        
           |  |  | 94 |                 return 'mars';
 | 
        
           |  |  | 95 |                 break;
 | 
        
           |  |  | 96 |             case '04' :
 | 
        
           |  |  | 97 |                 return 'avril';
 | 
        
           |  |  | 98 |                 break;
 | 
        
           |  |  | 99 |             case '05' :
 | 
        
           |  |  | 100 |                 return 'mai';
 | 
        
           |  |  | 101 |                 break;
 | 
        
           |  |  | 102 |             case '06' :
 | 
        
           |  |  | 103 |                 return 'juin';
 | 
        
           |  |  | 104 |                 break;
 | 
        
           |  |  | 105 |             case '07' :
 | 
        
           |  |  | 106 |                 return 'juillet';
 | 
        
           |  |  | 107 |                 break;
 | 
        
           |  |  | 108 |             case '08' :
 | 
        
           |  |  | 109 |                 return 'août';
 | 
        
           |  |  | 110 |                 break;
 | 
        
           |  |  | 111 |             case '09' :
 | 
        
           |  |  | 112 |                 return 'septembre';
 | 
        
           |  |  | 113 |                 break;
 | 
        
           |  |  | 114 |             case '10' :
 | 
        
           |  |  | 115 |                 return 'octobre';
 | 
        
           |  |  | 116 |                 break;
 | 
        
           |  |  | 117 |             case '11' :
 | 
        
           |  |  | 118 |                 return 'novembre';
 | 
        
           |  |  | 119 |                 break;
 | 
        
           |  |  | 120 |             case '12' :
 | 
        
           |  |  | 121 |                 return 'décembre';
 | 
        
           |  |  | 122 |                 break;
 | 
        
           |  |  | 123 |             default:
 | 
        
           |  |  | 124 |                 return '';
 | 
        
           |  |  | 125 |                 break;
 | 
        
           |  |  | 126 |         }
 | 
        
           |  |  | 127 |     }
 | 
        
           |  |  | 128 | }
 | 
        
           |  |  | 129 | ?>
 |