Subversion Repositories Applications.projet

Rev

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

Rev 129 Rev 431
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_formulaireMail.class.php,v 1.3 2006-07-05 09:44:11 alexandre_tb Exp $
22
// CVS : $Id: HTML_formulaireMail.class.php,v 1.3 2006/07/05 09:44:11 alexandre_tb Exp $
23
/**
23
/**
24
* Application projet
24
* Application projet
25
*
25
*
26
* La classe HTML_formulaireMail
26
* La classe HTML_formulaireMail
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.3 $
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
/** Inclure le fichier de langue pour utiliser cette classe de façon autonome. */
43
/** Inclure le fichier de langue pour utiliser cette classe de façon autonome. */
44
 
44
 
45
require_once 'HTML/QuickForm.php' ;
45
require_once 'HTML/QuickForm.php' ;
46
 
46
 
47
// +------------------------------------------------------------------------------------------------------+
47
// +------------------------------------------------------------------------------------------------------+
48
// |                                           LISTE des constantes                                       |
48
// |                                           LISTE des constantes                                       |
49
// +------------------------------------------------------------------------------------------------------+
49
// +------------------------------------------------------------------------------------------------------+
50
 
50
 
51
 
51
 
52
/**
52
/**
53
 * class HTML_formulaireMail
53
 * class HTML_formulaireMail
54
 * Cette classe représente un formulaire pour saisir un projet ou le modifier.
54
 * Cette classe représente un formulaire pour saisir un projet ou le modifier.
55
 */
55
 */
56
class HTML_formulaireMail extends HTML_QuickForm
56
class HTML_formulaireMail extends HTML_QuickForm
57
{
57
{
58
    /**
58
    /**
59
     * Constructeur
59
     * Constructeur
60
     *
60
     *
61
     * @param string formName Le nom du formulaire.
61
     * @param string formName Le nom du formulaire.
62
     * @param string method Soit get soit post, voir le protocole HTTP
62
     * @param string method Soit get soit post, voir le protocole HTTP
63
     * @param string action L'action du formulaire.
63
     * @param string action L'action du formulaire.
64
     * @param string target La cible du formulaire.
64
     * @param string target La cible du formulaire.
65
     * @param Array attributes Des attributs supplémentaires pour la balise <form>
65
     * @param Array attributes Des attributs supplémentaires pour la balise <form>
66
     * @param bool trackSubmit Pour repérer si la formulaire a été soumis.
66
     * @param bool trackSubmit Pour repérer si la formulaire a été soumis.
67
     * @return void
67
     * @return void
68
     * @access public
68
     * @access public
69
     */
69
     */
70
    function HTML_formulaireProjet( $formName = "",  $method = "post",  $action = "",  $target = "_self",  $attributes = "",  $trackSubmit = false )
70
    function HTML_formulaireProjet( $formName = "",  $method = "post",  $action = "",  $target = "_self",  $attributes = "",  $trackSubmit = false )
71
    {
71
    {
72
        HTML_QuickForm::HTML_QuickForm($formName, $method, $action, $target, $attributes, $trackSubmit) ;
72
        HTML_QuickForm::HTML_QuickForm($formName, $method, $action, $target, $attributes, $trackSubmit) ;
73
    } // end of member function HTML_formulaireProjet
73
    } // end of member function HTML_formulaireProjet
74
 
74
 
75
    /**
75
    /**
76
     * Renvoie le code HTML du formulaire.
76
     * Renvoie le code HTML du formulaire.
77
     *
77
     *
78
     * @return string
78
     * @return string
79
     * @access public
79
     * @access public
80
     */
80
     */
81
    function toHTML( )
81
    function toHTML( )
82
    {
82
    {
83
        $res = HTML_QuickForm::toHTML() ;
83
        $res = HTML_QuickForm::toHTML() ;
84
        return $res ;
84
        return $res ;
85
    } // end of member function toHTML
85
    } // end of member function toHTML
86
 
86
 
87
 
87
 
88
 
88
 
89
    /**
89
    /**
90
     * Ajoute les champs nécessaire au formulaire.
90
     * Ajoute les champs nécessaire au formulaire.
91
     *
91
     *
92
     * @return void
92
     * @return void
93
     * @access public
93
     * @access public
94
     */
94
     */
95
    function construitFormulaire()
95
    function construitFormulaire()
96
    {
96
    {
97
        $this->addElement ('text', 'mail_titre', PROJET_MAIL_TITRE, array ('size' => 60, 'id' => 'titre_mail')) ;
97
        $this->addElement ('text', 'mail_titre', PROJET_MAIL_TITRE, array ('size' => 60, 'id' => 'titre_mail')) ;
98
        $this->addRule ('mail_titre', PROJET_MAIL_TITRE_REQUIS, 'required', '', 'client') ;
98
        $this->addRule ('mail_titre', PROJET_MAIL_TITRE_REQUIS, 'required', '', 'client') ;
99
        $this->addElement ('textarea', 'mail_corps', PROJET_MAIL_CORPS, array('cols'=>80, 'rows'=>30, 'id' => 'corps_mail')) ;
99
        $this->addElement ('textarea', 'mail_corps', PROJET_MAIL_CORPS, array('cols'=>80, 'rows'=>30, 'id' => 'corps_mail')) ;
100
        
100
        
101
        $url_annuler = new Net_URL($this->getAttribute('action')) ;
101
        $url_annuler = new Net_URL($this->getAttribute('action')) ;
102
        $url_annuler->removeQueryString(PROJET_VARIABLE_ACTION) ;
102
        $url_annuler->removeQueryString(PROJET_VARIABLE_ACTION) ;
103
        // on fait un groupe avec les boutons pour les mettres sur la même ligne
103
        // on fait un groupe avec les boutons pour les mettres sur la même ligne
104
        $buttons[] = &HTML_QuickForm::createElement('link', 'annuler', PROJET_FICHIER_ANNULER, 
104
        $buttons[] = &HTML_QuickForm::createElement('link', 'annuler', PROJET_FICHIER_ANNULER, 
105
                            preg_replace ("/&amp;/", "&", $url_annuler->getURL()), PROJET_FICHIER_ANNULER); // Le preg_replace contourne un pb de QuickForm et Net_URL
105
                            preg_replace ("/&amp;/", "&", $url_annuler->getURL()), PROJET_FICHIER_ANNULER); // Le preg_replace contourne un pb de QuickForm et Net_URL
106
                                                                                                            // qui remplacent deux fois les & par des &amp;
106
                                                                                                            // qui remplacent deux fois les & par des &amp;
107
                                                                                                            // ce qui fait échouer le lien
107
                                                                                                            // ce qui fait échouer le lien
108
        $buttons[] = &HTML_QuickForm::createElement('submit', 'valider', PROJET_FICHIER_VALIDER);
108
        $buttons[] = &HTML_QuickForm::createElement('submit', 'valider', PROJET_FICHIER_VALIDER);
109
        $this->addGroup($buttons, null, null, '&nbsp;');
109
        $this->addGroup($buttons, null, null, '&nbsp;');
110
        
110
        
111
        $this->setRequiredNote('<span style="color: #ff0000">*</span>'.PROJET_CHAMPS_REQUIS) ;
111
        $this->setRequiredNote('<span style="color: #ff0000">*</span>'.PROJET_CHAMPS_REQUIS) ;
112
    } // end of member function _construitFormulaire
112
    } // end of member function _construitFormulaire
113
 
113
 
114
 
114
 
115
 
115
 
116
} // end of HTML_formulaireProjet
116
} // end of HTML_formulaireProjet
117
?>
117
?>