mirror of
https://github.com/Piwigo/Piwigo.git
synced 2026-07-06 01:42:29 +02:00
- new feature : caddie. The purpose is batch management, especially
concerning elements to categories associations. This is the very first release, needs many improvements. - new function : array_from_query. Firstly used by "caddie" feature, it may be useful in many cases. git-svn-id: http://piwigo.org/svn/trunk@755 68402e56-0260-453c-a942-63ccdbb3a9ee
This commit is contained in:
+35
-1
@@ -75,6 +75,39 @@ if ( isset( $_GET['num'] )
|
||||
|
||||
initialize_category();
|
||||
|
||||
// caddie filling :-)
|
||||
if (isset($_GET['caddie']))
|
||||
{
|
||||
include_once(PHPWG_ROOT_PATH.'admin/include/functions.php');
|
||||
// You can't add in caddie elements that are already in !
|
||||
|
||||
$query = '
|
||||
SELECT DISTINCT(id)
|
||||
FROM '.IMAGES_TABLE.' AS i
|
||||
INNER JOIN '.IMAGE_CATEGORY_TABLE.' AS ic ON id = ic.image_id
|
||||
'.$page['where'].'
|
||||
;';
|
||||
$ids = array_from_query($query, 'id');
|
||||
|
||||
$query = '
|
||||
SELECT element_id
|
||||
FROM '.CADDIE_TABLE.'
|
||||
WHERE user_id = '.$user['id'].'
|
||||
;';
|
||||
$in_caddie = array_from_query($query, 'element_id');
|
||||
|
||||
$caddiables = array_diff($ids, $in_caddie);
|
||||
|
||||
$datas = array();
|
||||
|
||||
foreach ($caddiables as $caddiable)
|
||||
{
|
||||
array_push($datas, array('element_id' => $caddiable,
|
||||
'user_id' => $user['id']));
|
||||
}
|
||||
mass_inserts(CADDIE_TABLE, array('element_id','user_id'), $datas);
|
||||
}
|
||||
|
||||
// creation of the array containing the cat ids to expand in the menu
|
||||
// $page['tab_expand'] contains an array with the category ids
|
||||
// $page['expand'] contains the string to display in URL with comma
|
||||
@@ -157,7 +190,8 @@ $template->assign_vars(array(
|
||||
'U_REGISTER' => add_session_id( PHPWG_ROOT_PATH.'register.php' ),
|
||||
'U_LOGOUT' => PHPWG_ROOT_PATH.'category.php?act=logout',
|
||||
'U_ADMIN'=>add_session_id( PHPWG_ROOT_PATH.'admin.php' ),
|
||||
'U_PROFILE'=>add_session_id(PHPWG_ROOT_PATH.'profile.php?'.str_replace( '&', '&', $_SERVER['QUERY_STRING'] ))
|
||||
'U_PROFILE'=>add_session_id(PHPWG_ROOT_PATH.'profile.php?'.str_replace( '&', '&', $_SERVER['QUERY_STRING'] )),
|
||||
'U_CADDIE'=>add_session_id(PHPWG_ROOT_PATH.'category.php'.get_query_string_diff(array('caddie')).'&caddie=1')
|
||||
)
|
||||
);
|
||||
//---------------------------------------------------------- special categories
|
||||
|
||||
Reference in New Issue
Block a user