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.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

All other Modules /

Discuss all other Modules here.

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

EventCalendar and announcements


Go to End


40 Posts   8725 Views

Avatar
alexanm

Community Member, 38 Posts

6 July 2009 at 3:40am

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

Forum Moderator, 4102 Posts

6 July 2009 at 11:54am

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

Community Member, 38 Posts

6 July 2009 at 11:42pm

Edited: 07/07/2009 1:16am

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

Forum Moderator, 4102 Posts

7 July 2009 at 1:40am

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

Community Member, 38 Posts

7 July 2009 at 1:45am

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

Forum Moderator, 4102 Posts

7 July 2009 at 1:56am

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

Community Member, 38 Posts

7 July 2009 at 2:07am

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

Forum Moderator, 4102 Posts

7 July 2009 at 2:35am

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