summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeroen van Meeuwen (Kolab Systems) <vanmeeuwen@kolabsys.com>2012-09-19 15:19:36 (GMT)
committerJeroen van Meeuwen (Kolab Systems) <vanmeeuwen@kolabsys.com>2012-09-19 15:23:58 (GMT)
commit74c2044d13c51c52a6f43614c3c0a514565ca555 (patch)
tree182c90d64d6f43e3677d38a6c4a9dd7c1a0863ac
parentb05c26e1e0a19f5861a6210e3a31a8272aa7afbf (diff)
downloadkolab-syncroton-74c2044d13c51c52a6f43614c3c0a514565ca555.tar.gz
Add a function to convert a given type id to its existing default type id, if it exists
-rw-r--r--lib/kolab_sync_backend.php17
1 files changed, 17 insertions, 0 deletions
diff --git a/lib/kolab_sync_backend.php b/lib/kolab_sync_backend.php
index b8f5463..eb3aae4 100644
--- a/lib/kolab_sync_backend.php
+++ b/lib/kolab_sync_backend.php
@@ -110,6 +110,23 @@ class kolab_sync_backend
$this->storage->set_pagesize(999999);
}
+ public static function default_type_id_for_type($type) {
+ if (!isset(self::$types[$type])) {
+ return $type;
+ }
+
+ $type_str = self::$types[$type];
+
+ $default_type_str = self::$types[$type] . ".default";
+
+ $default_type_id = array_search($default_type_str, self::$types);
+
+ if (!$default_type_id) {
+ return $type;
+ } else {
+ return $default_type_id;
+ }
+ }
/**
* List known devices