Subversion Repositories Applications.papyrus

Compare Revisions

Ignore whitespace Rev 2073 → Rev 2074

/trunk/papyrus/applettes/lien/lien.php
1,27 → 1,26
<?php
/*vim: set expandtab tabstop=4 shiftwidth=4: */
// +------------------------------------------------------------------------------------------------------+
// | PHP version 5.1 |
// | PHP version 5.1 |
// +------------------------------------------------------------------------------------------------------+
// | Copyright (C) 1999-2006 Tela Botanica (accueil@tela-botanica.org) |
// | Copyright (C) 1999-2006 Tela Botanica (accueil@tela-botanica.org) |
// +------------------------------------------------------------------------------------------------------+
// | This file is part of papyrus_bp. |
// | |
// | 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 |
// | This file is part of papyrus_bp. |
// | |
// | 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: lien.php,v 1.2 2008-11-14 11:22:24 jp_milcent Exp $
/**
* papyrus_bp - lien.php
*
29,16 → 28,16
*
*@package papyrus_bp
//Auteur original :
*@author Jean-Pascal MILCENT <jpm@tela-botanica.org>
*@author Jean-Pascal MILCENT <jpm@tela-botanica.org>
//Autres auteurs :
*@author Aucun
*@copyright Tela-Botanica 1999-2006
*@version $Revision: 1.2 $ $Date: 2008-11-14 11:22:24 $
*@author Aucun
*@copyright Tela-Botanica 1999-2006
*@version $Id$
// +------------------------------------------------------------------------------------------------------+
*/
 
// +------------------------------------------------------------------------------------------------------+
// | ENTÊTE du PROGRAMME |
// | ENTÊTE du PROGRAMME |
// +------------------------------------------------------------------------------------------------------+
$GLOBALS['_GEN_commun']['info_applette_nom_fonction'] = 'afficherLien';
$GLOBALS['_GEN_commun']['info_applette_balise'] = '\{\{[Ll]ien(?:\s*(?:((?:menu|site)="[^"]+")|(titre="[^"]+")|))+\s*\}\}';
49,16 → 48,16
 
