Subversion Repositories Applications.papyrus

Rev

Rev 465 | Go to most recent revision | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 465 Rev 474
1
<?php
1
<?php
2
/*vim: set expandtab tabstop=4 shiftwidth=4: */ 
2
/*vim: set expandtab tabstop=4 shiftwidth=4: */ 
3
// +------------------------------------------------------------------------------------------------------+
3
// +------------------------------------------------------------------------------------------------------+
4
// | PHP version 4.1                                                                                      |
4
// | PHP version 4.1                                                                                      |
5
// +------------------------------------------------------------------------------------------------------+
5
// +------------------------------------------------------------------------------------------------------+
6
// | Copyright (C) 2004 Tela Botanica (accueil@tela-botanica.org)                                         |
6
// | Copyright (C) 2004 Tela Botanica (accueil@tela-botanica.org)                                         |
7
// +------------------------------------------------------------------------------------------------------+
7
// +------------------------------------------------------------------------------------------------------+
8
// | This library is free software; you can redistribute it and/or                                        |
8
// | This library is free software; you can redistribute it and/or                                        |
9
// | modify it under the terms of the GNU General Public                                                  |
9
// | modify it under the terms of the GNU General Public                                                  |
10
// | License as published by the Free Software Foundation; either                                         |
10
// | License as published by the Free Software Foundation; either                                         |
11
// | version 2.1 of the License, or (at your option) any later version.                                   |
11
// | version 2.1 of the License, or (at your option) any later version.                                   |
12
// |                                                                                                      |
12
// |                                                                                                      |
13
// | This library is distributed in the hope that it will be useful,                                      |
13
// | This library is distributed in the hope that it will be useful,                                      |
14
// | but WITHOUT ANY WARRANTY; without even the implied warranty of                                       |
14
// | but WITHOUT ANY WARRANTY; without even the implied warranty of                                       |
15
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU                                    |
15
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU                                    |
16
// | General Public License for more details.                                                             |
16
// | General Public License for more details.                                                             |
17
// |                                                                                                      |
17
// |                                                                                                      |
18
// | You should have received a copy of the GNU General Public                                            |
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                                  |
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                            |
20
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA                            |
21
// +------------------------------------------------------------------------------------------------------+
21
// +------------------------------------------------------------------------------------------------------+
22
// CVS : $Id: HTML_listeProjet.class.php,v 1.2 2005-09-26 20:18:27 ddelon Exp $
22
// CVS : $Id: HTML_listeProjet.class.php,v 1.3 2005-09-27 16:36:56 alexandre_tb Exp $
23
/**
23
/**
24
* Application projet
24
* Application projet
25
*
25
*
26
* La classe controleur projet
26
* La classe controleur projet
27
*
27
*
28
*@package projet
28
*@package projet
29
//Auteur original :
29
//Auteur original :
30
*@author        Alexandre Granier <alexandre@tela-botanica.org>
30
*@author        Alexandre Granier <alexandre@tela-botanica.org>
31
//Autres auteurs :
31
//Autres auteurs :
32
*@author        Aucun
32
*@author        Aucun
33
*@copyright     Tela-Botanica 2000-2004
33
*@copyright     Tela-Botanica 2000-2004
34
*@version       $Revision: 1.2 $
34
*@version       $Revision: 1.3 $
35
// +------------------------------------------------------------------------------------------------------+
35
// +------------------------------------------------------------------------------------------------------+
36
*/
36
*/
37
 
37
 
38
 
38
 
39
// +------------------------------------------------------------------------------------------------------+
39
// +------------------------------------------------------------------------------------------------------+
40
// |                                            ENTETE du PROGRAMME                                       |
40
// |                                            ENTETE du PROGRAMME                                       |
41
// +------------------------------------------------------------------------------------------------------+
41
// +------------------------------------------------------------------------------------------------------+
42
 
42
 
43
include_once PROJET_CHEMIN_CLASSES.'HTML_Liste.class.php' ;
43
include_once PROJET_CHEMIN_CLASSES.'HTML_Liste.class.php' ;
44
 
44
 
