diff options
author | Aleksander Machniak <alec@alec.pl> | 2012-02-17 14:54:42 +0100 |
---|---|---|
committer | Aleksander Machniak <alec@alec.pl> | 2012-02-17 14:54:42 +0100 |
commit | 2727724ed788471bc3b43d2227ee153db9e80190 (patch) | |
tree | 2400a8086abe3688c2100564438509da493f9f54 /lib/api/kolab_api_service_domains.php | |
parent | e08072b6994af0b943e63815655fab0557453c9b (diff) | |
download | webadmin-2727724ed788471bc3b43d2227ee153db9e80190.tar.gz |
Class filenames unification
Diffstat (limited to 'lib/api/kolab_api_service_domains.php')
-rw-r--r-- | lib/api/kolab_api_service_domains.php | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/lib/api/kolab_api_service_domains.php b/lib/api/kolab_api_service_domains.php new file mode 100644 index 0000000..bedce85 --- /dev/null +++ b/lib/api/kolab_api_service_domains.php @@ -0,0 +1,38 @@ +<?php + +/** + * + */ +class kolab_api_service_domains extends kolab_api_service +{ + public function capabilities($domain) + { + return array( + 'list' => 'r', +// 'search' => 'r', + ); + } + + public function domains_list($get, $post) { + $auth = Auth::get_instance(); + + $domains = $auth->list_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); + } + + return array( + 'list' => $domains, + 'count' => $count, + ); + } +} + |