aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorplegall <plg@piwigo.org>2007-03-11 15:11:53 +0000
committerplegall <plg@piwigo.org>2007-03-11 15:11:53 +0000
commit0d28196ad453434aeaab8a459ad7fecad4ad17a4 (patch)
treeb950dd895911f36f218b5fa5f668d3dfe9508c07
parentb0375226c9d5f0c2133ba8fb18b523b5077acea1 (diff)
New: in history search, display tag names instead of tag ids in filtered
lines. git-svn-id: http://piwigo.org/svn/trunk@1891 68402e56-0260-453c-a942-63ccdbb3a9ee
-rw-r--r--admin/history.php47
1 files changed, 45 insertions, 2 deletions
diff --git a/admin/history.php b/admin/history.php
index e1e3d604c..0de17864d 100644
--- a/admin/history.php
+++ b/admin/history.php
@@ -302,6 +302,14 @@ SELECT
$image_ids[$row['image_id']] = 1;
}
+ if (isset($row['tag_ids']))
+ {
+ foreach (explode(',', $row['tag_ids']) as $tag_id)
+ {
+ array_push($tag_ids, $tag_id);
+ }
+ }
+
array_push(
$history_lines,
$row
@@ -379,6 +387,26 @@ SELECT
// echo '<pre>'; print_r($high_filesize_of_image); echo '</pre>';
}
+
+ if (count($tag_ids) > 0)
+ {
+ $tag_ids = array_unique($tag_ids);
+
+ $query = '
+SELECT
+ id,
+ name
+ FROM '.TAGS_TABLE.'
+ WHERE id IN ('.implode(', ', $tag_ids).')
+;';
+ $name_of_tag = array();
+
+ $result = pwg_query($query);
+ while ($row = mysql_fetch_array($result))
+ {
+ $name_of_tag[ $row['id'] ] = $row['name'];
+ }
+ }
$i = 0;
$first_line = $page['start'] + 1;
@@ -427,6 +455,20 @@ SELECT
$user_string.= '&amp;search_id='.$page['search_id'];
$user_string.= '&amp;user_id='.$line['user_id'];
$user_string.= '">+</a>';
+
+ $tags_string = '';
+ if (isset($line['tag_ids']))
+ {
+ $tags_string = preg_replace(
+ '/(\d+)/e',
+ '$name_of_tag["$1"]',
+ str_replace(
+ ',',
+ ', ',
+ $line['tag_ids']
+ )
+ );
+ }
$template->assign_block_vars(
'detail',
@@ -455,7 +497,7 @@ SELECT
? $name_of_category[$line['category_id']]
: 'deleted '.$line['category_id'] )
: '',
- 'TAGS' => $line['tag_ids'],
+ 'TAGS' => $tags_string,
'T_CLASS' => ($i % 2) ? 'row1' : 'row2',
)
);
@@ -601,7 +643,8 @@ while ($row = mysql_fetch_array($result))
{
$selected = '';
- if ($row['id'] == $form['user'])
+ if (isset($form['user'])
+ and $row['id'] == $form['user'])
{
$selected = 'selected="selected"';
}