Subversion Repositories Applications.papyrus

Rev

Rev 408 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
335 jpm 1
<?php
2
 
3
class Text_Wiki_Render_Xhtml_Nouveaute 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
        $type = '';
23
        $site = '';
24
        $nombre = $options['nombre'];
25
 
26
        // Récupération du type
27
        if (isset($options['type'])) {
28
            $type = $options['type'];
29
        }
30
 
31
        // Récupération du site
32
        if (isset($options['site'])) {
33
            $site = $options['site'];
34
        }
35
 
408 alexandre_ 36
        // Récupération de la catégorie
37
        if (isset($options['categorie'])) {
38
            $categorie = $options['categorie'];
39
        }
40
        $aso_info_menu = GEN_lireInfoMenuContenuDate($GLOBALS['_GEN_commun']['pear_db'], $type, $site, $categorie);
335 jpm 41
 
42
        // Formatage des infos en XHTML
43
        $sortie .= '<ul class="page_liste">'."\n";
44
        $i = 0;
45
        foreach ($aso_info_menu as $menu_id => $un_menu) {
46
            if ($i == $nombre) {
47
                break;
48
            }
49
            // Création de l'url
50
            $une_url =& new Pap_URL();
51
            $une_url->setId($menu_id);
52
            // Début affichage d'une entrée de la liste des pages modifiées
53
            if ($un_menu->gmc_ce_type_modification = 1) {
54
                $type_modif = 'mineure';
55
            } elseif ($un_menu->gmc_ce_type_modification = 2) {
56
                $type_modif = 'majeure';
57
            }
58
            $sortie .= '<li class="page_modification_'.$type_modif.'">'."\n";
59
 
60
            // Affichage du titre
61
            $sortie .= '<h2 class="page_titre"><a href="'.$une_url->getURL().'">';
62
            if (!empty($un_menu->gm_titre)) {
63
                $sortie .= $un_menu->gm_titre;
64
            } elseif (!empty($un_menu->gm_titre_alternatif)) {
65
                $sortie .= $un_menu->gm_titre_alternatif;
66
            } else {
67
                $sortie .= $un_menu->gm_nom;
68
            }
69
            $sortie .= '</a></h2>'."\n".'<dl>'."\n";
70
 
71
            // Affichage de l'auteur(s)
72
            if (!empty($un_menu->gm_auteur)) {
73
                $sortie .= '<dt class="page_auteur"> Auteur(s)&nbsp;: '.'</dt>'."\n";
74
                $sortie .= '<dd>'.$un_menu->gm_auteur.'</dd>'."\n";
75
            }
76
            // Affichage des contributeur(s)
77
            if (!empty($un_menu->gm_contributeur)) {
78
                $sortie .= '<dt class="page_contributeur"> Contributeur(s)&nbsp;: '.'</dt>'."\n";
79
                $sortie .= '<dd>'.$un_menu->gm_contributeur.'</dd>'."\n";
80
            }
81
 
82
            // Affichage de la date de la modification de la page
83
            $sortie .= '<dt class="page_modification_date"> '.'Modifié le&nbsp;: '.'</dt>'."\n";
84
            $sortie .= '<dd>'."\n";
85
            if (($jour = date('d', strtotime($un_menu->gmc_date_modification)) ) != 0 ) {
86
                $sortie .= '<span class="page_modification_jour"> '.$jour.'</span>'."\n";
87
            }
88
            if (($mois = $this->_traduireMois(date('m', strtotime($un_menu->gmc_date_modification))) ) != '' ) {
89
                $sortie .= '<span class="page_modification_mois"> '.$mois.'</span>'."\n";
90
            }
91
            if (($annee = date('Y', strtotime($un_menu->gmc_date_modification)) ) != 0 ) {
92
                $sortie .= '<span class="page_modification_annee"> '.$annee.'</span>'."\n";
93
            }
94
            $sortie .= '<span class="page_separateur_date_heure"> - </span>'."\n";
95
 
96
            // Affichage de l'horaire de la modification de la page
97
            if (($heure = date('G', strtotime($un_menu->gmc_date_modification)) ) != 0 ) {
98
                $sortie .= '<span class="page_modification_heure">'.$heure.'</span>';
99
                $sortie .= '<span class="page_separateur_heure">:</span>';
100
                $minute = date('i', strtotime($un_menu->gmc_date_modification));
101
                $sortie .= '<span class="page_modification_minute">'.$minute.'</span>'."\n";
102
                /*
103
                if (($seconde = date('s', strtotime($un_menu->gm_date_creation)) ) != 0 ) {
104
                    $sortie .= '<span class="page_separateur_heure">:</span>';
105
                    $sortie .= '<span class="page_creation_seconde">'.$seconde.'</span>';
106
                }
107
                */
108
            }
109
            $sortie .= '</dd>'."\n";
110
 
111
            // Affichage de la description
112
            if (!empty($un_menu->gm_description_libre)) {
113
                $sortie .= '<dt class="page_description"> Description&nbsp;: '.'</dt>'."\n";
114
                $sortie .= '<dd>'.$un_menu->gm_description_libre.'</dd>'."\n";
115
            }
116
 
117
            // Affichage du résumé de la modification
118
            if (!empty($un_menu->gmc_resume_modification)) {
119
                $sortie .= '<dt class="page_resumer_modification_'.$type_modif.'"> Résumer modification&nbsp;: '.'</dt>'."\n";
120
                $sortie .= '<dd>'.$un_menu->gmc_resume_modification.'</dd>'."\n";
121
            }
122
 
123
            $sortie .= '</dl>'."\n";
124
            $sortie .= '</li>'."\n";
125
            $i++;
126
        }
127
        $sortie .= '</ul>'."\n";
128
 
129
        return $sortie;
130
    }
131
 
132
    function _traduireMois($mois_numerique)
133
    {
134
        switch ($mois_numerique) {
135
            case '01' :
136
                return 'janvier';
137
            case '02' :
138
                return 'février';
139
            case '03' :
140
                return 'mars';
141
            case '04' :
142
                return 'avril';
143
            case '05' :
144
                return 'mai';
145
            case '06' :
146
                return 'juin';
147
            case '07' :
148
                return 'juillet';
149
            case '08' :
150
                return 'août';
151
            case '09' :
152
                return 'septembre';
153
            case '10' :
154
                return 'octobre';
155
            case '11' :
156
                return 'novembre';
157
            case '12' :
158
                return 'décembre';
159
            default:
160
                return '';
161
        }
162
    }
163
}
164
?>