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

Bring event details into LiveCalendarEvent widget


Reply


5 Posts   991 Views

Avatar
sca123

Community Member, 61 Posts

14 April 2010 at 3:34am

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

Avatar
UncleCheese

Forum Moderator, 4096 Posts

14 April 2010 at 5:02am

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.

Avatar
sca123

Community Member, 61 Posts

14 April 2010 at 5:34am

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

Avatar
potion_maker

Community Member, 36 Posts

6 August 2010 at 9:31am

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

Avatar
potion_maker

Community Member, 36 Posts

17 August 2010 at 8:39am

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.