diff options
author | Jeroen van Meeuwen (Kolab Systems) <vanmeeuwen@kolabsys.com> | 2012-08-22 09:16:00 +0100 |
---|---|---|
committer | Jeroen van Meeuwen (Kolab Systems) <vanmeeuwen@kolabsys.com> | 2012-08-22 09:21:39 +0100 |
commit | d36051ee4515bba6904f2950822df828c124dce2 (patch) | |
tree | 704b8d6081d05a06c4a39b8894cdec0d1075efeb /lib/api/kolab_api_service_domains.php | |
parent | 13ea713d0e97ae9a8cdacd0126b0e48d0974eecd (diff) | |
download | webadmin-d36051ee4515bba6904f2950822df828c124dce2.tar.gz |
Move the attributes, search and param parse functions to common ground (code-deduplication)
Diffstat (limited to 'lib/api/kolab_api_service_domains.php')
-rw-r--r-- | lib/api/kolab_api_service_domains.php | 23 |
1 files changed, 6 insertions, 17 deletions
diff --git a/lib/api/kolab_api_service_domains.php b/lib/api/kolab_api_service_domains.php index d322ef0..f58922e 100644 --- a/lib/api/kolab_api_service_domains.php +++ b/lib/api/kolab_api_service_domains.php @@ -84,23 +84,12 @@ class kolab_api_service_domains extends kolab_api_service { $auth = Auth::get_instance(); - $domains = $auth->list_domains(); - //console($domains); - $count = count($domains); - - // pagination - if (!empty($post['page_size']) && $count) { - $size = (int) $post['page_size']; - $page = !empty($post['page']) ? $post['page'] : 1; - $page = max(1, (int) $page); - $offset = ($page - 1) * $size; - - $domains = array_slice($domains, $offset, $size, true); - } + $attributes = $this->parse_list_attributes($post); + $params = $this->parse_list_params($post); + $search = $this->parse_list_search($post); + + $domains = $auth->list_domains(null, $attributes, $search, $params); - return array( - 'list' => $domains, - 'count' => $count, - ); + return $domains; } } |