From 9d88ee52dc217cb733acd70257c9b1845330b6a6 Mon Sep 17 00:00:00 2001 From: wjames5 Date: Wed, 20 Sep 2006 17:19:59 +0000 Subject: adds support for universal category REQUEST key to content_list_sql --- Pigeonholes.php | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) (limited to 'Pigeonholes.php') diff --git a/Pigeonholes.php b/Pigeonholes.php index 80b1efd..e0468d9 100644 --- a/Pigeonholes.php +++ b/Pigeonholes.php @@ -1,6 +1,6 @@ - * @version $Revision: 1.70 $ + * @version $Revision: 1.71 $ * @package pigeonholes */ @@ -991,7 +991,7 @@ function pigeonholes_content_store( $pObject, $pParamHash ) { /** * filter the search with pigeonholes - * @param $pParamHash['pigeonholes'] - a pigeonhole or an array of pigeonhole content_id + * @param $pParamHash['pigeonholes']['filter'] - a pigeonhole or an array of pigeonhole content_id **/ function pigeonholes_content_list_sql( &$pObject, $pParamHash = NULL ) { global $gBitSystem; @@ -1007,6 +1007,16 @@ function pigeonholes_content_list_sql( &$pObject, $pParamHash = NULL ) { $ret['bind_vars'][] = $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['pigeonholes']['filter'] ), '?' ) ).')'; + $ret['bind_vars'] = $pParamHash['liberty_categories']; + } else { + $ret['where_sql'] = " AND pm.`parent_id`=? "; + $ret['bind_vars'][] = $pParamHash['liberty_categories']; + } + } return $ret; } ?> -- cgit v1.3