<?




//require_once('superedit-SEF.php');
//require_once('config/.config_biuro.biall-net.pl.php');



//SEF('DEBUG_S');

function TEST_GET_ICAL_EVENTS() {
require_once('stuff/caldav-client.php');
 //$cal = new CalDAVClient( "https://biuro.biall-net.pl:8443/principals/users/a.binder/", "a.binder", "", "" );
 DEBUG_S(-3,'url',$_SESSION['CONFIG']['CALDAV_URL']);
  $cal = new CalDAVClient( $_SESSION['CONFIG']['CALDAV_URL']."/calendars/__uids__/4720124D-5F20-4EAB-B501-4872E33F9A5C/calendar/", $_SESSION['CONFIG']['CALDAV_USERNAME'], $_SESSION['CONFIG']['CALDAV_PASSWORD'], "" );
 $options = $cal->DoOptionsRequest();
DEBUG_S(-3,'options',$options);


//             <C:getctag />
$xmlC = <<<PROPP
<?xml version="1.0" encoding="utf-8" ?>
<D:propfind xmlns:D="DAV:" xmlns:C="http://calendarserver.org/ns/">
    <D:prop>
             <D:displayname />
             <D:resourcetype />
             <D:getetag />
     </D:prop>
</D:propfind>
PROPP;

 //if ( isset($options["PROPFIND"]) ) {
   // Fetch some information about the events in that calendar
   $cal->SetDepth(1);
   $folder_xml = $cal->DoXMLRequest("PROPFIND", $xmlC);
   DEBUG_S(-3,'folder_xml',$folder_xml,__FILE__,__FUNCTION__,__LINE__);
// }


if ( isset($options["PROPFIND"]) ) {
   // Fetch some information about the events in that calendar
   $cal->SetDepth(1);
/*
   $folder_xml = $cal->DoXMLRequest("PROPFIND", '<?xml version="1.0" encoding="utf-8" ?><propfind xmlns="DAV:"><prop><getcontentlength/><getcontenttype/><resourcetype/><getetag/></prop></propfind>' );
*/
 }

DEBUG_S(-3,'folder_xml',$folder_xml,__FILE__,__FUNCTION__,__LINE__);

// $events = $cal->GetEvents("20130901T000000Z","20140101T000000Z");
//DEBUG_S(-3,'events',$events);
}
?>

