Subversion Repositories Applications.papyrus

Rev

Rev 332 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
206 alex 1
<?php
2
/*vim: set expandtab tabstop=4 shiftwidth=4: */
3
// +------------------------------------------------------------------------------------------------------+
4
// | PHP version 4.1                                                                                      |
5
// +------------------------------------------------------------------------------------------------------+
6
// | Copyright (C) 2004 Tela Botanica (accueil@tela-botanica.org)                                         |
7
// +------------------------------------------------------------------------------------------------------+
8
// | This library is free software; you can redistribute it and/or                                        |
9
// | modify it under the terms of the GNU General Public                                                  |
10
// | License as published by the Free Software Foundation; either                                         |
11
// | version 2.1 of the License, or (at your option) any later version.                                   |
12
// |                                                                                                      |
13
// | This library is distributed in the hope that it will be useful,                                      |
14
// | but WITHOUT ANY WARRANTY; without even the implied warranty of                                       |
15
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU                                    |
16
// | General Public License for more details.                                                             |
17
// |                                                                                                      |
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                                  |
20
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA                            |
21
// +------------------------------------------------------------------------------------------------------+
832 florian 22
// CVS : $Id: HTML_formulaireAuth.class.php,v 1.4 2006-04-28 12:41:49 florian Exp $
206 alex 23
/**
24
* Application projet
25
*
26
* La classe HTML_formulaireAuth
27
*
28
*@package projet
29
//Auteur original :
30
*@author        Alexandre Granier <alexandre@tela-botanica.org>
31
//Autres auteurs :
32
*@author        Aucun
33
*@copyright     Tela-Botanica 2000-2004
832 florian 34
*@version       $Revision: 1.4 $
206 alex 35
// +------------------------------------------------------------------------------------------------------+
36
*/
37
 
38
 
39
// +------------------------------------------------------------------------------------------------------+
40
// |                                            ENTETE du PROGRAMME                                       |
41
// +------------------------------------------------------------------------------------------------------+
42
 
43
/** Inclure le fichier de langue pour utiliser cette classe de façon autonome. */
44
 
832 florian 45
require_once PAP_CHEMIN_API_PEAR.'HTML/QuickForm.php' ;
46
require_once PAP_CHEMIN_API_PEAR.'HTML/QuickForm/checkbox.php' ;
47
require_once PAP_CHEMIN_API_PEAR.'HTML/QuickForm/select.php' ;
206 alex 48
 
49
// +------------------------------------------------------------------------------------------------------+
50
// |                                           LISTE des constantes                                       |
51
// +------------------------------------------------------------------------------------------------------+
52
 
53
 
54
/**
55
 * class HTML_formulaireProjet
56
 * Cette classe représente un formulaire pour saisir un projet ou le modifier.
57
 */
