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