From 26b44267d5f3adc1cdf450d2f0c16eaf52648a07 Mon Sep 17 00:00:00 2001 From: plegall Date: Sat, 26 Mar 2005 22:35:07 +0000 Subject: - "add to caddie" link is visible only when categories contains elements. Only admin users can see this link - elements batch management : impossible to create a link between category and element that already exists - logical separation of category name under thumbnail and element name git-svn-id: http://piwigo.org/svn/trunk@760 68402e56-0260-453c-a942-63ccdbb3a9ee --- admin/element_set_global.php | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) (limited to 'admin') diff --git a/admin/element_set_global.php b/admin/element_set_global.php index ffd8c10fe..01a03a19e 100644 --- a/admin/element_set_global.php +++ b/admin/element_set_global.php @@ -91,16 +91,26 @@ SELECT element_id if ($_POST['associate'] != 0) { $datas = array(); + + $query = ' +SELECT image_id + FROM '.IMAGE_CATEGORY_TABLE.' + WHERE category_id = '.$_POST['associate'].' +;'; + $associated = array_from_query($query, 'image_id'); + + $associable = array_diff($collection, $associated); - foreach ($collection as $item) + foreach ($associable as $item) { array_push($datas, array('category_id'=>$_POST['associate'], 'image_id'=>$item)); } - // TODO : inserting an existing PK will fail - mass_inserts(IMAGE_CATEGORY_TABLE, array('image_id', 'category_id'), $datas); + mass_inserts(IMAGE_CATEGORY_TABLE, + array('image_id', 'category_id'), + $datas); update_category(array($_POST['associate'])); } -- cgit v1.2.3