summaryrefslogtreecommitdiffstats
path: root/apps/bookmarks/ajax
diff options
context:
space:
mode:
authorArthur Schiwon <blizzz@arthur-schiwon.de>2011-08-25 12:55:13 +0200
committerArthur Schiwon <blizzz@arthur-schiwon.de>2011-08-25 12:55:13 +0200
commite0a69bbeaccf45ec6f407090d3dfc50bc4f04101 (patch)
tree174bcb885a7badf230c204acd8b4d160a842ecf5 /apps/bookmarks/ajax
parent55a8ee34bdf9e4a357f347ae5ab3320e50589a10 (diff)
downloadnextcloud-server-e0a69bbeaccf45ec6f407090d3dfc50bc4f04101.tar.gz
nextcloud-server-e0a69bbeaccf45ec6f407090d3dfc50bc4f04101.zip
Make bookmarks sortable by clicks
Diffstat (limited to 'apps/bookmarks/ajax')
-rw-r--r--apps/bookmarks/ajax/updateList.php9
1 files changed, 8 insertions, 1 deletions
diff --git a/apps/bookmarks/ajax/updateList.php b/apps/bookmarks/ajax/updateList.php
index 9290757d0b1..61983cc0f5b 100644
--- a/apps/bookmarks/ajax/updateList.php
+++ b/apps/bookmarks/ajax/updateList.php
@@ -50,6 +50,13 @@ if($filterTag){
$offset = isset($_GET['page']) ? intval($_GET['page']) * 10 : 0;
$params[] = $offset;
+$sort = isset($_GET['sort']) ? ($_GET['sort']) : 'bookmarks_sorting_recent';
+if($sort == 'bookmarks_sorting_clicks') {
+ $sqlSort = 'clickcount DESC';
+} else {
+ $sqlSort = 'id DESC';
+}
+
if( $CONFIG_DBTYPE == 'sqlite' or $CONFIG_DBTYPE == 'sqlite3' ){
$_gc_separator = ', \' \'';
} else {
@@ -72,7 +79,7 @@ $query = OC_DB::prepare('
AND *PREFIX*bookmarks.user_id = ?
GROUP BY url
'.$sqlFilterTag.'
- ORDER BY *PREFIX*bookmarks.id DESC
+ ORDER BY *PREFIX*bookmarks.'.$sqlSort.'
LIMIT ?, 10');
$bookmarks = $query->execute($params)->fetchAll();