aboutsummaryrefslogtreecommitdiffstats
path: root/admin
diff options
context:
space:
mode:
authorGotcha <gotcha@piwigo.org>2010-03-07 16:53:53 +0000
committerGotcha <gotcha@piwigo.org>2010-03-07 16:53:53 +0000
commit2aaed23c854644273d05e7ccc3eed6a048757923 (patch)
tree637b0054944ea05c4a25f6f0e96a22d7a3113944 /admin
parent5f31dc10b52b5b6493f3920d0ee03b1a9c64c5b4 (diff)
Choose the sorting of the categories management
bug:1119 git-svn-id: http://piwigo.org/svn/branches/2.0@5076 68402e56-0260-453c-a942-63ccdbb3a9ee
Diffstat (limited to '')
-rw-r--r--admin/cat_list.php23
-rw-r--r--admin/template/goto/cat_list.tpl2
2 files changed, 25 insertions, 0 deletions
diff --git a/admin/cat_list.php b/admin/cat_list.php
index 426293e7f..7f4d3540c 100644
--- a/admin/cat_list.php
+++ b/admin/cat_list.php
@@ -139,6 +139,29 @@ SELECT id, name
l10n('Categories ordered alphanumerically')
);
}
+// sort categories alpha-numerically reverse
+else if (isset($_POST['submitOrderAlphaNumReverse']))
+{
+ $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'] ] = strtolower($row['name']);
+ }
+
+ arsort($categories, SORT_REGULAR);
+ save_categories_order(array_keys($categories));
+
+ array_push(
+ $page['infos'],
+ l10n('Categories ordered alphanumerically reverse')
+ );
+}
// +-----------------------------------------------------------------------+
// | Navigation path |
diff --git a/admin/template/goto/cat_list.tpl b/admin/template/goto/cat_list.tpl
index 7654a2345..9db47d900 100644
--- a/admin/template/goto/cat_list.tpl
+++ b/admin/template/goto/cat_list.tpl
@@ -44,6 +44,7 @@
<p>
<input class="submit" name="submitOrder" type="submit" value="{'Save order'|@translate}" {$TAG_INPUT_ENABLED} />
<input class="submit" name="submitOrderAlphaNum" type="submit" value="{'Order alphanumerically'|@translate}" {$TAG_INPUT_ENABLED} />
+ <input class="submit" name="submitOrderAlphaNumReverse" type="submit" value="{'Order alphanumerically reverse'|@translate}" {$TAG_INPUT_ENABLED} />
</p>
<ul class="categoryUl">
@@ -88,6 +89,7 @@
<p>
<input class="submit" name="submitOrder" type="submit" value="{'Save order'|@translate}" {$TAG_INPUT_ENABLED} />
<input class="submit" name="submitOrderAlphaNum" type="submit" value="{'Order alphanumerically'|@translate}" {$TAG_INPUT_ENABLED} />
+ <input class="submit" name="submitOrderAlphaNumReverse" type="submit" value="{'Order alphanumerically reverse'|@translate}" {$TAG_INPUT_ENABLED} />
</p>
</form>