Subversion Repositories Applications.papyrus

Rev

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

Rev 132 Rev 134
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 MON_PROGRAMME.                                                                  |
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.2 2004-11-08 17:41:07 jpm Exp $
24
// CVS : $Id: adme_general.fonct.php,v 1.3 2004-11-09 12:37:34 jpm Exp $
25
/**
25
/**
26
* Titre
26
* Contient l'affichage par défaut de l'appli quand aucune actin
27
*
27
*
28
* Description
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
*
30
*
30
*@package nom_du_paquetage
31
*@package Admin_menu
31
*@subpackage nom_du_sous-paquetage_si_necessaire
32
*@subpackage Fonctions
32
//Auteur original :
33
//Auteur original :
33
*@author        Prenom NOM <mail@tela-botanica.org>
34
*@author        Jean-Pascal MILCENT <jpm@tela-botanica.org>
34
//Autres auteurs :
35
//Autres auteurs :
35
*@author        Aucun
36
*@author        Aucun
36
*@copyright     Tela-Botanica 2000-2004
37
*@copyright     Tela-Botanica 2000-2004
37
*@version       $Revision: 1.2 $ $Date: 2004-11-08 17:41:07 $
38
*@version       $Revision: 1.3 $ $Date: 2004-11-09 12:37:34 $
38
// +------------------------------------------------------------------------------------------------------+
39
// +------------------------------------------------------------------------------------------------------+
39
*/
40
*/
40
 
41
 
41
// +------------------------------------------------------------------------------------------------------+
42
// +------------------------------------------------------------------------------------------------------+
42
// |                                            ENTETE du PROGRAMME                                       |
43
// |                                            ENTETE du PROGRAMME                                       |
43
// +------------------------------------------------------------------------------------------------------+
44
// +------------------------------------------------------------------------------------------------------+
44
 
45
 
45
 
46
 
46
// +------------------------------------------------------------------------------------------------------+
47
// +------------------------------------------------------------------------------------------------------+
47
// |                                           LISTE de FONCTIONS                                         |
48
// |                                           LISTE de FONCTIONS                                         |
48
// +------------------------------------------------------------------------------------------------------+
49
// +------------------------------------------------------------------------------------------------------+
49
 
50
 
