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_formulaireListe.class.php,v 1.2 2005-09-27 16:40:39 alexandre_tb Exp $
|
22 |
// CVS : $Id: HTML_formulaireListe.class.php,v 1.2 2005/09/27 16:40:39 alexandre_tb Exp $
|
23 |
/**
|
23 |
/**
|
24 |
* Application projet
|
24 |
* Application projet
|
25 |
*
|
25 |
*
|
26 |
* La classe HTML_formulaireListe
|
26 |
* La classe HTML_formulaireListe
|
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.2 $
|
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 |
require_once 'HTML/QuickForm/checkbox.php' ;
|
46 |
require_once 'HTML/QuickForm/checkbox.php' ;
|
47 |
require_once 'HTML/QuickForm/select.php' ;
|
47 |
require_once 'HTML/QuickForm/select.php' ;
|
48 |
|
48 |
|
49 |
// +------------------------------------------------------------------------------------------------------+
|
49 |
// +------------------------------------------------------------------------------------------------------+
|
50 |
// | LISTE des constantes |
|
50 |
// | LISTE des constantes |
|
51 |
// +------------------------------------------------------------------------------------------------------+
|
51 |
// +------------------------------------------------------------------------------------------------------+
|
52 |
|
52 |
|
53 |
|
53 |
|
54 |
/**
|
54 |
/**
|
55 |
* class HTML_formulaireListe
|
55 |
* class HTML_formulaireListe
|
56 |
* Cette classe représente un formulaire pour saisir un projet ou le modifier.
|
56 |
* Cette classe représente un formulaire pour saisir un projet ou le modifier.
|
57 |
*/
|
57 |
*/
|
58 |
class HTML_formulaireListe extends HTML_QuickForm
|
58 |
class HTML_formulaireListe extends HTML_QuickForm
|
59 |
{
|
59 |
{
|
60 |
|
60 |
|
61 |
|
61 |
|
62 |
/**
|
62 |
/**
|
63 |
* Constructeur
|
63 |
* Constructeur
|
64 |
*
|
64 |
*
|
65 |
* @param string formName Le nom du formulaire.
|
65 |
* @param string formName Le nom du formulaire.
|
66 |
* @param string method Soit get soit post, voir le protocole HTTP
|
66 |
* @param string method Soit get soit post, voir le protocole HTTP
|
67 |
* @param string action L'action du formulaire.
|
67 |
* @param string action L'action du formulaire.
|
68 |
* @param string target La cible du formulaire.
|
68 |
* @param string target La cible du formulaire.
|
69 |
* @param Array attributes Des attributs supplémentaires pour la balise <form>
|
69 |
* @param Array attributes Des attributs supplémentaires pour la balise <form>
|
70 |
* @param bool trackSubmit Pour repérer si la formulaire a été soumis.
|
70 |
* @param bool trackSubmit Pour repérer si la formulaire a été soumis.
|
71 |
* @return void
|
71 |
* @return void
|
72 |
* @access public
|
72 |
* @access public
|
73 |
*/
|
73 |
*/
|
74 |
function HTML_formulaireListe( $formName = "", $method = "post", $action = "", $target = "_self", $attributes = "", $trackSubmit = false )
|
74 |
function HTML_formulaireListe( $formName = "", $method = "post", $action = "", $target = "_self", $attributes = "", $trackSubmit = false )
|
75 |
{
|
75 |
{
|
76 |
HTML_QuickForm::HTML_QuickForm($formName, $method, $action, $target, $attributes, $trackSubmit) ;
|
76 |
HTML_QuickForm::HTML_QuickForm($formName, $method, $action, $target, $attributes, $trackSubmit) ;
|
77 |
} // end of member function HTML_formulaireListe
|
77 |
} // end of member function HTML_formulaireListe
|
78 |
|
78 |
|
79 |
/**
|
79 |
/**
|
80 |
* Renvoie le code HTML du formulaire.
|
80 |
* Renvoie le code HTML du formulaire.
|
81 |
*
|
81 |
*
|
82 |
* @return string
|
82 |
* @return string
|
83 |
* @access public
|
83 |
* @access public
|
84 |
*/
|
84 |
*/
|
85 |
function toHTML( )
|
85 |
function toHTML( )
|
86 |
{
|
86 |
{
|
87 |
$res = HTML_QuickForm::toHTML() ;
|
87 |
$res = HTML_QuickForm::toHTML() ;
|
88 |
return $res ;
|
88 |
return $res ;
|
89 |
} // end of member function toHTML
|
89 |
} // end of member function toHTML
|
90 |
|
90 |
|
91 |
/**
|
91 |
/**
|
92 |
* Ajoute les champs nécessaire au formulaire.
|
92 |
* Ajoute les champs nécessaire au formulaire.
|
93 |
*
|
93 |
*
|
94 |
* @return void
|
94 |
* @return void
|
95 |
* @access public
|
95 |
* @access public
|
96 |
*/
|
96 |
*/
|
97 |
function construitFormulaire()
|
97 |
function construitFormulaire()
|
98 |
{
|
98 |
{
|
99 |
$this->addElement ('text', 'nom_liste', PROJET_NOM_DE_LA_LISTE, array('size' => '20')) ;
|
99 |
$this->addElement ('text', 'nom_liste', PROJET_NOM_DE_LA_LISTE, array('size' => '20')) ;
|
100 |
$this->addRule ('nom_liste', PROJET_NOM_DE_LA_LISTE_REQUIRED, 'required', '', 'client') ;
|
100 |
$this->addRule ('nom_liste', PROJET_NOM_DE_LA_LISTE_REQUIRED, 'required', '', 'client') ;
|
101 |
$this->applyFilter('nom_liste', 'strtolower') ;
|
101 |
$this->applyFilter('nom_liste', 'strtolower') ;
|
102 |
|
102 |
|
103 |
$this->addElement ('text', 'domaine_liste', PROJET_DOMAINE_DE_LA_LISTE, array('size' => '20')) ;
|
103 |
$this->addElement ('text', 'domaine_liste', PROJET_DOMAINE_DE_LA_LISTE, array('size' => '20')) ;
|
104 |
$this->addRule ('domaine_liste', PROJET_DOMAINE_LISTE_REQUIRED, 'required', '', 'client') ;
|
104 |
$this->addRule ('domaine_liste', PROJET_DOMAINE_LISTE_REQUIRED, 'required', '', 'client') ;
|
105 |
|
105 |
|
106 |
$radio[] = &HTML_QuickForm::createElement('radio', 'liste_visibilite', 1, PROJET_OUI, 1) ;
|
106 |
$radio[] = &HTML_QuickForm::createElement('radio', 'liste_visibilite', 1, PROJET_OUI, 1) ;
|
107 |
$radio[] = &HTML_QuickForm::createElement('radio', 'liste_visibilite', 0, PROJET_NON, 0);
|
107 |
$radio[] = &HTML_QuickForm::createElement('radio', 'liste_visibilite', 0, PROJET_NON, 0);
|
108 |
$this->addGroup($radio, null, PROJET_FORUMS_VISIBILITE, ' ');
|
108 |
$this->addGroup($radio, null, PROJET_FORUMS_VISIBILITE, ' ');
|
109 |
|
109 |
|
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 |
$url_annuler = new Net_URL($this->getAttribute('action')) ;
|
112 |
$url_annuler = new Net_URL($this->getAttribute('action')) ;
|
113 |
$url_annuler->removeQueryString(PROJET_VARIABLE_ACTION) ;
|
113 |
$url_annuler->removeQueryString(PROJET_VARIABLE_ACTION) ;
|
114 |
$buttons[] = &HTML_QuickForm::createElement('link', 'annuler', PROJET_FICHIER_ANNULER,
|
114 |
$buttons[] = &HTML_QuickForm::createElement('link', 'annuler', PROJET_FICHIER_ANNULER,
|
115 |
preg_replace ("/&/", "&", $url_annuler->getURL()), PROJET_FICHIER_ANNULER); // Le preg_replace contourne un pb de QuickForm et Net_URL
|
115 |
preg_replace ("/&/", "&", $url_annuler->getURL()), PROJET_FICHIER_ANNULER); // Le preg_replace contourne un pb de QuickForm et Net_URL
|
116 |
// qui remplacent deux fois les & par des &
|
116 |
// qui remplacent deux fois les & par des &
|
117 |
// ce qui fait échouer le lien
|
117 |
// ce qui fait échouer le lien
|
118 |
$buttons[] = &HTML_QuickForm::createElement('submit', 'valider', PROJET_FICHIER_VALIDER);
|
118 |
$buttons[] = &HTML_QuickForm::createElement('submit', 'valider', PROJET_FICHIER_VALIDER);
|
119 |
$this->addGroup($buttons, null, null, ' ');
|
119 |
$this->addGroup($buttons, null, null, ' ');
|
120 |
} // end of member function _construitFormulaire
|
120 |
} // end of member function _construitFormulaire
|
121 |
|
121 |
|
122 |
} // end of HTML_formulaireListe
|
122 |
} // end of HTML_formulaireListe
|
123 |
?>
|
123 |
?>
|