1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/agendav_ynh.git synced 2024-09-03 20:36:12 +02:00

Add filter for expand part

This commit is contained in:
npze 2014-07-01 13:55:32 +02:00
parent 6675c2803c
commit 91b6f53506

View file

@ -875,7 +875,7 @@ EOXML;
* be an array with 'href', 'etag' and 'data' elements, corresponding to the URL, the server-supplied * be an array with 'href', 'etag' and 'data' elements, corresponding to the URL, the server-supplied
* etag (which only varies when the data changes) and the calendar data in iCalendar format. * etag (which only varies when the data changes) and the calendar data in iCalendar format.
*/ */
function DoCalendarQuery( $filter, $url = null ) { function DoCalendarQuery( $filter, $expand_filter, $url = null ) {
if ( isset($url) ) $this->SetCalendar($url); if ( isset($url) ) $this->SetCalendar($url);
@ -883,7 +883,9 @@ EOXML;
<?xml version="1.0" encoding="utf-8" ?> <?xml version="1.0" encoding="utf-8" ?>
<C:calendar-query xmlns:D="DAV:" xmlns:C="urn:ietf:params:xml:ns:caldav"> <C:calendar-query xmlns:D="DAV:" xmlns:C="urn:ietf:params:xml:ns:caldav">
<D:prop> <D:prop>
<C:calendar-data/> <C:calendar-data>
$expand_filter
</C:calendar-data>
<D:getetag/> <D:getetag/>
</D:prop>$filter </D:prop>$filter
</C:calendar-query> </C:calendar-query>
@ -936,9 +938,15 @@ EOXML;
$this->SetDepth('1'); $this->SetDepth('1');
$filter = ""; $filter = "";
if ( isset($start) && isset($finish) ) if ( isset($start) && isset($finish) )
{
$range = "<C:time-range start=\"$start\" end=\"$finish\"/>"; $range = "<C:time-range start=\"$start\" end=\"$finish\"/>";
$expand_filter = "<C:expand start=\"$start\" end=\"$finish\" />";
}
else else
{
$range = ''; $range = '';
$expand_filter = "";
}
$filter = <<<EOFILTER $filter = <<<EOFILTER
<C:filter> <C:filter>
@ -950,7 +958,8 @@ $range
</C:filter> </C:filter>
EOFILTER; EOFILTER;
return $this->DoCalendarQuery($filter, $relative_url);
return $this->DoCalendarQuery($filter, $expand_filter, $relative_url);
} }
@ -975,6 +984,7 @@ EOFILTER;
$time_range = <<<EOTIME $time_range = <<<EOTIME
<C:time-range start="$start" end="$finish"/> <C:time-range start="$start" end="$finish"/>
EOTIME; EOTIME;
$expand_filter = "<C:expand start=\"$start\" end=\"$finish\" />";
} }
// Warning! May contain traces of double negatives... // Warning! May contain traces of double negatives...
@ -996,7 +1006,7 @@ EOTIME;
</C:filter> </C:filter>
EOFILTER; EOFILTER;
return $this->DoCalendarQuery($filter, $relative_url); return $this->DoCalendarQuery($filter, $expand_filter, $relative_url);
} }
@ -1025,7 +1035,7 @@ EOFILTER;
EOFILTER; EOFILTER;
} }
return $this->DoCalendarQuery($filter, $relative_url); return $this->DoCalendarQuery($filter, $expand_filter, $relative_url);
} }