Subversion Repositories Applications.projet

Rev

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

Rev 249 Rev 302
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.4 2007-06-25 12:15:06 alexandre_tb Exp $
22
// CVS : $Id: HTML_listeParticipants.class.php,v 1.5 2008-08-25 15:13:17 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.4 $
34
*@version       $Revision: 1.5 $
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 = '', &$projet )
99
    function construitListe( $elements, $tableau_statut = '', &$projet )
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
            if (count ($elements)>5) $inscrit_liste = (int) array_pop ($elements[$i]);
106
            $id_statut = (int) array_pop ($elements[$i]) ;
107
            $id_statut = (int) array_pop ($elements[$i]) ;
107
            // En mode modif on ajoute la colonne supprimer
108
            // En mode modif on ajoute la colonne supprimer
108
            if ($this->_mode == 1) {
109
            if ($this->_mode == 1) {
109
                $this->_url->addQueryString ('id_utilisateur', $id_utilisateur) ;
110
                $this->_url->addQueryString ('id_utilisateur', $id_utilisateur) ;
110
                $this->_url->addQueryString('statut', 4) ;
111
                $this->_url->addQueryString('statut', 4) ;
111
                array_push ($elements[$i], '', '<a href="'.$this->_url->getURL().'" onclick="javascript:return confirm(\''.PROJET_SUPPRIMER.' ?\')">'
112
                $supprimer = '<a href="'.$this->_url->getURL().'" onclick="javascript:return confirm(\''.PROJET_SUPPRIMER.' ?\')">'.PROJET_SUPPRIMER.'</a>';
112
                                                .PROJET_SUPPRIMER.'</a>');
113
                if (count ($elements) > 5) array_push ($elements[$i], '');
-
 
114
                array_push ($elements[$i], '', $supprimer);
113
                $this->_url->removeQueryString('statut') ;
115
                $this->_url->removeQueryString('statut') ;
114
            }
116
            }
115
            
117
            
116
            // La colonne avec l inscription a la liste  de discussion
118
            // La colonne avec l inscription a la liste  de discussion
117
            
119
            
118
            $this->addRow ($elements[$i]) ;
120
            $this->addRow ($elements[$i]) ;
119
            // mise à jour du champs mail en l'entourant par la balise mailto
121
            // mise à jour du champs mail en l'entourant par la balise mailto
120
            
122
            
121
            ///                     $i+1 pour sauter la ligne de titre,  
123
            ///                     $i+1 pour sauter la ligne de titre,  
122
       
124
       
123
            if (strlen ($elements[$i][2]) > 10) {
125
            if (strlen ($elements[$i][2]) > 10) {
124
            	$mail_racourci = substr($elements[$i][2], 0, 10).'...' ;	
126
            	$mail_racourci = substr($elements[$i][2], 0, 10).'...' ;	
125
            }
127
            }
126
           
128
           
127
            $this->setCellContents ($i+1, 2, '<a href="mailto:'.$elements[$i][2].'">'.$mail_racourci.'</a>') ;
129
            $this->setCellContents ($i+1, 2, '<a href="mailto:'.$elements[$i][2].'">'.$mail_racourci.'</a>') ;
128
            
130
            
129
            // Mise à jour de la cellule contenant le statut
131
            // Mise à jour de la cellule contenant le statut
130
            if ($this->_mode == 1) {
132
            if ($this->_mode == 1) {
131
                $this->_url->addQueryString ('id_utilisateur', $id_utilisateur) ;
133
                $this->_url->addQueryString ('id_utilisateur', $id_utilisateur) ;
132
                $select = '<form action="'.$this->_url->getURL().'" method="post">'."\n" ;
134
                $select = '<form action="'.$this->_url->getURL().'" method="post">'."\n" ;
133
                $select .= '<select name="statut" onchange="javascript:this.form.submit();">' ;
135
                $select .= '<select name="statut" onchange="javascript:this.form.submit();">' ;
134
                foreach ($tableau_statut as $cle =>$element_statut) {
136
                foreach ($tableau_statut as $cle =>$element_statut) {
135
                    $select .= '<option value="'.$cle.'"' ;
137
                    $select .= '<option value="'.$cle.'"' ;
136
                    if ($cle == $id_statut) {
138
                    if ($cle == $id_statut) {
137
                        $select .= ' selected="selected"' ;
139
                        $select .= ' selected="selected"' ;
138
                    }
140
                    }
139
                    $select .= '>'.$element_statut.'</option>'."\n" ;
141
                    $select .= '>'.$element_statut.'</option>'."\n" ;
140
                }
142
                }
141
                $select .= '</select>'."\n".'</form>'."\n" ;
143
                $select .= '</select>'."\n".'</form>'."\n" ;
142
                $this->setCellContents($i+1, 4, $select) ;
144
                $this->setCellContents($i+1, 4, $select) ;
-
 
145
                
-
 
146
                // Colonne avec l inscription a la liste de discussion
-
 
147
                if (count ($elements)>5) {
-
 
148
                	$this->_url->addQueryString ('id_utilisateur', $id_utilisateur) ;
-
 
149
                
-
 
150
                	$select = '<form action="'.$this->_url->getURL().'" method="post">'."\n" ;
-
 
151
	                $select .= '<select name="inscription_liste" onchange="javascript:this.form.submit();">' ;
-
 
152
	                $select .= '<option value="0">Non inscrit</option>';
-
 
153
					$select .= '<option value="1"'.($inscrit_liste ? ' selected="selected"': '').'>Inscrit</option>';
-
 
154
	                $select .= '</select>'."\n".'</form>'."\n" ;
-
 
155
	                $this->setCellContents($i+1, 5, $select) ;
-
 
156
                }
143
            }
157
            }
