summaryrefslogtreecommitdiff
path: root/program/include/rcube_addressbook.php
diff options
context:
space:
mode:
authorthomascube <thomas@roundcube.net>2012-02-02 22:18:10 +0000
committerthomascube <thomas@roundcube.net>2012-02-02 22:18:10 +0000
commit43875379d5fcfc4e4d29e2edcbbed614a2050f7d (patch)
tree2679484edd2b05012c56eb01d6bfc8ff67916328 /program/include/rcube_addressbook.php
parentfd6f6e27c4c727c1485674147e997eb9ce6118d6 (diff)
Allow users to choose cols for contacts list sorting
Diffstat (limited to 'program/include/rcube_addressbook.php')
-rw-r--r--program/include/rcube_addressbook.php19
1 files changed, 18 insertions, 1 deletions
diff --git a/program/include/rcube_addressbook.php b/program/include/rcube_addressbook.php
index f7a526885..308aee4f5 100644
--- a/program/include/rcube_addressbook.php
+++ b/program/include/rcube_addressbook.php
@@ -5,7 +5,7 @@
| program/include/rcube_addressbook.php |
| |
| This file is part of the Roundcube Webmail client |
- | Copyright (C) 2006-2011, The Roundcube Dev Team |
+ | Copyright (C) 2006-2012, The Roundcube Dev Team |
| |
| Licensed under the GNU General Public License version 3 or |
| any later version with exceptions for skins & plugins. |
@@ -47,6 +47,8 @@ abstract class rcube_addressbook
public $group_id = null;
public $list_page = 1;
public $page_size = 10;
+ public $sort_col = 'name';
+ public $sort_order = 'ASC';
public $coltypes = array('name' => array('limit'=>1), 'firstname' => array('limit'=>1), 'surname' => array('limit'=>1), 'email' => array('limit'=>1));
protected $error;
@@ -183,6 +185,21 @@ abstract class rcube_addressbook
$this->page_size = (int)$size;
}
+ /**
+ * Set internal sort settings
+ *
+ * @param string $sort_col Sort column
+ * @param string $sort_order Sort order
+ */
+ function set_sort_order($sort_col, $sort_order = null)
+ {
+ if ($sort_col != null && ($this->coltypes[$sort_col] || in_array($sort_col, $this->coltypes))) {
+ $this->sort_col = $sort_col;
+ }
+ if ($sort_order != null) {
+ $this->sort_order = strtoupper($sort_order) == 'DESC' ? 'DESC' : 'ASC';
+ }
+ }
/**
* Check the given data before saving.