45
/**
45
/**
46
 * class HTML_listeProjet
46
 * class HTML_listeProjet
47
 * 
47
 * 
48
 */
48
 */
49
class HTML_listeProjet extends HTML_Liste
49
class HTML_listeProjet extends HTML_Liste
50
{
50
{
51
    /*** Attributes: ***/
51
    /*** Attributes: ***/
52
    /**
52
    /**
53
     * 0 mode normal 1 mode modification, rajoute un formulaire pour modifier le statut
53
     * 0 mode normal 1 mode modification, rajoute un formulaire pour modifier le statut
54
     * d'un utilisateur.
54
     * d'un utilisateur.
55
     * @access private
55
     * @access private
56
     */
56
     */
57
    var $_mode;
57
    var $_mode;
58
    /**
58
    /**
59
     * Un objet PEAR::Net_URL
59
     * Un objet PEAR::Net_URL
60
     * @access private
60
     * @access private
61
     */
61
     */
62
    var $_url;
62
    var $_url;
63
 
63
 
64
    /**
64
    /**
65
     * 
65
     * 
66
     *
66
     *
67
     * @param bool utilise_pager Indique si les résultats sont divisés en page.
67
     * @param bool utilise_pager Indique si les résultats sont divisés en page.
68
     * @return void
68
     * @return void
69
     * @access public
69
     * @access public
70
     */
70
     */
71
    function HTML_listeProjet( $utilise_pager = false )
71
    function HTML_listeProjet( $utilise_pager = false )
72
    {
72
    {
73
        HTML_Liste::HTML_Liste($utilise_pager, array ('class' => 'table_cadre')) ;
73
        HTML_Liste::HTML_Liste($utilise_pager, array ('class' => 'table_cadre')) ;
74
    } // end of member function HTML_listeProjet
74
    } // end of member function HTML_listeProjet
75
 
75
 
76
    /**
76
    /**
77
     * 
77
     * 
78
     *
78
     *
79
     * @return void
79
     * @return void
80
     * @access public
80
     * @access public
81
     */
81
     */
82
    function __construct($utilise_pager = false)
82
    function __construct( )
83
    {
83
    {
84
    	$this->HTML_listeProjet($utilise_pager);
-
 
85
        
84
        
86
    } // end of member function __cosntruct
85
    } // end of member function __cosntruct
87
 
86
 
88
    /**
87
    /**
89
     * 
88
     * 
90
     *
89
     *
91
     * @param Array label_entete Un tableau contenant les labels pour l'entête de la liste.
90
     * @param Array label_entete Un tableau contenant les labels pour l'entête de la liste.
92
     * @return void
91
     * @return void
93
     * @access public
92
     * @access public
94
     */
93
     */
95
    function construitEntete( $label_entete )
94
    function construitEntete( $label_entete )
96
    {
95
    {
97
        $this->addRow ($label_entete, '', 'TH') ;
96
        $this->addRow ($label_entete, '', 'TH') ;
98
    } // end of member function construitEntete
97
    } // end of member function construitEntete
99
 
98
 
100
    /**
99
    /**
101
     * 
100
     * 
102
     *
101
     *
103
     * @param Array label_liste Un tableau à double dimension contenant les valeurs de la liste. du type 
102
     * @param Array label_liste Un tableau à double dimension contenant les valeurs de la liste. du type 
104
     *      0 =>'label', 'label2', 
103
     *      0 =>'label', 'label2', 
105
     *      1 => ...
104
     *      1 => ...
106
     * @return void
105
     * @return void
107
     * @access public
106
     * @access public
108
     */
107
     */
109
    function construitListe( $label_liste, $tableau_statut = '' )
108
    function construitListe( $label_liste, $tableau_statut = '' )
110
    {
109
    {
111
        for ($i = 0; $i < count ($label_liste) ; $i++) {
110
        for ($i = 0; $i < count ($label_liste) ; $i++) {
112
            if ($this->_mode == 1) {
111
            if ($this->_mode == 1) {
113
                $id_projet = array_shift ($label_liste[$i]) ;
112
                $id_projet = array_shift ($label_liste[$i]) ;
114
                $id_statut = array_shift ($label_liste[$i]) ;
-
 
115
                $id_statut = array_pop ($label_liste[$i]) ;
113
                $id_statut = array_pop ($label_liste[$i]) ;
116
            }
114
            }
117
            
115
            
118
            $this->addRow ($label_liste[$i]) ;
116
            $this->addRow ($label_liste[$i]) ;
119
            
117
            
120
            if ($this->_mode == 1 && $id_statut < 3) {
118
            if ($this->_mode == 1 && $id_statut < 3) {
121
                $this->_url->addQueryString ('identifiant_projet', $id_projet) ;
119
                $this->_url->addQueryString ('identifiant_projet', $id_projet) ;
122
                $this->_url->removeQueryString (PROJET_VARIABLE_ID_PROJET) ;
120
                $this->_url->removeQueryString (PROJET_VARIABLE_ID_PROJET) ;
123
                $select = '<form action="'.$this->_url->getURL().'" method="post" class="magali">'."\n" ;
121
                $select = '<form action="'.$this->_url->getURL().'" method="post" class="magali">'."\n" ;
124
                $select .= '<select name="statut" onchange="javascript:this.form.submit();">' ;
122
                $select .= '<select name="statut" onchange="javascript:this.form.submit();">' ;
125
                foreach ($tableau_statut as $cle =>$element_statut) {
123
                foreach ($tableau_statut as $cle =>$element_statut) {
126
                    $select .= '<option value="'.$cle.'"' ;
124
                    $select .= '<option value="'.$cle.'"' ;
127
                    if ($cle == $id_statut) {
125
                    if ($cle == $id_statut) {
128
                        $select .= ' selected="selected"' ;
126
                        $select .= ' selected="selected"' ;
129
                    }
127
                    }
130
                    $select .= '>'.$element_statut.'</option>'."\n" ;
128
                    $select .= '>'.$element_statut.'</option>'."\n" ;
131
                }
129
                }
132
                $select .= '</select>'."\n".'</form>'."\n" ;
130
                $select .= '</select>'."\n".'</form>'."\n" ;
-
 
131
                if (is_int($id_statut)) {
133
                if ($id_statut != PROJET_PAS_DE_LISTE) $this->setCellContents($i+1, 2, $select) ;
132
                    $this->setCellContents($i+1, 2, $select) ;
-
 
133
                } else {
-
 
134
                    $this->setCellContents($i+1, 2, PROJET_PAS_DE_LISTE) ;
-
 
135
                }
134
            }
136
            }
135
        }
137
        }
136
        $this->altRowAttributes(1, array('class' => 'ligne_impaire'), array('class' => 'ligne_paire')) ;
138
        $this->altRowAttributes(1, array('class' => 'ligne_impaire'), array('class' => 'ligne_paire')) ;
137
        
139
        
138
    } // end of member function construitListe
140
    } // end of member function construitListe
139
 
141
 
140
    /**
142
    /**
141
     * 
143
     * 
142
     *
144
     *
143
     * @return void
145
     * @return void
144
     * @access public
146
     * @access public
145
     */
147
     */
146
    function setModeModification( )
148
    function setModeModification( )
147
    {
149
    {
148
        $this->_mode = 1 ;
150
        $this->_mode = 1 ;
149
    } // end of member function setModeModification
151
    } // end of member function setModeModification
150
 
152
 
151
    /**
153
    /**
152
     * 
154
     * 
153
     *
155
     *
154
     * @param Net_URL url Un objet PEAR::Net_URL
156
     * @param Net_URL url Un objet PEAR::Net_URL
155
     * @return void
157
     * @return void
156
     * @access public
158
     * @access public
157
     */
159
     */
158
    function setURL(& $url )
160
    function setURL(& $url )
159
    {
161
    {
160
        $this->_url = $url ;
162
        $this->_url = $url ;
161
    } // end of member function setURL
163
    } // end of member function setURL
162
 
164
 
163
} // end of HTML_listeProjet
165
} // end of HTML_listeProjet
164
?>
166
?>