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

Events Calendar UpcomingEvents stop at end of the year


Go to End
Reply


9 Posts   1946 Views

Avatar
tmray

Community Member, 7 Posts

23 June 2009 at 6:58am

I have the events calendar all set up and working. On the Calendar section in the cms I have the "Number of events to display on default view" in the configuration tab set to 99 but on the page itself it stops displaying events that are after 2009. Any idea how I can fix this?

P.S. I have the configuration set to 99 so if they add more will display. The ammount on the site right now are only about 10.

Thanks.
Tom

Avatar
UncleCheese

Forum Moderator, 4092 Posts

23 June 2009 at 7:07am

Interesting. Are you using the UpcomingEvents() function or is this in the default view?

Avatar
UncleCheese

Forum Moderator, 4092 Posts

23 June 2009 at 7:26am

It may be that you've encountered one of the logistical limitations of the EventCalendar. Here's the deal..

Events are populated using three different calls to the database: standard events, announcements, and recurring events. After each query, the function dumps the results into this huge array of date objects. The last thing it does before returning it to the template is sort them, and then, if the default view is active, it truncates them down to that number.

We did this because, when the function is not passed an end date, it wouldn't know when to stop adding events. This is especially problematic for recurring events, but it also applies to the other two. If it cut off when it reached the default event display total, then the other queries may never get run even though they have valid upcoming events. So the solution was to allow all of them to add what they want, then sort it all out and cut down the set at the end.

For lack of a better idea for a "forced" end date, we chose 6 months from the start date. Seeing that it's June, six months puts you at the new year, so that all adds up.

What I'm going to do is make the 6 months a global variable that can be configured in your _config.php. Run an update within the next 20 minutes or so, and you'll be able to add

Calendar::set_param('defaultFutureMonths', 12);

Obviously, the higher you make that number, the more processing time you're adding to the controller. Shouldn't be too bad if you don't have many events, though.

The other option for you, if you're using the UpcomingEvents() function is to pass it a third argument for the end date you want.

return $this->UpcomingEvents(
null, // filter
null, // start date, will default to today
"2010-06-01"
);

Avatar
tmray

Community Member, 7 Posts

24 June 2009 at 10:08am

I'm kinda confused. What would I be updating?

I'm using the Event Calendar Module http://silverstripe.org/event-calendar/ btw
Are you saying I would update that?

Avatar
UncleCheese

Forum Moderator, 4092 Posts

24 June 2009 at 10:57am

Oh, I thought you were on SVN. Silverstripe is supposed to build ZIP files every night of the SVN export but I'm not sure how reliable that is. Might just want to switch over to using SVN to get more frequent updates.

Avatar
tmray

Community Member, 7 Posts

24 June 2009 at 4:55pm

I'm still fairly new at Silverstripe so I'm not sure how I would set up an SVN on an existing site.
I'll do some hunting around on the site to see how I could do this.
Unless you might know of a way to make this work with the Events Calendar module I'm already using?

Thanks!

Avatar
tmray

Community Member, 7 Posts

25 June 2009 at 3:30am

I seemed to have found the part that controls this in the code/calander.php file

$this->end_date = new sfDate($this->start_date->addMonth(6)->date());

I changed the addMonth(6) to a different number and that fixed the problem.

.tom

Avatar
UncleCheese

Forum Moderator, 4092 Posts

25 June 2009 at 4:03am

It's not a good idea to modify the core code, though, because when updates come out (quite frequently) you're going to lose your changes. That's why I recommend using the SVN channel to get the module. If Silverstripe doesn't have the lastest version up in the modules section, I can post one later today.

Go to Top