phpgroupware-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Phpgroupware-cvs] sitemgr/modules class.module_toc_block.inc.php [skwas


From: Dave Hall
Subject: [Phpgroupware-cvs] sitemgr/modules class.module_toc_block.inc.php [skwashd-16-compat]
Date: Mon, 15 May 2006 09:20:46 +0000

CVSROOT:        /cvsroot/phpgroupware
Module name:    sitemgr
Branch:         skwashd-16-compat
Changes by:     Dave Hall <address@hidden>      06/05/15 09:20:46

Modified files:
        modules        : class.module_toc_block.inc.php 

Log message:
        better CSS friendly version

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/phpgroupware/sitemgr/modules/class.module_toc_block.inc.php.diff?only_with_tag=skwashd-16-compat&tr1=1.1.2.1&tr2=1.1.2.1.4.1&r1=text&r2=text

Patches:
Index: sitemgr/modules/class.module_toc_block.inc.php
diff -u /dev/null sitemgr/modules/class.module_toc_block.inc.php:1.1.2.1.4.1
--- /dev/null   Mon May 15 09:20:46 2006
+++ sitemgr/modules/class.module_toc_block.inc.php      Mon May 15 09:20:46 2006
@@ -0,0 +1,75 @@
+<?php
+
+class module_toc_block extends Module
+{
+       function module_toc_block()
+       {
+               $this->arguments = array
+               (
+                       'list_id' => array
+                       (
+                               'type' => 'textfield',
+                               'label' => lang('The ID for the CSS element 
containing the table of contents')
+                       ),
+               );
+               $this->title = lang('Table of contents');
+               $this->description = lang('This module provides a condensed 
table of contents, meant for side areas');
+       }
+
+       function get_content(&$arguments,$properties)
+       {
+               $cur_cat =& $GLOBALS['objbo']->cur_cat;
+               $indexarray = $GLOBALS['objbo']->getCatLinks();
+               $depth = 1;
+               $def_page = 0;
+
+               $content = "\n<ul id=\"{$arguments['list_id']}\">";
+
+               foreach ( $indexarray as $cat_id => $cat )
+               {
+                       $def_page = (int)$cat['def_page'];
+                       if ( $depth > $cat['depth'] )
+                       {
+                               $content = "</li>\n</ul>\n</li>\n";
+                       }
+                       
+                       $content .= '<li' . ($cat_id == $cur_cat ? ' 
class="active">' : '>') . $cat['link'];
+
+                       if ( $depth < $cat['depth'] )
+                       {
+                               $content .= "<ul>\n";
+                       }
+
+                       $pages = $GLOBALS['objbo']->getPageLinks($cat_id, 
false);
+                       if ( is_array($pages) && count($pages) )
+                       {
+                               $content .= "\n<ul>\n";
+                               
+                               foreach($pages as $id => $page)
+                               {
+                                       if ( $id <> $def_page )
+                                       {
+                                               $content .= 
"<li>{$page['link']}</li>\n";
+                                       }
+                               }
+                               
+                               $content .= "</ul>\n";
+                       }
+
+                       if ( $depth == $cat['depth'] )
+                       {
+                               $content .= "</li>\n";
+                       }
+
+                       $depth = $cat['depth'];
+               }
+               $content .= "</ul>\n";
+               
+               if (count($indexarray)==0)
+               {
+                       $content = "\n<ul id=\"{$arguments['list_id']}\"><li>" 
. lang('You do not have access to any content on this site.') . "</li></ul>\n";
+               }
+               return $content;
+       }
+}
+?>




reply via email to

[Prev in Thread] Current Thread [Next in Thread]