Subversion Repositories Applications.papyrus

Rev

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

Rev Author Line No. Line
448 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
// +------------------------------------------------------------------------------------------------------+
474 alexandre_ 22
// CVS : $Id: HTML_listeProjet.class.php,v 1.3 2005-09-27 16:36:56 alexandre_tb Exp $
448 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
474 alexandre_ 34
*@version       $Revision: 1.3 $
448 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
     */
474 alexandre_ 82
    function __construct( )
448 ddelon 83
    {
84
 
85
    } // end of member function __cosntruct
86
 
87
    /**
88
     *
89
     *
90
     * @param Array label_entete Un tableau contenant les labels pour l'entête de la liste.
91
     * @return void
92
     * @access public
93
     */
94
    function construitEntete( $label_entete )
95
    {
96
        $this->addRow ($label_entete, '', 'TH') ;
97
    } // end of member function construitEntete
98
 
99
    /**
100
     *
101
     *
102
     * @param Array label_liste Un tableau à double dimension contenant les valeurs de la liste. du type
103
     *      0 =>'label', 'label2',
104
     *      1 => ...
105
     * @return void
106
     * @access public
107
     */
108
    function construitListe( $label_liste, $tableau_statut = '' )
109
    {
110
        for ($i = 0; $i < count ($label_liste) ; $i++) {
111
            if ($this->_mode == 1) {
112
                $id_projet = array_shift ($label_liste[$i]) ;
113
                $id_statut = array_pop ($label_liste[$i]) ;
114
            }
115
 
116
            $this->addRow ($label_liste[$i]) ;
117
 
118
            if ($this->_mode == 1 && $id_statut < 3) {
119
                $this->_url->addQueryString ('identifiant_projet', $id_projet) ;
120
                $this->_url->removeQueryString (PROJET_VARIABLE_ID_PROJET) ;
121
                $select = '<form action="'.$this->_url->getURL().'" method="post" class="magali">'."\n" ;
122
                $select .= '<select name="statut" onchange="javascript:this.form.submit();">' ;
123
                foreach ($tableau_statut as $cle =>$element_statut) {
124
                    $select .= '<option value="'.$cle.'"' ;
125
                    if ($cle == $id_statut) {
126
                        $select .= ' selected="selected"' ;
127
                    }
128
                    $select .= '>'.$element_statut.'</option>'."\n" ;
129
                }
130
                $select .= '</select>'."\n".'</form>'."\n" ;
474 alexandre_ 131
                if (is_int($id_statut)) {
132
                    $this->setCellContents($i+1, 2, $select) ;
133
                } else {
134
                    $this->setCellContents($i+1, 2, PROJET_PAS_DE_LISTE) ;
135
                }
448 ddelon 136
            }
137
        }
138
        $this->altRowAttributes(1, array('class' => 'ligne_impaire'), array('class' => 'ligne_paire')) ;
139
 
140
    } // end of member function construitListe
141
 
142
    /**
143
     *
144
     *
145
     * @return void
146
     * @access public
147
     */
148
    function setModeModification( )
149
    {
150
        $this->_mode = 1 ;
151
    } // end of member function setModeModification
152
 
153
    /**
154
     *
155
     *
156
     * @param Net_URL url Un objet PEAR::Net_URL
157
     * @return void
158
     * @access public
159
     */
160
    function setURL(& $url )
161
    {
162
        $this->_url = $url ;
163
    } // end of member function setURL
164
 
165
} // end of HTML_listeProjet
166
?>