aboutsummaryrefslogtreecommitdiffstats
path: root/admin
diff options
context:
space:
mode:
authorplegall <plg@piwigo.org>2006-03-06 23:28:51 +0000
committerplegall <plg@piwigo.org>2006-03-06 23:28:51 +0000
commit53d78c95b04b8c1be7a8d6534a358622160060b8 (patch)
tree9c00c6c2a479bc450a8d35aa0cca12752a889bde /admin
parent8615119a8088ba77819601f50393ad05b6ce0208 (diff)
request 302: order categories alphanumerically
alphanumerically sort of language keys in admin.lang.php git-svn-id: http://piwigo.org/svn/trunk@1066 68402e56-0260-453c-a942-63ccdbb3a9ee
Diffstat (limited to 'admin')
-rw-r--r--admin/cat_list.php30
1 files changed, 30 insertions, 0 deletions
diff --git a/admin/cat_list.php b/admin/cat_list.php
index 0c350ea00..bd15c8de7 100644
--- a/admin/cat_list.php
+++ b/admin/cat_list.php
@@ -97,11 +97,41 @@ else if (isset($_POST['submitAdd']))
array_push($page['infos'], $output_create['info']);
}
}
+// save manual category ordering
else if (isset($_POST['submitOrder']))
{
asort($_POST['catOrd'], SORT_NUMERIC);
save_categories_order(array_keys($_POST['catOrd']));
+
+ array_push(
+ $page['infos'],
+ l10n('Categories manual order was saved')
+ );
}
+// sort categories alpha-numerically
+else if (isset($_POST['submitOrderAlphaNum']))
+{
+ $query = '
+SELECT id, name
+ FROM '.CATEGORIES_TABLE.'
+ WHERE id_uppercat '.
+ (!isset($_GET['parent_id']) ? 'IS NULL' : '= '.$_GET['parent_id']).'
+;';
+ $result = pwg_query($query);
+ while ($row = mysql_fetch_assoc($result))
+ {
+ $categories[ $row['id'] ] = $row['name'];
+ }
+
+ asort($categories, SORT_REGULAR);
+ save_categories_order(array_keys($categories));
+
+ array_push(
+ $page['infos'],
+ l10n('Categories ordered alphanumerically')
+ );
+}
+
// +-----------------------------------------------------------------------+
// | Cache management |
// +-----------------------------------------------------------------------+