Subversion Repositories Applications.projet

Rev

Rev 463 | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 463 Rev 465
1
<?php
1
<?php
2
// +------------------------------------------------------------------------------------------------------+
2
// +------------------------------------------------------------------------------------------------------+
3
// | Copyright (C) 2004 Tela Botanica (accueil@tela-botanica.org)                                         |
3
// | Copyright (C) 2004 Tela Botanica (accueil@tela-botanica.org)                                         |
4
// +------------------------------------------------------------------------------------------------------+
4
// +------------------------------------------------------------------------------------------------------+
5
// | This library is free software; you can redistribute it and/or                                        |
5
// | This library is free software; you can redistribute it and/or                                        |
6
// | modify it under the terms of the GNU General Public                                                  |
6
// | modify it under the terms of the GNU General Public                                                  |
7
// | License as published by the Free Software Foundation; either                                         |
7
// | License as published by the Free Software Foundation; either                                         |
8
// | version 2.1 of the License, or (at your option) any later version.                                   |
8
// | version 2.1 of the License, or (at your option) any later version.                                   |
9
// |                                                                                                      |
9
// |                                                                                                      |
10
// | This library is distributed in the hope that it will be useful,                                      |
10
// | This library is distributed in the hope that it will be useful,                                      |
11
// | but WITHOUT ANY WARRANTY; without even the implied warranty of                                       |
11
// | but WITHOUT ANY WARRANTY; without even the implied warranty of                                       |
12
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU                                    |
12
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU                                    |
13
// | General Public License for more details.                                                             |
13
// | General Public License for more details.                                                             |
14
// |                                                                                                      |
14
// |                                                                                                      |
15
// | You should have received a copy of the GNU General Public                                            |
15
// | You should have received a copy of the GNU General Public                                            |
16
// | License along with this library; if not, write to the Free Software                                  |
16
// | License along with this library; if not, write to the Free Software                                  |
17
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA                            |
17
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA                            |
18
// +------------------------------------------------------------------------------------------------------+
18
// +------------------------------------------------------------------------------------------------------+
19
// CVS : $Id: HTML_formulaireInscriptionProjet.class.php,v 1.3 2007-11-21 09:42:50 alexandre_tb Exp $
19
// CVS : $Id: HTML_formulaireInscriptionProjet.class.php,v 1.3 2007-11-21 09:42:50 alexandre_tb Exp $
20
/**
20
/**
21
* Application projet
21
* Application projet
22
*
22
*
23
* La classe HTML_formulaireInscriptionProjet
23
* La classe HTML_formulaireInscriptionProjet
24
* Elle se base sur la table projet_statut_utilisateur
24
* Elle se base sur la table projet_statut_utilisateur
25
*
25
*
26
*@package projet
26
*@package projet
27
//Auteur original :
27
//Auteur original :
28
*@author        Alexandre Granier <alexandre@tela-botanica.org>
28
*@author        Alexandre Granier <alexandre@tela-botanica.org>
29
//Autres auteurs :
29
//Autres auteurs :
30
*@author        Aucun
30
*@author        Aucun
31
*@copyright     Tela-Botanica 2000-2004
31
*@copyright     Tela-Botanica 2000-2004
32
*@version       $Revision: 1.3 $
32
*@version       $Revision: 1.3 $
33
// +------------------------------------------------------------------------------------------------------+
33
// +------------------------------------------------------------------------------------------------------+
34
*/
34
*/
35
 
35
 
36
 
36
 
37
// +------------------------------------------------------------------------------------------------------+
37
// +------------------------------------------------------------------------------------------------------+
38
// |                                            ENTETE du PROGRAMME                                       |
38
// |                                            ENTETE du PROGRAMME                                       |
39
// +------------------------------------------------------------------------------------------------------+
39
// +------------------------------------------------------------------------------------------------------+
40
 
40
 
41
require_once PAP_CHEMIN_API_PEAR.'HTML/QuickForm/radio.php';
41
require_once PAP_CHEMIN_API_PEAR.'HTML/QuickForm/radio.php';
42
require_once PAP_CHEMIN_API_PEAR.'HTML/QuickForm.php';
42
require_once PAP_CHEMIN_API_PEAR.'HTML/QuickForm.php';
43
 
43
 
44
/**
44
/**
45
 * class HTML_formulaireInscriptionProjet
45
 * class HTML_formulaireInscriptionProjet
46
 * 
46
 * 
47
 */
47
 */
