Rev 150 | Rev 367 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed
<?php/*vim: set expandtab tabstop=4 shiftwidth=4: */// +------------------------------------------------------------------------------------------------------+// | PHP version 4.1 |// +------------------------------------------------------------------------------------------------------+// | Copyright (C) 2004 Tela Botanica (accueil@tela-botanica.org) |// +------------------------------------------------------------------------------------------------------+// | This file is part of Papyrus. |// | |// | Foobar is free software; you can redistribute it and/or modify |// | it under the terms of the GNU General Public License as published by |// | the Free Software Foundation; either version 2 of the License, or |// | (at your option) any later version. |// | |// | Foobar is distributed in the hope that it will be useful, |// | but WITHOUT ANY WARRANTY; without even the implied warranty of |// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |// | GNU General Public License for more details. |// | |// | You should have received a copy of the GNU General Public License |// | along with Foobar; if not, write to the Free Software |// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |// +------------------------------------------------------------------------------------------------------+// CVS : $Id: adme_general.fonct.php,v 1.7 2004-11-24 11:31:51 jpm Exp $/*** Contient l'affichage par défaut de l'appli quand aucune actin** Ce fichier contient les fonctions d'affichage commune à toute l'application Admin Menu.* Nous y trouvons, entre autre, la fonction d'affichage par défaut de l'appli.**@package Admin_menu*@subpackage Fonctions//Auteur original :*@author Jean-Pascal MILCENT <jpm@tela-botanica.org>//Autres auteurs :*@author Aucun*@copyright Tela-Botanica 2000-2004*@version $Revision: 1.7 $ $Date: 2004-11-24 11:31:51 $// +------------------------------------------------------------------------------------------------------+*/// +------------------------------------------------------------------------------------------------------+// | ENTETE du PROGRAMME |// +------------------------------------------------------------------------------------------------------+// +------------------------------------------------------------------------------------------------------+// | LISTE de FONCTIONS |// +------------------------------------------------------------------------------------------------------+/** Fonction ADME_afficherFormPrincipal() - Affichage par défaut.** Fournit l'affichage par défaut de l'application Admin Menus.** @param object objet Pear de connection à la base de données.* @param object objet Pear représentant l'url de base.* @return string le XHTML par défaut de la page.*/function ADME_afficherFormPrincipal($objet_pear_db, $objet_pear_url, $adme_site_id, $adme_menu_id, $adme_action){//---------------------------------------------------------------------------------------------------------------// Nous affichons la liste des menus classiques et communs$retour = '';// Liste des sites principaux$requete = 'SELECT gs_id_site, gs_code_alpha, gs_nom '.'FROM gen_site, gen_site_relation '.'WHERE gsr_id_site_01 = gsr_id_site_02 '.'AND gsr_id_valeur = 102 '.// 102 = site "principal"'AND gsr_id_site_01 = gs_id_site '.'ORDER BY gsr_ordre ASC';$resultat = $objet_pear_db->query($requete);(DB::isError($resultat)) ? die(BOG_afficherErreurSql(__FILE__, __LINE__, $resultat->getMessage(), $requete)) : '' ;//---------------------------------------------------------------------------------------------------------------// Création du formulaire// Notes : Quickform semble remplacer les & des & à nouveau par des & solution utiliser str_replace()...$form =& new HTML_QuickForm('adme_form_sites', 'post', str_replace('&', '&', $objet_pear_url->getUrl()));$tab_index = 1000;$squelette =& $form->defaultRenderer();$squelette->setFormTemplate("\n".'<form{attributes}>'."\n".'{content}'."\n"."\n".'</form>'."\n");$squelette->setElementTemplate( '{label}'."\n".'{element}'."\n".'<!-- BEGIN required --><span class="symbole_obligatoire">*</span><!-- END required -->'."\n".'<!-- BEGIN error --><span class="erreur">{error}</span><!-- END error -->'."\n");$partie_site_debut = '<fieldset>'."\n".'<legend>'.ADME_LG_FORM_SITE_TITRE.'</legend>'."\n";$form->addElement('html', $partie_site_debut);$id = 'adme_site_id';$aso_attributs = array('id'=> $id, 'tabindex' => $tab_index++, 'onchange' => 'javascript:this.form.submit();');$label = '<label for="'.$id.'">'.ADME_LG_FORM_SITE_CHOIX.'</label>';$objet_select = new HTML_QuickForm_select($id, $label, '', $aso_attributs);$aso_options = array();while ($ligne = $resultat->fetchRow(DB_FETCHMODE_OBJECT)) {$site_nom = $ligne->gs_nom;if (!isset($adme_site_id) || $adme_site_id == 0) {$adme_site_id = $ligne->gs_id_site;}if ($ligne->gs_id_site == $adme_site_id) {$objet_select->addOption(htmlentities($ligne->gs_nom.' ('.$ligne->gs_code_alpha.')'), $ligne->gs_id_site, 'selected="selected"');} else {$objet_select->addOption(htmlentities($ligne->gs_nom.' ('.$ligne->gs_code_alpha.')'), $ligne->gs_id_site);}}$resultat->free();$form->addElement($objet_select);$form->addElement('submit', 'choisir_site', ADME_LG_FORM_SITE_VALIDER);$partie_site_fin = "\n".'</fieldset>';$form->addElement('html', $partie_site_fin);// Instanciation des valeurs par défaut du formulaire$form->setDefaults($adme_site_id);$retour .= '<h1>'.ADME_LG_MENU_TITRE.$site_nom.'</h1>'."\n";$retour .= '<p>'."\n";$retour .= $form->toHTML()."\n";$retour .= '</p>'."\n";//---------------------------------------------------------------------------------------------------------------// Gestion des menus classiques$retour .= '<p>'."\n";$objet_pear_url_copie = $objet_pear_url;$objet_pear_url_copie->addQueryString('adme_action', ADME_LG_ACTION_CLASSIQUE_AJOUTER);$objet_pear_url_copie->addQueryString('adme_site_id', $adme_site_id);$objet_pear_url_copie->addQueryString('adme_menu_id', 0);$url_ajout_menu_classique_n1 = $objet_pear_url_copie->getURL();unset($url_ajout_menu_n1);$retour .= '<a href="'.$url_ajout_menu_classique_n1.'" >'.ADME_LG_MENU_CLASSIQUE_RACINE.' '.'<img class="'.ADME_CLASS_IMG_ICONE.'" src="'.ADME_IMAGE_NOUVEAU.'" alt="+" />'.'</a>'."\n";$retour .= '</p>'."\n";$retour .= ADME_afficherListeMenuClassique($objet_pear_db, $objet_pear_url, $adme_site_id, $adme_menu_id, $adme_action, 0);//---------------------------------------------------------------------------------------------------------------// Gestion des menus communs$retour .= '<p>'."\n";$objet_pear_url_copie = $objet_pear_url;$objet_pear_url_copie->addQueryString('adme_action', ADME_LG_ACTION_COMMUN_AJOUTER);$objet_pear_url_copie->addQueryString('adme_site_id', $adme_site_id);$objet_pear_url_copie->addQueryString('adme_menu_id', 0);$url_ajout_menu_commun_n1 = $objet_pear_url_copie->getURL();unset($url_ajout_menu_n1);$retour .= '<a href="'.$url_ajout_menu_commun_n1.'">'.ADME_LG_MENU_COMMUN_RACINE.' '.'<img class="'.ADME_CLASS_IMG_ICONE.'" src="'.ADME_IMAGE_NOUVEAU.'" alt="+" />'.'</a>'."\n";$retour .= '</p>'."\n";$retour .= ADME_afficherListeMenuCommun($objet_pear_db, $objet_pear_url, $adme_site_id, $adme_menu_id, $adme_action, 0);return $retour;}// +------------------------------------------------------------------------------------------------------+// | PIED du PROGRAMME |// +------------------------------------------------------------------------------------------------------+/* +--Fin du code ----------------------------------------------------------------------------------------+** $Log: not supported by cvs2svn $* Revision 1.6 2004/11/10 17:26:07 jpm* Fin gestion de la traduction.** Revision 1.5 2004/11/10 11:58:54 jpm* Mise en place des constantes de traduction de l'appli.** Revision 1.4 2004/11/09 17:48:35 jpm* Gestion de différentes interfaces d'administration.** Revision 1.3 2004/11/09 12:37:34 jpm* Fin de gestion des menus et mise en conformité avec la convention de codage.** Revision 1.2 2004/11/08 17:41:07 jpm* Légères corrections : multisite, corrections SQL.** Revision 1.1 2004/11/04 12:26:42 jpm* Contient les fonctions d'affichage général de l'appli ADME.*** +-- Fin du code ----------------------------------------------------------------------------------------+*/?>