mirror of
https://github.com/Piwigo/Piwigo.git
synced 2026-05-01 02:52:50 +02:00
- change "->" in a beautiful arrow :-) for categories level in admin
- single category management screen updated : commentable and uploadable properties added, full directory displayed, status and visibility properties update uses inheritance, user favorite elements check moved to somewhere else : would be too long to calculate here for too many users - new admin functions set_cat_visible and set_cat_status : visibility and status updates can be done in cat_options and cat_modify - language : differentiate "locked" (state) and "lock" (action) git-svn-id: http://piwigo.org/svn/trunk@632 68402e56-0260-453c-a942-63ccdbb3a9ee
This commit is contained in:
@@ -990,4 +990,106 @@ SELECT id,uppercats
|
||||
$fields = array('primary' => array('id'), 'update' => array('global_rank'));
|
||||
mass_updates(CATEGORIES_TABLE, $fields, $datas);
|
||||
}
|
||||
|
||||
/**
|
||||
* change the visible property on a set of categories
|
||||
*
|
||||
* @param array categories
|
||||
* @param string value
|
||||
* @return void
|
||||
*/
|
||||
function set_cat_visible($categories, $value)
|
||||
{
|
||||
if (!in_array($value, array('true', 'false')))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// unlocking a category => all its parent categories become unlocked
|
||||
if ($value == 'true')
|
||||
{
|
||||
$uppercats = array();
|
||||
$query = '
|
||||
SELECT uppercats
|
||||
FROM '.CATEGORIES_TABLE.'
|
||||
WHERE id IN ('.implode(',', $categories).')
|
||||
;';
|
||||
$result = pwg_query($query);
|
||||
while ($row = mysql_fetch_array($result))
|
||||
{
|
||||
$uppercats = array_merge($uppercats,
|
||||
explode(',', $row['uppercats']));
|
||||
}
|
||||
$uppercats = array_unique($uppercats);
|
||||
|
||||
$query = '
|
||||
UPDATE '.CATEGORIES_TABLE.'
|
||||
SET visible = \'true\'
|
||||
WHERE id IN ('.implode(',', $uppercats).')
|
||||
;';
|
||||
pwg_query($query);
|
||||
}
|
||||
// locking a category => all its child categories become locked
|
||||
if ($value == 'false')
|
||||
{
|
||||
$subcats = get_subcat_ids($categories);
|
||||
$query = '
|
||||
UPDATE '.CATEGORIES_TABLE.'
|
||||
SET visible = \'false\'
|
||||
WHERE id IN ('.implode(',', $subcats).')
|
||||
;';
|
||||
pwg_query($query);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* change the status property on a set of categories : private or public
|
||||
*
|
||||
* @param array categories
|
||||
* @param string value
|
||||
* @return void
|
||||
*/
|
||||
function set_cat_status($categories, $value)
|
||||
{
|
||||
if (!in_array($value, array('public', 'private')))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// make public a category => all its parent categories become public
|
||||
if ($value == 'public')
|
||||
{
|
||||
$uppercats = array();
|
||||
$query = '
|
||||
SELECT uppercats
|
||||
FROM '.CATEGORIES_TABLE.'
|
||||
WHERE id IN ('.implode(',', $categories).')
|
||||
;';
|
||||
$result = pwg_query($query);
|
||||
while ($row = mysql_fetch_array($result))
|
||||
{
|
||||
$uppercats = array_merge($uppercats,
|
||||
explode(',', $row['uppercats']));
|
||||
}
|
||||
$uppercats = array_unique($uppercats);
|
||||
|
||||
$query = '
|
||||
UPDATE '.CATEGORIES_TABLE.'
|
||||
SET status = \'public\'
|
||||
WHERE id IN ('.implode(',', $uppercats).')
|
||||
;';
|
||||
pwg_query($query);
|
||||
}
|
||||
// make a category private => all its child categories become private
|
||||
if ($value == 'private')
|
||||
{
|
||||
$subcats = get_subcat_ids($categories);
|
||||
$query = '
|
||||
UPDATE '.CATEGORIES_TABLE.'
|
||||
SET status = \'private\'
|
||||
WHERE id IN ('.implode(',', $subcats).')
|
||||
;';
|
||||
pwg_query($query);
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
||||
Reference in New Issue
Block a user