50
function ADME_afficherFormPrincipal($objet_pear_db, $objet_pear_url)
51
function ADME_afficherFormPrincipal($objet_pear_db, $objet_pear_url)
51
{
52
{
52
    //---------------------------------------------------------------------------------------------------------------
53
    //---------------------------------------------------------------------------------------------------------------
53
    // Nous affichons la liste des menus classiques et communs
54
    // Nous affichons la liste des menus classiques et communs
54
    $retour = '';
55
    $retour = '';
55
    // Liste des sites principaux
56
    // Liste des sites principaux
56
    $requete =  'SELECT gs_id_site, gs_code_alpha, gs_nom '.
57
    $requete =  'SELECT gs_id_site, gs_code_alpha, gs_nom '.
57
                'FROM gen_site, gen_site_relation '.
58
                'FROM gen_site, gen_site_relation '.
58
                'WHERE gsr_id_site_01 = gsr_id_site_02 '.
59
                'WHERE gsr_id_site_01 = gsr_id_site_02 '.
59
                'AND gsr_id_valeur = 102 '.// 102 = site "principal"
60
                'AND gsr_id_valeur = 102 '.// 102 = site "principal"
60
                'AND gsr_id_site_01 = gs_id_site '.
61
                'AND gsr_id_site_01 = gs_id_site '.
61
                'ORDER BY gsr_ordre ASC';
62
                'ORDER BY gsr_ordre ASC';
62
    
63
    
63
    $resultat = $objet_pear_db->query($requete);
64
    $resultat = $objet_pear_db->query($requete);
64
    (DB::isError($resultat)) ? die(BOG_afficherErreurSql(__FILE__, __LINE__, $resultat->getMessage(), $requete)) : '' ;
65
    (DB::isError($resultat)) ? die(BOG_afficherErreurSql(__FILE__, __LINE__, $resultat->getMessage(), $requete)) : '' ;
65
    
66
    
66
    //---------------------------------------------------------------------------------------------------------------
67
    //---------------------------------------------------------------------------------------------------------------
67
    // Création du formulaire
68
    // Création du formulaire
68
    // Notes : Quickform semble remplacer les & des &amp; à nouveau par des &amp; solution utiliser str_replace()...
69
    // Notes : Quickform semble remplacer les & des &amp; à nouveau par des &amp; solution utiliser str_replace()...
69
    $form =& new HTML_QuickForm('adme_form_sites', 'post', str_replace('&amp;', '&', $objet_pear_url->getUrl()));
70
    $form =& new HTML_QuickForm('adme_form_sites', 'post', str_replace('&amp;', '&', $objet_pear_url->getUrl()));
70
    $tab_index = 1000;
71
    $tab_index = 1000;
71
    $squelette =& $form->defaultRenderer();
72
    $squelette =& $form->defaultRenderer();
72
    $squelette->setFormTemplate("\n".'<form{attributes}>'."\n".'{content}'."\n"."\n".'</form>'."\n");
73
    $squelette->setFormTemplate("\n".'<form{attributes}>'."\n".'{content}'."\n"."\n".'</form>'."\n");
73
    $squelette->setElementTemplate( '{label}'."\n".'{element}'."\n".
74
    $squelette->setElementTemplate( '{label}'."\n".'{element}'."\n".
74
                                    '<!-- BEGIN required --><span class="symbole_obligatoire">*</span><!-- END required -->'."\n".
75
                                    '<!-- BEGIN required --><span class="symbole_obligatoire">*</span><!-- END required -->'."\n".
75
                                    '<!-- BEGIN error --><span class="erreur">{error}</span><!-- END error -->'."\n");
76
                                    '<!-- BEGIN error --><span class="erreur">{error}</span><!-- END error -->'."\n");
76
    $partie_site_debut =    '<fieldset>'."\n".
77
    $partie_site_debut =    '<fieldset>'."\n".
77
                            '<legend>'.'Listes des sites'.'</legend>'."\n";
78
                            '<legend>'.'Listes des sites'.'</legend>'."\n";
78
    $form->addElement('html', $partie_site_debut);
79
    $form->addElement('html', $partie_site_debut);
79
    $id = 'adme_site_id';
80
    $id = 'adme_site_id';
80
    $aso_attributs = array('id'=> $id, 'tabindex' => $tab_index++, 'onchange' => 'javascript:this.form.submit();');
81
    $aso_attributs = array('id'=> $id, 'tabindex' => $tab_index++, 'onchange' => 'javascript:this.form.submit();');
81
    $label = '<label for="'.$id.'">'.'Choix du site à administrer : '.'</label>';
82
    $label = '<label for="'.$id.'">'.'Choix du site à administrer : '.'</label>';
82
    $objet_select = new HTML_QuickForm_select($id, $label, '', $aso_attributs);
83
    $objet_select = new HTML_QuickForm_select($id, $label, '', $aso_attributs);
83
    $aso_options = array();
84
    $aso_options = array();
84
    while ($ligne = $resultat->fetchRow(DB_FETCHMODE_OBJECT)) {
85
    while ($ligne = $resultat->fetchRow(DB_FETCHMODE_OBJECT)) {
85
        $site_nom = $ligne->gs_nom;
86
        $site_nom = $ligne->gs_nom;
86
        if (!isset($_GET['adme_site_id']) || $_GET['adme_site_id'] == 0) {
87
        if (!isset($_GET['adme_site_id']) || $_GET['adme_site_id'] == 0) {
87
            $_GET['adme_site_id'] = $ligne->gs_id_site;
88
            $_GET['adme_site_id'] = $ligne->gs_id_site;
88
        }
89
        }
89
        if ($ligne->gs_id_site == $_GET['adme_site_id']) {
90
        if ($ligne->gs_id_site == $_GET['adme_site_id']) {
90
            $objet_select->addOption(htmlentities($ligne->gs_nom.' ('.$ligne->gs_code_alpha.')'), $ligne->gs_id_site, 'selected="selected"');
91
            $objet_select->addOption(htmlentities($ligne->gs_nom.' ('.$ligne->gs_code_alpha.')'), $ligne->gs_id_site, 'selected="selected"');
91
        } else {
92
        } else {
92
            $objet_select->addOption(htmlentities($ligne->gs_nom.' ('.$ligne->gs_code_alpha.')'), $ligne->gs_id_site);
93
            $objet_select->addOption(htmlentities($ligne->gs_nom.' ('.$ligne->gs_code_alpha.')'), $ligne->gs_id_site);
93
        }
94
        }
94
    }
95
    }
95
    $resultat->free();
96
    $resultat->free();
96
    $form->addElement($objet_select);
97
    $form->addElement($objet_select);
97
    $form->addElement('submit', 'choisir_site', 'OK');
98
    $form->addElement('submit', 'choisir_site', 'OK');
98
    $partie_site_fin = "\n".'</fieldset>';
99
    $partie_site_fin = "\n".'</fieldset>';
99
    $form->addElement('html', $partie_site_fin);
100
    $form->addElement('html', $partie_site_fin);
100
    
101
    
101
    // Instanciation des valeurs par défaut du formulaire
102
    // Instanciation des valeurs par défaut du formulaire
102
    $form->setDefaults($_GET['adme_site_id']);
103
    $form->setDefaults($_GET['adme_site_id']);
103
    
104
    
104
    $retour .= '<h1>'.'Configuration des menus du site : '.$site_nom.'</h1>'."\n";
105
    $retour .= '<h1>'.'Configuration des menus du site : '.$site_nom.'</h1>'."\n";
105
    $retour .= '<p>'."\n";
106
    $retour .= '<p>'."\n";
106
    $retour .= $form->toHTML()."\n";
107
    $retour .= $form->toHTML()."\n";
107
    $retour .= '</p>'."\n";
108
    $retour .= '</p>'."\n";
108
    
109
    
109
    //---------------------------------------------------------------------------------------------------------------
110
    //---------------------------------------------------------------------------------------------------------------
110
    // Gestion des menus classiques
111
    // Gestion des menus classiques
111
    $etiquette_ajouter = 'Ajouter un menu classique';
112
    $etiquette_ajouter = 'Ajouter un menu classique';
112
    $retour .= '<p>'."\n";
113
    $retour .= '<p>'."\n";
113
    $objet_pear_url_copie = $objet_pear_url;
114
    $objet_pear_url_copie = $objet_pear_url;
114
    $objet_pear_url_copie->addQueryString('adme_action', 'ajouter_menu_classique');
115
    $objet_pear_url_copie->addQueryString('adme_action', 'ajouter_menu_classique');
115
    $objet_pear_url_copie->addQueryString('adme_site_id', $_GET['adme_site_id']);
116
    $objet_pear_url_copie->addQueryString('adme_site_id', $_GET['adme_site_id']);
116
    $objet_pear_url_copie->addQueryString('adme_menu_id', 0);
117
    $objet_pear_url_copie->addQueryString('adme_menu_id', 0);
117
    $url_ajout_menu_classique_n1 = $objet_pear_url_copie->getURL();
118
    $url_ajout_menu_classique_n1 = $objet_pear_url_copie->getURL();
118
    unset($url_ajout_menu_n1);
119
    unset($url_ajout_menu_n1);
119
    $retour .=    '<a href="'.$url_ajout_menu_classique_n1.'" >'.
120
    $retour .=    '<a href="'.$url_ajout_menu_classique_n1.'" >'.
120
                            $etiquette_ajouter.'&nbsp;'.
121
                            $etiquette_ajouter.'&nbsp;'.
121
                            '<img class="'.ADME_CLASS_IMG_ICONE.'" src="'.ADME_IMAGE_NOUVEAU.'" alt="+" />'.
122
                            '<img class="'.ADME_CLASS_IMG_ICONE.'" src="'.ADME_IMAGE_NOUVEAU.'" alt="+" />'.
122
                        '</a>'."\n";
123
                        '</a>'."\n";
123
    $retour .= '</p>'."\n";
124
    $retour .= '</p>'."\n";
124
    
125
    
125
    $retour .= ADME_afficherListeMenuClassique($objet_pear_db, $objet_pear_url, $_GET['adme_site_id'], $_GET['adme_menu_id'], $_GET['adme_action'], 0);
126
    $retour .= ADME_afficherListeMenuClassique($objet_pear_db, $objet_pear_url, $_GET['adme_site_id'], $_GET['adme_menu_id'], $_GET['adme_action'], 0);
126
    //---------------------------------------------------------------------------------------------------------------
127
    //---------------------------------------------------------------------------------------------------------------
127
    // Gestion des menus communs
128
    // Gestion des menus communs
128
    $etiquette_ajouter = 'Ajouter un menu commun';
129
    $etiquette_ajouter = 'Ajouter un menu commun';
129
    $retour .=     '<p>'."\n";
130
    $retour .=     '<p>'."\n";
130
    $objet_pear_url_copie = $objet_pear_url;
131
    $objet_pear_url_copie = $objet_pear_url;
131
    $objet_pear_url_copie->addQueryString('adme_action', 'ajouter_menu_commun');
132
    $objet_pear_url_copie->addQueryString('adme_action', 'ajouter_menu_commun');
132
    $objet_pear_url_copie->addQueryString('adme_site_id', $_GET['adme_site_id']);
133
    $objet_pear_url_copie->addQueryString('adme_site_id', $_GET['adme_site_id']);
133
    $objet_pear_url_copie->addQueryString('adme_menu_id', 0);
134
    $objet_pear_url_copie->addQueryString('adme_menu_id', 0);
134
    $url_ajout_menu_commun_n1 = $objet_pear_url_copie->getURL();
135
    $url_ajout_menu_commun_n1 = $objet_pear_url_copie->getURL();
135
    unset($url_ajout_menu_n1);
136
    unset($url_ajout_menu_n1);
136
    $retour .=     '<a href="'.$url_ajout_menu_commun_n1.'">'.
137
    $retour .=     '<a href="'.$url_ajout_menu_commun_n1.'">'.
137
                            $etiquette_ajouter.'&nbsp;'.
138
                            $etiquette_ajouter.'&nbsp;'.
138
                            '<img class="'.ADME_CLASS_IMG_ICONE.'" src="'.ADME_IMAGE_NOUVEAU.'" alt="+" />'.
139
                            '<img class="'.ADME_CLASS_IMG_ICONE.'" src="'.ADME_IMAGE_NOUVEAU.'" alt="+" />'.
139
                        '</a>'."\n";
140
                        '</a>'."\n";
140
    $retour .=     '</p>'."\n";
141
    $retour .=     '</p>'."\n";
141
    $retour .= ADME_afficherListeMenuCommun($objet_pear_db, $objet_pear_url, $_GET['adme_site_id'], $_GET['adme_menu_id'], $_GET['adme_action'], 0);
142
    $retour .= ADME_afficherListeMenuCommun($objet_pear_db, $objet_pear_url, $_GET['adme_site_id'], $_GET['adme_menu_id'], $_GET['adme_action'], 0);
142
    return $retour;
143
    return $retour;
143
}
144
}
144
// +------------------------------------------------------------------------------------------------------+
145
// +------------------------------------------------------------------------------------------------------+
145
// |                                            PIED du PROGRAMME                                         |
146
// |                                            PIED du PROGRAMME                                         |
146
// +------------------------------------------------------------------------------------------------------+
147
// +------------------------------------------------------------------------------------------------------+
147
 
148
 
148
 
149
 
149
/* +--Fin du code ----------------------------------------------------------------------------------------+
150
/* +--Fin du code ----------------------------------------------------------------------------------------+
150
*
151
*
151
* $Log: not supported by cvs2svn $
152
* $Log: not supported by cvs2svn $
-
 
153
* Revision 1.2  2004/11/08 17:41:07  jpm
-
 
154
* Légères corrections : multisite, corrections SQL.
-
 
155
*
152
* Revision 1.1  2004/11/04 12:26:42  jpm
156
* Revision 1.1  2004/11/04 12:26:42  jpm
153
* Contient les fonctions d'affichage général de l'appli ADME.
157
* Contient les fonctions d'affichage général de l'appli ADME.
154
*
158
*
155
*
159
*
156
* +-- Fin du code ----------------------------------------------------------------------------------------+
160
* +-- Fin du code ----------------------------------------------------------------------------------------+
157
*/
161
*/
158
?>
162
?>