mirror of
https://gitlab.com/davical-project/davical.git
synced 2026-05-22 02:04:19 +00:00
Handle <prop> following <filter> & a single-ended time filter.
This commit is contained in:
parent
db9083b587
commit
452cd69100
@ -25,12 +25,15 @@ function check_for_expansion( $calendar_data_node ) {
|
|||||||
* Build the array of properties to include in the report output
|
* Build the array of properties to include in the report output
|
||||||
*/
|
*/
|
||||||
$qry_content = $xmltree->GetContent('urn:ietf:params:xml:ns:caldav:calendar-query');
|
$qry_content = $xmltree->GetContent('urn:ietf:params:xml:ns:caldav:calendar-query');
|
||||||
$proptype = $qry_content[0]->GetTag();
|
|
||||||
|
while (list($idx, $qqq) = each($qry_content))
|
||||||
|
{
|
||||||
|
$proptype = $qry_content[$idx]->GetTag();
|
||||||
$properties = array();
|
$properties = array();
|
||||||
switch( $proptype ) {
|
switch( $proptype ) {
|
||||||
case 'DAV::prop':
|
case 'DAV::prop':
|
||||||
$qry_props = $xmltree->GetPath('/urn:ietf:params:xml:ns:caldav:calendar-query/'.$proptype.'/*');
|
$qry_props = $xmltree->GetPath('/urn:ietf:params:xml:ns:caldav:calendar-query/'.$proptype.'/*');
|
||||||
foreach( $qry_content[0]->GetElements() AS $k => $v ) {
|
foreach( $qry_content[$idx]->GetElements() AS $k => $v ) {
|
||||||
$propertyname = preg_replace( '/^.*:/', '', $v->GetTag() );
|
$propertyname = preg_replace( '/^.*:/', '', $v->GetTag() );
|
||||||
$properties[$propertyname] = 1;
|
$properties[$propertyname] = 1;
|
||||||
if ( $v->GetTag() == 'urn:ietf:params:xml:ns:caldav:calendar-data' ) check_for_expansion($v);
|
if ( $v->GetTag() == 'urn:ietf:params:xml:ns:caldav:calendar-data' ) check_for_expansion($v);
|
||||||
@ -39,17 +42,14 @@ switch( $proptype ) {
|
|||||||
|
|
||||||
case 'DAV::allprop':
|
case 'DAV::allprop':
|
||||||
$properties['allprop'] = 1;
|
$properties['allprop'] = 1;
|
||||||
if ( $qry_content[1]->GetTag() == 'DAV::include' ) {
|
if ( $qry_content[$idx]->GetTag() == 'DAV::include' ) {
|
||||||
foreach( $qry_content[1]->GetElements() AS $k => $v ) {
|
foreach( $qry_content[$idx]->GetElements() AS $k => $v ) {
|
||||||
$include_properties[] = $v->GetTag(); /** $include_properties is referenced in DAVResource where allprop is expanded */
|
$include_properties[] = $v->GetTag(); /** $include_properties is referenced in DAVResource where allprop is expanded */
|
||||||
if ( $v->GetTag() == 'urn:ietf:params:xml:ns:caldav:calendar-data' ) check_for_expansion($v);
|
if ( $v->GetTag() == 'urn:ietf:params:xml:ns:caldav:calendar-data' ) check_for_expansion($v);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
default:
|
|
||||||
$propertyname = preg_replace( '/^.*:/', '', $proptype );
|
|
||||||
$properties[$propertyname] = 1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -156,12 +156,21 @@ function SqlFilterFragment( $filter, $components, $property = null, $parameter =
|
|||||||
// $params[':time_range_start'] = $start;
|
// $params[':time_range_start'] = $start;
|
||||||
// $params[':time_range_end'] = $finish;
|
// $params[':time_range_end'] = $finish;
|
||||||
// }
|
// }
|
||||||
if ( isset($start) || isset($finish) ) {
|
if ( isset($start) && isset($finish) ) {
|
||||||
$sql .= ' AND (rrule IS NOT NULL OR (dtstart < :time_range_end AND (dtend > :time_range_start ';
|
$sql .= ' AND (rrule IS NOT NULL OR (dtstart < :time_range_end AND (dtend > :time_range_start ';
|
||||||
$sql .= ' OR (dtend IS NULL AND dtstart > :time_range_start)))) ';
|
$sql .= ' OR (dtend IS NULL AND dtstart > :time_range_start)))) ';
|
||||||
$params[':time_range_start'] = $start;
|
$params[':time_range_start'] = $start;
|
||||||
$params[':time_range_end'] = $finish;
|
$params[':time_range_end'] = $finish;
|
||||||
}
|
}
|
||||||
|
elseif ( isset($start) ) {
|
||||||
|
$sql .= ' AND (rrule IS NOT NULL OR (dtend > :time_range_start ';
|
||||||
|
$sql .= ' OR (dtend IS NULL AND dtstart > :time_range_start))) ';
|
||||||
|
$params[':time_range_start'] = $start;
|
||||||
|
}
|
||||||
|
elseif ( isset($finish) ) {
|
||||||
|
$sql .= ' AND (rrule IS NOT NULL OR dtstart < :time_range_end) ';
|
||||||
|
$params[':time_range_end'] = $finish;
|
||||||
|
}
|
||||||
$need_range_filter = array(new RepeatRuleDateTime($start),new RepeatRuleDateTime($finish));
|
$need_range_filter = array(new RepeatRuleDateTime($start),new RepeatRuleDateTime($finish));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -212,7 +221,7 @@ function SqlFilterFragment( $filter, $components, $property = null, $parameter =
|
|||||||
|
|
||||||
case 'UID':
|
case 'UID':
|
||||||
case 'SUMMARY':
|
case 'SUMMARY':
|
||||||
case 'LOCATION':
|
// case 'LOCATION':
|
||||||
case 'DESCRIPTION':
|
case 'DESCRIPTION':
|
||||||
case 'CLASS':
|
case 'CLASS':
|
||||||
case 'TRANSP':
|
case 'TRANSP':
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user