diff options
author | plegall <plg@piwigo.org> | 2005-03-26 22:35:07 +0000 |
---|---|---|
committer | plegall <plg@piwigo.org> | 2005-03-26 22:35:07 +0000 |
commit | 26b44267d5f3adc1cdf450d2f0c16eaf52648a07 (patch) | |
tree | 64e7db832cd6eb05cb1968b4a601051a4a144139 /admin/element_set_global.php | |
parent | 03b8e7bb3597e5e58a0dc01032c6ad94faf0fe35 (diff) |
- "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
Diffstat (limited to 'admin/element_set_global.php')
-rw-r--r-- | admin/element_set_global.php | 16 |
1 files changed, 13 insertions, 3 deletions
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'])); } |