summaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
authorChristian Fowler <spider@viovio.com>2007-09-26 19:32:14 +0000
committerChristian Fowler <spider@viovio.com>2007-09-26 19:32:14 +0000
commit2b9cfb1f06082a5c54c7906dcd7fddbbd1101669 (patch)
treef76eee954c15d4e07831192ba90d94b7a996435e /modules
parenteb35a00cd8866bfa7c4f4d0925710d4e5ec30ce8 (diff)
downloadliberty-2b9cfb1f06082a5c54c7906dcd7fddbbd1101669.tar.gz
liberty-2b9cfb1f06082a5c54c7906dcd7fddbbd1101669.tar.bz2
liberty-2b9cfb1f06082a5c54c7906dcd7fddbbd1101669.zip
allow passage of a structure_id in to module via module_params
Diffstat (limited to 'modules')
-rw-r--r--modules/mod_structure_toc.php17
1 files changed, 12 insertions, 5 deletions
diff --git a/modules/mod_structure_toc.php b/modules/mod_structure_toc.php
index 6496629..5105210 100644
--- a/modules/mod_structure_toc.php
+++ b/modules/mod_structure_toc.php
@@ -1,6 +1,6 @@
<?php
/**
- * @version $Header: /cvsroot/bitweaver/_bit_liberty/modules/mod_structure_toc.php,v 1.6 2007/06/22 10:16:09 lsces Exp $
+ * @version $Header: /cvsroot/bitweaver/_bit_liberty/modules/mod_structure_toc.php,v 1.7 2007/09/26 19:32:14 spiderr Exp $
*
* @package liberty
* @subpackage modules
@@ -9,9 +9,17 @@
/**
* Initial Setup
*/
-global $gStructure, $gContent;
+global $gStructure, $gContent, $moduleParams;
+extract( $moduleParams );
+
$struct = NULL;
-if( is_object( $gContent ) && ( empty( $gStructure ) || !$gStructure->isValid() ) ) {
+
+if( is_object( $gStructure ) && $gStructure->isValid() ) {
+ $struct = &$gStructure;
+} elseif( @BitBase::verifyId( $module_params['structure_id'] ) ) {
+ $struct = new LibertyStructure( $module_params['structure_id'] );
+ $struct->load();
+} elseif( is_object( $gContent ) ) {
$structures = $gContent->getStructures();
// We take the first structure. not good, but works for now - spiderr
if( !empty( $structures[0] ) ) {
@@ -19,9 +27,8 @@ if( is_object( $gContent ) && ( empty( $gStructure ) || !$gStructure->isValid()
$struct = new LibertyStructure( $structures[0]['structure_id'] );
$struct->load();
}
-} else {
- $struct = &$gStructure;
}
+
if( is_object( $struct ) && count( $struct->isValid() ) ) {
$gBitSmarty->assign( 'modStructureTOC', $struct->getToc( $struct->mInfo['root_structure_id'] ) );
}