summaryrefslogtreecommitdiffstats
path: root/lib/api/kolab_api_service_domains.php
diff options
context:
space:
mode:
authorAleksander Machniak <alec@alec.pl>2012-02-17 14:54:42 +0100
committerAleksander Machniak <alec@alec.pl>2012-02-17 14:54:42 +0100
commit2727724ed788471bc3b43d2227ee153db9e80190 (patch)
tree2400a8086abe3688c2100564438509da493f9f54 /lib/api/kolab_api_service_domains.php
parente08072b6994af0b943e63815655fab0557453c9b (diff)
downloadwebadmin-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.php38
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,
+ );
+ }
+}
+