144
            if ($id_statut == 1 && $this->_mode != 1) {
158
            if ($id_statut == 1 && $this->_mode != 1) {
145
                $this->setCellContents($i + 1, 4, PROJET_CHEF) ;
159
                $this->setCellContents($i + 1, 4, PROJET_CHEF) ;
146
                $this->updateRowAttributes ($i + 1, array('style' => 'font-weight:bold'), true) ;
160
                $this->updateRowAttributes ($i + 1, array('style' => 'font-weight:bold'), true) ;
147
            }
161
            }
148
            if ($this->_mode != 1 && $id_statut != 1) {
162
            if ($this->_mode != 1 && $id_statut != 1) {
149
                $this->setCellContents($i + 1, 4, $tableau_statut[$id_statut]) ;
163
                $this->setCellContents($i + 1, 4, $tableau_statut[$id_statut]) ;
150
            }
164
            }
151
            $this->updateCellAttributes ($i + 1, 0, array ('class' => 'nom')) ;
165
            $this->updateCellAttributes ($i + 1, 0, array ('class' => 'nom')) ;
152
            $this->updateCellAttributes ($i + 1, 1, array ('class' => 'prenom')) ;
166
            $this->updateCellAttributes ($i + 1, 1, array ('class' => 'prenom')) ;
153
        }
167
        }
154
        
168
        
155
    } // end of member function construitListe
169
    } // end of member function construitListe
156
 
170
 
157
    /**
171
    /**
158
     * 
172
     * 
159
     *
173
     *
160
     * @return void
174
     * @return void
161
     * @access public
175
     * @access public
162
     */
176
     */
163
    function setModeModification( )
177
    function setModeModification( )
164
    {
178
    {
165
        $this->_mode = 1 ;
179
        $this->_mode = 1 ;
166
    } // end of member function setModeModification
180
    } // end of member function setModeModification
167
 
181
 
168
    /**
182
    /**
169
     * Renvoie le code HTML de la table.
183
     * Renvoie le code HTML de la table.
170
     *
184
     *
171
     * @return string
185
     * @return string
172
     * @access public
186
     * @access public
173
     */
187
     */
174
    function toHTML( )
188
    function toHTML( )
175
    {
189
    {
176
        // Application de style
190
        // Application de style
177
        $this->altRowAttributes(1, array('class' =>'ligne_paire'), array('class' =>'ligne_impaire'), true) ;
191
        $this->altRowAttributes(1, array('class' =>'ligne_paire'), array('class' =>'ligne_impaire'), true) ;
178
        
192
        
179
        // s'il n'y a qu'une seule ligne, on renvoie un message indiquant qu'il n'y a pas de participants
193
        // s'il n'y a qu'une seule ligne, on renvoie un message indiquant qu'il n'y a pas de participants
180
        if ($this->getRowCount() == 1) {
194
        if ($this->getRowCount() == 1) {
181
            return '<div>'.PROJET_PAS_D_INSCRIT.'</div>'."\n";
195
            return '<div>'.PROJET_PAS_D_INSCRIT.'</div>'."\n";
182
        }
196
        }
183
        
197
        
184
        $res = HTML_Table::toHTML() ;
198
        $res = HTML_Table::toHTML() ;
185
       
199
       
186
        return $res ;
200
        return $res ;
187
    } // end of member function toHTML
201
    } // end of member function toHTML
188
 
202
 
189
    /**
203
    /**
190
     * Fixe la valeur de l'URL
204
     * Fixe la valeur de l'URL
191
     *
205
     *
192
     * @param Net_URL url Un pointeur vers un objet Net_URL
206
     * @param Net_URL url Un pointeur vers un objet Net_URL
193
     * @return void
207
     * @return void
194
     * @access public
208
     * @access public
195
     */
209
     */
196
    function setURL( &$url )
210
    function setURL( &$url )
197
    {
211
    {
198
        $this->_url = $url ;
212
        $this->_url = $url ;
199
    } // end of member function setURL
213
    } // end of member function setURL
200
 
214
 
201
} // end of HTML_listeParticipants
215
} // end of HTML_listeParticipants
202
?>
216
?>