diff options
| -rw-r--r-- | LibertyStructure.php | 17 | ||||
| -rw-r--r-- | modules/mod_structure_toc.php | 6 | ||||
| -rw-r--r-- | modules/mod_structure_toc.tpl | 2 | ||||
| -rw-r--r-- | templates/html_head_inc.tpl | 3 | ||||
| -rwxr-xr-x | templates/structure_toc_startul.tpl | 2 |
5 files changed, 22 insertions, 8 deletions
diff --git a/LibertyStructure.php b/LibertyStructure.php index f33c509..e8a9ce3 100644 --- a/LibertyStructure.php +++ b/LibertyStructure.php @@ -24,6 +24,7 @@ class LibertyStructure extends LibertyBase { parent::__construct(); $this->mStructureId = $pStructureId; $this->mContentId = $pContentId; + $this->load(); } function load( $pContentId=NULL ) { @@ -127,6 +128,22 @@ class LibertyStructure extends LibertyBase { * @access public * @return TRUE on success, FALSE on failure - mErrors will contain reason for failure */ + function getRootObject() { + $ret = NULL; + if( !empty( $this->mInfo['root_structure_id'] ) ) { + if( $rootHash = $this->mDb->getRow( "SELECT * FROM `".BIT_DB_PREFIX."liberty_structures` WHERE `structure_id` = ?", array( $this->mInfo['root_structure_id'] ) ) ) { + $ret = $this->getLibertyObject( $rootHash['content_id'] ); + } + } + return $ret; + } + + /** + * get the title of the root node + * + * @access public + * @return TRUE on success, FALSE on failure - mErrors will contain reason for failure + */ function getRootTitle() { $ret = NULL; if( isset( $this->mInfo['structure_path'][0]['title'] ) ) { diff --git a/modules/mod_structure_toc.php b/modules/mod_structure_toc.php index 2b75e77..7fb5d7e 100644 --- a/modules/mod_structure_toc.php +++ b/modules/mod_structure_toc.php @@ -19,20 +19,20 @@ $struct = NULL; if( is_object( $gStructure ) && $gStructure->isValid() && $gStructure->hasViewPermission() ) { $struct = &$gStructure; } elseif( @BitBase::verifyId( $module_params['structure_id'] ) ) { - $struct = new LibertyStructure( $module_params['structure_id'] ); - $struct->load(); + $struct = new LibertyStructure( $module_params['structure_id'] ); } elseif( is_object( $gContent ) && $gContent->hasViewPermission( FALSE ) ) { $structures = $gContent->getStructures(); // We take the first structure. not good, but works for now - spiderr if( !empty( $structures[0] ) ) { require_once( LIBERTY_PKG_PATH.'LibertyStructure.php' ); $struct = new LibertyStructure( $structures[0]['structure_id'] ); - $struct->load(); } } if( is_object( $struct ) && count( $struct->isValid() ) ) { $_template->tpl_vars['moduleTitle'] = new Smarty_variable( $moduleParams['title'] ); $toc = $struct->getToc( $struct->mInfo['root_structure_id'], 'asc', FALSE, 2 ); + $root = $struct->getRootObject( $struct->mInfo['root_structure_id'] ); + $_template->tpl_vars['rootTitle'] = new Smarty_variable( $root->getDisplayLink() ); $_template->tpl_vars['modStructureTOC'] = new Smarty_variable( $struct->getToc( $struct->mInfo['root_structure_id'], 'asc', FALSE, 2 ) ); } diff --git a/modules/mod_structure_toc.tpl b/modules/mod_structure_toc.tpl index 3f6fb18..12afa2d 100644 --- a/modules/mod_structure_toc.tpl +++ b/modules/mod_structure_toc.tpl @@ -1,5 +1,5 @@ {if $modStructureTOC} - {bitmodule title=$moduleTitle name="structure_navigation"} + {bitmodule title=$rootTitle name="structure_navigation"} {$modStructureTOC} {/bitmodule} {/if} diff --git a/templates/html_head_inc.tpl b/templates/html_head_inc.tpl index ace495e..4d3e251 100644 --- a/templates/html_head_inc.tpl +++ b/templates/html_head_inc.tpl @@ -2,9 +2,6 @@ {strip} {if $structureInfo} <link rel="index" title="{tr}Contents{/tr}" href="index.php?structure_id={$structureInfo.root_structure_id}" /> - {if $structureInfo.parent.structure_id} - <link rel="up" title="{tr}Up{/tr}" href="index.php?structure_id={$structureInfo.parent.structure_id}" /> - {/if} {if $structureInfo.prev.structure_id} <link rel="prev" title="{tr}Previous{/tr}" href="index.php?structure_id={$structureInfo.prev.structure_id}" /> {/if} diff --git a/templates/structure_toc_startul.tpl b/templates/structure_toc_startul.tpl index cb6eeee..2565b9d 100755 --- a/templates/structure_toc_startul.tpl +++ b/templates/structure_toc_startul.tpl @@ -1 +1 @@ -<ol class="structure-toc" id="structure-branch-{$structureId}" structure_id="{$structureId}"> +<ol class="structure-toc branch-{$structureId}" structure_id="{$structureId}"> |
