forked from extern/egroupware
Fixes Export of Yearly Recurring Events and eGW Coding Standards
This commit is contained in:
parent
f751deb019
commit
79b1279028
@ -11,7 +11,7 @@
|
|||||||
* @version $Id$
|
* @version $Id$
|
||||||
*/
|
*/
|
||||||
|
|
||||||
require_once EGW_SERVER_ROOT.'/phpgwapi/inc/horde/Horde/iCalendar.php';
|
require_once EGW_SERVER_ROOT.'/phpgwapi/inc/horde/lib/core.php';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* SIF Parser for SyncML
|
* SIF Parser for SyncML
|
||||||
@ -84,22 +84,27 @@ class calendar_sif extends calendar_boupdate
|
|||||||
const xml_decl = '<?xml version="1.0" encoding="UTF-8"?>';
|
const xml_decl = '<?xml version="1.0" encoding="UTF-8"?>';
|
||||||
const SIF_decl = '<SIFVersion>1.1</SIFVersion>';
|
const SIF_decl = '<SIFVersion>1.1</SIFVersion>';
|
||||||
|
|
||||||
function startElement($_parser, $_tag, $_attributes) {
|
function startElement($_parser, $_tag, $_attributes)
|
||||||
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
function endElement($_parser, $_tag) {
|
function endElement($_parser, $_tag)
|
||||||
|
{
|
||||||
//error_log('endElem: ' . $_tag .' => '. trim($this->sifData));
|
//error_log('endElem: ' . $_tag .' => '. trim($this->sifData));
|
||||||
if(!empty($this->sifMapping[$_tag])) {
|
if(!empty($this->sifMapping[$_tag]))
|
||||||
|
{
|
||||||
$this->event[$this->sifMapping[$_tag]] = trim($this->sifData);
|
$this->event[$this->sifMapping[$_tag]] = trim($this->sifData);
|
||||||
}
|
}
|
||||||
unset($this->sifData);
|
unset($this->sifData);
|
||||||
}
|
}
|
||||||
|
|
||||||
function characterData($_parser, $_data) {
|
function characterData($_parser, $_data)
|
||||||
|
{
|
||||||
$this->sifData .= $_data;
|
$this->sifData .= $_data;
|
||||||
}
|
}
|
||||||
|
|
||||||
function siftoegw($sifData) {
|
function siftoegw($sifData)
|
||||||
|
{
|
||||||
$vcal = new Horde_iCalendar;
|
$vcal = new Horde_iCalendar;
|
||||||
$finalEvent = array();
|
$finalEvent = array();
|
||||||
$sysCharSet = $GLOBALS['egw']->translation->charset();
|
$sysCharSet = $GLOBALS['egw']->translation->charset();
|
||||||
@ -117,7 +122,8 @@ class calendar_sif extends calendar_boupdate
|
|||||||
xml_set_element_handler($this->xml_parser, "startElement", "endElement");
|
xml_set_element_handler($this->xml_parser, "startElement", "endElement");
|
||||||
xml_set_character_data_handler($this->xml_parser, "characterData");
|
xml_set_character_data_handler($this->xml_parser, "characterData");
|
||||||
$this->strXmlData = xml_parse($this->xml_parser, $sifData);
|
$this->strXmlData = xml_parse($this->xml_parser, $sifData);
|
||||||
if(!$this->strXmlData) {
|
if (!$this->strXmlData)
|
||||||
|
{
|
||||||
error_log(sprintf("XML error: %s at line %d",
|
error_log(sprintf("XML error: %s at line %d",
|
||||||
xml_error_string(xml_get_error_code($this->xml_parser)),
|
xml_error_string(xml_get_error_code($this->xml_parser)),
|
||||||
xml_get_current_line_number($this->xml_parser)));
|
xml_get_current_line_number($this->xml_parser)));
|
||||||
@ -125,13 +131,16 @@ class calendar_sif extends calendar_boupdate
|
|||||||
}
|
}
|
||||||
#error_log(print_r($this->event, true));
|
#error_log(print_r($this->event, true));
|
||||||
|
|
||||||
foreach($this->event as $key => $value) {
|
foreach ($this->event as $key => $value)
|
||||||
|
{
|
||||||
$value = preg_replace('/<\!\[CDATA\[(.+)\]\]>/Usim', '$1', $value);
|
$value = preg_replace('/<\!\[CDATA\[(.+)\]\]>/Usim', '$1', $value);
|
||||||
$value = $GLOBALS['egw']->translation->convert($value, 'utf-8', $sysCharSet);
|
$value = $GLOBALS['egw']->translation->convert($value, 'utf-8', $sysCharSet);
|
||||||
#error_log("$key => $value");
|
#error_log("$key => $value");
|
||||||
switch($key) {
|
switch ($key)
|
||||||
|
{
|
||||||
case 'alldayevent':
|
case 'alldayevent':
|
||||||
if($value == 1) {
|
if ($value == 1)
|
||||||
|
{
|
||||||
$finalEvent['whole_day'] = true;
|
$finalEvent['whole_day'] = true;
|
||||||
$startParts = explode('-',$this->event['start']);
|
$startParts = explode('-',$this->event['start']);
|
||||||
$finalEvent['start']['hour'] = $finalEvent['start']['minute'] = $finalEvent['start']['second'] = 0;
|
$finalEvent['start']['hour'] = $finalEvent['start']['minute'] = $finalEvent['start']['second'] = 0;
|
||||||
@ -153,26 +162,31 @@ class calendar_sif extends calendar_boupdate
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case 'category':
|
case 'category':
|
||||||
if(!empty($value)) {
|
if (!empty($value))
|
||||||
|
{
|
||||||
$finalEvent[$key] = implode(',',$this->find_or_add_categories(explode(';', $value)));
|
$finalEvent[$key] = implode(',',$this->find_or_add_categories(explode(';', $value)));
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'end':
|
case 'end':
|
||||||
case 'start':
|
case 'start':
|
||||||
if($this->event['alldayevent'] < 1) {
|
if ($this->event['alldayevent'] < 1)
|
||||||
|
{
|
||||||
$finalEvent[$key] = $vcal->_parseDateTime($value);
|
$finalEvent[$key] = $vcal->_parseDateTime($value);
|
||||||
error_log("event ".$key." val=".$value.", parsed=".$finalEvent[$key]);
|
error_log("event ".$key." val=".$value.", parsed=".$finalEvent[$key]);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'isrecurring':
|
case 'isrecurring':
|
||||||
if($value == 1) {
|
if ($value == 1)
|
||||||
|
{
|
||||||
$finalEvent['recur_interval'] = $this->event['recur_interval'];
|
$finalEvent['recur_interval'] = $this->event['recur_interval'];
|
||||||
if($this->event['recur_noenddate'] == 0) {
|
if ($this->event['recur_noenddate'] == 0)
|
||||||
|
{
|
||||||
$finalEvent['recur_enddate'] = $vcal->_parseDateTime($this->event['recur_enddate']);
|
$finalEvent['recur_enddate'] = $vcal->_parseDateTime($this->event['recur_enddate']);
|
||||||
}
|
}
|
||||||
switch($this->event['recur_type']) {
|
switch ($this->event['recur_type'])
|
||||||
|
{
|
||||||
case self::olRecursDaily:
|
case self::olRecursDaily:
|
||||||
$finalEvent['recur_type'] = MCAL_RECUR_DAILY;
|
$finalEvent['recur_type'] = MCAL_RECUR_DAILY;
|
||||||
break;
|
break;
|
||||||
@ -203,7 +217,8 @@ class calendar_sif extends calendar_boupdate
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case 'reminderset':
|
case 'reminderset':
|
||||||
if($value == 1) {
|
if ($value == 1)
|
||||||
|
{
|
||||||
$finalEvent['alarm'] = $this->event['reminderstart'];
|
$finalEvent['alarm'] = $this->event['reminderstart'];
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -217,7 +232,8 @@ class calendar_sif extends calendar_boupdate
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case 'description':
|
case 'description':
|
||||||
if (preg_match('/\s*\[UID:(.+)?\]/Usm', $value, $matches)) {
|
if (preg_match('/\s*\[UID:(.+)?\]/Usm', $value, $matches))
|
||||||
|
{
|
||||||
$finalEvent['uid'] = $matches[1];
|
$finalEvent['uid'] = $matches[1];
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -266,35 +282,43 @@ class calendar_sif extends calendar_boupdate
|
|||||||
#error_log('ABID: '.$_abID);
|
#error_log('ABID: '.$_abID);
|
||||||
#error_log(base64_decode($_sifdata));
|
#error_log(base64_decode($_sifdata));
|
||||||
|
|
||||||
if(!$event = $this->siftoegw($_sifdata)) {
|
if (!$event = $this->siftoegw($_sifdata))
|
||||||
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(isset($event['alarm'])) {
|
if (isset($event['alarm']))
|
||||||
|
{
|
||||||
$alarm = $event['alarm'];
|
$alarm = $event['alarm'];
|
||||||
unset($event['alarm']);
|
unset($event['alarm']);
|
||||||
}
|
}
|
||||||
|
|
||||||
if($_calID > 0) {
|
if ($_calID > 0)
|
||||||
|
{
|
||||||
// update entry
|
// update entry
|
||||||
$event['id'] = $_calID;
|
$event['id'] = $_calID;
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
if (isset($event['whole_day']) && $event['whole_day']
|
if (isset($event['whole_day']) && $event['whole_day']
|
||||||
&& isset ($deviceInfo) && is_array($deviceInfo)
|
&& isset ($deviceInfo) && is_array($deviceInfo)
|
||||||
&& isset($deviceInfo['nonBlockingAllday'])
|
&& isset($deviceInfo['nonBlockingAllday'])
|
||||||
&& $deviceInfo['nonBlockingAllday']) {
|
&& $deviceInfo['nonBlockingAllday'])
|
||||||
|
{
|
||||||
$event['non_blocking'] = '1';
|
$event['non_blocking'] = '1';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if($eventID = $this->update($event, TRUE)) {
|
if ($eventID = $this->update($event, TRUE))
|
||||||
|
{
|
||||||
$updatedEvent = $this->read($eventID);
|
$updatedEvent = $this->read($eventID);
|
||||||
foreach ($updatedEvent['alarm'] as $alarmID => $alarmData)
|
foreach ($updatedEvent['alarm'] as $alarmID => $alarmData)
|
||||||
{
|
{
|
||||||
$this->delete_alarm($alarmID);
|
$this->delete_alarm($alarmID);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(isset($alarm)) {
|
if (isset($alarm))
|
||||||
|
{
|
||||||
$alarmData['time'] = $event['start'] - ($alarm*60);
|
$alarmData['time'] = $event['start'] - ($alarm*60);
|
||||||
$alarmData['offset'] = $alarm*60;
|
$alarmData['offset'] = $alarm*60;
|
||||||
$alarmData['all'] = 1;
|
$alarmData['all'] = 1;
|
||||||
@ -322,10 +346,13 @@ class calendar_sif extends calendar_boupdate
|
|||||||
#$event = $this->read($_id,null,false,'server');
|
#$event = $this->read($_id,null,false,'server');
|
||||||
#error_log("FOUND EVENT: ". print_r($event, true));
|
#error_log("FOUND EVENT: ". print_r($event, true));
|
||||||
|
|
||||||
if($event = $this->read($_id,null,false,'server')) {
|
if (($event = $this->read($_id,null,false,'server')))
|
||||||
|
{
|
||||||
|
|
||||||
if ($this->uidExtension) {
|
if ($this->uidExtension)
|
||||||
if (!preg_match('/\[UID:.+\]/m', $event['description'])) {
|
{
|
||||||
|
if (!preg_match('/\[UID:.+\]/m', $event['description']))
|
||||||
|
{
|
||||||
$event['description'] .= "\n[UID:" . $event['uid'] . "]";
|
$event['description'] .= "\n[UID:" . $event['uid'] . "]";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -360,10 +387,26 @@ class calendar_sif extends calendar_boupdate
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case 'IsRecurring':
|
case 'IsRecurring':
|
||||||
switch($event['recur_type']) {
|
if ($event['recur_type'] == MCAL_RECUR_NONE)
|
||||||
case MCAL_RECUR_NONE:
|
{
|
||||||
$sifEvent .= "<$sifField>0</$sifField>";
|
$sifEvent .= "<$sifField>0</$sifField>";
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
|
if ($event['recur_enddate'] == 0)
|
||||||
|
{
|
||||||
|
$sifEvent .= '<NoEndDate>1</NoEndDate>';
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$recurEndDate = mktime(24 , 0, 0,
|
||||||
|
date('m',$event['recur_enddate']),
|
||||||
|
date('d', $event['recur_enddate']),
|
||||||
|
date('Y', $event['recur_enddate']));
|
||||||
|
$sifEvent .= '<NoEndDate>0</NoEndDate>';
|
||||||
|
$sifEvent .= '<PatternEndDate>'. $vcal->_exportDateTime($recurEndDate) .'</PatternEndDate>';
|
||||||
|
}
|
||||||
|
switch ($event['recur_type'])
|
||||||
|
{
|
||||||
|
|
||||||
case MCAL_RECUR_DAILY:
|
case MCAL_RECUR_DAILY:
|
||||||
$eventInterval = ($event['recur_interval'] > 1 ? $event['recur_interval'] : 1);
|
$eventInterval = ($event['recur_interval'] > 1 ? $event['recur_interval'] : 1);
|
||||||
@ -373,13 +416,8 @@ class calendar_sif extends calendar_boupdate
|
|||||||
$sifEvent .= '<RecurrenceType>'. self::olRecursDaily .'</RecurrenceType>';
|
$sifEvent .= '<RecurrenceType>'. self::olRecursDaily .'</RecurrenceType>';
|
||||||
$sifEvent .= '<Interval>'. $eventInterval .'</Interval>';
|
$sifEvent .= '<Interval>'. $eventInterval .'</Interval>';
|
||||||
$sifEvent .= '<PatternStartDate>'. $vcal->_exportDateTime($recurStartDate) .'</PatternStartDate>';
|
$sifEvent .= '<PatternStartDate>'. $vcal->_exportDateTime($recurStartDate) .'</PatternStartDate>';
|
||||||
if($event['recur_enddate'] == 0) {
|
if ($event['recur_enddate'])
|
||||||
$sifEvent .= '<NoEndDate>1</NoEndDate>';
|
{
|
||||||
} else {
|
|
||||||
$recurEndDate = mktime(24,0,0,date('m',$event['recur_enddate']), date('d', $event['recur_enddate']), date('Y', $event['recur_enddate']));
|
|
||||||
|
|
||||||
$sifEvent .= '<NoEndDate>0</NoEndDate>';
|
|
||||||
$sifEvent .= '<PatternEndDate>'. $vcal->_exportDateTime($recurEndDate) .'</PatternEndDate>';
|
|
||||||
$totalDays = ($recurEndDate - $recurStartDate) / 86400;
|
$totalDays = ($recurEndDate - $recurStartDate) / 86400;
|
||||||
$occurrences = ceil($totalDays / $eventInterval);
|
$occurrences = ceil($totalDays / $eventInterval);
|
||||||
$sifEvent .= '<Occurrences>'. $occurrences .'</Occurrences>';
|
$sifEvent .= '<Occurrences>'. $occurrences .'</Occurrences>';
|
||||||
@ -395,19 +433,16 @@ class calendar_sif extends calendar_boupdate
|
|||||||
$sifEvent .= '<Interval>'. $eventInterval .'</Interval>';
|
$sifEvent .= '<Interval>'. $eventInterval .'</Interval>';
|
||||||
$sifEvent .= '<PatternStartDate>'. $vcal->_exportDateTime($recurStartDate) .'</PatternStartDate>';
|
$sifEvent .= '<PatternStartDate>'. $vcal->_exportDateTime($recurStartDate) .'</PatternStartDate>';
|
||||||
$sifEvent .= '<DayOfWeekMask>'. $event['recur_data'] .'</DayOfWeekMask>';
|
$sifEvent .= '<DayOfWeekMask>'. $event['recur_data'] .'</DayOfWeekMask>';
|
||||||
if($event['recur_enddate'] == 0) {
|
if ($event['recur_enddate'])
|
||||||
$sifEvent .= '<NoEndDate>1</NoEndDate>';
|
{
|
||||||
} else {
|
|
||||||
$recurEndDate = mktime(24, 0, 0, date('m',$event['recur_enddate']), date('d', $event['recur_enddate']), date('Y', $event['recur_enddate']));
|
|
||||||
|
|
||||||
$daysPerWeek = substr_count(decbin($event['recur_data']),'1');
|
$daysPerWeek = substr_count(decbin($event['recur_data']),'1');
|
||||||
$sifEvent .= '<NoEndDate>0</NoEndDate>';
|
|
||||||
$sifEvent .= '<PatternEndDate>'. $vcal->_exportDateTime($recurEndDate) .'</PatternEndDate>';
|
|
||||||
$totalWeeks = floor(($recurEndDate - $recurStartDate) / (86400*7));
|
$totalWeeks = floor(($recurEndDate - $recurStartDate) / (86400*7));
|
||||||
#error_log("AAA: $daysPerWeek $totalWeeks");
|
#error_log("AAA: $daysPerWeek $totalWeeks");
|
||||||
$occurrences = ($totalWeeks / $eventInterval) * $daysPerWeek;
|
$occurrences = ($totalWeeks / $eventInterval) * $daysPerWeek;
|
||||||
for($i = $recurEndDate; $i > $recurStartDate + ($totalWeeks * 86400*7); $i = $i - 86400) {
|
for($i = $recurEndDate; $i > $recurStartDate + ($totalWeeks * 86400*7); $i = $i - 86400)
|
||||||
switch(date('w', $i-1)) {
|
{
|
||||||
|
switch (date('w', $i-1))
|
||||||
|
{
|
||||||
case 0:
|
case 0:
|
||||||
if ($event['recur_data'] & 1) $occurrences++;
|
if ($event['recur_data'] & 1) $occurrences++;
|
||||||
break;
|
break;
|
||||||
@ -435,6 +470,7 @@ class calendar_sif extends calendar_boupdate
|
|||||||
$sifEvent .= '<Occurrences>'. $occurrences .'</Occurrences>';
|
$sifEvent .= '<Occurrences>'. $occurrences .'</Occurrences>';
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case MCAL_RECUR_MONTHLY_MDAY:
|
case MCAL_RECUR_MONTHLY_MDAY:
|
||||||
$eventInterval = ($event['recur_interval'] > 1 ? $event['recur_interval'] : 1);
|
$eventInterval = ($event['recur_interval'] > 1 ? $event['recur_interval'] : 1);
|
||||||
$recurStartDate = mktime(0,0,0,date('m',$event['start']), date('d', $event['start']), date('Y', $event['start']));
|
$recurStartDate = mktime(0,0,0,date('m',$event['start']), date('d', $event['start']), date('Y', $event['start']));
|
||||||
@ -443,15 +479,8 @@ class calendar_sif extends calendar_boupdate
|
|||||||
$sifEvent .= '<RecurrenceType>'. self::olRecursMonthly .'</RecurrenceType>';
|
$sifEvent .= '<RecurrenceType>'. self::olRecursMonthly .'</RecurrenceType>';
|
||||||
$sifEvent .= '<Interval>'. $eventInterval .'</Interval>';
|
$sifEvent .= '<Interval>'. $eventInterval .'</Interval>';
|
||||||
$sifEvent .= '<PatternStartDate>'. $vcal->_exportDateTime($recurStartDate) .'</PatternStartDate>';
|
$sifEvent .= '<PatternStartDate>'. $vcal->_exportDateTime($recurStartDate) .'</PatternStartDate>';
|
||||||
if($event['recur_enddate'] == 0) {
|
|
||||||
$sifEvent .= '<NoEndDate>1</NoEndDate>';
|
|
||||||
} else {
|
|
||||||
$recurEndDate = mktime(24, 0, 0, date('m',$event['recur_enddate']), date('d', $event['recur_enddate']), date('Y', $event['recur_enddate']));
|
|
||||||
|
|
||||||
$sifEvent .= '<NoEndDate>0</NoEndDate>';
|
|
||||||
$sifEvent .= '<PatternEndDate>'. $vcal->_exportDateTime($recurEndDate) .'</PatternEndDate>';
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case MCAL_RECUR_MONTHLY_WDAY:
|
case MCAL_RECUR_MONTHLY_WDAY:
|
||||||
$weekMaskMap = array('Sun' => self::olSunday, 'Mon' => self::olMonday, 'Tue' => self::olTuesday,
|
$weekMaskMap = array('Sun' => self::olSunday, 'Mon' => self::olMonday, 'Tue' => self::olTuesday,
|
||||||
'Wed' => self::olWednesday, 'Thu' => self::olThursday, 'Fri' => self::olFriday,
|
'Wed' => self::olWednesday, 'Thu' => self::olThursday, 'Fri' => self::olFriday,
|
||||||
@ -464,18 +493,12 @@ class calendar_sif extends calendar_boupdate
|
|||||||
$sifEvent .= '<Interval>'. $eventInterval .'</Interval>';
|
$sifEvent .= '<Interval>'. $eventInterval .'</Interval>';
|
||||||
$sifEvent .= '<PatternStartDate>'. $vcal->_exportDateTime($recurStartDate) .'</PatternStartDate>';
|
$sifEvent .= '<PatternStartDate>'. $vcal->_exportDateTime($recurStartDate) .'</PatternStartDate>';
|
||||||
$sifEvent .= '<Instance>' . (1 + (int) ((date('d',$event['start'])-1) / 7)) . '</Instance>';
|
$sifEvent .= '<Instance>' . (1 + (int) ((date('d',$event['start'])-1) / 7)) . '</Instance>';
|
||||||
if($event['recur_enddate'] == 0) {
|
|
||||||
$sifEvent .= '<NoEndDate>1</NoEndDate>';
|
|
||||||
$sifEvent .= '<DayOfWeekMask>' . $weekMaskMap[date('D',$event['start'])] . '</DayOfWeekMask>';
|
$sifEvent .= '<DayOfWeekMask>' . $weekMaskMap[date('D',$event['start'])] . '</DayOfWeekMask>';
|
||||||
} else {
|
|
||||||
$recurEndDate = mktime(24, 0, 0, date('m',$event['recur_enddate']), date('d', $event['recur_enddate']), date('Y', $event['recur_enddate']));
|
|
||||||
|
|
||||||
$sifEvent .= '<NoEndDate>0</NoEndDate>';
|
|
||||||
$sifEvent .= '<PatternEndDate>'. $vcal->_exportDateTime($recurEndDate) .'</PatternEndDate>';
|
|
||||||
$sifEvent .= '<DayOfWeekMask>' . $weekMaskMap[date('D',$event['start'])] . '</DayOfWeekMask>';
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case MCAL_RECUR_YEARLY:
|
case MCAL_RECUR_YEARLY:
|
||||||
|
$sifEvent .= "<$sifField>1</$sifField>";
|
||||||
|
$sifEvent .= '<RecurrenceType>'. self::olRecursYearly .'</RecurrenceType>';
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -496,13 +519,16 @@ class calendar_sif extends calendar_boupdate
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case 'Start':
|
case 'Start':
|
||||||
if ($this->isWholeDay($event)) {
|
if ($this->isWholeDay($event))
|
||||||
|
{
|
||||||
$value = date('Y-m-d', $event['start']);
|
$value = date('Y-m-d', $event['start']);
|
||||||
$sifEvent .= "<Start>$value</Start>";
|
$sifEvent .= "<Start>$value</Start>";
|
||||||
$vaule = date('Y-m-d', $event['end']);
|
$vaule = date('Y-m-d', $event['end']);
|
||||||
$sifEvent .= "<End>$value</End>";
|
$sifEvent .= "<End>$value</End>";
|
||||||
$sifEvent .= "<AllDayEvent>1</AllDayEvent>";
|
$sifEvent .= "<AllDayEvent>1</AllDayEvent>";
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
$value = $vcal->_exportDateTime($event['start']);
|
$value = $vcal->_exportDateTime($event['start']);
|
||||||
$sifEvent .= "<Start>$value</Start>";
|
$sifEvent .= "<Start>$value</Start>";
|
||||||
$value = $vcal->_exportDateTime($event['end']);
|
$value = $vcal->_exportDateTime($event['end']);
|
||||||
@ -515,7 +541,8 @@ class calendar_sif extends calendar_boupdate
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case 'ReminderSet':
|
case 'ReminderSet':
|
||||||
if(count((array)$event['alarm']) > 0) {
|
if (count((array)$event['alarm']) > 0)
|
||||||
|
{
|
||||||
$sifEvent .= "<$sifField>1</$sifField>";
|
$sifEvent .= "<$sifField>1</$sifField>";
|
||||||
foreach ($event['alarm'] as $alarmID => $alarmData)
|
foreach ($event['alarm'] as $alarmID => $alarmData)
|
||||||
{
|
{
|
||||||
@ -523,16 +550,21 @@ class calendar_sif extends calendar_boupdate
|
|||||||
// lets take only the first alarm
|
// lets take only the first alarm
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
$sifEvent .= "<$sifField>0</$sifField>";
|
$sifEvent .= "<$sifField>0</$sifField>";
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'Categories':
|
case 'Categories':
|
||||||
if(!empty($value)) {
|
if (!empty($value))
|
||||||
|
{
|
||||||
$value = implode('; ', $this->get_categories(explode(',',$value)));
|
$value = implode('; ', $this->get_categories(explode(',',$value)));
|
||||||
$value = $GLOBALS['egw']->translation->convert($value, $sysCharSet, 'utf-8');
|
$value = $GLOBALS['egw']->translation->convert($value, $sysCharSet, 'utf-8');
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -567,16 +599,20 @@ class calendar_sif extends calendar_boupdate
|
|||||||
$state = &$_SESSION['SyncML.state'];
|
$state = &$_SESSION['SyncML.state'];
|
||||||
$deviceInfo = $state->getClientDeviceInfo();
|
$deviceInfo = $state->getClientDeviceInfo();
|
||||||
|
|
||||||
if(isset($deviceInfo) && is_array($deviceInfo)) {
|
if (isset($deviceInfo) && is_array($deviceInfo))
|
||||||
|
{
|
||||||
if (isset($deviceInfo['uidExtension']) &&
|
if (isset($deviceInfo['uidExtension']) &&
|
||||||
$deviceInfo['uidExtension']){
|
$deviceInfo['uidExtension'])
|
||||||
|
{
|
||||||
$this->uidExtension = true;
|
$this->uidExtension = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// store product name and version, to be able to use it elsewhere
|
// store product name and version, to be able to use it elsewhere
|
||||||
if ($_productName) {
|
if ($_productName)
|
||||||
|
{
|
||||||
$this->productName = strtolower($_productName);
|
$this->productName = strtolower($_productName);
|
||||||
if (preg_match('/^[^\d]*(\d+\.?\d*)[\.|\d]*$/', $_productSoftwareVersion, $matches)) {
|
if (preg_match('/^[^\d]*(\d+\.?\d*)[\.|\d]*$/', $_productSoftwareVersion, $matches))
|
||||||
|
{
|
||||||
$this->productSoftwareVersion = $matches[1];
|
$this->productSoftwareVersion = $matches[1];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user