Subversion Repositories Applications.papyrus

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
1107 florian 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 Lesser 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
// | Lesser General Public License for more details.                                                      |
17
// |                                                                                                      |
18
// | You should have received a copy of the GNU Lesser 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
// +------------------------------------------------------------------------------------------------------+
22
// CVS : $Id$
23
/**
24
*
25
*@package bottin
26
//Auteur original :
27
*@author        Florian Schmitt <florian@ecole-et-nature.org>
28
//Autres auteurs :
29
*@copyright     Tela-Botanica 2000-2004
30
*@version       $Revision$ $Date$
31
// +------------------------------------------------------------------------------------------------------+
32
*/
33
// +------------------------------------------------------------------------------------------------------+
34
// |                                            ENTETE du PROGRAMME                                       |
35
// +------------------------------------------------------------------------------------------------------+
36
 
37
 
38
// +------------------------------------------------------------------------------------------------------+
39
// |                                                 CLASSE                                               |
40
// +------------------------------------------------------------------------------------------------------+
41
class Inscription_Admin {
42
    var $objet_pear_auth;
43
    var $objet_pear_db;
44
    var $objet_pear_url;
45
    var $sortie_xhtml;
46
 
47
    /** Fonction redigerContenu() - Affiche le formulaire de r?action
48
    *
49
    *
50
    *   @return  string  Le HTML
51
    */
52
    function afficherContenuCorps()
53
    {
54
        /** Inclusion du fichier de configuration de cette application.*/
55
        require_once PAP_CHEMIN_RACINE.'client/bottin/configuration/bottin.config.inc.php';
56
        //require_once INS_CHEMIN_APPLI.'configuration/cartographie.config.inc.php';
57
        require_once PAP_CHEMIN_API_PEAR.'HTML/QuickForm.php' ;
58
 
59
        //-------------------------------------------------------------------------------------------------------------------
60
        // Initialisation des attributs
61
        $this->objet_pear_auth = $GLOBALS['_GEN_commun']['pear_auth'];
62
        $this->objet_pear_db = $GLOBALS['ins_db'];
63
        $this->objet_pear_url = $GLOBALS['_GEN_commun']['url'];
64
        $this->sortie_xhtml = '<h1>'.INS_CONFIG_INSCRIPTION.'</h1><br />'."\n";
65
 
66
        //-------------------------------------------------------------------------------------------------------------------
67
        // Gestion des boutons de l'interface
68
        if (isset($_POST['afficheur_annuler'])) {
69
            return false;
70
        } else if (isset($_POST['afficheur_enregistrer_quitter'])) {
71
            $requete = 'UPDATE gen_menu SET gm_application_arguments="type_annuaire='.$_POST['type_annuaire'].'" WHERE gm_id_menu='.$_GET['adme_menu_id'];
72
            $resultat = $this->objet_pear_db->query($requete) ;
73
            if (DB::isError($resultat)) {
74
            	die ("Echec de la requete<br />".$resultat->getMessage()."<br />".$resultat->getDebugInfo()) ;
75
            }
76
            return false;
77
        }
78
 
79
        //--------------------------------------------------------------------------------------------------------------
80
        // Gestion des valeurs par defauts, en fonctions des donnees sauvees dans carto_config
81
        $requete = 'SELECT gm_application_arguments FROM gen_menu WHERE gm_id_menu='.$_GET['adme_menu_id'];
82
        $resultat = $this->objet_pear_db->query($requete) ;
83
        if (DB::isError($resultat)) {
84
        	die ("Echec de la requete<br />".$resultat->getMessage()."<br />".$resultat->getDebugInfo()) ;
85
        }
86
        $valeurs_par_defaut = array();
87
        if ($resultat->numRows()>0) {
88
        	while ($ligne = $resultat->fetchRow(DB_FETCHMODE_OBJECT)) {
89
        		$arguments = explode(' ', $ligne->gm_application_arguments);
90
 				for ($i = 0; $i < count($arguments); $i++) {
91
 					$attr = explode('=', $arguments[$i]);
92
 					if ($attr[0] != '') {
93
 						$info_application->$attr[0] = (isset($attr[1]) ? $attr[1] : '');
94
 					}
95
 			   	}
96
 			}
97
        	//valeurs par defaut enregistrees dans la table
98
        	$valeurs_par_defaut['type_annuaire']=$info_application->type_annuaire;
99
        } else {
100
        	//valeurs par defaut pour afficher une carto des structures
101
        	$valeurs_par_defaut['type_annuaire']=0;
102
        }
103
 
104
        //--------------------------------------------------------------------------------------------------------------
105
        // Gestion du formulaire
106
        $this->objet_pear_url->addQueryString('adme_site_id', $_GET['adme_site_id']);
107
        $this->objet_pear_url->addQueryString('adme_menu_id', $_GET['adme_menu_id']);
108
        $this->objet_pear_url->addQueryString('adme_action', 'administrer');
109
        $form =& new HTML_QuickForm('form_param_inscription', 'post', str_replace('&amp;', '&', $this->objet_pear_url->getUrl()));
110
        $squelette =& $form->defaultRenderer();
111
        $squelette->setFormTemplate("\n".'<form {attributes}>'."\n".'{content}'."\n".'</form>'."\n");
112
        $squelette->setElementTemplate( '<p>'."\n".
113
                                        '<label style="width:100px;padding:5px;text-align:right;">{label}'.
114
                                        '<!-- BEGIN required --><span class="symbole_obligatoire">*</span><!-- END required -->'."\n".
115
                                        '<!-- BEGIN error --><span class="erreur">{error}</span><!-- END error -->'."\n".
116
										' : </label>'."\n".'{element}'."\n".
117
										'</p>'."\n" );
118
        $option_tables[0] = INS_ANNUAIRE_BOTTIN;
119
        $option_tables[1] = INS_ANNUAIRE_ADMIN_PAPYRUS;
120
        $form->addElement('select', 'type_annuaire', INS_TYPE_ANNUAIRE, $option_tables);
121
        $liste_bouton_debut = '<ul class="liste_bouton">'."\n";
122
        $form->addElement('html', $liste_bouton_debut);
123
        $form->addElement('submit', 'afficheur_enregistrer_quitter', INS_ENREGISTRER_ET_QUITTER);
124
        $form->addElement('submit', 'afficheur_annuler', INS_ANNULER);
125
        $liste_bouton_fin = '</ul>'."\n";
126
        $form->addElement('html', $liste_bouton_fin);
127
        $form->setDefaults($valeurs_par_defaut);
128
        $this->sortie_xhtml .= $form->toHTML()."\n";
129
        return $this->sortie_xhtml;
130
    }
131
 
132
}// Fin de la classe
133
 
134
// +------------------------------------------------------------------------------------------------------+
135
// |                                            PIED du PROGRAMME                                         |
136
// +------------------------------------------------------------------------------------------------------+
137
?>