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

Has anyone successfully extended Event Calendar Module v. 3?


Reply


327 Views

Avatar
cmc

Community Member, 23 Posts

2 May 2013 at 10:41am

Edited: 02/05/2013 10:42am

I'm trying to extend the Event Calendar module for registerable events. It's sort of working. Everything seems ok in the CMS and I can access the extended events using "Preview" from the CMS.

However, none of the extended events show up in the calendar or upcoming events lists. It seems like this is due to a couple issues:

1) getStandardEvents() in the Calendar class uses this query -

DB::query("SELECT ID FROM SiteTree_Live WHERE ClassName = 'CalendarEvent' AND ParentID = $this->ID");

ClassName='CalendarEvent' excludes extended events so I've tried using -

DB::query("SELECT ID FROM SiteTree_Live WHERE ParentID = $this->ID");

Should I make this change with a DataExtension instead of modify the Calendar class?

2) EventID isn't being inserted into the CalendarDateTime table for extended CalendarDateTime. If I insert the EventID manually and use the modified query above the extended events are shown in the EventList.

Any ideas on how to get the EventID to be inserted into the CalendarDateTime when the new DateTime is added?

Here are snippets from my subclasses -

class MyEvent extends CalendarEvent {
   
   public static $db = array(
      'MinAge'            => 'Int',
      'MaxAge'            => 'Int',
   );

   public static $has_many = array (
      'DateTimes' => 'MyEventSession', //doesn't work at all unless the key is 'DateTimes'
   );
   
......

class MyEventSession extends CalendarDateTime {

public static $db = array(
'SessionName' => 'Text',
'LastDayToRegister' => 'Date',
'Price' => 'Int',
   'Capacity'    => 'Int',
);

public static $has_one = array(
'SpecialEvent' => 'MyEvent', //this doesn't work if key is 'Event'
);
......