Subversion Repositories Applications.papyrus

Rev

Rev 141 | Rev 150 | Go to most recent revision | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 141 Rev 148
1
<?php
1
<?php
2
/*vim: set expandtab tabstop=4 shiftwidth=4: */ 
2
/*vim: set expandtab tabstop=4 shiftwidth=4: */ 
3
// +------------------------------------------------------------------------------------------------------+
3
// +------------------------------------------------------------------------------------------------------+
4
// | PHP version 4.1                                                                                      |
4
// | PHP version 4.1                                                                                      |
5
// +------------------------------------------------------------------------------------------------------+
5
// +------------------------------------------------------------------------------------------------------+
6
// | Copyright (C) 2004 Tela Botanica (accueil@tela-botanica.org)                                         |
6
// | Copyright (C) 2004 Tela Botanica (accueil@tela-botanica.org)                                         |
7
// +------------------------------------------------------------------------------------------------------+
7
// +------------------------------------------------------------------------------------------------------+
8
// | This file is part of Papyrus.                                                                        |
8
// | This file is part of Papyrus.                                                                        |
9
// |                                                                                                      |
9
// |                                                                                                      |
10
// | Foobar is free software; you can redistribute it and/or modify                                       |
10
// | Foobar is free software; you can redistribute it and/or modify                                       |
11
// | it under the terms of the GNU General Public License as published by                                 |
11
// | it under the terms of the GNU General Public License as published by                                 |
12
// | the Free Software Foundation; either version 2 of the License, or                                    |
12
// | the Free Software Foundation; either version 2 of the License, or                                    |
13
// | (at your option) any later version.                                                                  |
13
// | (at your option) any later version.                                                                  |
14
// |                                                                                                      |
14
// |                                                                                                      |
15
// | Foobar is distributed in the hope that it will be useful,                                            |
15
// | Foobar is distributed in the hope that it will be useful,                                            |
16
// | but WITHOUT ANY WARRANTY; without even the implied warranty of                                       |
16
// | but WITHOUT ANY WARRANTY; without even the implied warranty of                                       |
17
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the                                        |
17
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the                                        |
18
// | GNU General Public License for more details.                                                         |
18
// | GNU General Public License for more details.                                                         |
19
// |                                                                                                      |
19
// |                                                                                                      |
20
// | You should have received a copy of the GNU General Public License                                    |
20
// | You should have received a copy of the GNU General Public License                                    |
21
// | along with Foobar; if not, write to the Free Software                                                |
21
// | along with Foobar; if not, write to the Free Software                                                |
22
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA                            |
22
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA                            |
23
// +------------------------------------------------------------------------------------------------------+
23
// +------------------------------------------------------------------------------------------------------+
24
// CVS : $Id: adme_general.fonct.php,v 1.4 2004-11-09 17:48:35 jpm Exp $
24
// CVS : $Id: adme_general.fonct.php,v 1.5 2004-11-10 11:58:54 jpm Exp $
25
/**
25
/**
26
* Contient l'affichage par défaut de l'appli quand aucune actin
26
* Contient l'affichage par défaut de l'appli quand aucune actin
27
*
27
*
28
* Ce fichier contient les fonctions d'affichage commune à toute l'application Admin Menu.
28
* Ce fichier contient les fonctions d'affichage commune à toute l'application Admin Menu.
29
* Nous y trouvons, entre autre, la fonction d'affichage par défaut de l'appli.
29
* Nous y trouvons, entre autre, la fonction d'affichage par défaut de l'appli.
30
*
30
*
31
*@package Admin_menu
31
*@package Admin_menu
32
*@subpackage Fonctions
32
*@subpackage Fonctions
33
//Auteur original :
33
//Auteur original :
34
*@author        Jean-Pascal MILCENT <jpm@tela-botanica.org>
34
*@author        Jean-Pascal MILCENT <jpm@tela-botanica.org>
35
//Autres auteurs :
35
//Autres auteurs :
36
*@author        Aucun
36
*@author        Aucun
37
*@copyright     Tela-Botanica 2000-2004
37
*@copyright     Tela-Botanica 2000-2004
38
*@version       $Revision: 1.4 $ $Date: 2004-11-09 17:48:35 $
38
*@version       $Revision: 1.5 $ $Date: 2004-11-10 11:58:54 $
39
// +------------------------------------------------------------------------------------------------------+
39
// +------------------------------------------------------------------------------------------------------+
40
*/
40
*/
41
 
