Skip to content
Extraits de code Groupes Projets
Valider 6cd8c1f1 rédigé par cerdic's avatar cerdic
Parcourir les fichiers

la presentation des enfants n'est appelee qu'en 2 endroits

inutile d'alourdir inc/presentation avec ca
parent b5708007
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
......@@ -319,6 +319,7 @@ ecrire/inc/petitionner.php -text
ecrire/inc/plonger.php -text
ecrire/inc/plugin.php -text
ecrire/inc/prepare_recherche.php -text
ecrire/inc/presenter_enfants.php -text
ecrire/inc/presenter_liste.php -text
ecrire/inc/puce_statut.php -text
ecrire/inc/rechercher.php -text
......
......@@ -472,6 +472,7 @@ function exec_accueil_dist()
echo encours_accueil();
}
include_spip('inc/presenter_enfants');
if (!$connect_id_rubrique)
echo afficher_enfant_rub(0, false, true) . "<div class='nettoyeur'></div>";
......
......@@ -129,6 +129,7 @@ function naviguer_droite($row, $id_rubrique, $id_parent, $id_secteur, $haut, $n_
$onglet_contenu = "<div id='wysiwyg'>$fond</div>"
. (_INTERFACE_ONGLETS? $boucles:"");
include_spip('inc/presenter_enfants');
$onglet_enfants =
afficher_enfant_rub($id_rubrique, false, true)
.(_INTERFACE_ONGLETS?"":
......
......@@ -1071,139 +1071,6 @@ function afficher_hierarchie($id_parent, $message='',$id_objet=0,$type='',$id_se
return $out;
}
// http://doc.spip.org/@enfant_rub
function enfant_rub($collection){
global $spip_display, $spip_lang_left, $spip_lang_right, $spip_lang;
$voir_logo = ($spip_display != 1 AND $spip_display != 4 AND isset($GLOBALS['meta']['image_process']) AND $GLOBALS['meta']['image_process'] != "non");
if ($voir_logo) {
$voir_logo = "float: $spip_lang_right; margin-$spip_lang_right: 0px; margin-top: 0px;";
$chercher_logo = charger_fonction('chercher_logo', 'inc');
} else $logo ='';
$res = "";
$result = sql_select("id_rubrique, id_parent, titre, descriptif, lang ", "spip_rubriques", "id_parent=$collection",'', '0+titre,titre');
while($row=sql_fetch($result)){
$id_rubrique=$row['id_rubrique'];
$id_parent=$row['id_parent'];
$titre=$row['titre'];
if (autoriser('voir','rubrique',$id_rubrique)){
$les_sous_enfants = sous_enfant_rub($id_rubrique);
changer_typo($row['lang']);
$lang_dir = lang_dir($row['lang']);
$descriptif=propre($row['descriptif']);
if ($voir_logo) {
if ($logo = $chercher_logo($id_rubrique, 'id_rubrique', 'on')) {
list($fid, $dir, $nom, $format) = $logo;
include_spip('inc/filtres_images');
$logo = image_reduire("<img src='$fid' alt='' />", 48, 36);
if ($logo)
$logo = "\n<div style='$voir_logo'>$logo</div>";
}
}
$lib_bouton = (!acces_restreint_rubrique($id_rubrique) ? "" :
http_img_pack("admin-12.gif", '', " width='12' height='12'", _T('image_administrer_rubrique'))) .
" <span dir='$lang_dir'><a href='" .
generer_url_ecrire("naviguer","id_rubrique=$id_rubrique") .
"'>".
typo($titre) .
"</a></span>";
$titre = (is_string($logo) ? $logo : '') .
bouton_block_depliable($lib_bouton,$les_sous_enfants ?false:-1,"enfants$id_rubrique");
$les_enfants = "\n<div class='enfants'>" .
debut_cadre_sous_rub(($id_parent ? "rubrique-24.gif" : "secteur-24.gif"), true, "", $titre) .
(!$descriptif ? '' : "\n<div class='verdana1'>$descriptif</div>") .
(($spip_display == 4) ? '' : $les_sous_enfants) .
"\n<div style='clear:both;'></div>" .
fin_cadre_sous_rub(true) .
"</div>";
$res .= ($spip_display != 4)
? $les_enfants
: "\n<li>$les_enfants</li>";
}
}
changer_typo($spip_lang); # remettre la typo de l'interface pour la suite
return (($spip_display == 4) ? "\n<ul>$res</ul>\n" : $res);
}
// http://doc.spip.org/@sous_enfant_rub
function sous_enfant_rub($collection2){
global $spip_lang_left;
$result3 = sql_select("id_rubrique, id_parent, titre, lang", "spip_rubriques", "id_parent=$collection2",'', '0+titre,titre');
$retour = '';
while($row=sql_fetch($result3)){
$id_rubrique2=$row['id_rubrique'];
$id_parent2=$row['id_parent'];
$titre2=$row['titre'];
changer_typo($row['lang']);
$lang_dir = lang_dir($row['lang']);
if (autoriser('voir','rubrique',$id_rubrique2))
$retour.="\n<li class='arial11 rubrique_12' dir='$lang_dir'><a href='" . generer_url_ecrire("naviguer","id_rubrique=$id_rubrique2") . "'>".typo($titre2)."</a></li>\n";
}
if (!$retour) return '';
return debut_block_depliable(false,"enfants$collection2")
."\n<ul style='margin: 0px; padding: 0px; padding-top: 3px;'>\n"
. $retour
. "</ul>\n\n".fin_block()."\n\n";
}
// http://doc.spip.org/@afficher_enfant_rub
function afficher_enfant_rub($id_rubrique, $bouton=false, $return=false) {
global $spip_lang_left,$spip_lang_right, $spip_display;
$les_enfants = enfant_rub($id_rubrique);
$n = strlen(trim($les_enfants));
if (!$n && !$bouton) return "";
if (!($x = strpos($les_enfants,"\n<div class='enfants'>",round($n/2)))) {
$les_enfants2="";
}else{
$les_enfants2 = substr($les_enfants, $x);
$les_enfants = substr($les_enfants,0,$x);
if ($spip_display == 4) {
$les_enfants .= '</li></ul>';
$les_enfants2 = '<ul><li>' . $les_enfants2;
}
}
$res =
"<div class='gauche'>"
. $les_enfants
. "</div>"
. "<div class='droite'>"
. $les_enfants2
. "</div>"
. "&nbsp;"
. "<div style='float:"
. $spip_lang_right
. ";position:relative;'>"
. (!$bouton ? ''
: (!$id_rubrique
? icone(_T('icone_creer_rubrique'), generer_url_ecrire("rubriques_edit","new=oui&retour=nav"), "secteur-24.gif", "creer.gif",$spip_lang_right, false)
: icone(_T('icone_creer_sous_rubrique'), generer_url_ecrire("rubriques_edit","new=oui&retour=nav&id_parent=$id_rubrique"), "rubrique-24.gif", "creer.gif",$spip_lang_right,false)))
. "</div>";
if ($return) return $res; else echo_log('afficher_enfant_rub',$res);
}
// Pour construire des menu avec SELECTED
// http://doc.spip.org/@mySel
function mySel($varaut,$variable, $option = NULL) {
......
<?php
/***************************************************************************\
* SPIP, Systeme de publication pour l'internet *
* *
* Copyright (c) 2001-2008 *
* Arnaud Martin, Antoine Pitrou, Philippe Riviere, Emmanuel Saint-James *
* *
* Ce programme est un logiciel libre distribue sous licence GNU/GPL. *
* Pour plus de details voir le fichier COPYING.txt ou l'aide en ligne. *
\***************************************************************************/
include_spip('inc/autoriser');
include_spip('inc/presentation');
// http://doc.spip.org/@enfant_rub
function enfant_rub($collection){
global $spip_display, $spip_lang_left, $spip_lang_right, $spip_lang;
$voir_logo = ($spip_display != 1 AND $spip_display != 4 AND isset($GLOBALS['meta']['image_process']) AND $GLOBALS['meta']['image_process'] != "non");
if ($voir_logo) {
$voir_logo = "float: $spip_lang_right; margin-$spip_lang_right: 0px; margin-top: 0px;";
$chercher_logo = charger_fonction('chercher_logo', 'inc');
} else $logo ='';
$res = "";
$result = sql_select("id_rubrique, id_parent, titre, descriptif, lang ", "spip_rubriques", "id_parent=$collection",'', '0+titre,titre');
while($row=sql_fetch($result)){
$id_rubrique=$row['id_rubrique'];
$id_parent=$row['id_parent'];
$titre=$row['titre'];
if (autoriser('voir','rubrique',$id_rubrique)){
$les_sous_enfants = sous_enfant_rub($id_rubrique);
changer_typo($row['lang']);
$lang_dir = lang_dir($row['lang']);
$descriptif=propre($row['descriptif']);
if ($voir_logo) {
if ($logo = $chercher_logo($id_rubrique, 'id_rubrique', 'on')) {
list($fid, $dir, $nom, $format) = $logo;
include_spip('inc/filtres_images');
$logo = image_reduire("<img src='$fid' alt='' />", 48, 36);
if ($logo)
$logo = "\n<div style='$voir_logo'>$logo</div>";
}
}
$lib_bouton = (!acces_restreint_rubrique($id_rubrique) ? "" :
http_img_pack("admin-12.gif", '', " width='12' height='12'", _T('image_administrer_rubrique'))) .
" <span dir='$lang_dir'><a href='" .
generer_url_ecrire("naviguer","id_rubrique=$id_rubrique") .
"'>".
typo($titre) .
"</a></span>";
$titre = (is_string($logo) ? $logo : '') .
bouton_block_depliable($lib_bouton,$les_sous_enfants ?false:-1,"enfants$id_rubrique");
$les_enfants = "\n<div class='enfants'>" .
debut_cadre_sous_rub(($id_parent ? "rubrique-24.gif" : "secteur-24.gif"), true, "", $titre) .
(!$descriptif ? '' : "\n<div class='verdana1'>$descriptif</div>") .
(($spip_display == 4) ? '' : $les_sous_enfants) .
"\n<div style='clear:both;'></div>" .
fin_cadre_sous_rub(true) .
"</div>";
$res .= ($spip_display != 4)
? $les_enfants
: "\n<li>$les_enfants</li>";
}
}
changer_typo($spip_lang); # remettre la typo de l'interface pour la suite
return (($spip_display == 4) ? "\n<ul>$res</ul>\n" : $res);
}
// http://doc.spip.org/@sous_enfant_rub
function sous_enfant_rub($collection2){
global $spip_lang_left;
$result3 = sql_select("id_rubrique, id_parent, titre, lang", "spip_rubriques", "id_parent=$collection2",'', '0+titre,titre');
$retour = '';
while($row=sql_fetch($result3)){
$id_rubrique2=$row['id_rubrique'];
$id_parent2=$row['id_parent'];
$titre2=$row['titre'];
changer_typo($row['lang']);
$lang_dir = lang_dir($row['lang']);
if (autoriser('voir','rubrique',$id_rubrique2))
$retour.="\n<li class='arial11 rubrique_12' dir='$lang_dir'><a href='" . generer_url_ecrire("naviguer","id_rubrique=$id_rubrique2") . "'>".typo($titre2)."</a></li>\n";
}
if (!$retour) return '';
return debut_block_depliable(false,"enfants$collection2")
."\n<ul style='margin: 0px; padding: 0px; padding-top: 3px;'>\n"
. $retour
. "</ul>\n\n".fin_block()."\n\n";
}
// http://doc.spip.org/@afficher_enfant_rub
function afficher_enfant_rub($id_rubrique, $bouton=false, $return=false) {
global $spip_lang_left,$spip_lang_right, $spip_display;
$les_enfants = enfant_rub($id_rubrique);
$n = strlen(trim($les_enfants));
if (!$n && !$bouton) return "";
if (!($x = strpos($les_enfants,"\n<div class='enfants'>",round($n/2)))) {
$les_enfants2="";
}else{
$les_enfants2 = substr($les_enfants, $x);
$les_enfants = substr($les_enfants,0,$x);
if ($spip_display == 4) {
$les_enfants .= '</li></ul>';
$les_enfants2 = '<ul><li>' . $les_enfants2;
}
}
$res =
"<div class='gauche'>"
. $les_enfants
. "</div>"
. "<div class='droite'>"
. $les_enfants2
. "</div>"
. "&nbsp;"
. "<div style='float:"
. $spip_lang_right
. ";position:relative;'>"
. (!$bouton ? ''
: (!$id_rubrique
? icone(_T('icone_creer_rubrique'), generer_url_ecrire("rubriques_edit","new=oui&retour=nav"), "secteur-24.gif", "creer.gif",$spip_lang_right, false)
: icone(_T('icone_creer_sous_rubrique'), generer_url_ecrire("rubriques_edit","new=oui&retour=nav&id_parent=$id_rubrique"), "rubrique-24.gif", "creer.gif",$spip_lang_right,false)))
. "</div>";
if ($return) return $res; else echo_log('afficher_enfant_rub',$res);
}
?>
\ No newline at end of file
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Veuillez vous inscrire ou vous pour commenter