Pridany linky do stromu kategorii
authorThomas Mudrunka <tomas@mudrunka.cz>
Fri, 9 Dec 2011 21:17:33 +0000 (22:17 +0100)
committerThomas Mudrunka <tomas@mudrunka.cz>
Fri, 9 Dec 2011 21:17:33 +0000 (22:17 +0100)
assistants/category-tree.inc.php

index b41b5471ac2d658d670021431eb278f09fd171b5..05d426d232c8c253b288bc6b91ddbd89265c6bd5 100644 (file)
@@ -25,7 +25,18 @@ function render_tree($tree, $index_path='__PATH__', $index_id='__ID__') {
        if(!is_array($tree)) return '';
        $html='<menu>';
                foreach($tree as $name => $subtree) if($name != $index_path && $name != $index_id) {
-                       @$html.='<li><b>'.$name.'</b> <small>('.$subtree[$index_id].' => '.$subtree[$index_path].')</small>'.render_tree($subtree).'</li>';
+                       $link = isset($subtree[$index_id]);
+                       $hidden = $link && $subtree[$index_id] <= 0;
+
+                       $html.='<li>';
+                       if($link) $html.= '<a href="'.$_SERVER['SCRIPT_NAME'].'/model/?where[category_id]=='.$subtree[$index_id].'">';
+                       if($hidden) $html.='<font color="grey">';
+                       $html.="<b>$name</b>";
+                       if($hidden) $html.='</font>';
+                       if($link) $html.= '</a>';
+                       @$html.=' <small>('.$subtree[$index_id].' => '.$subtree[$index_path].')</small>';
+                       $html.=render_tree($subtree);
+                       $html.='</li>';
                }
        $html.='</menu>';
        return $html;
This page took 0.145794 seconds and 4 git commands to generate.