// Inclusion des fichiers de traduction de l'applette LIEN de Papyrus
if (file_exists(LIEN_CHEMIN_LANGUE.'lien_langue_'.$GLOBALS['_GEN_commun']['i18n'].'.inc.php')) {
/** Inclusion du fichier de traduction suite à la transaction avec le navigateur.*/
require_once LIEN_CHEMIN_LANGUE.'lien_langue_'.$GLOBALS['_GEN_commun']['i18n'].'.inc.php';
/** Inclusion du fichier de traduction suite à la transaction avec le navigateur.*/
require_once LIEN_CHEMIN_LANGUE.'lien_langue_'.$GLOBALS['_GEN_commun']['i18n'].'.inc.php';
} else {
/** Inclusion du fichier de traduction par défaut.*/
require_once LIEN_CHEMIN_LANGUE.'lien_langue_'.LIEN_I18N_DEFAUT.'.inc.php';
/** Inclusion du fichier de traduction par défaut.*/
require_once LIEN_CHEMIN_LANGUE.'lien_langue_'.LIEN_I18N_DEFAUT.'.inc.php';
}
 
 
// +------------------------------------------------------------------------------------------------------+
// | CORPS du PROGRAMME |
// | CORPS du PROGRAMME |
// +------------------------------------------------------------------------------------------------------+
/** Fonction afficherLien() - Retourne le lien d'un menu ou d'un site.
*
72,37 → 71,37
function afficherLien($tab_applette_arguments, $_GEN_commun)
{
// Initialisation des variables
$sortie = '';
$sortie = '';
$niveau = null;
$GLOBALS['_LIEN_']['url'] = '';
$GLOBALS['_LIEN_']['titre'] = LIEN_LG_ERREUR_TITRE;
$GLOBALS['_LIEN_']['erreurs'] = array();
$GLOBALS['_LIEN_']['erreurs'] = array();
 
//+----------------------------------------------------------------------------------------------------------------+
// Gestion des arguments
$tab_arguments = $tab_applette_arguments;
$tab_arguments = $tab_applette_arguments;
unset($tab_arguments[0]);
foreach($tab_arguments as $argument) {
$tab_parametres = explode('=', $argument);
$options[$tab_parametres[0]] = trim($tab_parametres[1], '"');
}
foreach($tab_arguments as $argument) {
$tab_parametres = explode('=', $argument);
$options[$tab_parametres[0]] = trim($tab_parametres[1], '"');
}
//+----------------------------------------------------------------------------------------------------------------+
// Gestion des erreurs de paramètrage
if (!isset($options['menu']) && !isset($options['site']) ) {
$GLOBALS['_LIEN_']['erreur'] = LIEN_LG_ERREUR_SITE_MENU;
} else {
if (isset($options['menu'])) {
$niveau = 'menu';
$identifiant = $options['menu'];
} else if (isset($options['site'])) {
$niveau = 'site';
$identifiant = $options['site'];
}
}
// Gestion des erreurs de paramètrage
if (!isset($options['menu']) && !isset($options['site']) ) {
$GLOBALS['_LIEN_']['erreur'] = LIEN_LG_ERREUR_SITE_MENU;
} else {
if (isset($options['menu'])) {
$niveau = 'menu';
$identifiant = $options['menu'];
} else if (isset($options['site'])) {
$niveau = 'site';
$identifiant = $options['site'];
}
}
 
//+----------------------------------------------------------------------------------------------------------------+
// Récupération des données
//+----------------------------------------------------------------------------------------------------------------+
// Récupération des données
$bdd =& $GLOBALS['_GEN_commun']['pear_db'];
$id_langue = $GLOBALS['_GEN_commun']['i18n']; //identifiant de la langue choisie
if (isset($id_langue) && ($id_langue != '')) {
119,17 → 118,17
$aso_site = GEN_lireInfoSiteI18nCodeAlpha($bdd, $identifiant, $langue_url, DB_FETCHMODE_ASSOC);
}
if (isset($options['titre'])) {
$GLOBALS['_LIEN_']['titre'] = $options['titre'];
} else {
if (!empty($aso_site['gs_titre'])) {
if (isset($options['titre'])) {
$GLOBALS['_LIEN_']['titre'] = $options['titre'];
} else {
if (!empty($aso_site['gs_titre'])) {
$GLOBALS['_LIEN_']['titre'] = $aso_site['gs_titre'];
} else {
} else {
$GLOBALS['_LIEN_']['titre'] = $aso_site['gs_nom'];
}
}
$une_url->setUrlType('SITE');
$une_url->setId($aso_site['gs_id_site']);
}
}
$une_url->setUrlType('SITE');
$une_url->setId($aso_site['gs_id_site']);
}
// Les menus
if ($niveau == "menu") {
138,20 → 137,20
} else {
$aso_menu = GEN_lireInfoMenu($bdd, GEN_retournerIdMenuParCodeNum($bdd, GEN_retournerMenuCodeNum($bdd, $identifiant)), DB_FETCHMODE_ASSOC);
}
if (isset($options['titre'])) {
$GLOBALS['_LIEN_']['titre'] = $options['titre'];
} else {
if (!empty($aso_menu['gm_titre'])) {
if (isset($options['titre'])) {
$GLOBALS['_LIEN_']['titre'] = $options['titre'];
} else {
if (!empty($aso_menu['gm_titre'])) {
$GLOBALS['_LIEN_']['titre'] = $aso_menu['gm_titre'];
} elseif (!empty($aso_menu['gm_titre_alternatif'])) {
} elseif (!empty($aso_menu['gm_titre_alternatif'])) {
$GLOBALS['_LIEN_']['titre'] = $aso_menu['gm_titre_alternatif'];
} elseif (!empty($aso_menu['gm_nom'])) {
} elseif (!empty($aso_menu['gm_nom'])) {
$GLOBALS['_LIEN_']['titre'] = $aso_menu['gm_nom'];
}
}
$une_url->setId($aso_menu['gm_id_menu']);
}
}
}
$une_url->setId($aso_menu['gm_id_menu']);
}
if ($langue_url != GEN_I18N_ID_DEFAUT) {
$une_url->addQueryString(GEN_URL_CLE_I18N, $langue_url);
}
159,7 → 158,7
$GLOBALS['_LIEN_']['titre'] = htmlentities($GLOBALS['_LIEN_']['titre']);
//+----------------------------------------------------------------------------------------------------------------+
// Extrait les variables et les ajoutes à l'espace de noms local
// Extrait les variables et les ajoutes à l'espace de noms local
// Gestion des squelettes
extract($GLOBALS['_LIEN_']);
// Démarre le buffer
173,16 → 172,6
//+----------------------------------------------------------------------------------------------------------------+
// Sortie
return $sortie;
return $sortie;
}
 
/* +--Fin du code ----------------------------------------------------------------------------------------+
*
* $Log: not supported by cvs2svn $
* Revision 1.1 2006-12-08 20:08:59 jp_milcent
* Ajout de l'apllette Lien.
*
*
* +-- Fin du code ----------------------------------------------------------------------------------------+
*/
?>