Subversion Repositories Applications.projet

Rev

Rev 11 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 11 Rev 249
Line 17... Line 17...
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.2 2005-09-27 16:39:25 alexandre_tb Exp $
22
// CVS : $Id: HTML_formulaireCouperColler.class.php,v 1.3 2007-06-25 12:15:06 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
*
Line 29... Line 29...
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.3 $
35
// +------------------------------------------------------------------------------------------------------+
35
// +------------------------------------------------------------------------------------------------------+
36
*/
36
*/
Line 37... Line 37...
37
 
37
 
38
// +------------------------------------------------------------------------------------------------------+
38
// +------------------------------------------------------------------------------------------------------+
39
// |                                            ENTETE du PROGRAMME                                       |
39
// |                                            ENTETE du PROGRAMME                                       |
Line -... Line 40...
-
 
40
// +------------------------------------------------------------------------------------------------------+
-
 
41
 
40
// +------------------------------------------------------------------------------------------------------+
42
require_once 'HTML/QuickForm.php' ;
41
 
43
 
42
/**
44
/**
43
 * class HTML_formulaireCouperColler
45
 * class HTML_formulaireCouperColler
44
 * 
46
 * 
Line 56... Line 58...
56
        $squelette =& $this->defaultRenderer();
58
        $squelette =& $this->defaultRenderer();
57
        $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");
58
        $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");
Line 59... Line 61...
59
        
61
        
-
 
62
        $this->addElement('radio', 'projet_repertoire', '', PROJET_RACINE, 0) ;
60
        $this->addElement('radio', 'projet_repertoire', '', PROJET_RACINE, 0) ;
63
        
61
        if (count ($tableau_repertoire)) {
64
        if (count ($tableau_repertoire)) {
62
            $this->addElement('html', '<ul>') ;
65
            $this->addElement('html', '<ul>') ;
63
            foreach ($tableau_repertoire as $cle => $valeur) {
66
            foreach ($tableau_repertoire as $valeur) {
64
                if ($valeur->_id_pere ==0) {
67
                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
                    }
68
                    $this->addElement ('radio', 'projet_repertoire', '', $valeur['label'], $valeur['id']) ;
72
                    if (count ($sous_tableau)) $this->construitLigneRepertoire($sous_tableau) ;
69
                    if (count ($valeur['fils'])) $this->construireArbreRadio ($valeur['fils']);
73
                }
70
                }
74
            }
71
            }
75
            $this->addElement('html', '</ul>') ;
72
            $this->addElement('html', '</ul>') ;
Line 80... Line 77...
80
        
77
        
81
        // 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
82
        $buttons[] = &HTML_QuickForm::createElement('link', 'annuler', '', 
79
        $buttons[] = &HTML_QuickForm::createElement('link', 'annuler', '', 
83
                            preg_replace ("/&amp;/", "&", $url_annuler->getURL()), PROJET_FICHIER_ANNULER
80
                            preg_replace ("/&amp;/", "&", $url_annuler->getURL()), PROJET_FICHIER_ANNULER
84
                                            ); // Le preg_replace contourne un pb de QuickForm et Net_URL
81
                                            ); // Le preg_replace contourne un pb de QuickForm et Net_URL
85
                                                                                                            // qui remplacent deux fois les & par des &amp;
82
                                            // qui remplacent deux fois les & par des &amp;
86
                                                                                                            // ce qui fait échouer le lien
83
                                            // ce qui fait échouer le lien
87
        $buttons[] = &HTML_QuickForm::createElement('submit', 'valider_inscription_projet', PROJET_FICHIER_VALIDER);
84
        $buttons[] = &HTML_QuickForm::createElement('submit', 'valider_inscription_projet', PROJET_FICHIER_VALIDER);
88
        $this->addGroup($buttons, null, null, '&nbsp;');
85
        $this->addGroup($buttons, null, null, '&nbsp;');
Line -... Line 86...
-
 
86
    } // end of member function construitFormulaire
-
 
87
 
-
 
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']) ;
89
    } // end of member function construitFormulaire
93
    	 	$this->addElement('html', '</ul>') ;
90
 
94
    	 }
91
 
95
    }
92
    /**
96
    /**
93
    *
97
    *
94
    *
98
    *
95
    *
99
    *
Line 96... Line 100...
96
    *
100
    *
97
    */
101
    */
98
    
-
 
99
    function construitLigneRepertoire($tableau) {
102
    
100
        $this->addElement('html', '<ul>') ;
-
 
101
        foreach ($tableau as $valeur) {
103
    function construitLigneRepertoire($noeud) {
102
            $this->addElement('radio', 'projet_repertoire', '', $valeur->getNomLong(), $valeur->getIdDocument()) ;
104
        $this->addElement('html', '<ul>') ;
103
        }
105
        $this->addElement('radio', 'projet_repertoire', '', $noeud['label'], $noeud['id']) ;
104
        $this->addElement('html', '</ul>') ;
106
        $this->addElement('html', '</ul>') ;
105
    }
107
    }
Line 125... Line 127...
125
        $res = '<h2>'.PROJET_CHANGER_REPERTOIRE.'</h2>'."\n" ;
127
        $res = '<h2>'.PROJET_CHANGER_REPERTOIRE.'</h2>'."\n" ;
126
        $res .= PROJET_FICHIER_A_DEPLACER . $nom_de_fichier;
128
        $res .= PROJET_FICHIER_A_DEPLACER . $nom_de_fichier;
127
        $res .= '<h2>'.PROJET_CHOISISSEZ_REPERTOIRE.'</h2>' ;
129
        $res .= '<h2>'.PROJET_CHOISISSEZ_REPERTOIRE.'</h2>' ;
128
        $res .= HTML_QuickForm::toHTML() ;
130
        $res .= HTML_QuickForm::toHTML() ;
129
        return $res ;
131
        return $res ;
130
    } // end of member function toHTML
132
    }
131
} // end of HTML_formulaireCouperColler
-
 
-
 
133
}
132
?>
134
?>