本文整理汇总了PHP中Sabre\VObject\Component\VCalendar类的典型用法代码示例。如果您正苦于以下问题:PHP VCalendar类的具体用法?PHP VCalendar怎么用?PHP VCalendar使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了VCalendar类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: createVObject
/**
* create VObject
* @param string VObject as string
* @return Sabre_VObject or null
*/
private function createVObject($vobject_or_name)
{
if (is_object($vobject_or_name)) {
return $vobject_or_name;
} else {
$vcomponent = null;
switch ($vobject_or_name) {
case 'VCALENDAR':
case 'VTODO':
case 'VEVENT':
case 'VALARM':
case 'VFREEBUSY':
case 'VJOURNAL':
case 'VTIMEZONE':
$vcomponent = new VCalendar();
break;
case 'VCARD':
$vcomponent = new VCard();
break;
default:
$vcomponent = new VCalendar();
break;
}
if ($vcomponent !== null) {
$vobject = $vcomponent->createComponent($vobject_or_name);
return $vobject;
} else {
return null;
}
}
}
示例3: menuIdAction
/**
* @Route("/{id}.ics")
* @Method({"GET"})
*/
public function menuIdAction($id)
{
$api = new ApiController();
$api->setContainer($this->container);
$menu = $api->menuIdAction($id);
if ($menu->getStatusCode() !== 200) {
return new Response('Calendar not found', 404);
}
$json = json_decode($menu->getContent(), true);
$headers = array('Content-Type' => 'text/calendar; charset=utf-8', 'Content-Disposition' => 'attachment; filename="' . $id . '.ics');
$vCalendar = new VCalendar();
foreach ($json['data'] as $event) {
$vEvent = $vCalendar->add('VEVENT');
# Timezone
$timezone = new DateTimeZone('Europe/Paris');
# Start and end
$start = new DateTime();
$start->setTimestamp($event['start']);
$start->setTimezone($timezone);
$end = new DateTime();
$end->setTimestamp($event['end']);
$end->setTimezone($timezone);
$name = implode(', ', $event['meals']);
$description = implode(', ', $event['meals']);
$vEvent->add('UID', uniqid('menu_'));
$vEvent->add('DTSTART', $start);
$vEvent->add('DTEND', $end);
$vEvent->add('SUMMARY', $name);
$vEvent->add('DESCRIPTION', $description);
}
$calendar = $vCalendar->serialize();
return new Response($calendar, 200, $headers);
}
示例4: timeRangeTestData
public function timeRangeTestData()
{
$tests = array();
$calendar = new VCalendar();
$vevent = $calendar->createComponent('VEVENT');
$vevent->DTSTART = '20111223T120000Z';
$tests[] = array($vevent, new \DateTime('2011-01-01'), new \DateTime('2012-01-01'), true);
$tests[] = array($vevent, new \DateTime('2011-01-01'), new \DateTime('2011-11-01'), false);
$vevent2 = clone $vevent;
$vevent2->DTEND = '20111225T120000Z';
$tests[] = array($vevent2, new \DateTime('2011-01-01'), new \DateTime('2012-01-01'), true);
$tests[] = array($vevent2, new \DateTime('2011-01-01'), new \DateTime('2011-11-01'), false);
$vevent3 = clone $vevent;
$vevent3->DURATION = 'P1D';
$tests[] = array($vevent3, new \DateTime('2011-01-01'), new \DateTime('2012-01-01'), true);
$tests[] = array($vevent3, new \DateTime('2011-01-01'), new \DateTime('2011-11-01'), false);
$vevent4 = clone $vevent;
$vevent4->DTSTART = '20111225';
$vevent4->DTSTART['VALUE'] = 'DATE';
$tests[] = array($vevent4, new \DateTime('2011-01-01'), new \DateTime('2012-01-01'), true);
$tests[] = array($vevent4, new \DateTime('2011-01-01'), new \DateTime('2011-11-01'), false);
// Event with no end date should be treated as lasting the entire day.
$tests[] = array($vevent4, new \DateTime('2011-12-25 16:00:00'), new \DateTime('2011-12-25 17:00:00'), true);
// DTEND is non inclusive so all day events should not be returned on the next day.
$tests[] = array($vevent4, new \DateTime('2011-12-26 00:00:00'), new \DateTime('2011-12-26 17:00:00'), false);
// The timezone of timerange in question also needs to be considered.
$tests[] = array($vevent4, new \DateTime('2011-12-26 00:00:00', new \DateTimeZone('Europe/Berlin')), new \DateTime('2011-12-26 17:00:00', new \DateTimeZone('Europe/Berlin')), false);
$vevent5 = clone $vevent;
$vevent5->DURATION = 'P1D';
$vevent5->RRULE = 'FREQ=YEARLY';
$tests[] = array($vevent5, new \DateTime('2011-01-01'), new \DateTime('2012-01-01'), true);
$tests[] = array($vevent5, new \DateTime('2011-01-01'), new \DateTime('2011-11-01'), false);
$tests[] = array($vevent5, new \DateTime('2013-12-01'), new \DateTime('2013-12-31'), true);
$vevent6 = clone $vevent;
$vevent6->DTSTART = '20111225';
$vevent6->DTSTART['VALUE'] = 'DATE';
$vevent6->DTEND = '20111225';
$vevent6->DTEND['VALUE'] = 'DATE';
$tests[] = array($vevent6, new \DateTime('2011-01-01'), new \DateTime('2012-01-01'), true);
$tests[] = array($vevent6, new \DateTime('2011-01-01'), new \DateTime('2011-11-01'), false);
// Added this test to ensure that recurrence rules with no DTEND also
// get checked for the entire day.
$vevent7 = clone $vevent;
$vevent7->DTSTART = '20120101';
$vevent7->DTSTART['VALUE'] = 'DATE';
$vevent7->RRULE = 'FREQ=MONTHLY';
$tests[] = array($vevent7, new \DateTime('2012-02-01 15:00:00'), new \DateTime('2012-02-02'), true);
// The timezone of timerange in question should also be considered.
// Added this test to check recurring events that have no instances.
$vevent8 = clone $vevent;
$vevent8->DTSTART = '20130329T140000';
$vevent8->DTEND = '20130329T153000';
$vevent8->RRULE = array('FREQ' => 'WEEKLY', 'BYDAY' => array('FR'), 'UNTIL' => '20130412T115959Z');
$vevent8->add('EXDATE', '20130405T140000');
$vevent8->add('EXDATE', '20130329T140000');
$tests[] = array($vevent8, new \DateTime('2013-03-01'), new \DateTime('2013-04-01'), false);
return $tests;
}
示例5: testAlarmWayBefore
function testAlarmWayBefore()
{
$vcalendar = new VObject\Component\VCalendar();
$vevent = $vcalendar->createComponent('VEVENT');
$vevent->DTSTART = '20120101T120000Z';
$vevent->UID = 'bla';
$valarm = $vcalendar->createComponent('VALARM');
$valarm->TRIGGER = '-P2W1D';
$vevent->add($valarm);
$vcalendar->add($vevent);
$filter = array('name' => 'VCALENDAR', 'is-not-defined' => false, 'time-range' => null, 'prop-filters' => array(), 'comp-filters' => array(array('name' => 'VEVENT', 'is-not-defined' => false, 'time-range' => null, 'prop-filters' => array(), 'comp-filters' => array(array('name' => 'VALARM', 'is-not-defined' => false, 'prop-filters' => array(), 'comp-filters' => array(), 'time-range' => array('start' => new \DateTime('2011-12-10'), 'end' => new \DateTime('2011-12-20')))))));
$validator = new CalendarQueryValidator();
$this->assertTrue($validator->validate($vcalendar, $filter));
}
示例6: exportAction
/**
* @Route("/schedule/export", name="user_schedule_export")
* @Template()
*/
public function exportAction()
{
if (!$this->getUserLayer()->isStudent()) {
return $this->createAccessDeniedResponse();
}
/** @var $em EntityManager */
$em = $this->getDoctrine()->getManager();
/** @var $courses Course[] */
$courses = $em->getRepository('EtuUserBundle:Course')->findByUser($this->getUser());
$vcalendar = new VCalendar();
$semesterEnd = SemesterManager::current()->getEnd()->format('Ymd\\THis');
foreach ($courses as $course) {
if ($course->getUv() == 'SPJE') {
continue;
}
if ($course->getDay() == Course::DAY_SATHURDAY) {
$day = 'saturday';
} else {
$day = $course->getDay();
}
$day = new \DateTime('last ' . $day);
$start = clone $day;
$time = explode(':', $course->getStart());
$start->setTime($time[0], $time[1]);
$end = clone $day;
$time = explode(':', $course->getEnd());
$end->setTime($time[0], $time[1]);
$summary = $course->getWeek() != 'T' ? $course->getUv() . ' (' . $course->getWeek() . ')' : $course->getUv();
$vcalendar->add('VEVENT', ['SUMMARY' => $summary . ' - ' . $course->getType(), 'DTSTART' => $start, 'DTEND' => $end, 'RRULE' => 'FREQ=WEEKLY;INTERVAL=1;UNTIL=' . $semesterEnd, 'LOCATION' => $course->getRoom(), 'CATEGORIES' => $course->getType()]);
}
$response = new Response($vcalendar->serialize());
$response->headers->set('Content-Type', 'text/calendar; charset=utf-8');
$response->headers->set('Content-Disposition', 'attachment; filename="etuutt_schedule.ics"');
return $response;
}
示例7: timeRangeTestData
public function timeRangeTestData()
{
$tests = array();
$calendar = new VCalendar();
$vevent = $calendar->createComponent('VEVENT');
$vevent->DTSTART = '20111223T120000Z';
$tests[] = array($vevent, new \DateTime('2011-01-01'), new \DateTime('2012-01-01'), true);
$tests[] = array($vevent, new \DateTime('2011-01-01'), new \DateTime('2011-11-01'), false);
$vevent2 = clone $vevent;
$vevent2->DTEND = '20111225T120000Z';
$tests[] = array($vevent2, new \DateTime('2011-01-01'), new \DateTime('2012-01-01'), true);
$tests[] = array($vevent2, new \DateTime('2011-01-01'), new \DateTime('2011-11-01'), false);
$vevent3 = clone $vevent;
$vevent3->DURATION = 'P1D';
$tests[] = array($vevent3, new \DateTime('2011-01-01'), new \DateTime('2012-01-01'), true);
$tests[] = array($vevent3, new \DateTime('2011-01-01'), new \DateTime('2011-11-01'), false);
$vevent4 = clone $vevent;
$vevent4->DTSTART = '20111225';
$vevent4->DTSTART['VALUE'] = 'DATE';
$tests[] = array($vevent4, new \DateTime('2011-01-01'), new \DateTime('2012-01-01'), true);
$tests[] = array($vevent4, new \DateTime('2011-01-01'), new \DateTime('2011-11-01'), false);
// Event with no end date should be treated as lasting the entire day.
$tests[] = array($vevent4, new \DateTime('2011-12-25 16:00:00'), new \DateTime('2011-12-25 17:00:00'), true);
$vevent5 = clone $vevent;
$vevent5->DURATION = 'P1D';
$vevent5->RRULE = 'FREQ=YEARLY';
$tests[] = array($vevent5, new \DateTime('2011-01-01'), new \DateTime('2012-01-01'), true);
$tests[] = array($vevent5, new \DateTime('2011-01-01'), new \DateTime('2011-11-01'), false);
$tests[] = array($vevent5, new \DateTime('2013-12-01'), new \DateTime('2013-12-31'), true);
$vevent6 = clone $vevent;
$vevent6->DTSTART = '20111225';
$vevent6->DTSTART['VALUE'] = 'DATE';
$vevent6->DTEND = '20111225';
$vevent6->DTEND['VALUE'] = 'DATE';
$tests[] = array($vevent6, new \DateTime('2011-01-01'), new \DateTime('2012-01-01'), true);
$tests[] = array($vevent6, new \DateTime('2011-01-01'), new \DateTime('2011-11-01'), false);
// Added this test to ensure that recurrence rules with no DTEND also
// get checked for the entire day.
$vevent7 = clone $vevent;
$vevent7->DTSTART = '20120101';
$vevent7->DTSTART['VALUE'] = 'DATE';
$vevent7->RRULE = 'FREQ=MONTHLY';
$tests[] = array($vevent7, new \DateTime('2012-02-01 15:00:00'), new \DateTime('2012-02-02'), true);
return $tests;
}
示例8: timeRangeTestData
public function timeRangeTestData()
{
$calendar = new VCalendar();
$tests = array();
$vjournal = $calendar->createComponent('VJOURNAL');
$vjournal->DTSTART = '20111223T120000Z';
$tests[] = array($vjournal, new \DateTime('2011-01-01'), new \DateTime('2012-01-01'), true);
$tests[] = array($vjournal, new \DateTime('2011-01-01'), new \DateTime('2011-11-01'), false);
$vjournal2 = $calendar->createComponent('VJOURNAL');
$vjournal2->DTSTART = '20111223';
$vjournal2->DTSTART['VALUE'] = 'DATE';
$tests[] = array($vjournal2, new \DateTime('2011-01-01'), new \DateTime('2012-01-01'), true);
$tests[] = array($vjournal2, new \DateTime('2011-01-01'), new \DateTime('2011-11-01'), false);
$vjournal3 = $calendar->createComponent('VJOURNAL');
$tests[] = array($vjournal3, new \DateTime('2011-01-01'), new \DateTime('2012-01-01'), false);
$tests[] = array($vjournal3, new \DateTime('2011-01-01'), new \DateTime('2011-11-01'), false);
return $tests;
}
示例9: render
/**
*
* @param Response $response
* @param array $data
* @param int $status
*
* @return ResponseInterface
*/
public function render(ResponseInterface $response, array $data = [], $status = 200)
{
$icalendar = new VCalendar();
foreach ($data['cfps'] as $cfp) {
$cfpStart = new \DateTime($cfp['dateCfpStart']);
$cfpEnd = new \DateTime($cfp['dateCfpEnd']);
$lastChange = new \DateTime($cfp['lastChange']);
$lastChange->setTimezone(new \DateTimeZone('UTC'));
if ($cfp['timezone']) {
$cfpStart->setTimezone(new \DateTimeZone($cfp['timezone']));
$cfpEnd->setTimezone(new \DateTimeZone($cfp['timezone']));
}
$icalendar->add('VEVENT', ['SUMMARY' => $cfp['name'], 'DTSTART' => $cfpStart, 'DTEND' => $cfpEnd, 'URL' => $cfp['uri'], 'DTSTAMP' => $lastChange, 'UID' => $cfp['_rel']['cfp_uri'], 'DESCRIPTION' => $cfp['description'], 'GEO' => round($cfp['latitude'], 6) . ';' . round($cfp['longitude'], 6), 'LOCATION' => $cfp['location']]);
}
$response = $response->withHeader('Content-Type', 'text/calendar');
$stream = $response->getBody();
$stream->write($icalendar->serialize());
return $response->withBody($stream);
}
示例10: listAction
public function listAction()
{
$em = $this->getServiceLocator()->get('doctrine.entitymanager.orm_default');
$result = $em->getRepository('Phpug\\Entity\\Cache')->findBy(array('type' => 'event'));
$calendar = new VObject\Component\VCalendar();
$affectedUGs = $this->findGroupsWithinRangeAndDistance();
foreach ($result as $cal) {
if (!$cal->getGRoup()) {
continue;
}
if ($affectedUGs && !in_array($cal->getGroup()->getShortname(), $affectedUGs)) {
continue;
}
try {
$ical = VObject\Reader::read($cal->getCache());
foreach ($ical->children as $event) {
if (!$event instanceof VObject\Component\VEvent) {
continue;
}
$result = $event->validate(VObject\Node::REPAIR);
if ($result) {
error_log(print_r($result, true));
continue;
}
$event->SUMMARY = '[' . $cal->getGroup()->getName() . '] ' . $event->SUMMARY;
$calendar->add($event);
}
} catch (\Exception $e) {
}
}
$viewModel = $this->getViewModel();
if ($viewModel instanceof ViewModel) {
$viewModel->setVariable('location', $this->params()->fromQuery('latitude', 0) . ' ' . $this->params()->fromQuery('longitude', 0));
$viewModel->setVariable('latitude', $this->params()->fromQuery('latitude', 0));
$viewModel->setVariable('longitude', $this->params()->fromQuery('longitude', 0));
$viewModel->setVariable('distance', $this->params()->fromQuery('distance', 100));
}
return $viewModel->setVariable('calendar', new \Phpug\Wrapper\SabreVCalendarWrapper($calendar));
}
示例11: renderEvent
/**
* Render an event as vevent
* @param VCalendar $vcalendar
* @param Event $event
* @param Place $place
*/
private function renderEvent(VCalendar $vcalendar, Event $event, Place $place = null)
{
$vevent = $vcalendar->add('VEVENT', [], false);
$this->addDate($event, $vevent, 'DTSTART', $event->getStart());
$this->addDate($event, $vevent, 'DTEND', $event->getEnd());
$properties = [];
$properties['DTSTAMP'] = ['type' => 'DATE-TIME', 'value' => Utility::getNow()];
$properties['UID'] = ['type' => 'UNKNOWN', 'value' => $event->getUid()];
$properties['DESCRIPTION'] = ['type' => 'UNKNOWN', 'value' => $event->getDescription()];
$properties['SUMMARY'] = ['type' => 'UNKNOWN', 'value' => $event->getName()];
if ($place) {
$properties['LOCATION'] = ['type' => 'UNKNOWN', 'value' => $place->getName()];
$properties['GEO'] = ['type' => 'UNKNOWN', 'value' => $place->getLocation()->getLatitude() . ';' . $place->getLocation()->getLongitude()];
}
$allProperties = array_merge($properties, $event->getExtra());
foreach ($allProperties as $key => $val) {
$prop = $vevent->add($key, $val['value']);
if ($val['type'] === 'DATE') {
$prop['VALUE'] = $val['type'];
}
}
}
示例12: importEvents
private function importEvents(Calendar $calendar, VCalendar $document)
{
// Prepare by deleting all existing events
foreach ($calendar->getEvents() as $event) {
$this->getEntityManager()->remove($event);
}
$calendar->getEvents()->clear();
// Abort if there is no events at all
if (!$document->VEVENT) {
return;
}
// First, import only originals, because we want to save RRULE before it is destroyed when expanding
$originals = [];
foreach ($document->VEVENT as $vevent) {
if (!$vevent->__get('RECURRENCE-ID')) {
$event = $this->importEvent($calendar, $vevent);
$originals[$event->getUid()] = $event;
}
}
// Expand repetitions 2 month in the past and 1 year in the future
$now = Utility::getNow();
$start = $now->sub(new \DateInterval('P2M'));
$end = $now->add(new \DateInterval('P1Y'));
// Then we expand recurent rules
$expandedDocument = $document->expand($start, $end);
// Abort if there is no repetitions at all
if (!$expandedDocument->VEVENT) {
return;
}
// Finally re-import, but this time only the recurrent things
foreach ($expandedDocument->VEVENT as $vevent) {
$original = $this->findOriginal($originals, $vevent);
if ($original) {
$repetition = $this->importEvent($calendar, $vevent);
$repetition->setOriginal($original);
}
}
}
示例13: fire
public function fire($job, $data)
{
// Get the staff member
$staff = StaffModel::find($data['staff']);
// Set the calendar we're using
$calendarName = str_replace(' ', '', $staff->user->name) . '.ics';
// Get the calendar
$calendar = new VCalendar();
// Get a subset of the staff member's appointments
$series = $staff->appointments->filter(function ($a) {
// Get 14 days prior
$targetDate = Date::now()->subDays(14)->startOfDay();
return $a->start >= $targetDate;
});
foreach ($series as $a) {
// Create a new event
$event = [];
// Set the summary
$event['SUMMARY'] = $a->service->isLesson() ? "{$a->userAppointments->first()->user->name} ({$a->service->name})" : $a->service->name;
// Set the start time and end time
$event['DTSTART'] = $a->start;
$event['DTEND'] = $a->end;
if ($a->location) {
$event['LOCATION'] = $a->location->present()->name;
}
if (!empty($a->notes)) {
$event['DESCRIPTION'] = $a->notes;
}
// Add the event to the calendar
$calendar->add('VEVENT', $event);
}
// Write the new output to the file
File::put(App::make('path.public') . "/calendars/{$calendarName}", $calendar->serialize());
// Delete the job from the queue
$job->delete();
}
示例14: generateICS
/**
* Merges all calendar objects, and builds one big ics export
*
* @param array $nodes
* @return string
*/
public function generateICS(array $nodes)
{
$calendar = new VObject\Component\VCalendar();
$calendar->version = '2.0';
if (DAV\Server::$exposeVersion) {
$calendar->prodid = '-//SabreDAV//SabreDAV ' . DAV\Version::VERSION . '//EN';
} else {
$calendar->prodid = '-//SabreDAV//SabreDAV//EN';
}
$calendar->calscale = 'GREGORIAN';
$collectedTimezones = array();
$timezones = array();
$objects = array();
foreach ($nodes as $node) {
if (!isset($node[200]['{' . Plugin::NS_CALDAV . '}calendar-data'])) {
continue;
}
$nodeData = $node[200]['{' . Plugin::NS_CALDAV . '}calendar-data'];
$nodeComp = VObject\Reader::read($nodeData);
foreach ($nodeComp->children() as $child) {
switch ($child->name) {
case 'VEVENT':
case 'VTODO':
case 'VJOURNAL':
$objects[] = $child;
break;
// VTIMEZONE is special, because we need to filter out the duplicates
// VTIMEZONE is special, because we need to filter out the duplicates
case 'VTIMEZONE':
// Naively just checking tzid.
if (in_array((string) $child->TZID, $collectedTimezones)) {
continue;
}
$timezones[] = $child;
$collectedTimezones[] = $child->TZID;
break;
}
}
}
foreach ($timezones as $tz) {
$calendar->add($tz);
}
foreach ($objects as $obj) {
$calendar->add($obj);
}
return $calendar->serialize();
}
示例15: timeRangeTestData
public function timeRangeTestData()
{
$tests = array();
$calendar = new VCalendar();
$vtodo = $calendar->createComponent('VTODO');
$vtodo->DTSTART = '20111223T120000Z';
$tests[] = array($vtodo, new \DateTime('2011-01-01'), new \DateTime('2012-01-01'), true);
$tests[] = array($vtodo, new \DateTime('2011-01-01'), new \DateTime('2011-11-01'), false);
$vtodo2 = clone $vtodo;
$vtodo2->DURATION = 'P1D';
$tests[] = array($vtodo2, new \DateTime('2011-01-01'), new \DateTime('2012-01-01'), true);
$tests[] = array($vtodo2, new \DateTime('2011-01-01'), new \DateTime('2011-11-01'), false);
$vtodo3 = clone $vtodo;
$vtodo3->DUE = '20111225';
$tests[] = array($vtodo3, new \DateTime('2011-01-01'), new \DateTime('2012-01-01'), true);
$tests[] = array($vtodo3, new \DateTime('2011-01-01'), new \DateTime('2011-11-01'), false);
$vtodo4 = $calendar->createComponent('VTODO');
$vtodo4->DUE = '20111225';
$tests[] = array($vtodo4, new \DateTime('2011-01-01'), new \DateTime('2012-01-01'), true);
$tests[] = array($vtodo4, new \DateTime('2011-01-01'), new \DateTime('2011-11-01'), false);
$vtodo5 = $calendar->createComponent('VTODO');
$vtodo5->COMPLETED = '20111225';
$tests[] = array($vtodo5, new \DateTime('2011-01-01'), new \DateTime('2012-01-01'), true);
$tests[] = array($vtodo5, new \DateTime('2011-01-01'), new \DateTime('2011-11-01'), false);
$vtodo6 = $calendar->createComponent('VTODO');
$vtodo6->CREATED = '20111225';
$tests[] = array($vtodo6, new \DateTime('2011-01-01'), new \DateTime('2012-01-01'), true);
$tests[] = array($vtodo6, new \DateTime('2011-01-01'), new \DateTime('2011-11-01'), false);
$vtodo7 = $calendar->createComponent('VTODO');
$vtodo7->CREATED = '20111225';
$vtodo7->COMPLETED = '20111226';
$tests[] = array($vtodo7, new \DateTime('2011-01-01'), new \DateTime('2012-01-01'), true);
$tests[] = array($vtodo7, new \DateTime('2011-01-01'), new \DateTime('2011-11-01'), false);
$vtodo7 = $calendar->createComponent('VTODO');
$tests[] = array($vtodo7, new \DateTime('2011-01-01'), new \DateTime('2012-01-01'), true);
$tests[] = array($vtodo7, new \DateTime('2011-01-01'), new \DateTime('2011-11-01'), true);
return $tests;
}