Subversion Repositories Applications.projet

Rev

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

Rev Author Line No. Line
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
// +------------------------------------------------------------------------------------------------------+
15 ddelon 22
// CVS : $Id: HTML_listeProjet.class.php,v 1.4 2005-09-28 16:29:39 ddelon 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
15 ddelon 34
*@version       $Revision: 1.4 $
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
    {
73
        HTML_Liste::HTML_Liste($utilise_pager, array ('class' => 'table_cadre')) ;
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]) ;
115
            }
116
 
117
            $this->addRow ($label_liste[$i]) ;
118
 
119
            if ($this->_mode == 1 && $id_statut < 3) {
120
                $this->_url->addQueryString ('identifiant_projet', $id_projet) ;
121
                $this->_url->removeQueryString (PROJET_VARIABLE_ID_PROJET) ;
122
                $select = '<form action="'.$this->_url->getURL().'" method="post" class="magali">'."\n" ;
123
                $select .= '<select name="statut" onchange="javascript:this.form.submit();">' ;
124
                foreach ($tableau_statut as $cle =>$element_statut) {
125
                    $select .= '<option value="'.$cle.'"' ;
126
                    if ($cle == $id_statut) {
127
                        $select .= ' selected="selected"' ;
128
                    }
129
                    $select .= '>'.$element_statut.'</option>'."\n" ;
130
                }
131
                $select .= '</select>'."\n".'</form>'."\n" ;
11 alexandre_ 132
                if (is_int($id_statut)) {
133
                    $this->setCellContents($i+1, 2, $select) ;
134
                } else {
135
                    $this->setCellContents($i+1, 2, PROJET_PAS_DE_LISTE) ;
136
                }
2 ddelon 137
            }
138
        }
139
        $this->altRowAttributes(1, array('class' => 'ligne_impaire'), array('class' => 'ligne_paire')) ;
140
 
141
    } // end of member function construitListe
142
 
143
    /**
144
     *
145
     *
146
     * @return void
147
     * @access public
148
     */
149
    function setModeModification( )
150
    {
151
        $this->_mode = 1 ;
152
    } // end of member function setModeModification
153
 
154
    /**
155
     *
156
     *
157
     * @param Net_URL url Un objet PEAR::Net_URL
158
     * @return void
159
     * @access public
160
     */
161
    function setURL(& $url )
162
    {
163
        $this->_url = $url ;
164
    } // end of member function setURL
165
 
166
} // end of HTML_listeProjet
167
?>