aboutsummaryrefslogtreecommitdiffstats
path: root/admin/element_set_unit.php
diff options
context:
space:
mode:
authorplegall <plg@piwigo.org>2006-04-02 22:26:19 +0000
committerplegall <plg@piwigo.org>2006-04-02 22:26:19 +0000
commit42abf4c57664d2596872d437f70b95193f9a5d18 (patch)
treea1262b8601d5ac5b04b5b2e71af52c453712b9df /admin/element_set_unit.php
parent68ed2ea617ede199a0e2f15fdd4886095ae600cb (diff)
improvement: tags replace keywords. Better data model, less
limitations. Each image can be associated to as many tag as needed. Tags can contain non ASCII characters. Oriented navigation with tags by association. git-svn-id: http://piwigo.org/svn/trunk@1119 68402e56-0260-453c-a942-63ccdbb3a9ee
Diffstat (limited to '')
-rw-r--r--admin/element_set_unit.php34
1 files changed, 22 insertions, 12 deletions
diff --git a/admin/element_set_unit.php b/admin/element_set_unit.php
index c43522894..f6800f399 100644
--- a/admin/element_set_unit.php
+++ b/admin/element_set_unit.php
@@ -103,25 +103,21 @@ SELECT id, date_creation
{
$data{'date_creation'} = $row['date_creation'];
}
+
+ array_push($datas, $data);
- $keywords = get_keywords($_POST['keywords-'.$row['id']]);
- if (count($keywords) > 0)
- {
- $data{'keywords'} = implode(',', $keywords);
- }
- else
+ // tags management
+ if (isset($_POST[ 'tags-'.$row['id'] ]))
{
- $data{'keywords'} = '';
+ set_tags($_POST[ 'tags-'.$row['id'] ], $row['id']);
}
-
- array_push($datas, $data);
}
mass_updates(
IMAGES_TABLE,
array(
'primary' => array('id'),
- 'update' => array('name','author','comment','date_creation','keywords')
+ 'update' => array('name','author','comment','date_creation')
),
$datas
);
@@ -192,11 +188,13 @@ if (count($page['cat_elements_id']) > 0)
);
$template->assign_vars(array('NAV_BAR' => $nav_bar));
+ // tags
+ $all_tags = get_all_tags();
$element_ids = array();
$query = '
-SELECT id,path,tn_ext,name,date_creation,comment,keywords,author,file
+SELECT id,path,tn_ext,name,date_creation,comment,author,file
FROM '.IMAGES_TABLE.'
WHERE id IN ('.implode(',', $page['cat_elements_id']).')
'.$conf['order_by'].'
@@ -210,6 +208,13 @@ SELECT id,path,tn_ext,name,date_creation,comment,keywords,author,file
array_push($element_ids, $row['id']);
$src = get_thumbnail_src($row['path'], @$row['tn_ext']);
+
+ $query = '
+SELECT tag_id
+ FROM '.IMAGE_TAG_TABLE.'
+ WHERE image_id = '.$row['id'].'
+;';
+ $selected_tags = array_from_query($query, 'tag_id');
// creation date
if (!empty($row['date_creation']))
@@ -237,7 +242,12 @@ SELECT id,path,tn_ext,name,date_creation,comment,keywords,author,file
'AUTHOR' => @$row['author'],
'DESCRIPTION' => @$row['comment'],
'DATE_CREATION_YEAR' => $year,
- 'KEYWORDS' => @$row['keywords']
+
+ 'TAG_SELECTION' => get_html_tag_selection(
+ $all_tags,
+ 'tags-'.$row['id'],
+ $selected_tags
+ ),
)
);