diff options
author | thomascube <thomas@roundcube.net> | 2012-02-11 11:38:46 +0000 |
---|---|---|
committer | thomascube <thomas@roundcube.net> | 2012-02-11 11:38:46 +0000 |
commit | ba36dd03f6f7005a6e35ec02e4ff9a58f95be1c3 (patch) | |
tree | 002d0183144bb7adcf757144c035f0f8d0eba649 /program/include/rcube_addressbook.php | |
parent | 5ea6e16036aa18c57c709dc88e4255120b63e965 (diff) |
Backported r5850 to 0.7 branch
Diffstat (limited to 'program/include/rcube_addressbook.php')
-rw-r--r-- | program/include/rcube_addressbook.php | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/program/include/rcube_addressbook.php b/program/include/rcube_addressbook.php index 5f17f4a8a..33f8f8a5b 100644 --- a/program/include/rcube_addressbook.php +++ b/program/include/rcube_addressbook.php @@ -44,6 +44,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; @@ -180,6 +182,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. |