Subversion Repositories Applications.projet

Rev

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

Rev 11 Rev 95
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_listeParticipants.class.php,v 1.2 2005-09-27 16:42:00 alexandre_tb Exp $
22
// CVS : $Id: HTML_listeParticipants.class.php,v 1.3 2006-01-11 10:32:09 alexandre_tb Exp $
23
/**
23
/**
24
* Application projet
24
* Application projet
25
*
25
*
26
* La classe HTML_listeParticipants
26
* La classe HTML_listeParticipants
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
/**
46
/**
47
 * class HTML_listeParticipants
47
 * class HTML_listeParticipants
48
 * 
48
 * 
49
 */
49
 */
50
class HTML_listeParticipants extends HTML_Liste
50
class HTML_listeParticipants extends HTML_Liste
51
{
51
{
52
     /*** Attributes: ***/
52
     /*** Attributes: ***/
53
 
53
 
54
    /**
54
    /**
55
     * Le mode, par défaut 0 => normal 1 => modification En mode modification, une
55
     * Le mode, par défaut 0 => normal 1 => modification En mode modification, une
56
     * colonne de plus pour désinscrire un utilisateur
56
     * colonne de plus pour désinscrire un utilisateur
57
     * @access private
57
     * @access private
58
     */
58
     */
59
    var $_mode;
59
    var $_mode;
60
    /**
60
    /**
61
     * L'url vers la page affichant la liste
61
     * L'url vers la page affichant la liste
62
     * @access private
62
     * @access private
63
     */
63
     */
64
    var $_url;
64
    var $_url;
65
 
65
 
66
    /**
66
    /**
67
     * 
67
     * 
68
     *
68
     *
69
     * @return void
69
     * @return void
70
     * @access public
70
     * @access public
71
     */
71
     */
72
    function HTML_listeParticipants( $utilise_pager)
72
    function HTML_listeParticipants( $utilise_pager)
73
    {
73
    {
74
        HTML_Liste::HTML_Liste($utilise_pager, array('class' => 'table_cadre')) ;
74
        HTML_Liste::HTML_Liste($utilise_pager, array('class' => 'table_cadre')) ;
75
    } // end of member function HTML_listeParticipants
75
    } // end of member function HTML_listeParticipants
76
 
76
 
77
    /**
77
    /**
78
     * 
78
     * 
79
     *
79
     *
80
     * @param Array elements Tableau des éléments de l'entête. Des labels.
80
     * @param Array elements Tableau des éléments de l'entête. Des labels.
81
     * @return void
81
     * @return void
82
     * @access public
82
     * @access public
83
     */
83
     */
84
    function construitEntete( $elements )
84
    function construitEntete( $elements )
85
    {
85
    {
86
        if ($this->_mode == 1) {
86
        if ($this->_mode == 1) {
87
            array_push ($elements, PROJET_SUPPRIMER) ;
87
            array_push ($elements, PROJET_SUPPRIMER) ;
88
        }
88
        }
89
        $this->addRow ($elements, '', 'TH') ;
89
        $this->addRow ($elements, '', 'TH') ;
90
    } // end of member function construitEntete
90
    } // end of member function construitEntete
91
 
91
 
92
    /**
92
    /**
93
     * 
93
     * 
94
     *
94
     *
95
     * @param Array elements Tableau à deux dimension contenant les éléments à afficher.
95
     * @param Array elements Tableau à deux dimension contenant les éléments à afficher.
96
     * @return void
96
     * @return void
97
     * @access public
97
     * @access public
98
     */
98
     */
99
    function construitListe( $elements, $tableau_statut = '' )
99
    function construitListe( $elements, $tableau_statut = '' )
100
    {
100
    {
101
        for ($i = 0; $i < count ($elements) ; $i++) {
101
        for ($i = 0; $i < count ($elements) ; $i++) {
102
            // L'identifiant de l'utilisateur est le premier élément du tableau
102
            // L'identifiant de l'utilisateur est le premier élément du tableau
103
            $id_utilisateur = array_shift ($elements[$i]) ;
103
            $id_utilisateur = array_shift ($elements[$i]) ;
104
            
104
            
105
            // L'identifiant du statut est le dernier
105
            // L'identifiant du statut est le dernier
106
            $id_statut = (int) array_pop ($elements[$i]) ;
106
            $id_statut = (int) array_pop ($elements[$i]) ;
107
            // En mode modif on ajoute la colonne supprimer
107
            // En mode modif on ajoute la colonne supprimer
108
            if ($this->_mode == 1) {
108
            if ($this->_mode == 1) {
109
                $this->_url->addQueryString ('id_utilisateur', $id_utilisateur) ;
109
                $this->_url->addQueryString ('id_utilisateur', $id_utilisateur) ;
110
                $this->_url->addQueryString('statut', 4) ;
110
                $this->_url->addQueryString('statut', 4) ;
111
                array_push ($elements[$i], '', '<a href="'.$this->_url->getURL().'" onclick="javascript:return confirm(\''.PROJET_SUPPRIMER.' ?\')">'
111
                array_push ($elements[$i], '', '<a href="'.$this->_url->getURL().'" onclick="javascript:return confirm(\''.PROJET_SUPPRIMER.' ?\')">'
112
                                                .PROJET_SUPPRIMER.'</a>');
112
                                                .PROJET_SUPPRIMER.'</a>');
113
                $this->_url->removeQueryString('statut') ;
113
                $this->_url->removeQueryString('statut') ;
114
            }
114
            }
115
            
115
            
116
            $this->addRow ($elements[$i]) ;
116
            $this->addRow ($elements[$i]) ;
117
            // mise à jour du champs mail en l'entourant par la balise mailto
117
            // mise à jour du champs mail en l'entourant par la balise mailto
118
            
118
            
119
            ///                     $i+1 pour sauter la ligne de titre,  
119
            ///                     $i+1 pour sauter la ligne de titre,  
-
 
120
       
-
 
121
            if (strlen ($elements[$i][2]) > 10) {
-
 
122
            	$mail_racourci = substr($elements[$i][2], 0, 10).'...' ;	
-
 
123
            }
-
 
124
           
120
            $this->setCellContents ($i+1, 2, '<a href="mailto:'.$elements[$i][2].'">'.$elements[$i][2].'</a>') ;
125
            $this->setCellContents ($i+1, 2, '<a href="mailto:'.$elements[$i][2].'">'.$mail_racourci.'</a>') ;
121
            
126
            
122
            // Mise à jour de la cellule contenant le statut
127
            // Mise à jour de la cellule contenant le statut
123
            if ($this->_mode == 1) {
128
            if ($this->_mode == 1) {
124
                $this->_url->addQueryString ('id_utilisateur', $id_utilisateur) ;
129
                $this->_url->addQueryString ('id_utilisateur', $id_utilisateur) ;
125
                $select = '<form action="'.$this->_url->getURL().'" method="post">'."\n" ;
130
                $select = '<form action="'.$this->_url->getURL().'" method="post">'."\n" ;
126
                $select .= '<select name="statut" onchange="javascript:this.form.submit();">' ;
131
                $select .= '<select name="statut" onchange="javascript:this.form.submit();">' ;
127
                foreach ($tableau_statut as $cle =>$element_statut) {
132
                foreach ($tableau_statut as $cle =>$element_statut) {
128
                    $select .= '<option value="'.$cle.'"' ;
133
                    $select .= '<option value="'.$cle.'"' ;
129
                    if ($cle == $id_statut) {
134
                    if ($cle == $id_statut) {
130
                        $select .= ' selected="selected"' ;
135
                        $select .= ' selected="selected"' ;
131
                    }
136
                    }
132
                    $select .= '>'.$element_statut.'</option>'."\n" ;
137
                    $select .= '>'.$element_statut.'</option>'."\n" ;
133
                }
138
                }
134
                $select .= '</select>'."\n".'</form>'."\n" ;
139
                $select .= '</select>'."\n".'</form>'."\n" ;
135
                $this->setCellContents($i+1, 4, $select) ;
140
                $this->setCellContents($i+1, 4, $select) ;
136
            }
141
            }
137
            if ($id_statut == 1 && $this->_mode != 1) {
142
            if ($id_statut == 1 && $this->_mode != 1) {
138
                $this->setCellContents($i + 1, 4, PROJET_CHEF) ;
143
                $this->setCellContents($i + 1, 4, PROJET_CHEF) ;
139
                $this->updateRowAttributes ($i + 1, array('style' => 'font-weight:bold'), true) ;
144
                $this->updateRowAttributes ($i + 1, array('style' => 'font-weight:bold'), true) ;
140
            }
145
            }
141
            if ($this->_mode != 1 && $id_statut != 1) {
146
            if ($this->_mode != 1 && $id_statut != 1) {
142
                $this->setCellContents($i + 1, 4, $tableau_statut[$id_statut]) ;
147
                $this->setCellContents($i + 1, 4, $tableau_statut[$id_statut]) ;
143
            }
148
            }
144
            $this->updateCellAttributes ($i + 1, 0, array ('class' => 'nom')) ;
149
            $this->updateCellAttributes ($i + 1, 0, array ('class' => 'nom')) ;
145
            $this->updateCellAttributes ($i + 1, 1, array ('class' => 'prenom')) ;
150
            $this->updateCellAttributes ($i + 1, 1, array ('class' => 'prenom')) ;
146
        }
151
        }
147
        
152
        
148
    } // end of member function construitListe
153
    } // end of member function construitListe
149
 
154
 
150
    /**
155
    /**
151
     * 
156
     * 
152
     *
157
     *
153
     * @return void
158
     * @return void
154
     * @access public
159
     * @access public
155
     */
160
     */
156
    function setModeModification( )
161
    function setModeModification( )
157
    {
162
    {
158
        $this->_mode = 1 ;
163
        $this->_mode = 1 ;
159
    } // end of member function setModeModification
164
    } // end of member function setModeModification
160
 
165
 
161
    /**
166
    /**
162
     * Renvoie le code HTML de la table.
167
     * Renvoie le code HTML de la table.
163
     *
168
     *
164
     * @return string
169
     * @return string
165
     * @access public
170
     * @access public
166
     */
171
     */
167
    function toHTML( )
172
    function toHTML( )
168
    {
173
    {
169
        // Application de style
174
        // Application de style
170
        $this->altRowAttributes(1, array('class' =>'ligne_paire'), array('class' =>'ligne_impaire'), true) ;
175
        $this->altRowAttributes(1, array('class' =>'ligne_paire'), array('class' =>'ligne_impaire'), true) ;
171
        
176
        
172
        // s'il n'y a qu'une seule ligne, on renvoie un message indiquant qu'il n'y a pas de participants
177
        // s'il n'y a qu'une seule ligne, on renvoie un message indiquant qu'il n'y a pas de participants
173
        if ($this->getRowCount() == 1) {
178
        if ($this->getRowCount() == 1) {
174
            return '<div>'.PROJET_PAS_D_INSCRIT.'</div>'."\n";
179
            return '<div>'.PROJET_PAS_D_INSCRIT.'</div>'."\n";
175
        }
180
        }
176
        
181
        
177
        $res = HTML_Table::toHTML() ;
182
        $res = HTML_Table::toHTML() ;
178
       
183
       
179
        return $res ;
184
        return $res ;
180
    } // end of member function toHTML
185
    } // end of member function toHTML
181
 
186
 
182
    /**
187
    /**
183
     * Fixe la valeur de l'URL
188
     * Fixe la valeur de l'URL
184
     *
189
     *
185
     * @param Net_URL url Un pointeur vers un objet Net_URL
190
     * @param Net_URL url Un pointeur vers un objet Net_URL
186
     * @return void
191
     * @return void
187
     * @access public
192
     * @access public
188
     */
193
     */
189
    function setURL( &$url )
194
    function setURL( &$url )
190
    {
195
    {
191
        $this->_url = $url ;
196
        $this->_url = $url ;
192
    } // end of member function setURL
197
    } // end of member function setURL
193
 
198
 
194
} // end of HTML_listeParticipants
199
} // end of HTML_listeParticipants
195
?>
200
?>