229 |
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 |
// +------------------------------------------------------------------------------------------------------+
|
1497 |
florian |
22 |
// CVS : $Id: HTML_formulaireAppli.class.php,v 1.5 2007-06-26 14:18:53 florian Exp $
|
229 |
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
|
1497 |
florian |
34 |
*@version $Revision: 1.5 $
|
229 |
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' ;
|
229 |
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 |
*/
|
300 |
alex |
58 |
class HTML_formulaireAppl extends HTML_QuickForm
|
229 |
alex |
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 |
*/
|
300 |
alex |
72 |
function HTML_formulaireAppl( $formName = "", $method = "post", $action = "", $target = "_self", $attributes = "", $trackSubmit = false )
|
229 |
alex |
73 |
{
|
|
|
74 |
HTML_QuickForm::HTML_QuickForm($formName, $method, $action, $target, $attributes, $trackSubmit) ;
|
|
|
75 |
} // end of member function HTML_formulaireProjet
|
|
|
76 |
|
|
|
77 |
/**
|
|
|
78 |
* Renvoie le code HTML du formulaire.
|
|
|
79 |
*
|
|
|
80 |
* @return string
|
|
|
81 |
* @access public
|
|
|
82 |
*/
|
|
|
83 |
function toHTML( )
|
|
|
84 |
{
|
|
|
85 |
$res = HTML_QuickForm::toHTML() ;
|
|
|
86 |
return $res ;
|
|
|
87 |
} // end of member function toHTML
|
|
|
88 |
|
|
|
89 |
/**
|
|
|
90 |
* Ajoute les champs nécessaire au formulaire.
|
|
|
91 |
*
|
|
|
92 |
* @return void
|
|
|
93 |
* @access public
|
|
|
94 |
*/
|
|
|
95 |
function construitFormulaire($url_retour)
|
|
|
96 |
{
|
1497 |
florian |
97 |
$squelette =& $this->defaultRenderer();
|
|
|
98 |
$squelette->setFormTemplate("\n".'<form {attributes}>'."\n".'{content}'."\n".'</form>'."\n");
|
|
|
99 |
$squelette->setElementTemplate( '<p class="formulaire_element"><span class="form_label">'."\n".
|
|
|
100 |
'{label}'."\n".
|
|
|
101 |
'<!-- BEGIN required --><span style="color:red; width:5px; margin:0; padding:0;">*</span><!-- END required -->'."\n".
|
|
|
102 |
'</span>'."\n".'{element}'."\n".
|
|
|
103 |
'<!-- BEGIN error --><span class="erreur">{error}</span><!-- END error -->'."\n".
|
|
|
104 |
'</p>'."\n");
|
|
|
105 |
$squelette->setGroupElementTemplate('<p style="display:inline">{element}</p>', 'form_boutons');
|
|
|
106 |
$squelette->setRequiredNoteTemplate("\n".'<p class="symbole_obligatoire">* : {requiredNote}</p>'."\n");
|
|
|
107 |
//Note pour les erreurs javascript
|
|
|
108 |
$this->setJsWarnings('Erreur de saisie', 'Veuillez verifier vos informations saisies');
|
|
|
109 |
// Note de fin de formulaire
|
|
|
110 |
$this->setRequiredNote('Indique les champs obligatoires');
|
|
|
111 |
$this->addElement ('text', 'nom_appl', ADAP_NOM_APPL, array ('size' => 35)) ;
|
|
|
112 |
$this->addRule ('nom_appl', ADAP_NOM_APPL_ALERTE, 'required', '', 'client') ;
|
300 |
alex |
113 |
$this->addElement ('textarea', 'description', ADAP_DESCRIPTION, array ('cols' => 50, 'rows' => 5)) ;
|
1497 |
florian |
114 |
$this->addElement ('text', 'chemin', ADAP_CHEMIN, array('size' => 35)) ;
|
|
|
115 |
$this->addElement('html', '<br />');
|
|
|
116 |
$this->setRequiredNote(ADAP_CHAMPS_REQUIS) ;
|
229 |
alex |
117 |
// on fait un groupe avec les boutons pour les mettres sur la même ligne
|
300 |
alex |
118 |
$buttons[] = &HTML_QuickForm::createElement('button', 'annuler', ADAP_ANNULER, array ("onclick" => "javascript:document.location.href='".str_replace ('&', '&', $url_retour->getURL())."'"));
|
|
|
119 |
$buttons[] = &HTML_QuickForm::createElement('submit', 'valider', ADAP_VALIDER);
|
1497 |
florian |
120 |
$this->addGroup($buttons, 'form_boutons', null, ' ');
|
229 |
alex |
121 |
} // end of member function _construitFormulaire
|
|
|
122 |
} // end of HTML_formulaireProjet
|
|
|
123 |
?>
|