[pLog-svn] r2809 - in plog/trunk/class: gallery/dao view/admin
oscar at devel.lifetype.net
oscar at devel.lifetype.net
Tue Jan 17 21:25:51 GMT 2006
Author: oscar
Date: 2006-01-17 21:25:51 +0000 (Tue, 17 Jan 2006)
New Revision: 2809
Modified:
plog/trunk/class/gallery/dao/galleryresources.class.php
plog/trunk/class/view/admin/adminresourceslistview.class.php
Log:
Paging for gallery resources should work better now.
Modified: plog/trunk/class/gallery/dao/galleryresources.class.php
===================================================================
--- plog/trunk/class/gallery/dao/galleryresources.class.php 2006-01-17 20:30:49 UTC (rev 2808)
+++ plog/trunk/class/gallery/dao/galleryresources.class.php 2006-01-17 21:25:51 UTC (rev 2809)
@@ -203,8 +203,9 @@
}
// check if we need to do any paging
- if( $page > DEFAULT_PAGING_ENABLED && $itemsPerPage > DEFAULT_ITEMS_PER_PAGE )
- $result = array_slice( $result, ($page-1) * $amount, $amount );
+ if( $page > DEFAULT_PAGING_ENABLED )
+ $result = array_slice( $result, ($page-1) * $itemsPerPage, $itemsPerPage );
+
return $result;
}
@@ -249,7 +250,20 @@
*/
function getNumUserResources( $ownerId, $albumId = GALLERY_NO_ALBUM, $resourceType = GALLERY_RESOURCE_ANY, $searchTerms = "" )
{
- return( count( $this->getUserResources( $ownerId, $albumId, $resourceType, $searchTerms )));
+ $prefix = $this->getPrefix();
+ $table = "{$prefix}gallery_resources";
+ $cond .= "owner_id = '".Db::qstr( $ownerId )."'";
+ if( $albumId > GALLERY_NO_ALBUM )
+ $cond .= "AND album_id = '".Db::qstr($albumId)."'";
+ if( $resourceType > GALLERY_RESOURCE_ANY )
+ $cond .= " AND resource_type = '".Db::qstr($resourceType)."'";
+ if( $searchTerms != "" ) {
+ $searchParams = $this->getSearchConditions( $searchTerms );
+ $cond .= " AND (".$searchParams.")";
+ }
+
+ // return the number of items
+ return( $this->getNumItems( $table, $cond ));
}
/**
Modified: plog/trunk/class/view/admin/adminresourceslistview.class.php
===================================================================
--- plog/trunk/class/view/admin/adminresourceslistview.class.php 2006-01-17 20:30:49 UTC (rev 2808)
+++ plog/trunk/class/view/admin/adminresourceslistview.class.php 2006-01-17 21:25:51 UTC (rev 2809)
@@ -69,9 +69,10 @@
$this->_searchTerms,
$this->_page,
DEFAULT_ITEMS_PER_PAGE );
- // total number of resources, used by the pager
+
+ // total number of resources in this album, used by the pager
$numResources = $galleryResources->getNumUserResources( $this->_blogInfo->getId(),
- ROOT_ALBUM_ID,
+ $this->_albumId,
$this->_resourceType,
$this->_searchTerms );
}
More information about the pLog-svn
mailing list