mirror of
https://github.com/Piwigo/Piwigo.git
synced 2026-08-07 17:23:04 +02:00
- global categories' options : instead of N horizontal tabs on a single
page, N options in the left menu (but the same backend) - categories.global_rank : new calculated field. It gives a global rank of the category among all others (updated during ordering) - category.php page : menu is generated faster thanks to categories.global_rank, recursivity becomes useless :-) - new function to display select box with a set of categories : display_select_cat_wrapper - cat_options : instead of using 1 multiselect for true/false items, using 1 multiselect for true, and another one for false. The form provides buttons with arrows to switch categories from one multiselect to another - deletion of obsolete function display_categories (working with the old template system) - deletion of obsolete functions get_user_plain_structure, create_user_structure, get_user_subcat_ids, update_structure, count_images : useless thanks to global_rank git-svn-id: http://piwigo.org/svn/trunk@614 68402e56-0260-453c-a942-63ccdbb3a9ee
This commit is contained in:
+38
-17
@@ -37,12 +37,13 @@ define('CURRENT_DATE', date('Y-m-d'));
|
||||
// +-----------------------------------------------------------------------+
|
||||
|
||||
/**
|
||||
* order categories (update categories.rank database field)
|
||||
* order categories (update categories.rank and global_rank database fields)
|
||||
*
|
||||
* the purpose of this function is to give a rank for all categories
|
||||
* (insides its sub-category), even the newer that have none at te
|
||||
* beginning. For this, ordering function selects all categories ordered by
|
||||
* rank ASC then name ASC for each uppercat.
|
||||
* rank ASC then name ASC for each uppercat. It also updates the global rank
|
||||
* which is able to order any two categorie in the whole tree
|
||||
*
|
||||
* @returns void
|
||||
*/
|
||||
@@ -68,6 +69,35 @@ SELECT id, if(id_uppercat is null,\'\',id_uppercat) AS id_uppercat
|
||||
UPDATE '.CATEGORIES_TABLE.'
|
||||
SET rank = '.++$current_rank.'
|
||||
WHERE id = '.$row['id'].'
|
||||
;';
|
||||
pwg_query($query);
|
||||
}
|
||||
// global rank update
|
||||
$query = '
|
||||
UPDATE '.CATEGORIES_TABLE.'
|
||||
SET global_rank = rank
|
||||
WHERE id_uppercat IS NULL
|
||||
;';
|
||||
pwg_query($query);
|
||||
|
||||
$query = '
|
||||
SELECT DISTINCT(id_uppercat)
|
||||
FROM '.CATEGORIES_TABLE.'
|
||||
WHERE id_uppercat IS NOT NULL
|
||||
;';
|
||||
$result = pwg_query($query);
|
||||
while ($row = mysql_fetch_array($result))
|
||||
{
|
||||
$query = '
|
||||
SELECT global_rank
|
||||
FROM '.CATEGORIES_TABLE.'
|
||||
WHERE id = '.$row['id_uppercat'].'
|
||||
;';
|
||||
list($uppercat_global_rank) = mysql_fetch_array(pwg_query($query));
|
||||
$query = '
|
||||
UPDATE '.CATEGORIES_TABLE.'
|
||||
SET global_rank = CONCAT(\''.$uppercat_global_rank.'\', \'.\', rank)
|
||||
WHERE id_uppercat = '.$row['id_uppercat'].'
|
||||
;';
|
||||
pwg_query($query);
|
||||
}
|
||||
@@ -571,23 +601,14 @@ if (!isset($_POST['submit']))
|
||||
$template->assign_block_vars('introduction', array());
|
||||
|
||||
$query = '
|
||||
SELECT id
|
||||
SELECT id,name,uppercats,global_rank
|
||||
FROM '.CATEGORIES_TABLE.'
|
||||
WHERE site_id != 1
|
||||
WHERE site_id = 1
|
||||
;';
|
||||
$result = pwg_query($query);
|
||||
while ($row = mysql_fetch_array($result))
|
||||
{
|
||||
array_push($user['restrictions'], $row['id']);
|
||||
}
|
||||
$user['forbidden_categories'] = implode(',', $user['restrictions']);
|
||||
$user['expand'] = true;
|
||||
$structure = create_user_structure('');
|
||||
display_select_categories($structure,
|
||||
' ',
|
||||
array(),
|
||||
'introduction.category_option',
|
||||
array());
|
||||
display_select_cat_wrapper($query,
|
||||
array(),
|
||||
'introduction.category_option',
|
||||
false);
|
||||
}
|
||||
// +-----------------------------------------------------------------------+
|
||||
// | synchronize files |
|
||||
|
||||
Reference in New Issue
Block a user