From 32ed2bae9bf9a967465f74e74ae3a0e83424af5b Mon Sep 17 00:00:00 2001 From: Max Kremmel Date: Sun, 18 Jun 2006 07:43:06 +0000 Subject: display correct number of assignable elements and fix pagination related display limitation --- Pigeonholes.php | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) (limited to 'Pigeonholes.php') diff --git a/Pigeonholes.php b/Pigeonholes.php index 1019137..7b3fc68 100644 --- a/Pigeonholes.php +++ b/Pigeonholes.php @@ -1,6 +1,6 @@ - * @version $Revision: 1.63 $ + * @version $Revision: 1.64 $ * @package pigeonholes */ @@ -163,8 +163,10 @@ class Pigeonholes extends LibertyContent { * @return array of content not in any pigeonhole yet * @access public **/ - function getAssignableContent( $pListHash ) { + function getAssignableContent( &$pListHash ) { global $gBitUser, $gLibertySystem, $gBitSystem; + LibertyContent::prepGetList( $pListHash ); + $where = ''; $bindVars = array(); @@ -185,16 +187,16 @@ class Pigeonholes extends LibertyContent { } if( !empty( $pListHash['sort_mode'] ) ) { - $where .= " ORDER BY ".$this->mDb->convert_sortmode( $pListHash['sort_mode'] )." "; + $order = " ORDER BY ".$this->mDb->convert_sortmode( $pListHash['sort_mode'] )." "; } else { - $where .= " ORDER BY lc.`content_type_guid`, lc.`title` ASC"; + $order = " ORDER BY lc.`content_type_guid`, lc.`title` ASC"; } $query = "SELECT pigm.`parent_id`, lc.`content_id`, lc.`user_id`, lc.`title`, lc.`content_type_guid`, uu.`login`, uu.`real_name` FROM `".BIT_DB_PREFIX."liberty_content` lc LEFT JOIN `".BIT_DB_PREFIX."pigeonhole_members` pigm ON ( pigm.`content_id` = lc.`content_id` ) LEFT JOIN `".BIT_DB_PREFIX."users_users` uu ON ( uu.`user_id` = lc.`user_id` ) - $where"; + $where $order"; $result = $this->mDb->query( $query, $bindVars, @BitBase::verifyId( $pListHash['max_records'] ) ? $pListHash['max_records'] : NULL ); $contentTypes = $gLibertySystem->mContentTypes; @@ -225,6 +227,14 @@ class Pigeonholes extends LibertyContent { } } + $query = "SELECT COUNT( lc.`content_id` ) + FROM `".BIT_DB_PREFIX."liberty_content` lc + LEFT JOIN `".BIT_DB_PREFIX."pigeonhole_members` pigm ON ( pigm.`content_id` = lc.`content_id` ) + LEFT JOIN `".BIT_DB_PREFIX."users_users` uu ON ( uu.`user_id` = lc.`user_id` ) + $where"; + $pListHash['cant'] = $this->mDb->getOne( $query, $bindVars ); + + LibertyContent::postGetList( $pListHash ); return( !empty( $ret ) ? $ret : NULL ); } -- cgit v1.3