3 /***************************************************************************\
4 * SPIP, Systeme de publication pour l'internet *
6 * Copyright (c) 2001-2011 *
7 * Arnaud Martin, Antoine Pitrou, Philippe Riviere, Emmanuel Saint-James *
9 * Ce programme est un logiciel libre distribue sous licence GNU/GPL. *
10 * Pour plus de details voir le fichier COPYING.txt ou l'aide en ligne. *
11 \***************************************************************************/
13 if (!defined('_ECRIRE_INC_VERSION')) return;
16 * une classe definissant un bouton dans la barre du haut de l'interface
17 * privee ou dans un de ses sous menus
19 // http://doc.spip.org/@Bouton
21 var $icone; /* l'icone a mettre dans le bouton */
22 var $libelle; /* le nom de l'entree d'i18n associe */
23 var $url= null; /* l'url de la page (null => ?exec=nom) */
24 var $urlArg= null; /* arguments supplementaires de l'url */
25 var $url2= null; /* url jscript */
26 var $target= null; /* pour ouvrir dans une fenetre a part */
27 var $sousmenu= null;/* sous barre de boutons / onglets */
29 // http://doc.spip.org/@Bouton
30 function Bouton($icone, $libelle, $url=null, $urlArg=null,
31 $url2=null, $target=null) {
32 $this->icone
= $icone;
33 $this->libelle
= $libelle;
35 $this->urlArg
= $urlArg;
37 $this->target
= $target;
42 // http://doc.spip.org/@barre_onglets_rep_depuis
43 function barre_onglets_rep_depuis() {
46 $onglets['statistiques_lang']=
47 new Bouton(null, 'icone_repartition_actuelle');
49 new Bouton(null, 'onglet_repartition_debut',
50 generer_url_ecrire("statistiques_lang","critere=debut"));
54 // http://doc.spip.org/@barre_onglets_stat_depuis
55 function barre_onglets_stat_depuis() {
57 $onglets['popularite']=
58 new Bouton(null, 'icone_repartition_actuelle',
59 generer_url_ecrire("statistiques_repartition",""));
61 new Bouton(null, 'onglet_repartition_debut',
62 generer_url_ecrire("statistiques_repartition","critere=debut"));
67 // http://doc.spip.org/@barre_onglets_administration
68 function barre_onglets_administration() {
71 if (autoriser('sauvegarder')) {
73 new Bouton('spip-pack-24.png', 'onglet_save_restaur_base',
74 generer_url_ecrire("admin_tech"));
76 if (autoriser('detruire')) {
78 new Bouton('supprimer.gif', 'onglet_affacer_base',
79 generer_url_ecrire("admin_effacer"));
82 new Bouton('base-24.gif', 'onglet_declarer_une_autre_base',
83 generer_url_ecrire("admin_declarer"));
88 // http://doc.spip.org/@barre_onglets_configuration
89 function barre_onglets_configuration() {
93 new Bouton('racine-site-24.gif', 'onglet_contenu_site',
94 generer_url_ecrire("configuration"));
95 $onglets['interactivite']=
96 new Bouton('forum-interne-24.gif', 'onglet_interactivite',
97 generer_url_ecrire("config_contenu"));
98 $onglets['fonctions']=
99 new Bouton('image-24.gif', 'onglet_fonctions_avances',
100 generer_url_ecrire("config_fonctions"));
104 new Bouton('plugin-24.gif', 'onglet_plugins',
105 generer_url_ecrire("config_plugins"));
111 // http://doc.spip.org/@barre_onglets_config_lang
112 function barre_onglets_config_lang() {
116 new Bouton('langues-24.gif', 'info_langue_principale',
117 generer_url_ecrire("config_lang"));
119 new Bouton('traductions-24.gif', 'info_multilinguisme',
120 generer_url_ecrire("config_multilang"));
121 $onglets['fichiers']=
122 new Bouton('traductions-24.gif', 'module_fichiers_langues',
123 generer_url_ecrire("lang_raccourcis"));
128 function barre_onglets_plugins() {
131 $onglets['plugins_actifs']=
132 new Bouton('plugin-24.gif', 'plugins_actifs_liste',
133 generer_url_ecrire("admin_plugin"));
134 $onglets['admin_plugin']=
135 new Bouton('plugin-24.gif', 'plugins_liste',
136 generer_url_ecrire("admin_plugin","voir=tous"));
137 $onglets['charger_plugin']=
138 new Bouton('spip-pack-24.png', 'plugin_titre_automatique_ajouter',
139 generer_url_ecrire("charger_plugin"));
145 * definir la liste des onglets dans une page de l'interface privee
146 * on passe la main au pipeline "ajouter_onglets".
148 // http://doc.spip.org/@definir_barre_onglets
149 function definir_barre_onglets($script) {
151 if (function_exists($f = 'barre_onglets_' . $script))
153 else $onglets=array();
155 // ajouter les onglets issus des plugin via plugin.xml
156 if (function_exists('onglets_plugins')){
157 $liste_onglets_plugins = onglets_plugins();
159 foreach($liste_onglets_plugins as $id => $infos){
160 if (($parent = $infos['parent'])
161 && $parent == $script
162 && autoriser('onglet',$id)) {
163 $onglets[$id] = new Bouton(
164 find_in_path($infos['icone']), // icone
165 $infos['titre'], // titre
166 $infos['url']?
generer_url_ecrire($infos['url'],$infos['args']?
$infos['args']:''):null
172 return pipeline('ajouter_onglets', array('data'=>$onglets,'args'=>$script));
176 // http://doc.spip.org/@barre_onglets
177 function barre_onglets($rubrique, $ongletCourant){
181 foreach(definir_barre_onglets($rubrique) as $exec => $onglet) {
182 $url= $onglet->url ?
$onglet->url
: generer_url_ecrire($exec);
183 $res .= onglet(_T($onglet->libelle
), $url, $exec, $ongletCourant, $onglet->icone
);
186 return !$res ?
'' : (debut_onglet() . $res . fin_onglet());
189 // http://doc.spip.org/@definir_barre_gadgets
190 function definir_barre_gadgets() {
191 global $barre_gadgets;
192 $barre_gadgets= array(