A better way of achieving that last commit is to add a third parameter.

This commit is contained in:
Andrew McMillan 2012-04-04 12:06:17 +12:00
parent 631dbc67c3
commit 2542d351cb

View File

@ -928,41 +928,13 @@ EOFILTER;
* *
* @return array An array of the relative URL, etag, and calendar data returned from DoCalendarQuery() @see DoCalendarQuery() * @return array An array of the relative URL, etag, and calendar data returned from DoCalendarQuery() @see DoCalendarQuery()
*/ */
function GetEntryByUid( $uid, $relative_url = '' ) { function GetEntryByUid( $uid, $relative_url = '', $component_type = 'VEVENT' ) {
$filter = ""; $filter = "";
if ( $uid ) { if ( $uid ) {
$filter = <<<EOFILTER $filter = <<<EOFILTER
<C:filter> <C:filter>
<C:comp-filter name="VCALENDAR"> <C:comp-filter name="VCALENDAR">
<C:comp-filter name="VEVENT"> <C:comp-filter name="$component_type">
<C:prop-filter name="UID">
<C:text-match icollation="i;octet">$uid</C:text-match>
</C:prop-filter>
</C:comp-filter>
</C:comp-filter>
</C:filter>
EOFILTER;
}
return $this->DoCalendarQuery($filter, $relative_url);
}
/**
* Get the calendar entry by UID
*
* @param uid
* @param string $relative_url The URL relative to the base_url specified when the calendar was opened. Default ''.
*
* @return array An array of the relative URL, etag, and calendar data returned from DoCalendarQuery() @see DoCalendarQuery()
*/
function GetTodoByUid( $uid, $relative_url = '' ) {
$filter = "";
if ( $uid ) {
$filter = <<<EOFILTER
<C:filter>
<C:comp-filter name="VCALENDAR">
<C:comp-filter name="VTODO">
<C:prop-filter name="UID"> <C:prop-filter name="UID">
<C:text-match icollation="i;octet">$uid</C:text-match> <C:text-match icollation="i;octet">$uid</C:text-match>
</C:prop-filter> </C:prop-filter>