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

EventCalendar and announcements


Go to End
Reply

40 Posts   4711 Views

Avatar
alexanm

6 July 2009 at 3:40am Community Member, 38 Posts

Hello guys,

I have created my own descendant of the EventCalendar, as it is described in the exdenting recipe. Now I have the problem, that I'd like to have my created DateTime class also for the announcement. Is this possible?

TIA
Markus Alexander

Avatar
UncleCheese

6 July 2009 at 11:54am 4085 Posts

Yes. You can use the extendAnnouncement() function in your custom DateTime class. Just add your fields to the $db array like normal, then write the function:

public function extendAnnouncement()
{
$this->addAnnouncementField(new TextField('Foo'));
// etc...

}

Avatar
alexanm

6 July 2009 at 11:42pm (Last edited: 7 July 2009 1:16am), Community Member, 38 Posts

Hello Uncle Cheese,

thank you for your answer, this works perfect. Ma next Problem ist that I have subclassed the CalendarDateTime class, in order to get my own fields in there. This CalendarDateTime class also has a Category field, which I would like to have in the filter. So I have added the field to the filter in the Holder class:

$fields->addFilterField(new DropdownField('LineDanceDateTime_Category', 'Kategorie', singleton('LineDanceDateTime')->dbObject('Category')->enumValues()));

The filter now shows up correctly, but the problem is when I apply the filter, the resulting sql command tries to load from the table LineDanceDateTime_Live and this does not exist.

Any ideas?

And last but not least: Is it possible to get a detail page for announcements too? The Problem ist, that I think its really unhandy to create an event for each appointment I have. I think these are only good for recurring events. But I have about 10 to 20 "announcements" per month, which only need a start date and an end date. But I'd really like to have a detail page....
Is this possible somehow?

TIA
Markus Alexander

Avatar
UncleCheese

7 July 2009 at 1:40am 4085 Posts

The CalendarDateTime class does not have a Category field. I'm not sure where you're seeing that. All you should need is

$fields->addFilterField(new DropdownField('Category', 'Kategorie', singleton('LineDanceDateTime')->dbObject('Category')->enumValues()));

As for the announcements, they were created because a lot of people said it was unnecessary to have a page for every event, and it would be nice to have both options. So to now give announcements a detail page seems a little counter-intuitive, but I suppose it could be done.

Avatar
alexanm

7 July 2009 at 1:45am Community Member, 38 Posts

Hello Uncle Cheese,

sorry that was a typo: I have created the category field on my descendant 'LineDanceDateTime'. I have added the filter field as described below, but the resulting sql command tries to filter on the table 'LineDanceDateTime_Live' but this table does not exist, as the CalendarDateTime is descending from DataObject and not SiteTree...

Regarding the detail page: The main thing I'd like to have a detail page for the Announcements is, that I'll provide each event with geo coordinates, and would like to show a map of the destination on the detail page.

But I think I can also create the events as well.

Thanks
Markus Alexander

Avatar
UncleCheese

7 July 2009 at 1:56am 4085 Posts

Interesting. It seems there is a flaw in the filtering mechanism for the Calendar in that it isn't built to handle custom filtering for a DateTime object -- only Events. I'll put that on my list for today.

Avatar
alexanm

7 July 2009 at 2:07am Community Member, 38 Posts

Hello Uncle Cheese,

thanks for your fast replies.

Two more questions: Is the newest version of your module also compatible with silverstripe 2.3.1? I tried to migrate my test enviroment to version 2.3.2 yesterday, but that didn't really work...

Is there already an additional support for international Date and Time Formats? Because I had to change several things in your module in order to be able to get german month names and so on...

Thanks
Markus Alexander

Avatar
UncleCheese

7 July 2009 at 2:35am 4085 Posts

No. I believe 2.3.2 is required.

We've added a great date templating system to support any date format. You should not be altering the code. Have a look in your event_calendar/_config.php. Also, by default, the module will fall back on the date formatting specified in your lang file. I believe we have one set up for de_DE.

Go to Top