本文整理汇总了PHP中Sabre\VObject\Component\VCalendar::remove方法的典型用法代码示例。如果您正苦于以下问题:PHP VCalendar::remove方法的具体用法?PHP VCalendar::remove怎么用?PHP VCalendar::remove使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Sabre\VObject\Component\VCalendar
的用法示例。
在下文中一共展示了VCalendar::remove方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: render
public function render(Diary $diary)
{
$vcalendar = new VCalendar();
$vcalendar->remove('PRODID');
$vcalendar->add('PRODID', '-//Camdram//NONSGML Show Diary//EN');
foreach ($diary->getEvents() as $event) {
$start_time = null;
$rrule = array();
if ($event instanceof MultiDayEventInterface) {
$start_time = new \DateTime($event->getStartDate()->format('Y-m-d') . ' ' . $event->getStartTime()->format('H:i:s'));
$last_start_time = new \DateTime($event->getEndDate()->format('Y-m-d') . ' ' . $event->getStartTime()->format('H:i:s'));
$rrule = 'FREQ=DAILY;UNTIL=' . $last_start_time->format('Ymd\\THis\\Z');
} elseif ($event instanceof SingleDayEventInterface) {
$start_time = new \DateTime($event->getDate() . ' ' . $event->getStartTime()->format('H:i:s'));
}
if ($start_time) {
$utc = new \DateTimeZone('UTC');
$start_time->setTimezone($utc);
$end_time = clone $start_time;
$end_time->modify('+2 hours');
$dtstamp = clone $event->getUpdatedAt();
$dtstamp->setTimezone($utc);
$params = array('SUMMARY' => $event->getName(), 'LOCATION' => $event->getVenue(), 'UID' => $event->getUid(), 'DTSTAMP' => $dtstamp, 'DTSTART' => $start_time, 'DURATION' => 'PT2H00M00S', 'DESCRIPTION' => $event->getDescription());
if ($rrule) {
$params['RRULE'] = $rrule;
}
$vcalendar->add('VEVENT', $params);
}
}
return $vcalendar->serialize();
}
示例2: processMessageRequest
/**
* Processes incoming REQUEST messages.
*
* This is message from an organizer, and is either a new event
* invite, or an update to an existing one.
*
*
* @param Message $itipMessage
* @param VCalendar $existingObject
* @return VCalendar|null
*/
protected function processMessageRequest(Message $itipMessage, VCalendar $existingObject = null)
{
if (!$existingObject) {
// This is a new invite, and we're just going to copy over
// all the components from the invite.
$existingObject = new VCalendar();
foreach ($itipMessage->message->getComponents() as $component) {
$existingObject->add(clone $component);
}
} else {
// We need to update an existing object with all the new
// information. We can just remove all existing components
// and create new ones.
foreach ($existingObject->getComponents() as $component) {
$existingObject->remove($component);
}
foreach ($itipMessage->message->getComponents() as $component) {
$existingObject->add(clone $component);
}
}
return $existingObject;
}
示例3: testRemoveNotFound
/**
* @expectedException InvalidArgumentException
*/
function testRemoveNotFound()
{
$comp = new VCalendar(array(), false);
$prop = $comp->createProperty('A', 'B');
$comp->remove($prop);
}