lets have only one function check_for_expansion()

This commit is contained in:
Florian Schlichting 2016-12-29 23:07:41 +01:00
parent eaef540766
commit 7cadfc9463
3 changed files with 25 additions and 38 deletions

View File

@ -2,27 +2,6 @@
include_once('vCalendar.php');
$need_expansion = false;
function check_for_expansion( $calendar_data_node ) {
global $need_expansion, $expand_range_start, $expand_range_end, $expand_as_floating;
if ( !class_exists('DateTime') ) return; /** We don't support expansion on PHP5.1 */
$expansion = $calendar_data_node->GetElements('urn:ietf:params:xml:ns:caldav:expand');
if ( isset($expansion[0]) ) {
$need_expansion = true;
$expand_range_start = $expansion[0]->GetAttribute('start');
$expand_range_end = $expansion[0]->GetAttribute('end');
$expand_as_floating = $expansion[0]->GetAttribute('floating');
if ( isset($expand_range_start) ) $expand_range_start = new RepeatRuleDateTime($expand_range_start);
if ( isset($expand_range_end) ) $expand_range_end = new RepeatRuleDateTime($expand_range_end);
if ( isset($expand_as_floating) && $expand_as_floating == "yes" )
$expand_as_floating = true;
else
$expand_as_floating = false;
}
}
/**
* Build the array of properties to include in the report output
*/
@ -30,6 +9,7 @@ $qry_content = $xmltree->GetContent('urn:ietf:params:xml:ns:caldav:calendar-quer
$properties = array();
$include_properties = array();
$need_expansion = false;
while (list($idx, $qqq) = each($qry_content))
{
$proptype = $qry_content[$idx]->GetNSTag();

View File

@ -5,29 +5,13 @@
$responses = array();
$need_expansion = false;
function check_for_expansion( $calendar_data_node ) {
global $need_expansion, $expand_range_start, $expand_range_end;
if ( !class_exists('DateTime') ) return; /** We don't support expansion on PHP5.1 */
$expansion = $calendar_data_node->GetElements('urn:ietf:params:xml:ns:caldav:expand');
if ( isset($expansion[0]) ) {
$need_expansion = true;
$expand_range_start = $expansion[0]->GetAttribute('start');
$expand_range_end = $expansion[0]->GetAttribute('end');
if ( isset($expand_range_start) ) $expand_range_start = new RepeatRuleDateTime($expand_range_start);
if ( isset($expand_range_end) ) $expand_range_end = new RepeatRuleDateTime($expand_range_end);
}
}
/**
* Build the array of properties to include in the report output
*/
$proptype = $qry_content[0]->GetNSTag();
$properties = array();
$need_expansion = false;
switch( $proptype ) {
case 'DAV::prop':
$qry_props = $xmltree->GetPath('/*/'.$proptype.'/*');

View File

@ -79,6 +79,29 @@ switch( $xmltree->GetNSTag() ) {
exit; // Not that it should return anyway.
}
/**
* check if we need to do expansion of recurring events
* @param object $calendar_data_node
*/
function check_for_expansion( $calendar_data_node ) {
global $need_expansion, $expand_range_start, $expand_range_end, $expand_as_floating;
if ( !class_exists('DateTime') ) return; /** We don't support expansion on PHP5.1 */
$expansion = $calendar_data_node->GetElements('urn:ietf:params:xml:ns:caldav:expand');
if ( isset($expansion[0]) ) {
$need_expansion = true;
$expand_range_start = $expansion[0]->GetAttribute('start');
$expand_range_end = $expansion[0]->GetAttribute('end');
$expand_as_floating = $expansion[0]->GetAttribute('floating');
if ( isset($expand_range_start) ) $expand_range_start = new RepeatRuleDateTime($expand_range_start);
if ( isset($expand_range_end) ) $expand_range_end = new RepeatRuleDateTime($expand_range_end);
if ( isset($expand_as_floating) && $expand_as_floating == "yes" )
$expand_as_floating = true;
else
$expand_as_floating = false;
}
}
/**