1 : <?php
2 :
3 : /**
4 : * Dictionaries of Old French and Latin
5 : *
6 : * PHP 5
7 : *
8 : * @category Application
9 : * @package DicFro
10 : * @author Michel Corne <mcorne@yahoo.com>
11 : * @copyright 2008-2010 Michel Corne
12 : * @license http://opensource.org/licenses/gpl-3.0.html GNU General Public License, version 3 (GPLv3)
13 : * @link http://www.micmap.org/dicfro
14 : */
15 :
16 : require_once 'ViewHelper/Base.php';
17 :
18 : /**
19 : * Dictionaries View Helper
20 : *
21 : * @category Application
22 : * @package DicFro
23 : * @author Michel Corne <mcorne@yahoo.com>
24 : * @copyright 2008-2010 Michel Corne
25 : * @license http://opensource.org/licenses/gpl-3.0.html GNU General Public License, version 3 (GPLv3)
26 : */
27 :
28 : class ViewHelper_Dictionaries extends ViewHelper_Base
29 : {
30 :
31 : /**
32 : * Dictionary names and descriptions
33 : * @var array
34 : */
35 : public $dictionaries = array(
36 : // dictionnaires internes
37 : 'complement-godefroy' => array(
38 : 'name' => 'Complément Godefroy',
39 : 'description' => 'Complément du dictionnaire de l\'ancienne langue française et de tous ses dialectes du IXème au XVème siècle, Frédéric Godefroy, 1895-1902',
40 : ),
41 : 'dictionnaire-godefroy' => array(
42 : 'name' => 'Dictionnaire Godefroy',
43 : 'description' => 'Dictionnaire de l\'ancienne langue française et de tous ses dialectes du IXème au XVème siècle, Frédéric Godefroy, 1880-1895',
44 : ),
45 : 'gaffiot' => array(
46 : 'name' => 'Gaffiot',
47 : 'description' => 'Dictionnaire Latin-Français, Félix Gaffiot, 1934',
48 : ),
49 : 'glossaire-chanson-de-roland' => array(
50 : 'name' => 'Chanson de Roland',
51 : 'description' => 'Glossaire de la Chanson de Roland, Joseph Bédier, 1927',
52 : ),
53 : 'glossaire-chretien-de-troyes' => array(
54 : 'name' => 'Chrétien de Troyes',
55 : 'description' => 'Dictionnaire de l\'oeuvre de Chrétien de Troyes, Wörterbuch zu Kristian von Troyes\' sämtlichen Werken, Wendelin Foerster, 1914',
56 : ),
57 : 'glossaire-couronnement-de-louis' => array(
58 : 'name' => 'Couronnement de Louis',
59 : 'description' => 'Glossaire du Couronnement de Louis, Ernest Langlois, 1888',
60 : ),
61 : 'glossaire-roman-de-la-rose' => array(
62 : 'name' => 'Roman de la Rose',
63 : 'description' => 'Glossaire du Roman de la Rose, Ernest Langlois, 1914-1924',
64 : ),
65 : 'glossaire-roman-de-tristan' => array(
66 : 'name' => 'Roman de Tristan',
67 : 'description' => 'Glossaire du Roman de Tristan par Béroul, Ernest Muret, 1903',
68 : ),
69 : 'lexique-godefroy' => array(
70 : 'name' => 'Lexique Godefroy',
71 : 'description' => 'Lexique de l\'ancien français, Frédéric Godefroy, 1901',
72 : ),
73 : 'lexique-roman' => array(
74 : 'name' => 'Lexique Roman',
75 : 'description' => 'Lexique Roman ou dictionnaire de la langue des troubadours comparée avec les autres langues de l\'Europe latine, François J. M. Raynouard, 1844',
76 : ),
77 : 'tableaux-de-conjugaison' => array(
78 : 'name' => 'Tableaux de conjugaison',
79 : 'description' => 'Tableaux de conjugaison de l\'ancien français, Machio Okada et Hitoshi Ogurisu, 2007',
80 : ),
81 : 'vandaele' => array(
82 : 'name' => 'Van Daele',
83 : 'description' => 'Petit dictionnaire de l\'ancien français, Hilaire Van Daele, 1901',
84 : ),
85 : // dictionnaire externes
86 : 'cnrtl' => array(
87 : 'name' => 'CNRTL',
88 : 'description' => 'Dictionnaire du Centre National de Ressources Textuelles et Lexicales',
89 : ),
90 : 'dmf' => array(
91 : 'name' => 'Moyen français',
92 : 'description' => 'Dictionnaire du Moyen Français par l\'Atilf',
93 : ),
94 : 'jeanneau' => array(
95 : 'name' => 'Jeanneau',
96 : 'description' => 'Dictionnaire français-latin de Gérard Jeanneau',
97 : ),
98 : 'leconjugueur' => array(
99 : 'name' => 'Le conjugueur',
100 : 'description' => 'La conjugaison française par le Conjugueur',
101 : ),
102 : 'littre' => array(
103 : 'name' => 'Littré',
104 : 'description' => 'Dictionnaire de la langue française d\'Émile Littré, 1872-1877',
105 : ),
106 : 'whitaker' => array(
107 : 'name' => 'Whitaker',
108 : 'description' => 'Dictionnaire latin-anglais de William Whitaker',
109 : ),
110 : );
111 :
112 : /**
113 : * Dictionary groups
114 : *
115 : * Groups and dictionaries are displayed as they are ordered below in the home page and select box.
116 : * @var array
117 : */
118 : public $groups = array(
119 : array(
120 : 'name' => 'Dictionnaires d\'ancien français',
121 : 'dictionaries' => array(
122 : 'dictionnaire-godefroy',
123 : 'complement-godefroy',
124 : 'lexique-godefroy',
125 : 'lexique-roman',
126 : 'tableaux-de-conjugaison',
127 : 'vandaele',
128 : ),
129 : ),
130 : array(
131 : 'name' => 'Glossaires d\'ancien français',
132 : 'dictionaries' => array(
133 : 'glossaire-chanson-de-roland',
134 : 'glossaire-chretien-de-troyes',
135 : 'glossaire-couronnement-de-louis',
136 : 'glossaire-roman-de-la-rose',
137 : 'glossaire-roman-de-tristan',
138 : ),
139 : ),
140 : array(
141 : 'name' => 'Dictionnaires de français',
142 : 'dictionaries' => array(
143 : 'cnrtl',
144 : 'leconjugueur',
145 : 'littre',
146 : 'dmf',
147 : ),
148 : ),
149 : array(
150 : 'name' => 'Dictionnaires de latin',
151 : 'dictionaries' => array(
152 : 'gaffiot',
153 : 'jeanneau',
154 : 'whitaker',
155 : ),
156 : ),
157 : );
158 :
159 : /**
160 : * Returns the dictionary description
161 : *
162 : * @return mixed the dictionary description
163 : */
164 : public function getDescription()
165 : {
166 1 : return $this->dictionaries[$this->view->dictionary]['description'];
167 : }
168 :
169 : /**
170 : * Returns the groups of dictionaries for use in a select box
171 : *
172 : * @return array the groups of dictionaries
173 : */
174 : public function getGroups()
175 : {
176 1 : $optgroups = array();
177 :
178 1 : foreach($this->groups as $group) {
179 1 : $options = array();
180 :
181 1 : foreach($group['dictionaries'] as $dictionary) {
182 1 : $options[] = array(
183 1 : 'value' => $dictionary,
184 1 : 'text' => $this->dictionaries[$dictionary]['name'],
185 1 : 'title' => $this->dictionaries[$dictionary]['description'],
186 : );
187 1 : }
188 :
189 1 : $optgroups[] = array(
190 1 : 'label' => $group['name'],
191 1 : 'options' => $options,
192 : );
193 1 : }
194 :
195 1 : return $optgroups;
196 : }
197 :
198 : /**
199 : * Returns the page title
200 : *
201 : * @return string the page title
202 : */
203 : public function getPageTitle()
204 : {
205 1 : return isset($this->dictionaries[$this->view->dictionary])?
206 1 : $this->dictionaries[$this->view->dictionary]['name'] :
207 1 : 'DicFro';
208 : }
|