yohang/CalendR

Multi-day Events

spib opened this issue · 2 comments

spib commented

Hi,

How do you show multi-day events on a calendar? The following piece of code correctly shows events which start on a particular date, but it doesn't show events which span multiple days. I'm using the Indexed Event Collection.

<?php foreach ($eventCollection->find($day) as $event): ?>
    <li><?= $event ?></li>
<?php endforeach ?>

Thanks

GDmac commented

Take a look at the find() method of the indexed collection and of basic collection. Indexed Collection only stores and finds events in an array with keys derived from eventBegin. The basic collection actually has some logic in its find() method to lookup period->containsEvent() or event->contains(date) etc.

So, your $eventCollection->find($day) only finds events under its array this->events[$day].

  1. How are you creating/retrieving your collection?
  2. You can supply your provider to Calendar and getEvents() to retrieve a basic collection
  3. Or you can retrieve an array from your own provider
$collection = $calendar->getEvents($period);
// or
$array = $provider->getEvents($DateTimeStart, $DateTimeEnd);
spib commented

Thanks, this is an old issue and I'm no longer using this module so the issue can be closed