Subversion Repositories Applications.projet

Rev

Rev 249 | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

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