aboutsummaryrefslogtreecommitdiffstats
path: root/include/functions_category.inc.php
diff options
context:
space:
mode:
authorrub <rub@piwigo.org>2006-12-01 23:31:19 +0000
committerrub <rub@piwigo.org>2006-12-01 23:31:19 +0000
commit63638b9b6dcdcef8baf5363419f0f6c5130c62df (patch)
treecf53c156032a7565dc7db3842cbd10952a920812 /include/functions_category.inc.php
parentb2de3c32ee635788f2f34c98d529fdc167ca6a51 (diff)
Resolved Issue ID 0000299:
o Add (new) icon of parent category with children categories including new images o Improved display text for images count o Improved (a little) mass_* functions More explications on the forum. You must call directly upgrade_feep.php (http://127.0.0.1/BSF/upgrade_feed.php for example) git-svn-id: http://piwigo.org/svn/trunk@1624 68402e56-0260-453c-a942-63ccdbb3a9ee
Diffstat (limited to 'include/functions_category.inc.php')
-rw-r--r--include/functions_category.inc.php63
1 files changed, 51 insertions, 12 deletions
diff --git a/include/functions_category.inc.php b/include/functions_category.inc.php
index ceef3025d..ae8b617f7 100644
--- a/include/functions_category.inc.php
+++ b/include/functions_category.inc.php
@@ -52,29 +52,31 @@ function check_restrictions($category_id)
function get_categories_menu()
{
- global $page,$user;
-
- $infos = array('');
+ global $page, $user;
$query = '
-SELECT name,id,date_last,nb_images,global_rank
- FROM '.CATEGORIES_TABLE.'
- WHERE 1 = 1'; // stupid but permit using AND after it !
+SELECT ';
+ // From CATEGORIES_TABLE
+ $query.= '
+ name, id, nb_images, global_rank,';
+ // From USER_CACHE_CATEGORIES_TABLE
+ $query.= '
+ max_date_last, is_child_date_last, count_images, count_categories';
+
+ // $user['forbidden_categories'] including with USER_CACHE_CATEGORIES_TABLE
+ $query.= '
+ FROM '.CATEGORIES_TABLE.' INNER JOIN '.USER_CACHE_CATEGORIES_TABLE.'
+ ON id = cat_id and user_id = '.$user['id'];
if (!$user['expand'])
{
$query.= '
- AND (id_uppercat is NULL';
+ WHERE (id_uppercat is NULL';
if (isset($page['category']))
{
$query.= ' OR id_uppercat IN ('.$page['uppercats'].')';
}
$query.= ')';
}
- if ($user['forbidden_categories'] != '')
- {
- $query.= '
- AND id NOT IN ('.$user['forbidden_categories'].')';
- }
$query.= '
;';
@@ -82,6 +84,7 @@ SELECT name,id,date_last,nb_images,global_rank
$cats = array();
while ($row = mysql_fetch_array($result))
{
+ $row['is_child_date_last'] = get_boolean($row['is_child_date_last']);
array_push($cats, $row);
}
usort($cats, 'global_rank_compare');
@@ -89,6 +92,7 @@ SELECT name,id,date_last,nb_images,global_rank
return get_html_menu_category($cats);
}
+
/**
* Retrieve informations about a category in the database
*
@@ -352,4 +356,39 @@ function rank_compare($a, $b)
return ($a['rank'] < $b['rank']) ? -1 : 1;
}
+
+/**
+ * returns display text for information images of category
+ *
+ * @param array categories
+ * @return string
+ */
+function get_display_images_count($cat_nb_images, $cat_count_images, $cat_count_categories, $short_message = true)
+{
+ $display_text = '';
+
+ // Count of category is main
+ // if not picture on categorie, test on sub-categories
+ $count = ($cat_nb_images > 0 ? $cat_nb_images : $cat_count_images);
+
+ if ($count > 0)
+ {
+ $display_text.= sprintf(l10n(($count > 1 ? 'images_available' : 'image_available')), $count);
+
+ if ($cat_nb_images > 0)
+ {
+ if (! $short_message)
+ {
+ $display_text.= ' '.l10n('images_available_cpl');
+ }
+ }
+ else
+ {
+ $display_text.= ' '.sprintf(l10n(($cat_count_categories > 1 ? 'images_available_cats' : 'images_available_cat')), $cat_count_categories);
+ }
+ }
+
+ return $display_text;
+}
+
?> \ No newline at end of file