58
class HTML_formulaireAuth extends HTML_QuickForm
59
{
60
    /**
61
     * Constructeur
62
     *
63
     * @param string formName Le nom du formulaire.
64
     * @param string method Soit get soit post, voir le protocole HTTP
65
     * @param string action L'action du formulaire.
66
     * @param string target La cible du formulaire.
67
     * @param Array attributes Des attributs supplémentaires pour la balise <form>
68
     * @param bool trackSubmit Pour repérer si la formulaire a été soumis.
69
     * @return void
70
     * @access public
71
     */
332 jpm 72
    function HTML_formulaireAuth($formName = '', $method = 'post', $action = '', $target = '_self', $attributes = '', $trackSubmit = false)
206 alex 73
    {
332 jpm 74
        HTML_QuickForm::HTML_QuickForm($formName, $method, $action, $target, $attributes, $trackSubmit);
75
        $squelette =& $this->defaultRenderer();
76
        $squelette->setFormTemplate("\n".'<form{attributes}>'."\n".'{content}'."\n".'</form>'."\n");
77
        $squelette->setElementTemplate(  '<li>'."\n".
78
                                    '{label}'."\n".
79
                                    '{element}'."\n".
80
                                    '<!-- BEGIN required --><span class="symbole_obligatoire">'.ADAU_SYMBOLE_CHP_OBLIGATOIRE.'</span><!-- END required -->'."\n".
81
                                    '<!-- BEGIN error --><span class="erreur">{error}</span><!-- END error -->'."\n".
82
                                    '</li>'."\n");
83
        $squelette->setRequiredNoteTemplate("\n".'<p><span class="symbole_obligatoire">'.ADAU_SYMBOLE_CHP_OBLIGATOIRE.'</span> {requiredNote}</p>'."\n");
206 alex 84
    } // end of member function HTML_formulaireProjet
85
 
86
    /**
87
     * Renvoie le code HTML du formulaire.
88
     *
89
     * @return string
90
     * @access public
91
     */
332 jpm 92
    function toHTML()
206 alex 93
    {
332 jpm 94
        $res = HTML_QuickForm::toHTML();
95
        return $res;
206 alex 96
    } // end of member function toHTML
97
 
98
    /**
99
     * Ajoute les champs nécessaire au formulaire.
100
     *
101
     * @return void
102
     * @access public
103
     */
104
    function construitFormulaire($url_retour)
105
    {
332 jpm 106
        $tab_index = 1000;
107
        $size = 60;
108
        $cols = 50;
109
        $rows = 6;
206 alex 110
 
332 jpm 111
        $form_debut = '<fieldset>'."\n".'<legend>'.ADAU_NOM_FORM.'</legend>'."\n".'<ul>'."\n";
112
        $this->addElement('html', $form_debut);
206 alex 113
 
332 jpm 114
        $id = 'nom_auth';
115
        $aso_attributs = array('id'=> $id, 'tabindex' => $tab_index++, 'size' => $size);
116
        $label = '<label for="'.$id.'">'.ADAU_NOM_AUTH.'</label>';
117
        $this->addElement('text', $id, $label, $aso_attributs);
118
        $this->addRule('nom_auth', ADAU_NOM_AUTH_ALERTE, 'required', '', 'client');
206 alex 119
 
332 jpm 120
        $id = 'abreviation';
121
        $aso_attributs = array('id'=> $id, 'tabindex' => $tab_index++, 'size' => $size);
122
        $label = '<label for="'.$id.'">'.ADAU_ABREVIATION.'</label>';
123
        $this->addElement('text', $id, $label, $aso_attributs);
124
        $this->addRule('abreviation', ADAU_ABREVIATION_ALERTE, 'required', '', 'client');
206 alex 125
 
332 jpm 126
        $id = 'dsn';
127
        $aso_attributs = array('id'=> $id, 'tabindex' => $tab_index++, 'size' => $size);
128
        $label = '<label for="'.$id.'">'.ADAU_DSN.'</label>';
129
        $this->addElement('text', $id, $label, $aso_attributs);
130
        $this->addRule('dsn', ADAU_DSN_ALERTE, 'required', '', 'client');
206 alex 131
 
332 jpm 132
        $id = 'nom_table';
133
        $aso_attributs = array('id'=> $id, 'tabindex' => $tab_index++, 'size' => $size);
134
        $label = '<label for="'.$id.'">'.ADAU_NOM_TABLE.'</label>';
135
        $this->addElement('text', $id, $label, $aso_attributs);
136
        $this->addRule('nom_table', ADAU_NOM_TABLE_ALERTE, 'required', '', 'client');
206 alex 137
 
332 jpm 138
        $id = 'champs_login';
139
        $aso_attributs = array('id'=> $id, 'tabindex' => $tab_index++, 'size' => $size);
140
        $label = '<label for="'.$id.'">'.ADAU_CHAMPS_LOGIN.'</label>';
141
        $this->addElement('text', $id, $label, $aso_attributs);
142
        $this->addRule('champs_login', ADAU_CHAMPS_LOGIN_ALERTE, 'required', '', 'client');
206 alex 143
 
332 jpm 144
        $id = 'champs_passe';
145
        $aso_attributs = array('id'=> $id, 'tabindex' => $tab_index++, 'size' => $size);
146
        $label = '<label for="'.$id.'">'.ADAU_CHAMPS_PASSE.'</label>';
147
        $this->addElement('text', $id, $label, $aso_attributs);
148
        $this->addRule('champs_passe', ADAU_CHAMPS_PASSE_ALERTE, 'required', '', 'client');
206 alex 149
 
332 jpm 150
        $id = 'cryptage';
151
        $aso_attributs = array('id'=> $id, 'tabindex' => $tab_index++, 'size' => $size);
152
        $label = '<label for="'.$id.'">'.ADAU_CRYPTAGE.'</label>';
153
        $this->addElement('text', $id, $label, $aso_attributs);
154
        $this->addRule('cryptage', ADAU_CRYPTAGE_ALERTE, 'required', '', 'client');
206 alex 155
 
332 jpm 156
        $id = 'parametres';
157
        $aso_attributs = array('id'=> $id, 'tabindex' => $tab_index++, 'rows' => $rows, 'cols' => $cols);
158
        $label = '<label for="'.$id.'">'.ADAU_PARAMETRE.'</label>';
159
        $this->addElement('textarea', $id, $label, $aso_attributs);
206 alex 160
 
332 jpm 161
        $form_fin = '</ul>'."\n".'</fieldset>'."\n";
162
        $this->addElement('html', $form_fin);
206 alex 163
 
332 jpm 164
        // Gestion des boutons
165
        $liste_bouton_debut = '<ul class="liste_bouton">'."\n";
166
        $this->addElement('html', $liste_bouton_debut);
209 alex 167
 
332 jpm 168
        $this->addElement('submit', 'valider', ADAU_VALIDER);
169
 
170
        $bouton_annuler = '<li><a class="bouton" href="'.str_replace ('&amp;', '&', $url_retour->getURL()).'">'.ADAU_ANNULER.'</a></li>'."\n";
171
        $this->addElement('html', $bouton_annuler);
172
 
173
        $liste_bouton_fin = '</ul>'."\n";
174
        $this->addElement('html', $liste_bouton_fin);
175
 
176
 
177
        $this->setRequiredNote(ADAU_CHAMPS_REQUIS);
178
 
206 alex 179
    } // end of member function _construitFormulaire
180
 
181
} // end of HTML_formulaireProjet
182
?>