forked from Public/pics
FeaturedThumbnailManager: add pager widget; show only 20 thumbs per page
This commit is contained in:
@@ -12,6 +12,8 @@ class EditAlbum extends HTMLController
|
||||
private $form;
|
||||
private $formview;
|
||||
|
||||
const THUMBS_PER_PAGE = 20;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
// Ensure it's just admins at this point.
|
||||
@@ -143,15 +145,34 @@ class EditAlbum extends HTMLController
|
||||
|
||||
if (!empty($id_tag))
|
||||
{
|
||||
$current_page = isset($_GET['page']) ? (int) $_GET['page'] : 1;
|
||||
|
||||
list($assets, $num_assets) = AssetIterator::getByOptions([
|
||||
'direction' => 'desc',
|
||||
'limit' => 500,
|
||||
'limit' => self::THUMBS_PER_PAGE,
|
||||
'page' => $current_page,
|
||||
'id_tag' => $id_tag,
|
||||
], true);
|
||||
|
||||
// If we have asset images, show the thumbnail manager
|
||||
if ($num_assets > 0)
|
||||
$this->page->adopt(new FeaturedThumbnailManager($assets, $id_tag ? $album->id_asset_thumb : 0));
|
||||
{
|
||||
$manager = new FeaturedThumbnailManager($assets, $id_tag ? $album->id_asset_thumb : 0);
|
||||
$this->page->adopt($manager);
|
||||
|
||||
// Make a page index as needed, while we're at it.
|
||||
if ($num_assets > self::THUMBS_PER_PAGE)
|
||||
{
|
||||
$index = new PageIndex([
|
||||
'recordCount' => $num_assets,
|
||||
'items_per_page' => self::THUMBS_PER_PAGE,
|
||||
'start' => ($current_page - 1) * self::THUMBS_PER_PAGE,
|
||||
'base_url' => BASEURL . '/editalbum/?id=' . $id_tag,
|
||||
'page_slug' => '&page=%PAGE%',
|
||||
]);
|
||||
$manager->adopt(new PageIndexWidget($index));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($_POST['changeThumbnail']))
|
||||
|
||||
@@ -8,6 +8,8 @@
|
||||
|
||||
class EditTag extends HTMLController
|
||||
{
|
||||
const THUMBS_PER_PAGE = 20;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$id_tag = isset($_GET['id']) ? (int) $_GET['id'] : 0;
|
||||
@@ -117,14 +119,34 @@ class EditTag extends HTMLController
|
||||
|
||||
if (!empty($id_tag))
|
||||
{
|
||||
$current_page = isset($_GET['page']) ? (int) $_GET['page'] : 1;
|
||||
|
||||
list($assets, $num_assets) = AssetIterator::getByOptions([
|
||||
'direction' => 'desc',
|
||||
'limit' => 500,
|
||||
'limit' => self::THUMBS_PER_PAGE,
|
||||
'page' => $current_page,
|
||||
'id_tag' => $id_tag,
|
||||
], true);
|
||||
|
||||
// If we have asset images, show the thumbnail manager
|
||||
if ($num_assets > 0)
|
||||
$this->page->adopt(new FeaturedThumbnailManager($assets, $id_tag ? $tag->id_asset_thumb : 0));
|
||||
{
|
||||
$manager = new FeaturedThumbnailManager($assets, $id_tag ? $tag->id_asset_thumb : 0);
|
||||
$this->page->adopt($manager);
|
||||
|
||||
// Make a page index as needed, while we're at it.
|
||||
if ($num_assets > self::THUMBS_PER_PAGE)
|
||||
{
|
||||
$index = new PageIndex([
|
||||
'recordCount' => $num_assets,
|
||||
'items_per_page' => self::THUMBS_PER_PAGE,
|
||||
'start' => ($current_page - 1) * self::THUMBS_PER_PAGE,
|
||||
'base_url' => BASEURL . '/edittag/?id=' . $id_tag,
|
||||
'page_slug' => '&page=%PAGE%',
|
||||
]);
|
||||
$manager->adopt(new PageIndexWidget($index));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($_POST['changeThumbnail']))
|
||||
|
||||
Reference in New Issue
Block a user