本文整理汇总了PHP中Horde_Icalendar::_exportDate方法的典型用法代码示例。如果您正苦于以下问题:PHP Horde_Icalendar::_exportDate方法的具体用法?PHP Horde_Icalendar::_exportDate怎么用?PHP Horde_Icalendar::_exportDate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Horde_Icalendar
的用法示例。
在下文中一共展示了Horde_Icalendar::_exportDate方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: vevent2sif
public function vevent2sif($vcard)
{
/* Some special handling for all-day vEvents that are not passed
* as TYPE=DATE (TYPE=DATE does not exist for vCalendar 1.0) */
if (preg_match('/(\\r\\n|\\r|\\n)DTSTART:.*T000000(\\r\\n|\\r|\\n)/', $vcard)) {
if (preg_match('/(\\r\\n|\\r|\\n)DTEND:(\\d\\d\\d\\d)(\\d\\d)(\\d\\d)T235959(\\r\\n|\\r|\\n)/', $vcard, $m)) {
$vcard = preg_replace('/(\\r\\n|\\r|\\n)DTSTART:(.*)T000000(\\r\\n|\\r|\\n)/', "\$1DTSTART;VALUE=DATE:\$2\$3", $vcard);
$vcard = preg_replace('/(\\r\\n|\\r|\\n)DTEND:(.*)T235959(\\r\\n|\\r|\\n)/', "\$1DTEND;VALUE=DATE:\$2\$3", $vcard);
}
// @TODO: else: handle case with DTEND= T240000
}
$iCal = new Horde_Icalendar();
if (!$iCal->parsevCalendar($vcard)) {
// @TODO: NEVER use die() in a library.
die("There was an error importing the data.");
}
$components = $iCal->getComponents();
switch (count($components)) {
case 0:
// @TODO: NEVER use die() in a library.
die("No data was found.");
case 1:
$content = $components[0];
break;
default:
// @TODO: NEVER use die() in a library.
die("Multiple components found; only one is supported.");
}
$hash = array('ReminderSet' => 0, 'IsRecurring' => 0, 'BusyStatus' => 2);
$alarm = $end = null;
$start = $content->getAttribute('DTSTART');
$start_params = $content->getAttribute('DTSTART', true);
if (!empty($start_params[0]['VALUE']) && $start_params[0]['VALUE'] == 'DATE') {
$hash['AllDayEvent'] = 1;
$hash['Start'] = sprintf('%04d-%02d-%02d', $start['year'], $start['month'], $start['mday']);
$start = mktime(0, 0, 0, $start['month'], $start['mday'], $start['year']);
} else {
$hash['AllDayEvent'] = 0;
$hash['Start'] = Horde_Icalendar::_exportDateTime($start);
}
foreach ($content->getAllAttributes() as $item) {
$GLOBALS['backend']->logMessage(sprintf('Sync4j for name %s, value %s', $item['name'], is_string($item['value']) ? $item['value'] : var_export($item['value'], true)), 'DEBUG');
switch (Horde_String::upper($item['name'])) {
case 'DTSTART':
break;
case 'DTEND':
if (!empty($item['params']['VALUE']) && $item['params']['VALUE'] == 'DATE') {
$hash['AllDayEvent'] = 1;
$date = new Horde_Date($item['value']['year'], $item['value']['month'], $item['value']['mday']);
$date->mday--;
$hash['End'] = $date->format('Y-m-d');
$end = $date->datestamp();
} else {
$hash['AllDayEvent'] = 0;
$hash['End'] = Horde_Icalendar::_exportDateTime($item['value']);
$end = $item['value'];
}
break;
case 'SUMMARY':
$hash['Subject'] = $item['value'];
break;
case 'DESCRIPTION':
$hash['Body'] = $item['value'];
break;
case 'LOCATION':
$hash['Location'] = $item['value'];
break;
case 'CATEGORIES':
$hash['Categories'] = $item['value'];
break;
case 'AALARM':
$hash['ReminderSet'] = 1;
$alarm = $item['value'];
break;
case 'STATUS':
switch (Horde_String::upper($item['value'])) {
case 'FREE':
case 'CANCELLED':
$hash['BusyStatus'] = 0;
break;
case 'TENTATIVE':
$hash['BusyStatus'] = 1;
break;
case 'CONFIRMED':
$hash['BusyStatus'] = 2;
break;
}
break;
case 'CLASS':
switch (Horde_String::upper($item['value'])) {
case 'PUBLIC':
$hash['Sensitivity'] = 0;
break;
case 'PRIVATE':
$hash['Sensitivity'] = 2;
break;
case 'CONFIDENTIAL':
$hash['Sensitivity'] = 3;
break;
}
//.........这里部分代码省略.........