1872 |
alexandre_ |
1 |
<?php
|
|
|
2 |
/*vim: set expandtab tabstop=4 shiftwidth=4: */
|
|
|
3 |
// +------------------------------------------------------------------------------------------------------+
|
|
|
4 |
// | PHP version 4.1 |
|
|
|
5 |
// +------------------------------------------------------------------------------------------------------+
|
|
|
6 |
// | Copyright (C) 2004 Tela Botanica (accueil@tela-botanica.org) |
|
|
|
7 |
// +------------------------------------------------------------------------------------------------------+
|
|
|
8 |
// | This library is free software; you can redistribute it and/or |
|
|
|
9 |
// | modify it under the terms of the GNU General Public |
|
|
|
10 |
// | License as published by the Free Software Foundation; either |
|
|
|
11 |
// | version 2.1 of the License, or (at your option) any later version. |
|
|
|
12 |
// | |
|
|
|
13 |
// | This library is distributed in the hope that it will be useful, |
|
|
|
14 |
// | but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
|
|
15 |
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
|
|
16 |
// | General Public License for more details. |
|
|
|
17 |
// | |
|
|
|
18 |
// | You should have received a copy of the GNU General Public |
|
|
|
19 |
// | License along with this library; if not, write to the Free Software |
|
|
|
20 |
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|
|
|
21 |
// +------------------------------------------------------------------------------------------------------+
|
|
|
22 |
// CVS : $Id: enteteColonneTriable.class.php,v 1.1 2008-08-25 15:17:13 alexandre_tb Exp $
|
|
|
23 |
/**
|
|
|
24 |
* Application projet
|
|
|
25 |
*
|
|
|
26 |
* Fichier de presentation de la liste des projets pour Tela Botanica nouvelle version
|
|
|
27 |
*
|
|
|
28 |
*@package projet
|
|
|
29 |
//Auteur original :
|
|
|
30 |
*@author Alexandre Granier <alexandre@tela-botanica.org>
|
|
|
31 |
//Autres auteurs :
|
|
|
32 |
*@author Aucun
|
|
|
33 |
*@copyright Tela-Botanica 2000-2008
|
|
|
34 |
// +------------------------------------------------------------------------------------------------------+
|
|
|
35 |
*/
|
|
|
36 |
|
|
|
37 |
|
|
|
38 |
|
|
|
39 |
/**
|
|
|
40 |
* class enteteColonneTriable
|
|
|
41 |
*/
|
|
|
42 |
class enteteColonneTriable
|
|
|
43 |
{
|
|
|
44 |
|
|
|
45 |
|
|
|
46 |
/*** Attributes: ***/
|
|
|
47 |
|
|
|
48 |
/**
|
|
|
49 |
* Nom de la colonne dont on veut afficher le lien
|
|
|
50 |
* @access private
|
|
|
51 |
*/
|
|
|
52 |
private $colonne;
|
|
|
53 |
|
|
|
54 |
/**
|
|
|
55 |
* Nom de la colonne dont on veut afficher le lien
|
|
|
56 |
* @access private
|
|
|
57 |
*/
|
|
|
58 |
private $var_colonneDeTri;
|
|
|
59 |
|
|
|
60 |
|
|
|
61 |
/**
|
|
|
62 |
* Nom de la colonne clique par l utilisateur
|
|
|
63 |
* @access private
|
|
|
64 |
*/
|
|
|
65 |
private $colonneCliquee;
|
|
|
66 |
|
|
|
67 |
/**
|
|
|
68 |
* @access private
|
|
|
69 |
*/
|
|
|
70 |
private $ordre = 'asc';
|
|
|
71 |
|
|
|
72 |
/**
|
|
|
73 |
* @access private
|
|
|
74 |
*/
|
|
|
75 |
private $var_ordre ;
|
|
|
76 |
|
|
|
77 |
/**
|
|
|
78 |
* @access private
|
|
|
79 |
*/
|
|
|
80 |
private $icone_asc;
|
|
|
81 |
|
|
|
82 |
/**
|
|
|
83 |
* @access private
|
|
|
84 |
*/
|
|
|
85 |
private $icone_desc;
|
|
|
86 |
|
|
|
87 |
/**
|
|
|
88 |
* icone par defaut lorsqu aucun tri n est demande
|
|
|
89 |
* @access private
|
|
|
90 |
*/
|
|
|
91 |
private $icone_base;
|
|
|
92 |
|
|
|
93 |
|
|
|
94 |
/**
|
|
|
95 |
*
|
|
|
96 |
* @param string nom_colonne Le nom de la colonne sur laquelle va s'effectuer les tris
|
|
|
97 |
|
|
|
98 |
* @return
|
|
|
99 |
* @access public
|
|
|
100 |
*/
|
|
|
101 |
public function enteteColonneTriable( $nom_colonne ) {
|
|
|
102 |
$this->colonne = $nom_colonne;
|
|
|
103 |
} // end of member function enteteColonneTriable
|
|
|
104 |
|
|
|
105 |
/**
|
|
|
106 |
*
|
|
|
107 |
* @param string colonneDeTri
|
|
|
108 |
* @return bool
|
|
|
109 |
* @access public
|
|
|
110 |
*/
|
|
|
111 |
public function setColonneCliquee( $colonneDeTri, $var_colonneDeTri ) {
|
|
|
112 |
$this->colonneCliquee = $colonneDeTri;
|
|
|
113 |
$this->var_colonneDeTri = $var_colonneDeTri;
|
|
|
114 |
} // end of member function setColonneCliquee
|
|
|
115 |
|
|
|
116 |
/**
|
|
|
117 |
* Precise l ordre ascendant ou descendant
|
|
|
118 |
* Ne peut prendre que 2 valeurs asc ou desc
|
|
|
119 |
*
|
|
|
120 |
* @param string ordre
|
|
|
121 |
* @return
|
|
|
122 |
* @access public
|
|
|
123 |
*/
|
|
|
124 |
public function setOrdre( $ordre, $var_ordre ) {
|
|
|
125 |
if ($ordre != 'asc' && $ordre != 'desc') return false;
|
|
|
126 |
//if ($this->colonne == $this->colonneCliquee) $this->ordre = $ordre;
|
|
|
127 |
// C subtil, il faut inverser l ordre de tri pour la colonne dont le tri est
|
|
|
128 |
// actif, afin de pouvoir inverser le tri
|
|
|
129 |
$this->ordre = $ordre;
|
|
|
130 |
if ($this->colonne == $this->colonneCliquee) {
|
|
|
131 |
if ($ordre == 'asc') $this->ordre = 'desc'; else $this->ordre = 'asc';
|
|
|
132 |
}
|
|
|
133 |
$this->var_ordre = $var_ordre;
|
|
|
134 |
} // end of member function setOrdre
|
|
|
135 |
|
|
|
136 |
/**
|
|
|
137 |
* Pour indiquer le chemin vers l icone de fleche vers le bas
|
|
|
138 |
* Renvoie false si le chemin vers l icone n existe pas
|
|
|
139 |
*
|
|
|
140 |
* @param string chemin_icone Le chemin vers l icone
|
|
|
141 |
|
|
|
142 |
* @return
|
|
|
143 |
* @access public
|
|
|
144 |
*/
|
|
|
145 |
public function setIconeAsc( $chemin_icone ) {
|
|
|
146 |
$this->icone_asc = $chemin_icone;
|
|
|
147 |
} // end of member function setIconeAsc
|
|
|
148 |
|
|
|
149 |
/**
|
|
|
150 |
* Pour indiquer le chemin vers l icone de fleche vers le bas
|
|
|
151 |
* Renvoie false si le chemin vers l icone n existe pas
|
|
|
152 |
*
|
|
|
153 |
* @param string chemin_icone Chemin vers l icone indiquant un classement descendant, en general une fleche
|
|
|
154 |
vers le haut
|
|
|
155 |
|
|
|
156 |
* @return bool
|
|
|
157 |
* @access public
|
|
|
158 |
*/
|
|
|
159 |
public function setIconeDesc( $chemin_icone ) {
|
|
|
160 |
$this->icone_desc = $chemin_icone;
|
|
|
161 |
} // end of member function setIconeDesc
|
|
|
162 |
|
|
|
163 |
/**
|
|
|
164 |
*
|
|
|
165 |
* @param string chemin_icone chemin vers un fichier
|
|
|
166 |
|
|
|
167 |
* @return bool
|
|
|
168 |
* @access public
|
|
|
169 |
*/
|
|
|
170 |
public function setIconeSansTri( $chemin_icone ) {
|
|
|
171 |
$this->icone_base = $chemin_icone;
|
|
|
172 |
} // end of member function setIconeSansTri
|
|
|
173 |
|
|
|
174 |
/**
|
|
|
175 |
* Permet d attribuer un template d affichage
|
|
|
176 |
*
|
|
|
177 |
* @param string template Permet d attribuer un template d affichage
|
|
|
178 |
|
|
|
179 |
* @return
|
|
|
180 |
* @access public
|
|
|
181 |
*/
|
|
|
182 |
public function setTemplate( $template ) {
|
|
|
183 |
|
|
|
184 |
} // end of member function setTemplate
|
|
|
185 |
|
|
|
186 |
/**
|
|
|
187 |
* Renvoie l icone approprie pour l entete de la colonne
|
|
|
188 |
*
|
|
|
189 |
* @return string
|
|
|
190 |
* @access public
|
|
|
191 |
*/
|
|
|
192 |
public function getIcone( ) {
|
|
|
193 |
if ($this->colonne == $this->colonneCliquee) {
|
|
|
194 |
if ($this->ordre == 'asc') {
|
|
|
195 |
return $this->icone_asc;
|
|
|
196 |
} else {
|
|
|
197 |
return $this->icone_desc;
|
|
|
198 |
}
|
|
|
199 |
} else {
|
|
|
200 |
return $this->icone_base;
|
|
|
201 |
}
|
|
|
202 |
} // end of member function getIcone
|
|
|
203 |
|
|
|
204 |
/**
|
|
|
205 |
* Renvoie la classe approprie pour l entete de la colonne
|
|
|
206 |
*
|
|
|
207 |
* @return string
|
|
|
208 |
* @access public
|
|
|
209 |
*/
|
|
|
210 |
public function getClasse( ) {
|
|
|
211 |
if ($this->colonne == $this->colonneCliquee) {
|
|
|
212 |
if ($this->ordre == 'asc') {
|
|
|
213 |
return 'tri_bas';
|
|
|
214 |
} else {
|
|
|
215 |
return 'tri_haut';
|
|
|
216 |
}
|
|
|
217 |
} else {
|
|
|
218 |
return 'tri_sans';
|
|
|
219 |
}
|
|
|
220 |
} // end of member function getIcone
|
|
|
221 |
|
|
|
222 |
/**
|
|
|
223 |
* Renvoie le lien de la colonne
|
|
|
224 |
*
|
|
|
225 |
* @return string
|
|
|
226 |
* @access public
|
|
|
227 |
*/
|
|
|
228 |
public function getLien($url) {
|
|
|
229 |
$url->addQueryString('projet_tri', $this->colonne);
|
|
|
230 |
$url->addQueryString('projet_ordre_tri', $this->ordre);
|
|
|
231 |
return $url->getURL();
|
|
|
232 |
} // end of member function getLien
|
|
|
233 |
|
|
|
234 |
/**
|
|
|
235 |
* Renvoie l entete
|
|
|
236 |
*
|
|
|
237 |
* @return string
|
|
|
238 |
* @access public
|
|
|
239 |
*/
|
|
|
240 |
public function getEntete( ) {
|
|
|
241 |
|
|
|
242 |
} // end of member function getEntete
|
|
|
243 |
|
|
|
244 |
/**
|
|
|
245 |
* similaire a getEntete()
|
|
|
246 |
*
|
|
|
247 |
* @return string
|
|
|
248 |
* @access public
|
|
|
249 |
*/
|
|
|
250 |
public function toHTML( ) {
|
|
|
251 |
return getEntete();
|
|
|
252 |
} // end of member function toHTML
|
|
|
253 |
|
|
|
254 |
|
|
|
255 |
|
|
|
256 |
|
|
|
257 |
|
|
|
258 |
} // end of enteteColonneTriable
|
|
|
259 |
?>
|