document closed Debian bug
[davical.git] / inc / caldav-REPORT-freebusy.php
blobc77a504ba50cb321c7c86317bee111eaba13b831
1 <?php
2 /**
3 * Handle the FREE-BUSY-QUERY variant of REPORT
4 */
5 include_once("freebusy-functions.php");
7 $fbq_content = $xmltree->GetContent('urn:ietf:params:xml:ns:caldav:free-busy-query');
8 $fbq_start = $fbq_content[0]->GetAttribute('start');
9 $fbq_end = $fbq_content[0]->GetAttribute('end');
10 if ( ! ( isset($fbq_start) || isset($fbq_end) ) ) {
11 $request->DoResponse( 400, 'All valid freebusy requests MUST contain a time-range filter' );
13 $range_start = new RepeatRuleDateTime($fbq_start);
14 $range_end = new RepeatRuleDateTime($fbq_end);
17 /** We use the same code for the REPORT, the POST and the freebusy GET... */
18 $freebusy = get_freebusy( '^' . $request->path . $request->DepthRegexTail(true), $range_start, $range_end );
20 $result = new iCalComponent();
21 $result->VCalendar();
22 $result->AddComponent($freebusy);
24 $request->DoResponse( 200, $result->Render(), 'text/calendar' );
25 // Won't return from that