X-Git-Url: http://git.cyclocoop.org/?p=velocampus%2Fweb%2Fwww.git;a=blobdiff_plain;f=www%2Fecrire%2Finc%2Fpresenter_enfants.php;fp=www%2Fecrire%2Finc%2Fpresenter_enfants.php;h=9836a15d3773f374db54af894f9353a7365f5ab3;hp=0000000000000000000000000000000000000000;hb=80b4d3e85f78d402ed2e73f8f5d1bf4c19962eed;hpb=aaf970bf4cdaf76689ecc10609048e18d073820c
diff --git a/www/ecrire/inc/presenter_enfants.php b/www/ecrire/inc/presenter_enfants.php
new file mode 100644
index 0000000..9836a15
--- /dev/null
+++ b/www/ecrire/inc/presenter_enfants.php
@@ -0,0 +1,151 @@
+", 48, 36);
+ if ($logo)
+ $logo = "\n
$logo
";
+ }
+ }
+
+ $lib_bouton = (!acces_restreint_rubrique($id_rubrique) ? "" :
+ http_img_pack("admin-12.gif", '', " width='12' height='12'", _T('image_administrer_rubrique'))) .
+ " ".
+ typo($titre) .
+ "";
+
+ $titre = (is_string($logo) ? $logo : '') .
+ bouton_block_depliable($lib_bouton,$les_sous_enfants ?false:-1,"enfants$id_rubrique");
+
+ $les_enfants = "\n" .
+ debut_cadre_sous_rub(($id_parent ? "rubrique-24.gif" : "secteur-24.gif"), true, "", $titre) .
+ (!$descriptif ? '' : "\n
$descriptif
") .
+ (($spip_display == 4) ? '' : $les_sous_enfants) .
+ "\n
" .
+ fin_cadre_sous_rub(true) .
+ "
";
+
+ $res .= ($spip_display != 4)
+ ? $les_enfants
+ : "\n$les_enfants";
+ }
+ }
+
+ changer_typo($spip_lang); # remettre la typo de l'interface pour la suite
+ return (($spip_display == 4) ? "\n\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".typo($titre2)."\n";
+ }
+
+ if (!$retour) return '';
+
+ return debut_block_depliable(false,"enfants$collection2")
+ ."\n\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",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 .= '';
+ $les_enfants2 = '
- ' . $les_enfants2;
+ }
+ }
+
+ $res =
+ "
"
+ . $les_enfants
+ . "
"
+ . ""
+ . $les_enfants2
+ . "
"
+ . " "
+ . ""
+ . (!$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)))
+ . "
";
+
+ if ($return) return $res; else echo_log('afficher_enfant_rub',$res);
+}
+
+?>