1081 |
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 Annuaire_Backoffice_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_ANNUAIRE_BACKOFFICE.'</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();
|
1298 |
neiluj |
87 |
if ($resultat->numRows()>0) {
|
|
|
88 |
while ($ligne = $resultat->fetchRow(DB_FETCHMODE_ASSOC)) {
|
|
|
89 |
$arguments = explode(' ', $ligne->gm_application_arguments);
|
|
|
90 |
var_dump($arguments);
|
1081 |
florian |
91 |
for ($i = 0; $i < count($arguments); $i++) {
|
|
|
92 |
$attr = explode('=', $arguments[$i]);
|
|
|
93 |
if ($attr[0] != '') {
|
|
|
94 |
$info_application->$attr[0] = (isset($attr[1]) ? $attr[1] : '');
|
|
|
95 |
}
|
|
|
96 |
}
|
|
|
97 |
}
|
|
|
98 |
//valeurs par defaut enregistrees dans la table
|
|
|
99 |
$valeurs_par_defaut['type_annuaire']=$info_application->type_annuaire;
|
|
|
100 |
} else {
|
|
|
101 |
//valeurs par defaut pour afficher une carto des structures
|
|
|
102 |
$valeurs_par_defaut['type_annuaire']=0;
|
|
|
103 |
}
|
|
|
104 |
|
|
|
105 |
//--------------------------------------------------------------------------------------------------------------
|
|
|
106 |
// Gestion du formulaire
|
|
|
107 |
$this->objet_pear_url->addQueryString('adme_site_id', $_GET['adme_site_id']);
|
|
|
108 |
$this->objet_pear_url->addQueryString('adme_menu_id', $_GET['adme_menu_id']);
|
|
|
109 |
$this->objet_pear_url->addQueryString('adme_action', 'administrer');
|
|
|
110 |
$form =& new HTML_QuickForm('form_param_annuaire_backoffice', 'post', str_replace('&', '&', $this->objet_pear_url->getUrl()));
|
|
|
111 |
$squelette =& $form->defaultRenderer();
|
|
|
112 |
$squelette->setFormTemplate("\n".'<form{attributes}>'."\n".'{content}'."\n".'</form>'."\n");
|
|
|
113 |
$squelette->setElementTemplate( '<p>'."\n".
|
|
|
114 |
'<label style="width:100px;padding:5px;text-align:right;">{label}'.
|
|
|
115 |
'<!-- BEGIN required --><span class="symbole_obligatoire">*</span><!-- END required -->'."\n".
|
|
|
116 |
'<!-- BEGIN error --><span class="erreur">{error}</span><!-- END error -->'."\n".
|
|
|
117 |
' : </label>'."\n".'{element}'."\n".
|
|
|
118 |
'</p>'."\n" );
|
|
|
119 |
$option_tables[0] = INS_ANNUAIRE_BOTTIN;
|
|
|
120 |
$option_tables[1] = INS_ANNUAIRE_ADMIN_PAPYRUS;
|
|
|
121 |
$form->addElement('select', 'type_annuaire', INS_TYPE_ANNUAIRE, $option_tables);
|
|
|
122 |
$liste_bouton_debut = '<ul class="liste_bouton">'."\n";
|
|
|
123 |
$form->addElement('html', $liste_bouton_debut);
|
|
|
124 |
$form->addElement('submit', 'afficheur_enregistrer_quitter', INS_ENREGISTRER_ET_QUITTER);
|
|
|
125 |
$form->addElement('submit', 'afficheur_annuler', INS_ANNULER);
|
|
|
126 |
$liste_bouton_fin = '</ul>'."\n";
|
|
|
127 |
$form->addElement('html', $liste_bouton_fin);
|
|
|
128 |
$form->setDefaults($valeurs_par_defaut);
|
|
|
129 |
$this->sortie_xhtml .= $form->toHTML()."\n";
|
|
|
130 |
return $this->sortie_xhtml;
|
|
|
131 |
}
|
|
|
132 |
|
|
|
133 |
}// Fin de la classe
|
|
|
134 |
|
|
|
135 |
// +------------------------------------------------------------------------------------------------------+
|
|
|
136 |
// | PIED du PROGRAMME |
|
|
|
137 |
// +------------------------------------------------------------------------------------------------------+
|
|
|
138 |
?>
|