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>
|
1421 |
alexandre_ |
28 |
*@author Alexandre Granier <alexandre@tela-botanica.org>
|
1107 |
florian |
29 |
//Autres auteurs :
|
1421 |
alexandre_ |
30 |
*@copyright Tela-Botanica 2000-2007
|
1107 |
florian |
31 |
*@version $Revision$ $Date$
|
|
|
32 |
// +------------------------------------------------------------------------------------------------------+
|
|
|
33 |
*/
|
|
|
34 |
// +------------------------------------------------------------------------------------------------------+
|
|
|
35 |
// | ENTETE du PROGRAMME |
|
|
|
36 |
// +------------------------------------------------------------------------------------------------------+
|
|
|
37 |
|
|
|
38 |
|
|
|
39 |
// +------------------------------------------------------------------------------------------------------+
|
|
|
40 |
// | CLASSE |
|
|
|
41 |
// +------------------------------------------------------------------------------------------------------+
|
1400 |
alexandre_ |
42 |
|
|
|
43 |
include_once 'configuration/bottin.config.inc.php';
|
|
|
44 |
include_once INS_CHEMIN_APPLI.'langues/bottin.admin.langue_fr.php';
|
|
|
45 |
|
1107 |
florian |
46 |
class Inscription_Admin {
|
|
|
47 |
var $objet_pear_auth;
|
|
|
48 |
var $objet_pear_db;
|
|
|
49 |
var $objet_pear_url;
|
|
|
50 |
var $sortie_xhtml;
|
|
|
51 |
|
|
|
52 |
/** Fonction redigerContenu() - Affiche le formulaire de r?action
|
|
|
53 |
*
|
|
|
54 |
*
|
|
|
55 |
* @return string Le HTML
|
|
|
56 |
*/
|
|
|
57 |
function afficherContenuCorps()
|
|
|
58 |
{
|
|
|
59 |
/** Inclusion du fichier de configuration de cette application.*/
|
|
|
60 |
require_once PAP_CHEMIN_RACINE.'client/bottin/configuration/bottin.config.inc.php';
|
|
|
61 |
//require_once INS_CHEMIN_APPLI.'configuration/cartographie.config.inc.php';
|
|
|
62 |
require_once PAP_CHEMIN_API_PEAR.'HTML/QuickForm.php' ;
|
|
|
63 |
|
|
|
64 |
//-------------------------------------------------------------------------------------------------------------------
|
|
|
65 |
// Initialisation des attributs
|
|
|
66 |
$this->objet_pear_auth = $GLOBALS['_GEN_commun']['pear_auth'];
|
|
|
67 |
$this->objet_pear_db = $GLOBALS['ins_db'];
|
|
|
68 |
$this->objet_pear_url = $GLOBALS['_GEN_commun']['url'];
|
|
|
69 |
$this->sortie_xhtml = '<h1>'.INS_CONFIG_INSCRIPTION.'</h1><br />'."\n";
|
|
|
70 |
|
|
|
71 |
//-------------------------------------------------------------------------------------------------------------------
|
|
|
72 |
// Gestion des boutons de l'interface
|
|
|
73 |
if (isset($_POST['afficheur_annuler'])) {
|
|
|
74 |
return false;
|
1421 |
alexandre_ |
75 |
}
|
1107 |
florian |
76 |
|
1421 |
alexandre_ |
77 |
|
1107 |
florian |
78 |
$requete = 'SELECT gm_application_arguments FROM gen_menu WHERE gm_id_menu='.$_GET['adme_menu_id'];
|
|
|
79 |
$resultat = $this->objet_pear_db->query($requete) ;
|
|
|
80 |
if (DB::isError($resultat)) {
|
1400 |
alexandre_ |
81 |
return ("Echec de la requete<br />".$resultat->getMessage()."<br />".$resultat->getDebugInfo()) ;
|
1107 |
florian |
82 |
}
|
|
|
83 |
$valeurs_par_defaut = array();
|
1400 |
alexandre_ |
84 |
if ($resultat->numRows()>0) {
|
1107 |
florian |
85 |
while ($ligne = $resultat->fetchRow(DB_FETCHMODE_OBJECT)) {
|
|
|
86 |
$arguments = explode(' ', $ligne->gm_application_arguments);
|
|
|
87 |
for ($i = 0; $i < count($arguments); $i++) {
|
|
|
88 |
$attr = explode('=', $arguments[$i]);
|
|
|
89 |
if ($attr[0] != '') {
|
|
|
90 |
$info_application->$attr[0] = (isset($attr[1]) ? $attr[1] : '');
|
|
|
91 |
}
|
|
|
92 |
}
|
|
|
93 |
}
|
|
|
94 |
//valeurs par defaut enregistrees dans la table
|
1400 |
alexandre_ |
95 |
if (isset ($info_application->type_annuaire))$valeurs_par_defaut['type_annuaire']=$info_application->type_annuaire;
|
1107 |
florian |
96 |
} else {
|
|
|
97 |
//valeurs par defaut pour afficher une carto des structures
|
1400 |
alexandre_ |
98 |
$valeurs_par_defaut['type_annuaire']=0;
|
1107 |
florian |
99 |
}
|
|
|
100 |
|
1421 |
alexandre_ |
101 |
//-------------------------------------------------------------------------------------------------------------
|
|
|
102 |
// Si le formulaire vient d etre poste, on met a jour la table inscription_configuration
|
|
|
103 |
|
|
|
104 |
if (isset($_POST['enregistrer_quitter'])) {
|
|
|
105 |
$req = 'update inscription_configuration set '.
|
1426 |
alexandre_ |
106 |
'ic_nom_inscription="'.$_POST['ic_nom_inscription'].'", '.
|
1421 |
alexandre_ |
107 |
'ic_url_bazar="'.$_POST['ic_url_bazar'].'", '.
|
1426 |
alexandre_ |
108 |
(isset ($_POST['ic_inscription_modere']) ? 'ic_inscription_modere="'.$_POST['ic_inscription_modere'].'", ':'ic_inscription_modere=0, ').
|
1421 |
alexandre_ |
109 |
'ic_mail_moderateur="'.$_POST['ic_mail_moderateur'].'", '.
|
|
|
110 |
'ic_sujet_mail="'.$_POST['ic_sujet_mail'].'", '.
|
|
|
111 |
'ic_utilise_nom_wiki="'.$_POST['ic_utilise_nom_wiki'].'", '.
|
|
|
112 |
(isset ($_POST['ic_genere_nom_wiki']) ? 'ic_genere_nom_wiki="'.$_POST['ic_genere_nom_wiki'].'", ':'').
|
|
|
113 |
(isset ($_POST['ic_utilise_reecriture_url']) ? 'ic_utilise_reecriture_url="'.$_POST['ic_utilise_reecriture_url'].'", ':'').
|
|
|
114 |
'ic_url_prefixe="'.$_POST['ic_url_prefixe'].'", '.
|
|
|
115 |
(isset ($_POST['ic_mail_valide_inscription']) ? 'ic_mail_valide_inscription="'.$_POST['ic_mail_valide_inscription'].'", ':'').
|
|
|
116 |
'ic_google_key="'.$_POST['ic_google_key'].'", '.
|
1426 |
alexandre_ |
117 |
'ic_mail_admin_apres_inscription="'.$_POST['ic_mail_admin_apres_inscription'].'"'.
|
|
|
118 |
' where ic_id_inscription="'.$_GET['id_inscription'].'"';
|
1421 |
alexandre_ |
119 |
|
1426 |
alexandre_ |
120 |
$this->objet_pear_db->query($req);
|
|
|
121 |
$this->sortie_xhtml .= $req;
|
1421 |
alexandre_ |
122 |
// On place la configuration dans gm_application_arguments de la table gen_menu
|
1426 |
alexandre_ |
123 |
$requete = 'update gen_menu set gm_application_arguments = \'config='.serialize($_POST).'" where gm_id_menu="'.
|
1421 |
alexandre_ |
124 |
$_REQUEST['adme_menu_id'].'\'';
|
|
|
125 |
$resultat = $this->objet_pear_db->query($requete);
|
|
|
126 |
|
|
|
127 |
if (DB::isError($resultat)) {
|
|
|
128 |
return ("Echec de la requete<br />".$resultat->getMessage()."<br />".$resultat->getDebugInfo()) ;
|
|
|
129 |
}
|
|
|
130 |
|
|
|
131 |
}
|
|
|
132 |
|
|
|
133 |
|
1400 |
alexandre_ |
134 |
// Requete pour recuperer les valeurs de la table inscription_config
|
1426 |
alexandre_ |
135 |
$requete = 'select * from inscription_configuration order by ic_id_inscription';
|
1421 |
alexandre_ |
136 |
$resultat = $this->objet_pear_db->query($requete) ;
|
1400 |
alexandre_ |
137 |
if (DB::isError($resultat)) {
|
|
|
138 |
return ("Echec de la requete<br />".$resultat->getMessage()."<br />".$resultat->getDebugInfo()) ;
|
|
|
139 |
}
|
1421 |
alexandre_ |
140 |
if ($resultat->numRows() == 0) {
|
1400 |
alexandre_ |
141 |
return 'La table inscription_configuration est vide. Il faut qu\'elle contienne au moins une ligne';
|
|
|
142 |
}
|
1426 |
alexandre_ |
143 |
while ($ligne = $resultat->fetchRow(DB_FETCHMODE_ASSOC)) {
|
|
|
144 |
$this->sortie_xhtml .= '<h2>'.$ligne['ic_nom_inscription'].'</h2>';
|
|
|
145 |
$id = $ligne['ic_id_inscription'];
|
|
|
146 |
//-------------------------------------------------------------------------------------------------------------
|
|
|
147 |
// Gestion du formulaire
|
|
|
148 |
$GLOBALS['ins_url']->addQueryString('adme_site_id', $_GET['adme_site_id']);
|
|
|
149 |
$GLOBALS['ins_url']->addQueryString('adme_menu_id', $_GET['adme_menu_id']);
|
|
|
150 |
$GLOBALS['ins_url']->addQueryString('adme_action', 'administrer');
|
|
|
151 |
$GLOBALS['ins_url']->addQueryString('id_inscription', $ligne['ic_id_inscription']);
|
|
|
152 |
$form[$id] = &new HTML_QuickForm('form_param_inscription_'.$id, 'post', str_replace('&', '&', $GLOBALS['ins_url']->getUrl()));
|
|
|
153 |
$squelette =& $form[$id]->defaultRenderer();
|
|
|
154 |
$squelette->setFormTemplate("\n".'<form {attributes}>'."\n".'{content}'."\n".'</form>'."\n");
|
|
|
155 |
$squelette->setElementTemplate( '<p>'."\n".
|
|
|
156 |
'<label style="width:100px;padding:5px;text-align:right;">{label}'.
|
|
|
157 |
'<!-- BEGIN required --><span class="symbole_obligatoire">*</span><!-- END required -->'."\n".
|
|
|
158 |
'<!-- BEGIN error --><span class="erreur">{error}</span><!-- END error -->'."\n".
|
|
|
159 |
' : </label>'."\n".'{element}'."\n".
|
|
|
160 |
'</p>'."\n" );
|
|
|
161 |
/*
|
|
|
162 |
$option_tables[0] = INS_ANNUAIRE_BOTTIN;
|
|
|
163 |
$option_tables[1] = INS_ANNUAIRE_ADMIN_PAPYRUS;
|
|
|
164 |
$form[$id]->addElement('select', 'type_annuaire', INS_TYPE_ANNUAIRE, $option_tables);
|
|
|
165 |
*/
|
|
|
166 |
//$liste_bouton_debut = '<ul class="liste_bouton">'."\n";
|
|
|
167 |
//$form[$id]->addElement('html', $liste_bouton_debut);
|
|
|
168 |
// checkbox pour la presence ou non d un formulaire structure
|
|
|
169 |
//$form[$id]->addElement('checkbox', 'ic_formulaire_structure', INS_FORMULAIRE_STRUCTURE);
|
|
|
170 |
$form[$id]->addElement('text', 'ic_url_bazar', INS_URL_BAZAR);
|
|
|
171 |
$form[$id]->addElement('text', 'ic_nom_inscription', INS_NOM_INSCRIPTION);
|
|
|
172 |
$form[$id]->addElement('checkbox', 'ic_inscription_modere', INS_INSCRIPTION_MODERE);
|
|
|
173 |
$form[$id]->addElement('textarea', 'ic_mail_moderateur', INS_MAILS_MODERATEURS, array('cols' => 30, 'rows' => 4));
|
|
|
174 |
$form[$id]->addElement('checkbox', 'ic_mail_valide_inscription', INS_INSCRIPTION_VERIFICATION_EMAIL);
|
|
|
175 |
$form[$id]->addElement('textarea', 'ic_mail_admin_apres_inscription', INS_MAILS_ADMIN, array('cols' => 30, 'rows' => 4));
|
|
|
176 |
$form[$id]->addElement('text', 'ic_sujet_mail', INS_SUJET_MAIL_CONFIRMATION, array('size' => '60'));
|
|
|
177 |
$form[$id]->addElement('text', 'ic_sujet_mail_inscription_prise_en_compte', INS_SUJET_MAIL_INSCRIPTION_PRISE_EN_COMPTE,
|
|
|
178 |
array('size' => '60'));
|
|
|
179 |
$form[$id]->addElement('textarea', 'ic_corps_mail_inscription_prise_en_compte', INS_CORPS_MAIL_INSCRIPTION_PRISE_EN_COMPTE,
|
|
|
180 |
array('cols' => '60', 'rows' =>'8' ));
|
|
|
181 |
$form[$id]->addElement('checkbox', 'ic_utilise_nom_wiki', INS_CHAMPS_WIKI);
|
|
|
182 |
$form[$id]->addElement('checkbox', 'ic_genere_nom_wiki', INS_GENERE_NOM_WIKI);
|
|
|
183 |
$form[$id]->addElement('checkbox', 'ic_utilise_reecriture_url', INS_REECRITURE_URL);
|
|
|
184 |
$form[$id]->addElement('text', 'ic_url_prefixe', INS_PREFIXE_URL);
|
|
|
185 |
$form[$id]->addElement('text', 'ic_google_key', INS_GOOGLE_KEY, array('size' => '60'));
|
|
|
186 |
$form[$id]->addElement('submit', 'enregistrer_quitter', INS_ENREGISTRER_ET_QUITTER);
|
|
|
187 |
$form[$id]->addElement('button', 'afficheur_annuler', INS_ANNULER);
|
|
|
188 |
|
|
|
189 |
$form[$id]->setDefaults($ligne);
|
|
|
190 |
$this->sortie_xhtml .= $form[$id]->toHTML()."\n";
|
|
|
191 |
|
|
|
192 |
}
|
1107 |
florian |
193 |
return $this->sortie_xhtml;
|
|
|
194 |
}
|
|
|
195 |
|
|
|
196 |
}// Fin de la classe
|
|
|
197 |
|
|
|
198 |
// +------------------------------------------------------------------------------------------------------+
|
|
|
199 |
// | PIED du PROGRAMME |
|
|
|
200 |
// +------------------------------------------------------------------------------------------------------+
|
|
|
201 |
?>
|