summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLester Caine ext:(%22) <lester@lsces.co.uk>2013-07-31 22:35:36 +0100
committerLester Caine ext:(%22) <lester@lsces.co.uk>2013-07-31 22:35:36 +0100
commit835f95f12a2237c2f2dc18b6f3c0bbe345da1b5a (patch)
tree9a6f74d9fc6ca8385ff2d6540354b4353a557a8b
parent8c13e333ee046e8bab2b080031998f0d769e5f42 (diff)
downloadkernel-835f95f12a2237c2f2dc18b6f3c0bbe345da1b5a.tar.gz
kernel-835f95f12a2237c2f2dc18b6f3c0bbe345da1b5a.tar.bz2
kernel-835f95f12a2237c2f2dc18b6f3c0bbe345da1b5a.zip
Additional menu generator building from a set of book entries
This will be developed further but is used on several lsces sites
-rw-r--r--modules/mod_side_menu.php54
-rwxr-xr-xmodules/mod_side_menu.tpl1
-rw-r--r--templates/side_bar.tpl26
3 files changed, 81 insertions, 0 deletions
diff --git a/modules/mod_side_menu.php b/modules/mod_side_menu.php
new file mode 100644
index 0000000..4c67b7c
--- /dev/null
+++ b/modules/mod_side_menu.php
@@ -0,0 +1,54 @@
+<?php
+/**
+ * $Header$
+ *
+ * Copyright ( c ) 2004 bitweaver.org
+ * All Rights Reserved. See below for details and a complete list of authors.
+ * Licensed under the GNU LESSER GENERAL PUBLIC LICENSE. See http://www.gnu.org/copyleft/lesser.html for details
+ *
+ * @package kernel
+ * @subpackage modules
+ */
+extract( $moduleParams );
+
+if( !empty( $module_params ) ) {
+ $gBitSmarty->assign( 'modParams', $module_params );
+}
+
+global $gStructure, $gContent;
+if( !$gStructure and $gContent ) {
+ $structs = $gContent->getStructures();
+ if ( count($structs) > 1 ) {
+ $gStructure = new LibertyStructure( $structs[0]['structure_id'] );
+ if( $gStructure->load() ) {
+ $gStructure->loadNavigation();
+ $gStructure->loadPath();
+ $gBitSmarty->assign( 'structureInfo', $gStructure->mInfo );
+ }
+ }
+}
+
+if( $gStructure and !empty($gStructure->mInfo['structure_path']) ) {
+ $secondbox = 0;
+ $tree = 1;
+ $gStructure->mInfo['structure_path'][0]['structure_id'];
+ if( $gStructure->mInfo['parent']['structure_id'] == 4 ) $sidebox = $gStructure->mInfo['content_id'] - 3;
+ elseif( $gStructure->mInfo['parent']['content_id'] > 4 ) $sidebox = $gStructure->mInfo['parent']['content_id'] - 3;
+ else $sidebox = 1;
+ if( $gStructure->mInfo['content_id'] != 4 ) {
+ $menu = $gStructure->buildTreeToc( $tree );
+ $gBitSmarty->assign_by_ref( 'menu', $menu[0]['sub'] );
+ $gBitSmarty->assign( 'sidebox', $sidebox );
+ if ($secondbox) {
+ $secondmenu = $gStructure->buildTreeToc( $secondbox );
+ $gBitSmarty->assign_by_ref( 'secondmenu', $secondmenu[0]['sub'] );
+ }
+ }
+} else {
+ require_once( LIBERTY_PKG_PATH.'LibertyStructure.php' );
+ $gStructure = new LibertyStructure( 1 );
+ $menu = $gStructure->buildTreeToc( 1 );
+ $gBitSmarty->assign_by_ref( 'menu', $menu[0]['sub'] );
+}
+
+?>
diff --git a/modules/mod_side_menu.tpl b/modules/mod_side_menu.tpl
new file mode 100755
index 0000000..2fba543
--- /dev/null
+++ b/modules/mod_side_menu.tpl
@@ -0,0 +1 @@
+{include file="bitpackage:kernel/side_bar.tpl"}
diff --git a/templates/side_bar.tpl b/templates/side_bar.tpl
new file mode 100644
index 0000000..c7657fb
--- /dev/null
+++ b/templates/side_bar.tpl
@@ -0,0 +1,26 @@
+{strip}
+ <div id="cssmenu">
+ <ul>
+ <li><a href="/wiki/">Home</a><ul></ul></li>
+ <li>
+ {section name=ix loop=$menu}
+ {if $menu[ix].pos ne ''}
+ {if $menu[ix].first}<ul>{else}</li>{/if}
+ {if $menu[ix].last}</ul>{else}
+ <li><a href="{$menu[ix].display_url}">
+ {if $menu[ix].page_alias}{$menu[ix].page_alias}{else}{$menu[ix].title|escape}{/if}</a>
+ {/if}
+ {/if}
+ <ul>
+ {section name=six loop=$menu[ix].sub}
+ <li><a href="{$menu[ix].sub[six].display_url}">
+ {if $menu[ix].sub[six].page_alias}{$menu[ix].sub[six].page_alias}
+ {else}{$menu[ix].sub[six].title|escape}{/if}
+ </a></li>
+ {/section}
+ </ul>
+ {/section}
+ </li>
+ </ul><!-- end outermost .toc -->
+ </div>
+{/strip}