Jump to:

10848 Posts in 2516 Topics by 1792 members

All other Modules

SilverStripe Forums » All other Modules » Pre-loading Calendar Events

Discuss all other Modules here.

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

Page: 1
Go to End
Author Topic: 866 Views
  • sav_ss
    Avatar
    Community Member
    11 Posts

    Pre-loading Calendar Events Link to this post

    Would there be a way of scheduling events so that they dont appear on the website until after a specified date?

    Thanks.

  • sav_ss
    Avatar
    Community Member
    11 Posts

    Re: Pre-loading Calendar Events Link to this post

    Sorry about asking for too much up front :\

    I updated the CalendarEventClass

    class CalendarEvent extends Page
    {
       static $db = array (
          ...
          'ActivationDate' => 'Date'
       );
    }

    I'm having problems finding out what the syntax would be to compare this field with the current date. I've narrowed it down to modifying Calendar.ss about here

    ...
    <% if Events %>
       <div id="events">
          <% control Events %>

    I thought of encapsulating the remainder of the control block into something like

    <% if $ActivationDate < time() %>
    ...
    <% end_if %>

    It doesn't work. heh.
    Can anyone tell me the correct syntax please?

  • sav_ss
    Avatar
    Community Member
    11 Posts

    Re: Pre-loading Calendar Events Link to this post

    Still trying to understand this code ...

    In the file Calendar.php there's protected members $start_date and $end_date that appear global to the class. There's also a function 'Events' which the template file is 'control'-ing to display the list of event on the website. The function 'Events' takes a bunch of arguments, including the variables $start_date and $end_date. Why is that ? Are these new $start_date and $end_date variables?
    Shouldn't the function 'Events' naturally have access to these variables ?

    Regards,

  • sav_ss
    Avatar
    Community Member
    11 Posts

    Re: Pre-loading Calendar Events Link to this post

    Well, I've given up trying to accomplish the date activation that way.
    Does anyone (apart from unclechee$e) know how to add another date to the Dates and Times tab of the CMS?

    Regards,

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