From 40e652922c65516a9600b072d136043aab8cd64a Mon Sep 17 00:00:00 2001 From: mistic100 Date: Fri, 2 Nov 2012 15:04:54 +0000 Subject: feature:2614 bad display when there are empty albums revert most of the previous changes and slice the array at the very end git-svn-id: http://piwigo.org/svn/trunk@18892 68402e56-0260-453c-a942-63ccdbb3a9ee --- include/category_cats.inc.php | 34 ++++++++++++++++------------------ 1 file changed, 16 insertions(+), 18 deletions(-) (limited to 'include') diff --git a/include/category_cats.inc.php b/include/category_cats.inc.php index f055ae415..5f6908c31 100644 --- a/include/category_cats.inc.php +++ b/include/category_cats.inc.php @@ -69,29 +69,13 @@ if ('recent_cats' != $page['section']) $query.= ' ;'; -$categories_sql = hash_from_query($query, 'id'); - -if ($page['section']=='recent_cats') -{ - usort($categories_sql, 'global_rank_compare'); -} - -$page['total_categories'] = count($categories_sql); - -$categories_sql = array_slice( - array_values($categories_sql), - $page['startcat'], - $conf['nb_categories_page'] - ); - -$categories_sql = trigger_event('loc_index_categories_selection', $categories_sql); - +$result = pwg_query($query); $categories = array(); $category_ids = array(); $image_ids = array(); $user_representative_updates_for = array(); -foreach ($categories_sql as $row) +while ($row = pwg_db_fetch_assoc($result)) { $row['is_child_date_last'] = @$row['max_date_last']>@$row['date_last']; @@ -187,6 +171,11 @@ SELECT } } +if ($page['section']=='recent_cats') +{ + usort($categories, 'global_rank_compare'); +} + if (count($categories) > 0) { $infos_of_image = array(); @@ -386,6 +375,15 @@ if (count($categories) > 0) $tpl_thumbnails_var[] = $tpl_var; } + + // pagination + $page['total_categories'] = count($tpl_thumbnails_var); + + $tpl_thumbnails_var = array_slice( + array_values($tpl_thumbnails_var), + $page['startcat'], + $conf['nb_categories_page'] + ); $derivative_params = trigger_event('get_index_album_derivative_params', ImageStdParams::get_by_type(IMG_THUMB) ); $tpl_thumbnails_var = trigger_event('loc_end_index_category_thumbnails', $tpl_thumbnails_var, $categories); -- cgit v1.2.3