Jump to:

10929 Posts in 2613 Topics by 1809 members

All other Modules

SilverStripe Forums » All other Modules » Events Calendar UpcomingEvents stop at end of the year

Discuss all other Modules here.

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

Page: 1 2
Go to End
Author Topic: 1863 Views
  • tmray
    Avatar
    Community Member
    7 Posts

    Events Calendar UpcomingEvents stop at end of the year Link to this post

    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

  • UncleCheese
    Avatar
    4085 Posts

    Re: Events Calendar UpcomingEvents stop at end of the year Link to this post

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

  • UncleCheese
    Avatar
    4085 Posts

    Re: Events Calendar UpcomingEvents stop at end of the year Link to this post

    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"
    );

  • tmray
    Avatar
    Community Member
    7 Posts

    Re: Events Calendar UpcomingEvents stop at end of the year Link to this post

    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?

  • UncleCheese
    Avatar
    4085 Posts

    Re: Events Calendar UpcomingEvents stop at end of the year Link to this post

    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.

  • tmray
    Avatar
    Community Member
    7 Posts

    Re: Events Calendar UpcomingEvents stop at end of the year Link to this post

    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!

  • tmray
    Avatar
    Community Member
    7 Posts

    Re: Events Calendar UpcomingEvents stop at end of the year Link to this post

    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

  • UncleCheese
    Avatar
    4085 Posts

    Re: Events Calendar UpcomingEvents stop at end of the year Link to this post

    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.

    1863 Views
Page: 1 2
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.