Exemplo n.º 1
0
 /**
  * Get a list of all the folders we are going to sync.
  * Each caldav calendar can contain tasks (prefix T) and events (prefix C), so duplicate each calendar found.
  * @see BackendDiff::GetFolderList()
  */
 public function GetFolderList()
 {
     ZLog::Write(LOGLEVEL_DEBUG, sprintf("BackendCalDAV->GetFolderList(): Getting all folders."));
     $folders = array();
     $calendars = $this->_caldav->FindCalendars();
     foreach ($calendars as $val) {
         $folder = array();
         $fpath = explode("/", $val->url, -1);
         if (is_array($fpath)) {
             $folderid = array_pop($fpath);
             $id = "C" . $folderid;
             $folders[] = $this->StatFolder($id);
             $id = "T" . $folderid;
             $folders[] = $this->StatFolder($id);
         }
     }
     return $folders;
 }
Exemplo n.º 2
0
 static function findCalendars()
 {
     ob_start();
     require_once ROOTPATH . '/plugins/davicalCliente/caldav-client-v2.php';
     $cal = new CalDAVClient(Config::service('CalDAV', 'url') . '/', Config::me('uid'), Config::me('password'));
     ob_end_clean();
     return $cal->FindCalendars();
 }
Exemplo n.º 3
0
define('LOGLEVEL', LOGLEVEL_DEBUG);
define('LOGUSERLEVEL', LOGLEVEL_DEVICEID);
// $username = "******";
// $password = "******";
//
// define('CALDAV_SERVER', 'http://sogo-demo.inverse.ca');
// define('CALDAV_PORT', '80');
// define('CALDAV_PATH', '/SOGo/dav/%u/Calendar/');
// define('CALDAV_PERSONAL', 'personal');
// define('CALDAV_SUPPORTS_SYNC', true);
$caldav_path = str_replace('%u', $username, CALDAV_PATH);
$caldav = new CalDAVClient(CALDAV_SERVER . ":" . CALDAV_PORT . $caldav_path, $username, $password);
printf("Connected %d\n", $caldav->CheckConnection());
// Show options supported by server
$options = $caldav->DoOptionsRequest();
print_r($options);
$calendars = $caldav->FindCalendars();
print_r($calendars);
$path = $caldav_path . CALDAV_PERSONAL . "/";
$val = $caldav->GetCalendarDetails($path);
print_r($val);
$begin = gmdate("Ymd\\THis\\Z", time() - 24 * 7 * 60 * 60);
$finish = gmdate("Ymd\\THis\\Z", 2147483647);
$msgs = $caldav->GetEvents($begin, $finish, $path);
print_r($msgs);
// Initial sync
$results = $caldav->GetSync($path, true, CALDAV_SUPPORTS_SYNC);
print_r($results);
sleep(60);
$results = $caldav->GetSync($path, false, CALDAV_SUPPORTS_SYNC);
print_r($results);