aboutsummaryrefslogtreecommitdiffstats
path: root/picture.php
diff options
context:
space:
mode:
authorplegall <plg@piwigo.org>2004-12-05 21:28:40 +0000
committerplegall <plg@piwigo.org>2004-12-05 21:28:40 +0000
commit9064686d9990b6830c0cd6a00d95745d3841eb9e (patch)
tree0d2bc6ee0564041f1836fb63c30cfe00738f211b /picture.php
parente4ce82fc27e1e10d697815928ef06c692a3f56da (diff)
- on picture.php, related categories under the element are displayed in
global_rank order - when adding a new virtual category, initializes its global_rank - bug fixed : in admin/cat_list, false next rank - in admin/cat_modify, complete directory is calculated only if category is not virtual - admin/picture_modify rewritten : graphically nearer to admin/cat_modify, virtual associations are back - update_category partially rewritten : take an array of categories in parameter, becomes optionnaly recursive, use the set_random_representant function, set a random representant for categories with elements and no representant - bug fixed : on a search results screen, elements belonging to more than 1 category were shown more than once - bug fixed : in admin/cat_modify, changing a value in a textefield and hitting enter was setting a new random representant git-svn-id: http://piwigo.org/svn/trunk@635 68402e56-0260-453c-a942-63ccdbb3a9ee
Diffstat (limited to '')
-rw-r--r--picture.php35
1 files changed, 26 insertions, 9 deletions
diff --git a/picture.php b/picture.php
index 6dbb67739..e0af0b062 100644
--- a/picture.php
+++ b/picture.php
@@ -738,8 +738,9 @@ SELECT COUNT(rate) AS count
}
// related categories
$query = '
-SELECT category_id
+SELECT category_id,uppercats,commentable,global_rank
FROM '.IMAGE_CATEGORY_TABLE.'
+ INNER JOIN '.CATEGORIES_TABLE.' ON category_id = id
WHERE image_id = '.$_GET['image_id'];
if ($user['forbidden_categories'] != '')
{
@@ -749,19 +750,35 @@ if ($user['forbidden_categories'] != '')
$query.= '
;';
$result = pwg_query($query);
-$categories = '';
-$page['show_comments'] = false;
+$cat_array = array();
while ($row = mysql_fetch_array($result))
{
- if ($categories != '')
+ array_push($cat_array, $row);
+}
+usort($cat_array, 'global_rank_compare');
+
+$cat_output = '';
+$page['show_comments'] = false;
+foreach ($cat_array as $category)
+{
+ if ($cat_output != '')
+ {
+ $cat_output.= '<br />';
+ }
+
+ if (count($cat_array) > 3)
+ {
+ $cat_output .= get_cat_display_name_cache($category['uppercats'],
+ ' &rarr; ');
+ }
+ else
{
- $categories.= '<br />';
+ $cat_info = get_cat_info($category['category_id']);
+ $cat_output .= get_cat_display_name($cat_info['name'], ' &rarr; ');
}
- $cat_info = get_cat_info($row['category_id']);
- $categories .= get_cat_display_name($cat_info['name'], ' &gt;');
// the picture is commentable if it belongs at least to one category which
// is commentable
- if ($cat_info['commentable'])
+ if ($category['commentable'])
{
$page['show_comments'] = true;
}
@@ -770,7 +787,7 @@ $template->assign_block_vars(
'info_line',
array(
'INFO' => $lang['categories'],
- 'VALUE' => $categories
+ 'VALUE' => $cat_output
));
// metadata
if ($metadata_showable and isset($_GET['show_metadata']))