aboutsummaryrefslogtreecommitdiffstats
path: root/include/section_init.inc.php
diff options
context:
space:
mode:
authormistic100 <mistic@piwigo.org>2012-09-23 11:19:26 +0000
committermistic100 <mistic@piwigo.org>2012-09-23 11:19:26 +0000
commit4e65d9af4667f3d8556522843f776f1fa074ea21 (patch)
treeea39e514f64b1cea7cd8df375eae4f1fc38e3682 /include/section_init.inc.php
parent7e33b84e770ddab61ef1d5c67061cd41c189f20e (diff)
feature 2614: pagination on albums
git-svn-id: http://piwigo.org/svn/trunk@18165 68402e56-0260-453c-a942-63ccdbb3a9ee
Diffstat (limited to 'include/section_init.inc.php')
-rw-r--r--include/section_init.inc.php47
1 files changed, 46 insertions, 1 deletions
diff --git a/include/section_init.inc.php b/include/section_init.inc.php
index 2bfb1e9b5..25712a0bb 100644
--- a/include/section_init.inc.php
+++ b/include/section_init.inc.php
@@ -41,7 +41,11 @@
// 'start' => 24
// );
-$page['items'] = array();
+// exemple of dynamic nb_categories_page (%2 for nice display)
+// $conf['nb_categories_page'] = 2*round($user['nb_image_page']/4);
+
+$page['items'] = $page['categories'] = array();
+$page['start'] = $page['starta'] = 0;
// some ISPs set PATH_INFO to empty string or to SCRIPT_FILENAME while in the
// default apache implementation it is not set
@@ -246,8 +250,11 @@ if ('categories' == $page['section'])
else
$page['title'] = ''; // will be set later
+
+ // GET IMAGES LIST
if
(
+ $page['starta'] == 0 and
(!isset($page['chronology_field'])) and
(
(isset($page['category'])) or
@@ -310,6 +317,44 @@ SELECT DISTINCT(image_id)
$page['items'] = array_from_query($query, 'image_id');
} //otherwise the calendar will requery all subitems
+
+ // GET CATEGORIES LIST
+ if ( 0==$page['start']
+ and !isset($page['flat'])
+ and !isset($page['chronology_field'])
+ and ('recent_cats'==$page['section'] or 'categories'==$page['section'])
+ and (!isset($page['category']['count_categories']) or $page['category']['count_categories']>0 )
+ )
+ {
+ $query = '
+SELECT c.id
+ FROM '.CATEGORIES_TABLE.' c
+ INNER JOIN '.USER_CACHE_CATEGORIES_TABLE.' ucc
+ ON id = cat_id
+ AND user_id = '.$user['id'];
+
+ if ('recent_cats' == $page['section'])
+ {
+ $query.= '
+ WHERE date_last >= '.pwg_db_get_recent_period_expression($user['recent_period']);
+ }
+ else
+ {
+ $query.= '
+ WHERE id_uppercat '.(!isset($page['category']) ? 'is NULL' : '= '.$page['category']['id']);
+ }
+
+ $query.= '
+ '.get_sql_condition_FandF(
+ array('visible_categories' => 'id'),
+ 'AND'
+ );
+
+ $query.= '
+ ;';
+
+ $page['categories'] = array_from_query($query, 'id');
+ }
}
// special sections
else