Jump to:

10990 Posts in 2727 Topics by 1818 members

All other Modules

SilverStripe Forums » All other Modules » Bring event details into LiveCalendarEvent widget

Discuss all other Modules here.

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

Page: 1
Go to End
Author Topic: 943 Views
  • sca123
    Avatar
    Community Member
    61 Posts

    Bring event details into LiveCalendarEvent widget Link to this post

    Hi
    I am customising the LiveCalendarEvent widget so that when a user clicks on a valid date a lightwindow appears showing the event title and description.

    I am also only using the "Announcements" part of the Events Calendar module, as this suits the site better.

    What I need to know is how I pull in the announcement title and announcement content into the widget?

    Thanks
    Samuel

  • UncleCheese
    Avatar
    4085 Posts

    Re: Bring event details into LiveCalendarEvent widget Link to this post

    Tricky. Here's the problem. The calendar is setup to accept multiple events on a given day. As such, the LiveCalendarWidget is not technically "event aware" in the sense that you could pull an associated event from a specific day. All it knows is that it has at least one event, and the click takes you to the calendar view for that day, which again, may contain one or 100 events.

    Your model is asking the calendar to assume that there is only one event per day, as I understand it.

    It would take some clever re-engineering. Not hacking, but subclassing and template overrides. Should be relatively easy if you're good with code.

    Start by subclassing LiveCalendarWidget, and overload the getWeeks() method.

    $weeks = parent::getWeeks();
    foreach($weeks->Days as $d) {
    $date = $this->start_date->format('Y') . "-" . $this->start_date->format('m') . "-" . $d->Number;
    $d->Event = DataObject::get_one("CalendarDateTime", "StartDate = '$date'");
    }

    Then, override the template in your theme dir, and in the <% control Days %> function, you should be able to get to the associated event with $Event.

    You'll need to run an update because none of the LiveCalendarWidget vars are subclassable right now, and I just changed that.

  • sca123
    Avatar
    Community Member
    61 Posts

    Re: Bring event details into LiveCalendarEvent widget Link to this post

    Hi UncleCheese and thank you for your reply.
    Would it make it any easier to show all events in the pop-up, thus allowing for multiple events on one day.

    For example, the output would be:

    DATE

    Title
    Description

    Title
    Description

    etc...

    Thanks in advance

  • potion_maker
    Avatar
    Community Member
    36 Posts

    Re: Bring event details into LiveCalendarEvent widget Link to this post

    Hey Sca,
    Did you ever get any further with this stuff? I too was looking at customizing the widget to be more similar to a google calendar. Larger, displaying event info in a days given box, etc. . .

  • potion_maker
    Avatar
    Community Member
    36 Posts

    Re: Bring event details into LiveCalendarEvent widget Link to this post

    Could you expand or spell this out a little more for me please. I'm still having a hard time bringing info into the widget. Thanks.

    943 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.