Jump to:

10931 Posts in 2614 Topics by 1810 members

All other Modules

SilverStripe Forums » All other Modules » Event module: want to see "other dates" for repeating events

Discuss all other Modules here.

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

Page: 1
Go to End
Author Topic: 882 Views
  • dfondente
    Avatar
    Community Member
    15 Posts

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

    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?

  • UncleCheese
    Avatar
    4085 Posts

    Re: Event module: want to see "other dates" for repeating events Link to this post

    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.

  • dfondente
    Avatar
    Community Member
    15 Posts

    Re: Event module: want to see "other dates" for repeating events Link to this post

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

    Attached Files
    882 Views
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.