- elements batch management : element_set page becomes the frontend to

element_set_global and element_set_unit, infos_images (after a long time
  of use) become deprecated : the more powerful element_set is used
  instead. Consequently, batch management concerns caddie but also "normal
  categories".

- refactoring code in admin.php to include the sub-file (clearer)

- caddie : function fill_caddie replaces the code in category.php and can be
  used in admin/element_set.php

- caddie : caddie table is added in delete_elements function


git-svn-id: http://piwigo.org/svn/trunk@764 68402e56-0260-453c-a942-63ccdbb3a9ee
This commit is contained in:
plegall
2005-04-16 16:56:32 +00:00
parent 41e52d7a8a
commit b63d91c59e
12 changed files with 455 additions and 231 deletions
+37 -9
View File
@@ -550,15 +550,8 @@ function get_query_string_diff($rejects = array())
{
if (!in_array($key, $rejects))
{
if ($is_first)
{
$query_string.= '?';
$is_first = false;
}
else
{
$query_string.= '&';
}
$query_string.= $is_first ? '?' : '&';
$is_first = false;
$query_string.= $key.'='.$value;
}
}
@@ -695,4 +688,39 @@ function get_month_list($blockname, $selection)
'OPTION' => $lang['month'][$i]));
}
}
/**
* fill the current user caddie with given elements, if not already in
* caddie
*
* @param array elements_id
*/
function fill_caddie($elements_id)
{
global $user;
include_once(PHPWG_ROOT_PATH.'admin/include/functions.php');
$query = '
SELECT element_id
FROM '.CADDIE_TABLE.'
WHERE user_id = '.$user['id'].'
;';
$in_caddie = array_from_query($query, 'element_id');
$caddiables = array_diff($elements_id, $in_caddie);
$datas = array();
foreach ($caddiables as $caddiable)
{
array_push($datas, array('element_id' => $caddiable,
'user_id' => $user['id']));
}
if (count($caddiables) > 0)
{
mass_inserts(CADDIE_TABLE, array('element_id','user_id'), $datas);
}
}
?>