summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Pigeonholes.php47
-rw-r--r--admin/admin_pigeonholes_inc.php6
-rw-r--r--bit_setup_inc.php17
3 files changed, 47 insertions, 23 deletions
diff --git a/Pigeonholes.php b/Pigeonholes.php
index 8e36763..553f68d 100644
--- a/Pigeonholes.php
+++ b/Pigeonholes.php
@@ -1,6 +1,6 @@
<?php
/**
- * @version $Header: /cvsroot/bitweaver/_bit_pigeonholes/Pigeonholes.php,v 1.95 2007/08/04 18:27:42 squareing Exp $
+ * @version $Header: /cvsroot/bitweaver/_bit_pigeonholes/Pigeonholes.php,v 1.96 2007/08/23 07:31:27 squareing Exp $
*
* +----------------------------------------------------------------------+
* | Copyright ( c ) 2004, bitweaver.org
@@ -17,7 +17,7 @@
* Pigeonholes class
*
* @author xing <xing@synapse.plus.com>
- * @version $Revision: 1.95 $
+ * @version $Revision: 1.96 $
* @package pigeonholes
*/
@@ -1070,33 +1070,48 @@ function pigeonholes_content_store( $pObject, $pParamHash ) {
}
/**
+ * When the list function is called and the template, a filter option will appear based on categories
+ *
+ * @param array $pObject Current object
+ * @param array $pParamHash Parameter hash - only works if $_REQUEST[pigeonholes][filter] is passed back to the list sql funciton
+ * @access public
+ * @return void
+ */
+function pigeonholes_content_list( &$pObject, $pParamHash = NULL ) {
+ global $gBitSystem, $gBitSmarty;
+ if( $gBitSystem->isFeatureActive( 'pigeonholes_list_filter' )) {
+ $pigeonholes = new Pigeonholes();
+ $pigeonList = $pigeonholes->getPigeonholesPathList();
+ foreach( $pigeonList as $content_id => $path ) {
+ $list[$content_id] = $pigeonholes->getDisplayPath( $path );
+ }
+ $gBitSmarty->assign( 'pigeonList', $list );
+ }
+}
+
+/**
* filter the search with pigeonholes
* @param $pParamHash['pigeonholes']['filter'] - a pigeonhole or an array of pigeonhole content_id
**/
function pigeonholes_content_list_sql( &$pObject, $pParamHash = NULL ) {
global $gBitSystem;
$ret = array();
- if( /*$gBitSystem->isFeatureActive( 'pigeonholes_categorize_'.$pObject->getContentType() ) && */ !empty( $pParamHash['pigeonholes']['filter'] ) ) {
- if ( is_array( $pParamHash['pigeonholes']['filter'] ) ) {
- $ret['join_sql'] = "LEFT JOIN `".BIT_DB_PREFIX."pigeonhole_members` pm ON (lc .`content_id`= pm.`content_id`)";
- $ret['where_sql'] = ' AND pm.`parent_id` in ('.implode( ',', array_fill(0, count( $pParamHash['pigeonholes']['filter'] ), '?' ) ).')';
- $ret['bind_vars'] = $pParamHash['pigeonholes']['filter'];
- } else {
- $ret['join_sql'] = "LEFT JOIN `".BIT_DB_PREFIX."pigeonhole_members` pm ON (lc .`content_id`= pm.`content_id`)";
- $ret['where_sql'] = " AND pm.`parent_id`=? ";
- $ret['bind_vars'][] = $pParamHash['pigeonholes']['filter'];
- }
+
+ if( !empty( $pParamHash['pigeonholes']['filter'] )) {
+ $pParamHash['liberty_categories'] = $pParamHash['pigeonholes']['filter'];
}
- if( !empty( $pParamHash['liberty_categories'] ) ) {
- $ret['join_sql'] = "LEFT JOIN `".BIT_DB_PREFIX."pigeonhole_members` pm ON (lc .`content_id`= pm.`content_id`)";
- if ( is_array( $pParamHash['liberty_categories'] ) ) {
- $ret['where_sql'] = ' AND pm.`parent_id` in ('.implode( ',', array_fill(0, count( $pParamHash['liberty_categories'] ), '?' ) ).')';
+
+ if( !empty( $pParamHash['liberty_categories'] )) {
+ $ret['join_sql'] = "LEFT JOIN `".BIT_DB_PREFIX."pigeonhole_members` pm ON (lc .`content_id`= pm.`content_id`)";
+ if( is_array( $pParamHash['liberty_categories'] )) {
+ $ret['where_sql'] = ' AND pm.`parent_id` in ('.implode( ',', array_fill( 0, count( $pParamHash['liberty_categories'] ), '?' )).')';
$ret['bind_vars'] = $pParamHash['liberty_categories'];
} else {
$ret['where_sql'] = " AND pm.`parent_id`=? ";
$ret['bind_vars'][] = $pParamHash['liberty_categories'];
}
}
+
return $ret;
}
?>
diff --git a/admin/admin_pigeonholes_inc.php b/admin/admin_pigeonholes_inc.php
index d73aded..be06a61 100644
--- a/admin/admin_pigeonholes_inc.php
+++ b/admin/admin_pigeonholes_inc.php
@@ -1,5 +1,5 @@
<?php
-// $Header: /cvsroot/bitweaver/_bit_pigeonholes/admin/admin_pigeonholes_inc.php,v 1.17 2007/06/10 12:35:51 nickpalmer Exp $
+// $Header: /cvsroot/bitweaver/_bit_pigeonholes/admin/admin_pigeonholes_inc.php,v 1.18 2007/08/23 07:31:27 squareing Exp $
$pigeonholeDisplaySettings = array(
'pigeonholes_display_path' => array(
@@ -18,6 +18,10 @@ $pigeonholeDisplaySettings = array(
'label' => 'Display Subtree',
'note' => 'When viewing the category list, you can display the subcategories as well.',
),
+ 'pigeonholes_list_filter' => array(
+ 'label' => 'Listing Filter',
+ 'note' => 'When viewing a listing of content items, users can limit the listing based on category.',
+ ),
'pigeonholes_themes' => array(
'label' => 'Theme selection',
'note' => 'Allow the selection of a different theme to use for a category.',
diff --git a/bit_setup_inc.php b/bit_setup_inc.php
index 490e305..596cb7f 100644
--- a/bit_setup_inc.php
+++ b/bit_setup_inc.php
@@ -1,7 +1,7 @@
<?php
/**
* @author xing <xing@synapse.plus.com>
- * @version $Revision: 1.16 $
+ * @version $Revision: 1.17 $
* @package Pigeonholes
* @subpackage functions
*/
@@ -16,24 +16,29 @@ $gBitSystem->registerPackage( $registerHash );
define( 'PIGEONHOLES_CONTENT_TYPE_GUID', 'pigeonholes' );
-if( $gBitSystem->isPackageActive( 'pigeonholes' ) ) {
+if( $gBitSystem->isPackageActive( 'pigeonholes' )) {
// include service functions
require_once( PIGEONHOLES_PKG_PATH.'Pigeonholes.php' );
$tpl = $gBitSystem->isFeatureActive( 'pigeonholes_use_jstab' ) ? 'tab' : 'mini';
$gLibertySystem->registerService( LIBERTY_SERVICE_CATEGORIZATION, PIGEONHOLES_PKG_NAME, array(
+ // functions
'content_display_function' => 'pigeonholes_content_display',
'content_preview_function' => 'pigeonholes_content_preview',
'content_edit_function' => 'pigeonholes_content_edit',
'content_store_function' => 'pigeonholes_content_store',
'content_expunge_function' => 'pigeonholes_content_expunge',
- 'content_view_tpl' => 'bitpackage:pigeonholes/service_view_members_inc.tpl',
- 'content_nav_tpl' => 'bitpackage:pigeonholes/service_nav_path_inc.tpl',
+ 'content_list_function' => 'pigeonholes_content_list',
'content_list_sql_function' => 'pigeonholes_content_list_sql',
+
+ // templates
'content_edit_'.$tpl.'_tpl' => 'bitpackage:pigeonholes/service_edit_'.$tpl.'_inc.tpl',
- ) );
+ 'content_view_tpl' => 'bitpackage:pigeonholes/service_view_members_inc.tpl',
+ 'content_nav_tpl' => 'bitpackage:pigeonholes/service_nav_path_inc.tpl',
+ 'content_list_tpl' => 'bitpackage:pigeonholes/service_list_inc.tpl',
+ ));
- if( $gBitUser->hasPermission( 'p_pigeonholes_view' ) ) {
+ if( $gBitUser->hasPermission( 'p_pigeonholes_view' )) {
$menuHash = array(
'package_name' => PIGEONHOLES_PKG_NAME,
'index_url' => PIGEONHOLES_PKG_URL.'index.php',