Subversion Repositories Applications.papyrus

Compare Revisions

Ignore whitespace Rev 125 → Rev 126

/trunk/papyrus/applications/admin_menu/bibliotheque/adme_general.fonct.php
New file
0,0 → 1,155
<?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 MON_PROGRAMME. |
// | |
// | 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.1 2004-11-04 12:26:42 jpm Exp $
/**
* Titre
*
* Description
*
*@package nom_du_paquetage
*@subpackage nom_du_sous-paquetage_si_necessaire
//Auteur original :
*@author Prenom NOM <mail@tela-botanica.org>
//Autres auteurs :
*@author Aucun
*@copyright Tela-Botanica 2000-2004
*@version $Revision: 1.1 $ $Date: 2004-11-04 12:26:42 $
// +------------------------------------------------------------------------------------------------------+
*/
 
// +------------------------------------------------------------------------------------------------------+
// | ENTETE du PROGRAMME |
// +------------------------------------------------------------------------------------------------------+
 
 
// +------------------------------------------------------------------------------------------------------+
// | LISTE de FONCTIONS |
// +------------------------------------------------------------------------------------------------------+
 
function ADME_afficherFormPrincipal($objet_pear_db, $objet_pear_url)
{
//---------------------------------------------------------------------------------------------------------------
// 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';
$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 &amp; à nouveau par des &amp; solution utiliser str_replace()...
$form =& new HTML_QuickForm('adme_form_sites', 'post', str_replace('&amp;', '&', $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>'.'Listes des sites'.'</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.'">'.'Choix du site à administrer : '.'</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 ($_GET['adme_site_id'] == 0) {
$_GET['adme_site_id'] = $ligne->gs_id_site;
}
if ($ligne->gs_id_site == $_GET['adme_site_id']) {
$objet_select->addOption(htmlentities($ligne->gs_nom.' ('.$ligne->gs_code_alpha.')'), $ligne->gs_code_alpha, 'selected="selected"');
} else {
$objet_select->addOption(htmlentities($ligne->gs_nom.' ('.$ligne->gs_code_alpha.')'), $ligne->gs_code_alpha);
}
}
$resultat->free();
$form->addElement($objet_select);
$form->addElement('submit', 'choisir_site', 'OK');
$partie_site_fin = "\n".'</fieldset>';
$form->addElement('html', $partie_site_fin);
// Instanciation des valeurs par défaut du formulaire
$form->setDefaults($_GET['adme_site_id']);
$retour .= '<h1>'.'Configuration des menus du site : '.$site_nom.'</h1>'."\n";
$retour .= '<p>'."\n";
$retour .= $form->toHTML()."\n";
$retour .= '</p>'."\n";
//---------------------------------------------------------------------------------------------------------------
// Gestion des menus classiques
$etiquette_ajouter = 'Ajouter un menu classique';
$retour .= '<p>'."\n";
$objet_pear_url_copie = $objet_pear_url;
$objet_pear_url_copie->addQueryString('adme_action', 'ajouter_menu_classique');
$objet_pear_url_copie->addQueryString('adme_site_id', $_GET['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.'" >'.
$etiquette_ajouter.'&nbsp;'.
'<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, $_GET['adme_site_id'], $_GET['adme_menu_id'], $_GET['adme_menu_ouvert'], 0);
//---------------------------------------------------------------------------------------------------------------
// Gestion des menus communs
$etiquette_ajouter = 'Ajouter un menu commun';
$retour .= '<p>'."\n";
$objet_pear_url_copie = $objet_pear_url;
$objet_pear_url_copie->addQueryString('adme_action', 'ajouter_menu_commun');
$objet_pear_url_copie->addQueryString('adme_site_id', $_GET['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.'">'.
$etiquette_ajouter.'&nbsp;'.
'<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, $_GET['adme_site_id'], $_GET['adme_menu_id'], $_GET['adme_menu_ouvert'], 0);
return $retour;
}
// +------------------------------------------------------------------------------------------------------+
// | PIED du PROGRAMME |
// +------------------------------------------------------------------------------------------------------+
 
 
/* +--Fin du code ----------------------------------------------------------------------------------------+
*
* $Log: not supported by cvs2svn $
*
* +-- Fin du code ----------------------------------------------------------------------------------------+
*/
?>