diff options
| author | Max Kremmel <xing@synapse.plus.com> | 2006-02-04 17:47:25 +0000 |
|---|---|---|
| committer | Max Kremmel <xing@synapse.plus.com> | 2006-02-04 17:47:25 +0000 |
| commit | cb3e84150edf23491c3c353ad850905002de2259 (patch) | |
| tree | b4b9298511fa98fb14777c8d9bc6ed2bb2f8a415 | |
| parent | ad0a664fc8b46af019e1e4f57d23fadcf67bbc98 (diff) | |
| download | pigeonholes-cb3e84150edf23491c3c353ad850905002de2259.tar.gz pigeonholes-cb3e84150edf23491c3c353ad850905002de2259.tar.bz2 pigeonholes-cb3e84150edf23491c3c353ad850905002de2259.zip | |
add module that automatically displays the full pigeonhole, the content is part of
| -rw-r--r-- | Pigeonholes.php | 12 | ||||
| -rw-r--r-- | modules/mod_category_menu.php | 19 | ||||
| -rw-r--r-- | modules/mod_category_menu.tpl | 10 | ||||
| -rw-r--r-- | templates/section_inc.tpl | 2 |
4 files changed, 39 insertions, 4 deletions
diff --git a/Pigeonholes.php b/Pigeonholes.php index 899d395..36136ad 100644 --- a/Pigeonholes.php +++ b/Pigeonholes.php @@ -1,6 +1,6 @@ <?php /** - * @version $Header: /cvsroot/bitweaver/_bit_pigeonholes/Pigeonholes.php,v 1.37 2006/02/02 17:19:05 squareing Exp $ + * @version $Header: /cvsroot/bitweaver/_bit_pigeonholes/Pigeonholes.php,v 1.38 2006/02/04 17:47:24 squareing Exp $ * * +----------------------------------------------------------------------+ * | Copyright ( c ) 2004, bitweaver.org @@ -17,7 +17,7 @@ * Pigeonholes class * * @author xing <xing@synapse.plus.com> - * @version $Revision: 1.37 $ + * @version $Revision: 1.38 $ * @package pigeonholes */ @@ -262,15 +262,21 @@ class Pigeonholes extends LibertyAttachable { **/ function getPigeonholesFromContentId( $pContentId ) { if( @BitBase::verifyId( $pContentId ) ) { - $query = "SELECT pig.* + $query = "SELECT ls.* FROM `".BIT_DB_PREFIX."pigeonhole_members` pigm INNER JOIN `".BIT_DB_PREFIX."pigeonholes` pig ON ( pig.`content_id` = pigm.`parent_id` ) + INNER JOIN `".BIT_DB_PREFIX."liberty_structures` ls ON ( pig.`structure_id` = ls.`structure_id` ) WHERE pigm.`content_id`=?"; $ret = $this->mDb->getAll( $query, array( $pContentId ) ); } return( !empty( $ret ) ? $ret : FALSE ); } + function getStructure( $pParamHash ) { + $struct = new LibertyStructure(); + return $struct->getStructure( $pParamHash ); + } + /** * get the path of a pigeonhole * @param $pStructureId structure id of pigeonhole, if no id is given, it gets the id from $this->mStructureId diff --git a/modules/mod_category_menu.php b/modules/mod_category_menu.php new file mode 100644 index 0000000..ce10019 --- /dev/null +++ b/modules/mod_category_menu.php @@ -0,0 +1,19 @@ +<?php +global $gContent; +if( !empty( $gContent->mContentId ) ) { + if( $gBitUser->hasPermission( 'bit_p_view_pigeonholes' ) ) { + require_once( PIGEONHOLES_PKG_PATH.'Pigeonholes.php' ); + $pigeonholes = new Pigeonholes(); + + if( empty( $gStructure ) ) { + $gStructure = new LibertyStructure(); + } + if( $pigeons = $pigeonholes->getPigeonholesFromContentId( $gContent->mContentId ) ) { + foreach( $pigeons as $pigeon ) { + $modPigeonStructures[] = $gStructure->getSubTree( $pigeon['root_structure_id'], TRUE ); + } + $gBitSmarty->assign( 'modPigeonStructures', !empty( $modPigeonStructures ) ? $modPigeonStructures : FALSE ); + } + } +} +?> diff --git a/modules/mod_category_menu.tpl b/modules/mod_category_menu.tpl new file mode 100644 index 0000000..f203fa0 --- /dev/null +++ b/modules/mod_category_menu.tpl @@ -0,0 +1,10 @@ +{* $Header: /cvsroot/bitweaver/_bit_pigeonholes/modules/mod_category_menu.tpl,v 1.1 2006/02/04 17:47:24 squareing Exp $ *} +{strip} +{if $gBitSystem->isFeatureActive( 'display_pigeonhole_members' ) and $modPigeonStructures} + {bitmodule title="$moduleTitle" name="whats_related"} + {foreach from=$modPigeonStructures item=subtree} + {include file="bitpackage:pigeonholes/view_structure_inc.tpl" no_details=true no_edit=true} + {/foreach} + {/bitmodule} +{/if} +{/strip} diff --git a/templates/section_inc.tpl b/templates/section_inc.tpl index 425cfaf..ca11271 100644 --- a/templates/section_inc.tpl +++ b/templates/section_inc.tpl @@ -85,7 +85,7 @@ {smartlink ititle="Remove Category" ibiticon="liberty/delete" ifile="edit_pigeonholes.php" structure_id=$subtree[ix].structure_id action=remove} </div> {/if} - + {if $subtree[ix].content_id == $smarty.request.content_id || $subtree[ix].structure_id == $smarty.request.structure_id} {assign var=current value=1} {else} |
