2 |
ddelon |
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 |
// +------------------------------------------------------------------------------------------------------+
|
431 |
mathias |
22 |
// CVS : $Id: HTML_listeProjet.class.php,v 1.7 2006/09/15 12:35:54 alexandre_tb Exp $
|
2 |
ddelon |
23 |
/**
|
|
|
24 |
* Application projet
|
|
|
25 |
*
|
|
|
26 |
* La classe controleur projet
|
|
|
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-2004
|
134 |
alexandre_ |
34 |
*@version $Revision: 1.7 $
|
2 |
ddelon |
35 |
// +------------------------------------------------------------------------------------------------------+
|
|
|
36 |
*/
|
|
|
37 |
|
|
|
38 |
|
|
|
39 |
// +------------------------------------------------------------------------------------------------------+
|
|
|
40 |
// | ENTETE du PROGRAMME |
|
|
|
41 |
// +------------------------------------------------------------------------------------------------------+
|
|
|
42 |
|
|
|
43 |
include_once PROJET_CHEMIN_CLASSES.'HTML_Liste.class.php' ;
|
|
|
44 |
|
|
|
45 |
/**
|
|
|
46 |
* class HTML_listeProjet
|
|
|
47 |
*
|
|
|
48 |
*/
|
|
|
49 |
class HTML_listeProjet extends HTML_Liste
|
|
|
50 |
{
|
|
|
51 |
/*** Attributes: ***/
|
|
|
52 |
/**
|
|
|
53 |
* 0 mode normal 1 mode modification, rajoute un formulaire pour modifier le statut
|
|
|
54 |
* d'un utilisateur.
|
|
|
55 |
* @access private
|
|
|
56 |
*/
|
|
|
57 |
var $_mode;
|
|
|
58 |
/**
|
|
|
59 |
* Un objet PEAR::Net_URL
|
|
|
60 |
* @access private
|
|
|
61 |
*/
|
|
|
62 |
var $_url;
|
|
|
63 |
|
|
|
64 |
/**
|
|
|
65 |
*
|
|
|
66 |
*
|
|
|
67 |
* @param bool utilise_pager Indique si les résultats sont divisés en page.
|
|
|
68 |
* @return void
|
|
|
69 |
* @access public
|
|
|
70 |
*/
|
|
|
71 |
function HTML_listeProjet( $utilise_pager = false )
|
|
|
72 |
{
|
85 |
jp_milcent |
73 |
HTML_Liste::HTML_Liste($utilise_pager, array ('class' => 'table_cadre', 'summary' => PROJET_LISTE)) ;
|
2 |
ddelon |
74 |
} // end of member function HTML_listeProjet
|
|
|
75 |
|
|
|
76 |
/**
|
|
|
77 |
*
|
|
|
78 |
*
|
|
|
79 |
* @return void
|
|
|
80 |
* @access public
|
|
|
81 |
*/
|
15 |
ddelon |
82 |
function __construct($utilise_pager = false)
|
2 |
ddelon |
83 |
{
|
15 |
ddelon |
84 |
$this->HTML_listeProjet($utilise_pager);
|
2 |
ddelon |
85 |
|
|
|
86 |
} // end of member function __cosntruct
|
|
|
87 |
|
|
|
88 |
/**
|
|
|
89 |
*
|
|
|
90 |
*
|
|
|
91 |
* @param Array label_entete Un tableau contenant les labels pour l'entête de la liste.
|
|
|
92 |
* @return void
|
|
|
93 |
* @access public
|
|
|
94 |
*/
|
|
|
95 |
function construitEntete( $label_entete )
|
|
|
96 |
{
|
|
|
97 |
$this->addRow ($label_entete, '', 'TH') ;
|
|
|
98 |
} // end of member function construitEntete
|
|
|
99 |
|
|
|
100 |
/**
|
|
|
101 |
*
|
|
|
102 |
*
|
|
|
103 |
* @param Array label_liste Un tableau à double dimension contenant les valeurs de la liste. du type
|
|
|
104 |
* 0 =>'label', 'label2',
|
|
|
105 |
* 1 => ...
|
|
|
106 |
* @return void
|
|
|
107 |
* @access public
|
|
|
108 |
*/
|
|
|
109 |
function construitListe( $label_liste, $tableau_statut = '' )
|
|
|
110 |
{
|
|
|
111 |
for ($i = 0; $i < count ($label_liste) ; $i++) {
|
|
|
112 |
if ($this->_mode == 1) {
|
|
|
113 |
$id_projet = array_shift ($label_liste[$i]) ;
|
|
|
114 |
$id_statut = array_pop ($label_liste[$i]) ;
|
37 |
alexandre_ |
115 |
|
2 |
ddelon |
116 |
}
|
37 |
alexandre_ |
117 |
$resume = array_shift ($label_liste[$i]) ;
|
2 |
ddelon |
118 |
$this->addRow ($label_liste[$i]) ;
|
|
|
119 |
|
37 |
alexandre_ |
120 |
|
2 |
ddelon |
121 |
if ($this->_mode == 1 && $id_statut < 3) {
|
|
|
122 |
$this->_url->addQueryString ('identifiant_projet', $id_projet) ;
|
|
|
123 |
$this->_url->removeQueryString (PROJET_VARIABLE_ID_PROJET) ;
|
|
|
124 |
$select = '<form action="'.$this->_url->getURL().'" method="post" class="magali">'."\n" ;
|
|
|
125 |
$select .= '<select name="statut" onchange="javascript:this.form.submit();">' ;
|
|
|
126 |
foreach ($tableau_statut as $cle =>$element_statut) {
|
|
|
127 |
$select .= '<option value="'.$cle.'"' ;
|
|
|
128 |
if ($cle == $id_statut) {
|
|
|
129 |
$select .= ' selected="selected"' ;
|
|
|
130 |
}
|
|
|
131 |
$select .= '>'.$element_statut.'</option>'."\n" ;
|
|
|
132 |
}
|
|
|
133 |
$select .= '</select>'."\n".'</form>'."\n" ;
|
11 |
alexandre_ |
134 |
if (is_int($id_statut)) {
|
134 |
alexandre_ |
135 |
//$this->setCellContents($i+1, 2, $select) ;
|
|
|
136 |
$this->setCellContents($this->getRowCount() - 1, 2, $select) ;
|
11 |
alexandre_ |
137 |
} else {
|
|
|
138 |
$this->setCellContents($i+1, 2, PROJET_PAS_DE_LISTE) ;
|
|
|
139 |
}
|
2 |
ddelon |
140 |
}
|
37 |
alexandre_ |
141 |
// On affiche le résumé dans la deuxième ligne
|
|
|
142 |
if (PROJET_LISTE_RESUME) {
|
|
|
143 |
$this->addRow (array ($resume), array('colspan' => $this->getColCount()));
|
|
|
144 |
}
|
2 |
ddelon |
145 |
}
|
|
|
146 |
$this->altRowAttributes(1, array('class' => 'ligne_impaire'), array('class' => 'ligne_paire')) ;
|
|
|
147 |
|
|
|
148 |
} // end of member function construitListe
|
|
|
149 |
|
|
|
150 |
/**
|
|
|
151 |
*
|
|
|
152 |
*
|
|
|
153 |
* @return void
|
|
|
154 |
* @access public
|
|
|
155 |
*/
|
|
|
156 |
function setModeModification( )
|
|
|
157 |
{
|
|
|
158 |
$this->_mode = 1 ;
|
|
|
159 |
} // end of member function setModeModification
|
|
|
160 |
|
|
|
161 |
/**
|
|
|
162 |
*
|
|
|
163 |
*
|
|
|
164 |
* @param Net_URL url Un objet PEAR::Net_URL
|
|
|
165 |
* @return void
|
|
|
166 |
* @access public
|
|
|
167 |
*/
|
|
|
168 |
function setURL(& $url )
|
|
|
169 |
{
|
|
|
170 |
$this->_url = $url ;
|
|
|
171 |
} // end of member function setURL
|
37 |
alexandre_ |
172 |
|
|
|
173 |
/**
|
|
|
174 |
* Alternates the row attributes starting at $start
|
|
|
175 |
* @param int $start Row index of row in which alternating begins
|
|
|
176 |
* @param mixed $attributes1 Associative array or string of table row attributes
|
|
|
177 |
* @param mixed $attributes2 Associative array or string of table row attributes
|
|
|
178 |
* @param bool $inTR false if attributes are to be applied in TD tags
|
|
|
179 |
* true if attributes are to be applied in TR tag
|
|
|
180 |
* @access public
|
|
|
181 |
*/
|
|
|
182 |
|
|
|
183 |
function altRowAttributes($start, $attributes1, $attributes2, $inTR = false)
|
|
|
184 |
{
|
|
|
185 |
for ($row = $start ; $row < $this->_rows ; $row++) {
|
|
|
186 |
$attributes = ( ($row+$start)%2 == 0 ) ? $attributes1 : $attributes2;
|
|
|
187 |
$this->updateRowAttributes($row, $attributes, $inTR);
|
|
|
188 |
if (PROJET_LISTE_RESUME) {
|
|
|
189 |
$row++;
|
|
|
190 |
$this->updateRowAttributes($row, $attributes, $inTR);
|
|
|
191 |
$start++;
|
|
|
192 |
}
|
|
|
193 |
}
|
|
|
194 |
} // end func altRowAttributes
|
2 |
ddelon |
195 |
|
|
|
196 |
} // end of HTML_listeProjet
|
|
|
197 |
?>
|