41
 
42
// +------------------------------------------------------------------------------------------------------+
42
// +------------------------------------------------------------------------------------------------------+
43
// |                                            ENTETE du PROGRAMME                                       |
43
// |                                            ENTETE du PROGRAMME                                       |
44
// +------------------------------------------------------------------------------------------------------+
44
// +------------------------------------------------------------------------------------------------------+
45
 
45
 
46
 
46
 
47
// +------------------------------------------------------------------------------------------------------+
47
// +------------------------------------------------------------------------------------------------------+
48
// |                                           LISTE de FONCTIONS                                         |
48
// |                                           LISTE de FONCTIONS                                         |
49
// +------------------------------------------------------------------------------------------------------+
49
// +------------------------------------------------------------------------------------------------------+
50
/** Fonction ADME_afficherFormPrincipal() - Affichage par défaut.
50
/** Fonction ADME_afficherFormPrincipal() - Affichage par défaut.
51
*
51
*
52
* Fournit l'affichage par défaut de l'application Admin Menus.
52
* Fournit l'affichage par défaut de l'application Admin Menus.
53
*
53
*
54
* @param  object objet Pear de connection à la base de données.
54
* @param  object objet Pear de connection à la base de données.
55
* @param  object objet Pear représentant l'url de base.
55
* @param  object objet Pear représentant l'url de base.
56
* @return string le XHTML par défaut de la page.
56
* @return string le XHTML par défaut de la page.
57
*/
57
*/
58
function ADME_afficherFormPrincipal($objet_pear_db, $objet_pear_url, $adme_site_id, $adme_menu_id, $adme_action)
58
function ADME_afficherFormPrincipal($objet_pear_db, $objet_pear_url, $adme_site_id, $adme_menu_id, $adme_action)
59
{
59
{
60
    //---------------------------------------------------------------------------------------------------------------
60
    //---------------------------------------------------------------------------------------------------------------
61
    // Nous affichons la liste des menus classiques et communs
61
    // Nous affichons la liste des menus classiques et communs
62
    $retour = '';
62
    $retour = '';
63
    // Liste des sites principaux
63
    // Liste des sites principaux
64
    $requete =  'SELECT gs_id_site, gs_code_alpha, gs_nom '.
64
    $requete =  'SELECT gs_id_site, gs_code_alpha, gs_nom '.
65
                'FROM gen_site, gen_site_relation '.
65
                'FROM gen_site, gen_site_relation '.
66
                'WHERE gsr_id_site_01 = gsr_id_site_02 '.
66
                'WHERE gsr_id_site_01 = gsr_id_site_02 '.
67
                'AND gsr_id_valeur = 102 '.// 102 = site "principal"
67
                'AND gsr_id_valeur = 102 '.// 102 = site "principal"
68
                'AND gsr_id_site_01 = gs_id_site '.
68
                'AND gsr_id_site_01 = gs_id_site '.
69
                'ORDER BY gsr_ordre ASC';
69
                'ORDER BY gsr_ordre ASC';
70
    
70
    
71
    $resultat = $objet_pear_db->query($requete);
71
    $resultat = $objet_pear_db->query($requete);
72
    (DB::isError($resultat)) ? die(BOG_afficherErreurSql(__FILE__, __LINE__, $resultat->getMessage(), $requete)) : '' ;
72
    (DB::isError($resultat)) ? die(BOG_afficherErreurSql(__FILE__, __LINE__, $resultat->getMessage(), $requete)) : '' ;
73
    
73
    
74
    //---------------------------------------------------------------------------------------------------------------
74
    //---------------------------------------------------------------------------------------------------------------
75
    // Création du formulaire
75
    // Création du formulaire
76
    // Notes : Quickform semble remplacer les & des &amp; à nouveau par des &amp; solution utiliser str_replace()...
76
    // Notes : Quickform semble remplacer les & des &amp; à nouveau par des &amp; solution utiliser str_replace()...
77
    $form =& new HTML_QuickForm('adme_form_sites', 'post', str_replace('&amp;', '&', $objet_pear_url->getUrl()));
77
    $form =& new HTML_QuickForm('adme_form_sites', 'post', str_replace('&amp;', '&', $objet_pear_url->getUrl()));
78
    $tab_index = 1000;
78
    $tab_index = 1000;
79
    $squelette =& $form->defaultRenderer();
79
    $squelette =& $form->defaultRenderer();
80
    $squelette->setFormTemplate("\n".'<form{attributes}>'."\n".'{content}'."\n"."\n".'</form>'."\n");
80
    $squelette->setFormTemplate("\n".'<form{attributes}>'."\n".'{content}'."\n"."\n".'</form>'."\n");
81
    $squelette->setElementTemplate( '{label}'."\n".'{element}'."\n".
81
    $squelette->setElementTemplate( '{label}'."\n".'{element}'."\n".
82
                                    '<!-- BEGIN required --><span class="symbole_obligatoire">*</span><!-- END required -->'."\n".
82
                                    '<!-- BEGIN required --><span class="symbole_obligatoire">*</span><!-- END required -->'."\n".
83
                                    '<!-- BEGIN error --><span class="erreur">{error}</span><!-- END error -->'."\n");
83
                                    '<!-- BEGIN error --><span class="erreur">{error}</span><!-- END error -->'."\n");
84
    $partie_site_debut =    '<fieldset>'."\n".
84
    $partie_site_debut =    '<fieldset>'."\n".
85
                            '<legend>'.'Listes des sites'.'</legend>'."\n";
85
                            '<legend>'.ADME_LG_TITRE_SITE.'</legend>'."\n";
86
    $form->addElement('html', $partie_site_debut);
86
    $form->addElement('html', $partie_site_debut);
87
    $id = 'adme_site_id';
87
    $id = 'adme_site_id';
88
    $aso_attributs = array('id'=> $id, 'tabindex' => $tab_index++, 'onchange' => 'javascript:this.form.submit();');
88
    $aso_attributs = array('id'=> $id, 'tabindex' => $tab_index++, 'onchange' => 'javascript:this.form.submit();');
89
    $label = '<label for="'.$id.'">'.'Choix du site à administrer : '.'</label>';
89
    $label = '<label for="'.$id.'">'.ADME_LG_FORM_SITE_CHOIX.'</label>';
90
    $objet_select = new HTML_QuickForm_select($id, $label, '', $aso_attributs);
90
    $objet_select = new HTML_QuickForm_select($id, $label, '', $aso_attributs);
91
    $aso_options = array();
91
    $aso_options = array();
92
    while ($ligne = $resultat->fetchRow(DB_FETCHMODE_OBJECT)) {
92
    while ($ligne = $resultat->fetchRow(DB_FETCHMODE_OBJECT)) {
93
        $site_nom = $ligne->gs_nom;
93
        $site_nom = $ligne->gs_nom;
94
        if (!isset($adme_site_id) || $adme_site_id == 0) {
94
        if (!isset($adme_site_id) || $adme_site_id == 0) {
95
            $adme_site_id = $ligne->gs_id_site;
95
            $adme_site_id = $ligne->gs_id_site;
96
        }
96
        }
97
        if ($ligne->gs_id_site == $adme_site_id) {
97
        if ($ligne->gs_id_site == $adme_site_id) {
98
            $objet_select->addOption(htmlentities($ligne->gs_nom.' ('.$ligne->gs_code_alpha.')'), $ligne->gs_id_site, 'selected="selected"');
98
            $objet_select->addOption(htmlentities($ligne->gs_nom.' ('.$ligne->gs_code_alpha.')'), $ligne->gs_id_site, 'selected="selected"');
99
        } else {
99
        } else {
100
            $objet_select->addOption(htmlentities($ligne->gs_nom.' ('.$ligne->gs_code_alpha.')'), $ligne->gs_id_site);
100
            $objet_select->addOption(htmlentities($ligne->gs_nom.' ('.$ligne->gs_code_alpha.')'), $ligne->gs_id_site);
101
        }
101
        }
102
    }
102
    }
103
    $resultat->free();
103
    $resultat->free();
104
    $form->addElement($objet_select);
104
    $form->addElement($objet_select);
105
    $form->addElement('submit', 'choisir_site', 'OK');
105
    $form->addElement('submit', 'choisir_site', ADME_LG_FORM_SITE_VALIDER);
106
    $partie_site_fin = "\n".'</fieldset>';
106
    $partie_site_fin = "\n".'</fieldset>';
107
    $form->addElement('html', $partie_site_fin);
107
    $form->addElement('html', $partie_site_fin);
108
    
108
    
109
    // Instanciation des valeurs par défaut du formulaire
109
    // Instanciation des valeurs par défaut du formulaire
110
    $form->setDefaults($adme_site_id);
110
    $form->setDefaults($adme_site_id);
111
    
111
    
112
    $retour .= '<h1>'.'Configuration des menus du site : '.$site_nom.'</h1>'."\n";
112
    $retour .= '<h1>'.ADME_LG_MENU_TITRE.$site_nom.'</h1>'."\n";
113
    $retour .= '<p>'."\n";
113
    $retour .= '<p>'."\n";
114
    $retour .= $form->toHTML()."\n";
114
    $retour .= $form->toHTML()."\n";
115
    $retour .= '</p>'."\n";
115
    $retour .= '</p>'."\n";
116
    
116
    
117
    //---------------------------------------------------------------------------------------------------------------
117
    //---------------------------------------------------------------------------------------------------------------
118
    // Gestion des menus classiques
118
    // Gestion des menus classiques
119
    $etiquette_ajouter = 'Ajouter un menu classique';
-
 
120
    $retour .= '<p>'."\n";
119
    $retour .= '<p>'."\n";
121
    $objet_pear_url_copie = $objet_pear_url;
120
    $objet_pear_url_copie = $objet_pear_url;
122
    $objet_pear_url_copie->addQueryString('adme_action', 'ajouter_menu_classique');
121
    $objet_pear_url_copie->addQueryString('adme_action', 'ajouter_menu_classique');
123
    $objet_pear_url_copie->addQueryString('adme_site_id', $adme_site_id);
122
    $objet_pear_url_copie->addQueryString('adme_site_id', $adme_site_id);
124
    $objet_pear_url_copie->addQueryString('adme_menu_id', 0);
123
    $objet_pear_url_copie->addQueryString('adme_menu_id', 0);
125
    $url_ajout_menu_classique_n1 = $objet_pear_url_copie->getURL();
124
    $url_ajout_menu_classique_n1 = $objet_pear_url_copie->getURL();
126
    unset($url_ajout_menu_n1);
125
    unset($url_ajout_menu_n1);
127
    $retour .=    '<a href="'.$url_ajout_menu_classique_n1.'" >'.
126
    $retour .=    '<a href="'.$url_ajout_menu_classique_n1.'" >'.
128
                            $etiquette_ajouter.'&nbsp;'.
127
                            ADME_LG_MENU_CLASSIQUE_RACINE.'&nbsp;'.
129
                            '<img class="'.ADME_CLASS_IMG_ICONE.'" src="'.ADME_IMAGE_NOUVEAU.'" alt="+" />'.
128
                            '<img class="'.ADME_CLASS_IMG_ICONE.'" src="'.ADME_IMAGE_NOUVEAU.'" alt="+" />'.
130
                        '</a>'."\n";
129
                        '</a>'."\n";
131
    $retour .= '</p>'."\n";
130
    $retour .= '</p>'."\n";
132
    
131
    
133
    $retour .= ADME_afficherListeMenuClassique($objet_pear_db, $objet_pear_url, $adme_site_id, $adme_menu_id, $adme_action, 0);
132
    $retour .= ADME_afficherListeMenuClassique($objet_pear_db, $objet_pear_url, $adme_site_id, $adme_menu_id, $adme_action, 0);
134
    //---------------------------------------------------------------------------------------------------------------
133
    //---------------------------------------------------------------------------------------------------------------
135
    // Gestion des menus communs
134
    // Gestion des menus communs
136
    $etiquette_ajouter = 'Ajouter un menu commun';
-
 
137
    $retour .=     '<p>'."\n";
135
    $retour .=     '<p>'."\n";
138
    $objet_pear_url_copie = $objet_pear_url;
136
    $objet_pear_url_copie = $objet_pear_url;
139
    $objet_pear_url_copie->addQueryString('adme_action', 'ajouter_menu_commun');
137
    $objet_pear_url_copie->addQueryString('adme_action', 'ajouter_menu_commun');
140
    $objet_pear_url_copie->addQueryString('adme_site_id', $adme_site_id);
138
    $objet_pear_url_copie->addQueryString('adme_site_id', $adme_site_id);
141
    $objet_pear_url_copie->addQueryString('adme_menu_id', 0);
139
    $objet_pear_url_copie->addQueryString('adme_menu_id', 0);
142
    $url_ajout_menu_commun_n1 = $objet_pear_url_copie->getURL();
140
    $url_ajout_menu_commun_n1 = $objet_pear_url_copie->getURL();
143
    unset($url_ajout_menu_n1);
141
    unset($url_ajout_menu_n1);
144
    $retour .=     '<a href="'.$url_ajout_menu_commun_n1.'">'.
142
    $retour .=     '<a href="'.$url_ajout_menu_commun_n1.'">'.
145
                            $etiquette_ajouter.'&nbsp;'.
143
                            ADME_LG_MENU_COMMUN_RACINE.'&nbsp;'.
146
                            '<img class="'.ADME_CLASS_IMG_ICONE.'" src="'.ADME_IMAGE_NOUVEAU.'" alt="+" />'.
144
                            '<img class="'.ADME_CLASS_IMG_ICONE.'" src="'.ADME_IMAGE_NOUVEAU.'" alt="+" />'.
147
                        '</a>'."\n";
145
                        '</a>'."\n";
148
    $retour .=     '</p>'."\n";
146
    $retour .=     '</p>'."\n";
149
    $retour .= ADME_afficherListeMenuCommun($objet_pear_db, $objet_pear_url, $adme_site_id, $adme_menu_id, $adme_action, 0);
147
    $retour .= ADME_afficherListeMenuCommun($objet_pear_db, $objet_pear_url, $adme_site_id, $adme_menu_id, $adme_action, 0);
150
    return $retour;
148
    return $retour;
151
}
149
}
152
 
