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 |
// +------------------------------------------------------------------------------------------------------+
|
1400 |
alexandre_ |
41 |
|
|
|
42 |
include_once 'configuration/bottin.config.inc.php';
|
|
|
43 |
include_once INS_CHEMIN_APPLI.'langues/bottin.admin.langue_fr.php';
|
|
|
44 |
|
1107 |
florian |
45 |
class Inscription_Admin {
|
|
|
46 |
var $objet_pear_auth;
|
|
|
47 |
var $objet_pear_db;
|
|
|
48 |
var $objet_pear_url;
|
|
|
49 |
var $sortie_xhtml;
|
|
|
50 |
|
|
|
51 |
/** Fonction redigerContenu() - Affiche le formulaire de r?action
|
|
|
52 |
*
|
|
|
53 |
*
|
|
|
54 |
* @return string Le HTML
|
|
|
55 |
*/
|
|
|
56 |
function afficherContenuCorps()
|
|
|
57 |
{
|
|
|
58 |
/** Inclusion du fichier de configuration de cette application.*/
|
|
|
59 |
require_once PAP_CHEMIN_RACINE.'client/bottin/configuration/bottin.config.inc.php';
|
|
|
60 |
//require_once INS_CHEMIN_APPLI.'configuration/cartographie.config.inc.php';
|
|
|
61 |
require_once PAP_CHEMIN_API_PEAR.'HTML/QuickForm.php' ;
|
|
|
62 |
|
|
|
63 |
//-------------------------------------------------------------------------------------------------------------------
|
|
|
64 |
// Initialisation des attributs
|
|
|
65 |
$this->objet_pear_auth = $GLOBALS['_GEN_commun']['pear_auth'];
|
|
|
66 |
$this->objet_pear_db = $GLOBALS['ins_db'];
|
|
|
67 |
$this->objet_pear_url = $GLOBALS['_GEN_commun']['url'];
|
|
|
68 |
$this->sortie_xhtml = '<h1>'.INS_CONFIG_INSCRIPTION.'</h1><br />'."\n";
|
|
|
69 |
|
|
|
70 |
//-------------------------------------------------------------------------------------------------------------------
|
|
|
71 |
// Gestion des boutons de l'interface
|
|
|
72 |
if (isset($_POST['afficheur_annuler'])) {
|
|
|
73 |
return false;
|
|
|
74 |
} else if (isset($_POST['afficheur_enregistrer_quitter'])) {
|
|
|
75 |
$requete = 'UPDATE gen_menu SET gm_application_arguments="type_annuaire='.$_POST['type_annuaire'].'" WHERE gm_id_menu='.$_GET['adme_menu_id'];
|
|
|
76 |
$resultat = $this->objet_pear_db->query($requete) ;
|
|
|
77 |
if (DB::isError($resultat)) {
|
|
|
78 |
die ("Echec de la requete<br />".$resultat->getMessage()."<br />".$resultat->getDebugInfo()) ;
|
|
|
79 |
}
|
|
|
80 |
return false;
|
|
|
81 |
}
|
|
|
82 |
|
|
|
83 |
//--------------------------------------------------------------------------------------------------------------
|
|
|
84 |
// Gestion des valeurs par defauts, en fonctions des donnees sauvees dans carto_config
|
|
|
85 |
$requete = 'SELECT gm_application_arguments FROM gen_menu WHERE gm_id_menu='.$_GET['adme_menu_id'];
|
|
|
86 |
$resultat = $this->objet_pear_db->query($requete) ;
|
|
|
87 |
if (DB::isError($resultat)) {
|
1400 |
alexandre_ |
88 |
return ("Echec de la requete<br />".$resultat->getMessage()."<br />".$resultat->getDebugInfo()) ;
|
1107 |
florian |
89 |
}
|
|
|
90 |
$valeurs_par_defaut = array();
|
1400 |
alexandre_ |
91 |
if ($resultat->numRows()>0) {
|
1107 |
florian |
92 |
while ($ligne = $resultat->fetchRow(DB_FETCHMODE_OBJECT)) {
|
|
|
93 |
$arguments = explode(' ', $ligne->gm_application_arguments);
|
|
|
94 |
for ($i = 0; $i < count($arguments); $i++) {
|
|
|
95 |
$attr = explode('=', $arguments[$i]);
|
|
|
96 |
if ($attr[0] != '') {
|
|
|
97 |
$info_application->$attr[0] = (isset($attr[1]) ? $attr[1] : '');
|
|
|
98 |
}
|
|
|
99 |
}
|
|
|
100 |
}
|
|
|
101 |
//valeurs par defaut enregistrees dans la table
|
1400 |
alexandre_ |
102 |
if (isset ($info_application->type_annuaire))$valeurs_par_defaut['type_annuaire']=$info_application->type_annuaire;
|
1107 |
florian |
103 |
} else {
|
|
|
104 |
//valeurs par defaut pour afficher une carto des structures
|
1400 |
alexandre_ |
105 |
$valeurs_par_defaut['type_annuaire']=0;
|
1107 |
florian |
106 |
}
|
|
|
107 |
|
1400 |
alexandre_ |
108 |
// Requete pour recuperer les valeurs de la table inscription_config
|
|
|
109 |
$requete = 'select * from inscription_configuration';
|
|
|
110 |
$resultat = $this->objet_pear_db->getRow($requete, '', DB_FETCHMODE_ASSOC) ;
|
|
|
111 |
if (DB::isError($resultat)) {
|
|
|
112 |
return ("Echec de la requete<br />".$resultat->getMessage()."<br />".$resultat->getDebugInfo()) ;
|
|
|
113 |
}
|
|
|
114 |
if (!is_object($resultat)) {
|
|
|
115 |
$this->sortie_xhtml .= 'ok';
|
|
|
116 |
} else {
|
|
|
117 |
return 'La table inscription_configuration est vide. Il faut qu\'elle contienne au moins une ligne';
|
|
|
118 |
}
|
|
|
119 |
//-------------------------------------------------------------------------------------------------------------
|
1107 |
florian |
120 |
// Gestion du formulaire
|
|
|
121 |
$this->objet_pear_url->addQueryString('adme_site_id', $_GET['adme_site_id']);
|
|
|
122 |
$this->objet_pear_url->addQueryString('adme_menu_id', $_GET['adme_menu_id']);
|
|
|
123 |
$this->objet_pear_url->addQueryString('adme_action', 'administrer');
|
|
|
124 |
$form =& new HTML_QuickForm('form_param_inscription', 'post', str_replace('&', '&', $this->objet_pear_url->getUrl()));
|
|
|
125 |
$squelette =& $form->defaultRenderer();
|
|
|
126 |
$squelette->setFormTemplate("\n".'<form {attributes}>'."\n".'{content}'."\n".'</form>'."\n");
|
|
|
127 |
$squelette->setElementTemplate( '<p>'."\n".
|
|
|
128 |
'<label style="width:100px;padding:5px;text-align:right;">{label}'.
|
|
|
129 |
'<!-- BEGIN required --><span class="symbole_obligatoire">*</span><!-- END required -->'."\n".
|
|
|
130 |
'<!-- BEGIN error --><span class="erreur">{error}</span><!-- END error -->'."\n".
|
|
|
131 |
' : </label>'."\n".'{element}'."\n".
|
|
|
132 |
'</p>'."\n" );
|
|
|
133 |
$option_tables[0] = INS_ANNUAIRE_BOTTIN;
|
|
|
134 |
$option_tables[1] = INS_ANNUAIRE_ADMIN_PAPYRUS;
|
|
|
135 |
$form->addElement('select', 'type_annuaire', INS_TYPE_ANNUAIRE, $option_tables);
|
1400 |
alexandre_ |
136 |
//$liste_bouton_debut = '<ul class="liste_bouton">'."\n";
|
|
|
137 |
//$form->addElement('html', $liste_bouton_debut);
|
|
|
138 |
// checkbox pour la presence ou non d un formulaire structure
|
|
|
139 |
$form->addElement('checkbox', 'ic_formulaire_structure', INS_FORMULAIRE_STRUCTURE);
|
|
|
140 |
$form->addElement('text', 'ic_url_bazar', INS_URL_BAZAR);
|
|
|
141 |
$form->addElement('checkbox', 'ic_inscription_modere', INS_INSCRIPTION_MODERE_OUI_NON);
|
|
|
142 |
$form->addElement('textarea', 'ic_mail_moderateur', INS_MAILS_MODERATEURS, array('cols' => 30, 'rows' => 4));
|
|
|
143 |
$form->addElement('checkbox', 'ic_mail_valide_inscription', INS_INSCRIPTION_VERIFICATION_EMAIL);
|
|
|
144 |
$form->addElement('textarea', 'ic_mail_admin_apres_inscription', INS_MAILS_ADMIN, array('cols' => 30, 'rows' => 4));
|
|
|
145 |
$form->addElement('text', 'ic_sujet_mail', INS_SUJET_MAIL_CONFIRMATION);
|
|
|
146 |
$form->addElement('checkbox', 'ic_utilise_nom_wiki', INS_CHAMPS_WIKI);
|
|
|
147 |
$form->addElement('checkbox', 'ic_genere_nom_wiki', INS_GENERE_NOM_WIKI);
|
|
|
148 |
$form->addElement('checkbox', 'ic_utilise_reecriture_url', INS_REECRITURE_URL);
|
|
|
149 |
$form->addElement('text', 'ic_url_prefixe', INS_PREFIXE_URL);
|
1107 |
florian |
150 |
$form->addElement('submit', 'afficheur_enregistrer_quitter', INS_ENREGISTRER_ET_QUITTER);
|
1400 |
alexandre_ |
151 |
$form->addElement('button', 'afficheur_annuler', INS_ANNULER);
|
|
|
152 |
//$liste_bouton_fin = '</ul>'."\n";
|
|
|
153 |
//$form->addElement('html', $liste_bouton_fin);
|
|
|
154 |
foreach ($resultat as $cle => $valeur) $valeurs_par_defaut[$cle] = $valeur ;
|
1107 |
florian |
155 |
$form->setDefaults($valeurs_par_defaut);
|
|
|
156 |
$this->sortie_xhtml .= $form->toHTML()."\n";
|
|
|
157 |
return $this->sortie_xhtml;
|
|
|
158 |
}
|
|
|
159 |
|
|
|
160 |
}// Fin de la classe
|
|
|
161 |
|
|
|
162 |
// +------------------------------------------------------------------------------------------------------+
|
|
|
163 |
// | PIED du PROGRAMME |
|
|
|
164 |
// +------------------------------------------------------------------------------------------------------+
|
|
|
165 |
?>
|