示例#1
0
 /**
  * Read available calendars from server
  */
 private function _read_calendars()
 {
     // already read sources
     if (isset($this->calendars)) {
         return $this->calendars;
     }
     // get all folders that have "event" type, sorted by namespace/name
     $folders = kolab_storage::sort_folders(kolab_storage::get_folders('event') + kolab_storage::get_user_folders('event', true));
     $this->calendars = array();
     foreach ($folders as $folder) {
         if ($folder instanceof kolab_storage_folder_user) {
             $calendar = new kolab_user_calendar($folder->name, $this->cal);
             $calendar->subscriptions = count($folder->children) > 0;
         } else {
             $calendar = new kolab_calendar($folder->name, $this->cal);
         }
         if ($calendar->ready) {
             $this->calendars[$calendar->id] = $calendar;
             if ($calendar->editable) {
                 $this->has_writeable = true;
             }
         }
     }
     return $this->calendars;
 }