150
 
153
// +------------------------------------------------------------------------------------------------------+
151
// +------------------------------------------------------------------------------------------------------+
154
// |                                            PIED du PROGRAMME                                         |
152
// |                                            PIED du PROGRAMME                                         |
155
// +------------------------------------------------------------------------------------------------------+
153
// +------------------------------------------------------------------------------------------------------+
156
 
154
 
157
 
155
 
158
/* +--Fin du code ----------------------------------------------------------------------------------------+
156
/* +--Fin du code ----------------------------------------------------------------------------------------+
159
*
157
*
160
* $Log: not supported by cvs2svn $
158
* $Log: not supported by cvs2svn $
-
 
159
* Revision 1.4  2004/11/09 17:48:35  jpm
-
 
160
* Gestion de différentes interfaces d'administration.
-
 
161
*
161
* Revision 1.3  2004/11/09 12:37:34  jpm
162
* Revision 1.3  2004/11/09 12:37:34  jpm
162
* Fin de gestion des menus et mise en conformité avec la convention de codage.
163
* Fin de gestion des menus et mise en conformité avec la convention de codage.
163
*
164
*
164
* Revision 1.2  2004/11/08 17:41:07  jpm
165
* Revision 1.2  2004/11/08 17:41:07  jpm
165
* Légères corrections : multisite, corrections SQL.
166
* Légères corrections : multisite, corrections SQL.
166
*
167
*
167
* Revision 1.1  2004/11/04 12:26:42  jpm
168
* Revision 1.1  2004/11/04 12:26:42  jpm
168
* Contient les fonctions d'affichage général de l'appli ADME.
169
* Contient les fonctions d'affichage général de l'appli ADME.
169
*
170
*
170
*
171
*
171
* +-- Fin du code ----------------------------------------------------------------------------------------+
172
* +-- Fin du code ----------------------------------------------------------------------------------------+
172
*/
173
*/
173
?>
174
?>