48
class HTML_formulaireInscriptionProjet extends HTML_QuickForm
48
class HTML_formulaireInscriptionProjet extends HTML_QuickForm
49
{
49
{
50
     /*** Attributes: ***/
50
     /*** Attributes: ***/
51
 
51
 
52
    /**
52
    /**
53
     * 
53
     * 
54
     *
54
     *
55
     * @return void
55
     * @return void
56
     * @access public
56
     * @access public
57
     */
57
     */
58
    function HTML_formulaireInscriptionProjet( $formName = '',  $method = 'post',  $action = '',  $target = '_self',  $attributes = '',  $trackSubmit = false )
58
    function HTML_formulaireInscriptionProjet( $formName = '',  $method = 'post',  $action = '',  $target = '_self',  $attributes = '',  $trackSubmit = false )
59
    {
59
    {
60
        HTML_QuickForm::HTML_QuickForm($formName, $method, $action, $target, $attributes, $trackSubmit) ;
60
        HTML_QuickForm::HTML_QuickForm($formName, $method, $action, $target, $attributes, $trackSubmit) ;
61
    } // end of member function HTML_formulaireInscriptionProjet
61
    } // end of member function HTML_formulaireInscriptionProjet
62
 
62
 
63
    /**
63
    /**
64
     * 
64
     * 
65
     *
65
     *
66
     * @return void
66
     * @return void
67
     * @access public
67
     * @access public
68
     */
68
     */
69
    function construitFormulaire(& $projet )
69
    function construitFormulaire(& $projet )
70
    {
70
    {
71
         $squelette =& $this->defaultRenderer();
71
         $squelette =& $this->defaultRenderer();
72
        $squelette->setFormTemplate("\n".'<form{attributes}>'."\n".'{content}'."\n".'</form>'."\n");
72
        $squelette->setFormTemplate("\n".'<form{attributes}>'."\n".'{content}'."\n".'</form>'."\n");
73
        
73
        
74
        $modele_element_debut = '<li class="groupe_formulaire">'."\n".'<span class="inscription_label1">{label}<!-- BEGIN required --><span class="symbole_obligatoire">*</span><!-- END required --></span>'.
74
        $modele_element_debut = '<li class="groupe_formulaire">'."\n".'<span class="inscription_label1">{label}<!-- BEGIN required --><span class="symbole_obligatoire">*</span><!-- END required --></span>'.
75
                                        "\n".'{element}'."\n".''."\n".
75
                                        "\n".'{element}'."\n".''."\n".
76
                                        '<!-- BEGIN error --><span class="erreur">{error}</span><!-- END error -->'."\n".
76
                                        '<!-- BEGIN error --><span class="erreur">{error}</span><!-- END error -->'."\n".
77
                                        ''."\n" ;
77
                                        ''."\n" ;
78
        $modele_element_fin = "\n".'<span class="inscription_label2">{label}<!-- BEGIN required --><span class="symbole_obligatoire">*</span><!-- END required --></span>'.
78
        $modele_element_fin = "\n".'<span class="inscription_label2">{label}<!-- BEGIN required --><span class="symbole_obligatoire">*</span><!-- END required --></span>'.
79
                                        "\n".'{element}'."\n".''."\n".
79
                                        "\n".'{element}'."\n".''."\n".
80
                                        '<!-- BEGIN error --><span class="erreur">{error}</span><!-- END error -->'."\n".
80
                                        '<!-- BEGIN error --><span class="erreur">{error}</span><!-- END error -->'."\n".
81
                                        '</li>'."\n" ;
81
                                        '</li>'."\n" ;
82
        
82
        
83
        $squelette->setElementTemplate( '<li class="liste_inscription">'."\n".'<span class="inscription_label">{label}<!-- BEGIN required --><span class="symbole_obligatoire">*</span><!-- END required --></span>'.
83
        $squelette->setElementTemplate( '<li class="liste_inscription">'."\n".'<span class="inscription_label">{label}<!-- BEGIN required --><span class="symbole_obligatoire">*</span><!-- END required --></span>'.
84
                                        "\n".'{element}'."\n".''."\n".
84
                                        "\n".'{element}'."\n".''."\n".
85
                                        '<!-- BEGIN error --><span class="erreur">{error}</span><!-- END error -->'."\n".
85
                                        '<!-- BEGIN error --><span class="erreur">{error}</span><!-- END error -->'."\n".
86
                                        '</li>'."\n");
86
                                        '</li>'."\n");
87
        $squelette->setElementTemplate( '<ul><li class="groupe_bouton">{element}', 'annuler');
87
        $squelette->setElementTemplate( '<ul><li class="groupe_bouton">{element}', 'annuler');
88
        $squelette->setElementTemplate( '{element}</li></ul>', 'valider');
88
        $squelette->setElementTemplate( '{element}</li></ul>', 'valider');
89
    
89
    
90
        $squelette->setRequiredNoteTemplate("\n".'<p>'."\n".'<span class="symbole_obligatoire">*</span> {requiredNote}'."\n".'</p>'."\n");
90
        $squelette->setRequiredNoteTemplate("\n".'<p>'."\n".'<span class="symbole_obligatoire">*</span> {requiredNote}'."\n".'</p>'."\n");
91
    
91
    
92
        if ($projet->avoirListe()) {
92
        if ($projet->avoirListe()) {
93
        	// Si le projet est modéré, on ne propose pas l'inscription à la liste
93
        	// Si le projet est modéré, on ne propose pas l'inscription à la liste
94
        	if(!$projet->isModere()) {	
94
        	if(!$projet->isModere()) {	
95
            	$this->addElement ('radio', 'radio_inscription_liste', '&nbsp;', PROJET_INSCRIPTION_LISTE_NORMAL, 2) ;
95
            	$this->addElement ('radio', 'radio_inscription_liste', '&nbsp;', PROJET_INSCRIPTION_LISTE_NORMAL, 2) ;
96
            	$this->addElement ('radio', 'radio_inscription_liste', '&nbsp;', PROJET_INSCRIPTION_PAS_DE_MAIL, 1) ;
96
            	$this->addElement ('radio', 'radio_inscription_liste', '&nbsp;', PROJET_INSCRIPTION_PAS_DE_MAIL, 1) ;
97
        	} else {
97
        	} else {
98
        		$this->addElement ('hidden', 'radio_inscription_liste', 0) ;
98
        		$this->addElement ('hidden', 'radio_inscription_liste', 0) ;
99
        		$form->addElement('static', 'laius_inscription_moderee', PROJET_LISTE_INSCRIPTION_MODEREE);
99
        		$this->addElement('static', 'laius_inscription_moderee', PROJET_LISTE_INSCRIPTION_MODEREE);
100
        	}
100
        	}
101
            
101
            
102
            // Indisponible pour le moment
102
            // Indisponible pour le moment
103
            //$this->addElement ('radio', 'radio_inscription_liste', '&nbsp;', PROJET_INSCRIPTION_LISTE_RESUME, 2) ;
103
            //$this->addElement ('radio', 'radio_inscription_liste', '&nbsp;', PROJET_INSCRIPTION_LISTE_RESUME, 2) ;
104
        }
104
        }
105
        $this->addElement ('hidden', 'id_projet', $projet->getId()) ;
105
        $this->addElement ('hidden', 'id_projet', $projet->getId()) ;
106
        $url_annuler = new Net_URL($this->getAttribute('action')) ;
106
        $url_annuler = new Net_URL($this->getAttribute('action')) ;
107
        $url_annuler->removeQueryString(PROJET_VARIABLE_ACTION) ;
107
        $url_annuler->removeQueryString(PROJET_VARIABLE_ACTION) ;
108
        $url_annuler->removeQueryString(PROJET_VARIABLE_ID_PROJET) ;
108
        $url_annuler->removeQueryString(PROJET_VARIABLE_ID_PROJET) ;
109
        // on fait un groupe avec les boutons pour les mettres sur la m�me ligne
109
        // on fait un groupe avec les boutons pour les mettres sur la m�me ligne
110
        $buttons[] = &HTML_QuickForm::createElement('link', 'annuler', PROJET_FICHIER_ANNULER, 
110
        $buttons[] = &HTML_QuickForm::createElement('link', 'annuler', PROJET_FICHIER_ANNULER, 
111
                            preg_replace ("/&amp;/", "&", $url_annuler->getURL()), PROJET_FICHIER_ANNULER); // Le preg_replace contourne un pb de QuickForm et Net_URL
111
                            preg_replace ("/&amp;/", "&", $url_annuler->getURL()), PROJET_FICHIER_ANNULER); // Le preg_replace contourne un pb de QuickForm et Net_URL
112
                                                                                                            // qui remplacent deux fois les & par des &amp;
112
                                                                                                            // qui remplacent deux fois les & par des &amp;
113
                                                                                                            // ce qui fait �chouer le lien
113
                                                                                                            // ce qui fait �chouer le lien
114
        $buttons[] = &HTML_QuickForm::createElement('submit', 'valider_inscription_projet', PROJET_S_INSCRIRE_AU_PROJET);
114
        $buttons[] = &HTML_QuickForm::createElement('submit', 'valider_inscription_projet', PROJET_S_INSCRIRE_AU_PROJET);
115
        $this->addGroup($buttons, null, null, '&nbsp;');
115
        $this->addGroup($buttons, null, null, '&nbsp;');
116
        
116
        
117
    } // end of member function construitFormulaire
117
    } // end of member function construitFormulaire
118
 
118
 
119
 
119
 
120
} // end of HTML_formulaireInscriptionProjet
120
} // end of HTML_formulaireInscriptionProjet
121
?>
121
?>