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

Event Calendar wish: LiveCalendarWidget for specific events


Reply


1065 Views

Avatar
Juanitou

Community Member, 323 Posts

3 November 2009 at 5:22am

Hi!

With my limited PHP knowledge, I’m trying to modify LiveCalendarWidget for it to show only the dates associated with an specific event. If I’m not missing something, this is not possible for the time being, at least not without assigning a different Calendar to every CalendarEvent. I’m surprised nobody asked for it before… :)

I extended CalendarEvent and added to the new controller a Widget function without the reference to the Parent (the Calendar) in the constructor:

class ActivityPage_Controller extends CalendarEvent_Controller {

   protected function Widget($type) {
      if($date = CalendarUtil::getDateFromURL())
         $date_obj = new sfDate($date);
      elseif($date = DataObject::get_one($this->getDateTimeClass(),"EventID = {$this->ID}", "StartDate ASC"))
         $date_obj = new sfDate($date->StartDate);
      else
         return false;

      // $this->Parent() for obtaining all ActivityHolder events (ActivityPage)
      //return new $type($this->Parent(),$date_obj,$date_obj);
      return new $type($this,$date_obj,$date_obj);
   }

   public function LiveCalendarWidget() {
      return $this->Widget('LiveCalendarWidget');
   }

}

That does not work before Events(), getStandardEvents() , getEventDateTimeClass()… and other functions from several classes of the module are included in ActivityPage, with some modifications. Finally, I can get the widget to show the events of the first month, but the functions for navigating through months don’t work. Argh!

Well, what can we expect of those methods ripping to pieces UncleCheese work (a price for the ugliest hack ever?).

Please vote for this wish: LiveCalendarWidget should show specific events, at least in CalendarEvent pages.

Best regards,
Juan