2 |
ddelon |
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 |
// +------------------------------------------------------------------------------------------------------+
|
431 |
mathias |
22 |
// CVS : $Id: HTML_formulaireCouperColler.class.php,v 1.2 2005/09/27 16:39:25 alexandre_tb Exp $
|
2 |
ddelon |
23 |
/**
|
|
|
24 |
* Application projet
|
|
|
25 |
*
|
|
|
26 |
* La classe HTML_formulaireCouperColler
|
|
|
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
|
431 |
mathias |
34 |
*@version $Revision: 1.2 $
|
2 |
ddelon |
35 |
// +------------------------------------------------------------------------------------------------------+
|
|
|
36 |
*/
|
|
|
37 |
|
|
|
38 |
// +------------------------------------------------------------------------------------------------------+
|
|
|
39 |
// | ENTETE du PROGRAMME |
|
|
|
40 |
// +------------------------------------------------------------------------------------------------------+
|
|
|
41 |
|
249 |
alexandre_ |
42 |
require_once 'HTML/QuickForm.php' ;
|
|
|
43 |
|
2 |
ddelon |
44 |
/**
|
|
|
45 |
* class HTML_formulaireCouperColler
|
|
|
46 |
*
|
|
|
47 |
*/
|
|
|
48 |
class HTML_formulaireCouperColler extends HTML_QuickForm
|
|
|
49 |
{
|
|
|
50 |
/**
|
|
|
51 |
*
|
|
|
52 |
*
|
|
|
53 |
* @return void
|
|
|
54 |
* @access public
|
|
|
55 |
*/
|
|
|
56 |
function construitFormulaire($tableau_repertoire)
|
|
|
57 |
{
|
|
|
58 |
$squelette =& $this->defaultRenderer();
|
|
|
59 |
$squelette->setFormTemplate("\n".'<form{attributes}><ul>'."\n".'{content}'."\n".'</ul></form>'."\n");
|
|
|
60 |
$squelette->setElementTemplate( '<li style="list-style-type: none;">'."\n".'{element}'."\n".'</li>'."\n");
|
|
|
61 |
|
|
|
62 |
$this->addElement('radio', 'projet_repertoire', '', PROJET_RACINE, 0) ;
|
249 |
alexandre_ |
63 |
|
2 |
ddelon |
64 |
if (count ($tableau_repertoire)) {
|
|
|
65 |
$this->addElement('html', '<ul>') ;
|
249 |
alexandre_ |
66 |
foreach ($tableau_repertoire as $valeur) {
|
|
|
67 |
if ($valeur['id_pere'] ==0) {
|
|
|
68 |
$this->addElement ('radio', 'projet_repertoire', '', $valeur['label'], $valeur['id']) ;
|
|
|
69 |
if (count ($valeur['fils'])) $this->construireArbreRadio ($valeur['fils']);
|
2 |
ddelon |
70 |
}
|
|
|
71 |
}
|
|
|
72 |
$this->addElement('html', '</ul>') ;
|
|
|
73 |
}
|
|
|
74 |
|
|
|
75 |
$url_annuler = new Net_URL($this->getAttribute('action')) ;
|
|
|
76 |
$url_annuler->removeQueryString(PROJET_VARIABLE_ACTION) ;
|
|
|
77 |
|
|
|
78 |
// on fait un groupe avec les boutons pour les mettres sur la même ligne
|
|
|
79 |
$buttons[] = &HTML_QuickForm::createElement('link', 'annuler', '',
|
|
|
80 |
preg_replace ("/&/", "&", $url_annuler->getURL()), PROJET_FICHIER_ANNULER
|
|
|
81 |
); // Le preg_replace contourne un pb de QuickForm et Net_URL
|
249 |
alexandre_ |
82 |
// qui remplacent deux fois les & par des &
|
|
|
83 |
// ce qui fait échouer le lien
|
2 |
ddelon |
84 |
$buttons[] = &HTML_QuickForm::createElement('submit', 'valider_inscription_projet', PROJET_FICHIER_VALIDER);
|
|
|
85 |
$this->addGroup($buttons, null, null, ' ');
|
|
|
86 |
} // end of member function construitFormulaire
|
|
|
87 |
|
249 |
alexandre_ |
88 |
function construireArbreRadio(&$noeud) {
|
|
|
89 |
foreach ($noeud as $val) {
|
|
|
90 |
$this->addElement('html', '<ul>') ;
|
|
|
91 |
$this->construitLigneRepertoire($val) ;
|
|
|
92 |
if (count($val['fils'])) $this->construireArbreRadio ($val['fils']) ;
|
|
|
93 |
$this->addElement('html', '</ul>') ;
|
|
|
94 |
}
|
|
|
95 |
}
|
2 |
ddelon |
96 |
/**
|
|
|
97 |
*
|
|
|
98 |
*
|
|
|
99 |
*
|
|
|
100 |
*
|
|
|
101 |
*/
|
|
|
102 |
|
249 |
alexandre_ |
103 |
function construitLigneRepertoire($noeud) {
|
2 |
ddelon |
104 |
$this->addElement('html', '<ul>') ;
|
249 |
alexandre_ |
105 |
$this->addElement('radio', 'projet_repertoire', '', $noeud['label'], $noeud['id']) ;
|
2 |
ddelon |
106 |
$this->addElement('html', '</ul>') ;
|
|
|
107 |
}
|
|
|
108 |
/**
|
|
|
109 |
*
|
|
|
110 |
*
|
|
|
111 |
* @return void
|
|
|
112 |
* @access public
|
|
|
113 |
*/
|
|
|
114 |
function HTML_formulaireCouperColler($formName = '', $method = 'post', $action = '', $target = '_self', $attributes = '', $trackSubmit = false )
|
|
|
115 |
{
|
|
|
116 |
HTML_QuickForm::HTML_QuickForm($formName, $method, $action, $target, $attributes, $trackSubmit) ;
|
|
|
117 |
} // end of member function HTML_formulaireCouperColler
|
|
|
118 |
|
|
|
119 |
/**
|
|
|
120 |
*
|
|
|
121 |
*
|
|
|
122 |
* @return string
|
|
|
123 |
* @access public
|
|
|
124 |
*/
|
|
|
125 |
function toHTML($nom_de_fichier)
|
|
|
126 |
{
|
|
|
127 |
$res = '<h2>'.PROJET_CHANGER_REPERTOIRE.'</h2>'."\n" ;
|
|
|
128 |
$res .= PROJET_FICHIER_A_DEPLACER . $nom_de_fichier;
|
|
|
129 |
$res .= '<h2>'.PROJET_CHOISISSEZ_REPERTOIRE.'</h2>' ;
|
|
|
130 |
$res .= HTML_QuickForm::toHTML() ;
|
|
|
131 |
return $res ;
|
249 |
alexandre_ |
132 |
}
|
|
|
133 |
}
|
2 |
ddelon |
134 |
?>
|