summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Bruederli <bruederli@kolabsys.com>2013-07-18 15:49:58 (GMT)
committerThomas Bruederli <bruederli@kolabsys.com>2013-07-18 15:49:58 (GMT)
commit8470fba8bef59a6f6e4657b8d70ba63610fa56cc (patch)
treeb835b9c85d6ffe7cf2abc3de5ac8ad4ce1255b75
parent358afce60a38f8e6da0dba9fdc0241237e2947d5 (diff)
downloadiRony-8470fba8bef59a6f6e4657b8d70ba63610fa56cc.tar.gz
Moved sort_folders() function to libkolab/kolab_storage class
-rw-r--r--lib/Kolab/CalDAV/CalendarBackend.php2
-rw-r--r--lib/Kolab/CardDAV/ContactsBackend.php2
-rw-r--r--lib/Kolab/Utils/DAVBackend.php29
3 files changed, 2 insertions, 31 deletions
diff --git a/lib/Kolab/CalDAV/CalendarBackend.php b/lib/Kolab/CalDAV/CalendarBackend.php
index 09cc40e..2b8b8b3 100644
--- a/lib/Kolab/CalDAV/CalendarBackend.php
+++ b/lib/Kolab/CalDAV/CalendarBackend.php
@@ -61,7 +61,7 @@ class CalendarBackend extends CalDAV\Backend\AbstractBackend
$folders = array_merge(kolab_storage::get_folders('event'), kolab_storage::get_folders('task'));
$this->calendars = $this->folders = $this->aliases = array();
- foreach (DAVBackend::sort_folders($folders) as $folder) {
+ foreach (kolab_storage::sort_folders($folders) as $folder) {
$id = DAVBackend::get_uid($folder);
$this->folders[$id] = $folder;
$fdata = $folder->get_imap_data(); // fetch IMAP folder data for CTag generation
diff --git a/lib/Kolab/CardDAV/ContactsBackend.php b/lib/Kolab/CardDAV/ContactsBackend.php
index 8c6e1c0..90d10e5 100644
--- a/lib/Kolab/CardDAV/ContactsBackend.php
+++ b/lib/Kolab/CardDAV/ContactsBackend.php
@@ -58,7 +58,7 @@ class ContactsBackend extends CardDAV\Backend\AbstractBackend
$folders = kolab_storage::get_folders('contact');
$this->sources = $this->folders = $this->aliases = array();
- foreach (DAVBackend::sort_folders($folders) as $folder) {
+ foreach (kolab_storage::sort_folders($folders) as $folder) {
$id = DAVBackend::get_uid($folder);
$fdata = $folder->get_imap_data(); // fetch IMAP folder data for CTag generation
$this->folders[$id] = $folder;
diff --git a/lib/Kolab/Utils/DAVBackend.php b/lib/Kolab/Utils/DAVBackend.php
index 04aa80f..0734be9 100644
--- a/lib/Kolab/Utils/DAVBackend.php
+++ b/lib/Kolab/Utils/DAVBackend.php
@@ -94,35 +94,6 @@ class DAVBackend
}
/**
- * Sort the given list of kolab folders by namespace/name
- *
- * @param array List of kolab_storage_folder objects
- * @return array Sorted list of folders
- */
- public static function sort_folders($folders)
- {
- $nsnames = array('personal' => array(), 'shared' => array(), 'other' => array());
- foreach ($folders as $folder) {
- $folders[$folder->name] = $folder;
- $ns = $folder->get_namespace();
- $nsnames[$ns][$folder->name] = html_entity_decode($folder->get_name(), ENT_COMPAT, RCUBE_CHARSET); // decode &raquo;
- }
-
- $names = array();
- foreach ($nsnames as $ns => $dummy) {
- asort($nsnames[$ns], SORT_LOCALE_STRING);
- $names += $nsnames[$ns];
- }
-
- $out = array();
- foreach ($names as $utf7name => $name) {
- $out[] = $folders[$utf7name];
- }
-
- return $out;
- }
-
- /**
* Build an absolute URL with the given parameters
*/
public static function abs_url($parts = array())