Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

All other Modules /

Discuss all other Modules here.

Moderators: martimiz, Sean, biapar, Willr, Ingo, swaiba, simon_w

Event module: want to see "other dates" for repeating events


Reply


3 Posts   919 Views

Avatar
dfondente

Community Member, 15 Posts

29 July 2009 at 1:58pm

When viewing upcoming events on the calendar, events that have more than one date / time assigned to them show an "other dates" notice listing the other dates for the event. I would like to have this same functionality for events that are assigned a single date/time but are configured as repeating events.

I looked in CalendarDateTime.php to locate the method that returns the values used in the default calendar template:

   public function OtherDates()
   {
      if($this->Announcement())
         return false;
      
      if($this->Event()->Recursion == 1) {
         
         return $this->Event()->Parent()->getNextRecurringEvents($this->Event(), $this);
      }
         
      return DataObject::get(
         get_class($this),
         "EventID = {$this->EventID} AND StartDate != '{$this->StartDate}'",
         "StartDate ASC",
         "",
         $this->Event()->Calendar()->DefaultEventDisplay
      );
   }

The first chunk is clear: if it's an "announcement" don't return anything.
The third chunk also works: if this is not a "repeating event", retrieve any DateTime objects for this Event that do not have the same StartDate.

The second chunk is what puzzles me. It appears to me without digging deeper into the code that this would return something similar to the third chunk, but for repeating events. But that isn't what it returns. It returns an object that is not empty, but doesn't seem to have anything useful in it (no event information).

Can anyone explain what is supposed to happen for repeating events? Are they supposed to return "other dates" just like non-repeating events that have multiple dates/times manually configured? Or is it purposely returning something else?

Avatar
UncleCheese

Forum Moderator, 4092 Posts

29 July 2009 at 2:25pm

Hmm... Never had a problem with this working. It should return a DOS of DateTime objects. Make sure you have your repeating event count set to a good value on your Configruation tab.

Avatar
dfondente

Community Member, 15 Posts

29 July 2009 at 2:38pm

Screenshot shows the configuration of the calendar. One thought: I have subclassed Calendar, CalendarEvent, and CalendarDateTime. Could that be a problem?

Attached Files