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.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

All other Modules /

Discuss all other Modules here.

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

Preview: Event Calendar Module


Go to End


293 Posts   69202 Views

Avatar
UncleCheese

Forum Moderator, 4102 Posts

5 February 2009 at 2:00pm

Sounds to me like something really simple is missing. Could you provide one, some, or all of the following?

- The website
- The code
- A temporary login to your CMS

Avatar
Chucky2k

Community Member, 32 Posts

5 February 2009 at 2:52pm

Edited: 25/02/2009 1:06pm

Thanks UncleCheese, Detail are:

Website: www.supportact.com.au/ss/

Code: SalEvent.php

<?php

class SalEvent extends CalendarEvent
{
  static $db = array (
   'Location' => 'Varchar(100)',
   'Cost' => 'Varchar(50)',
   'RegistrationLink' => 'Varchar(100)'
  );
 
  static $has_one = array (
   'Image' => 'Image'
  );

  public function getCMSFields()
  {
   $f = parent::getCMSFields();
   $f->addFieldToTab("Root.Content.Main", new TextField('Location'), 'Content');
   $f->addFieldToTab("Root.Content.Main", new TextField('Cost'), 'Content');
   $f->addFieldToTab("Root.Content.Main", new TextField('RegistrationLink','Registration Link'),'Content');
   $f->addFieldToTab("Root.Content.Image", new ImageField('Image'));
 
   return $f;
 }
} // end SalEvent subclass 

class SalEvent_Controller extends CalendarEvent_Controller
 {
 }

?>

SalEventHolder.php

<?php

class SalEventHolder extends Calendar
{
	static $has_many = array (
	'SalEvents' => 'SalEvent'
	);

	static $allowed_children = array (
	'SalEvent'
	);
} 

class SalEventHolder_Controller extends Calendar_Controller
{
}

?>

Thanks again

Avatar
UncleCheese

Forum Moderator, 4102 Posts

5 February 2009 at 3:14pm

Sigh.. This is a bug with the CollapseDatesAndTimes function which I've tried so hard to make work, but it looks like it's still not there. You probably wont' need the function, so just take it out.

Calendar.php, Line 245

Change this:

		if($events = $this->getStandardEvents($filter))
			$event_list = CalendarUtil::CollapseDatesAndTimes($this->getStandardEvents($filter));

to this:

		if($events = $this->getStandardEvents($filter))
			$event_list = $events;

That should fix it. Keep my tempuser account active in case it doesn't. :)

Avatar
Chucky2k

Community Member, 32 Posts

5 February 2009 at 3:34pm

That worked perfectly.

Many thanks. :)

Avatar
George

Community Member, 41 Posts

6 February 2009 at 1:23am

Is it possible and how to extend the Announcements (for example with locations)
like it is described for Dates and Times with WorkshopDateTime?

Avatar
UncleCheese

Forum Moderator, 4102 Posts

6 February 2009 at 3:26am

Interesting. I did consider that for that initial release, but here was my thought process:

"Should I make an API for the Announcement object, too? Nah, no one will ask for that feature."

:)

I'm hesitant to start moving things around now that is looking much closer to stable, but I'm happy to play around with it. If I add something like that, I'll let you know and you can check it out from the SVN.

Avatar
George

Community Member, 41 Posts

6 February 2009 at 3:38am

ok. Thanks.

I have another issue.
Under configuration event descr behaviour and word count is not shown. (e_c svn + sv 2.3rc3)

Avatar
UncleCheese

Forum Moderator, 4102 Posts

6 February 2009 at 3:40am

I took that out in the latest version. You shouldn't need it. It was there to give users more control over the presentation, but I realized that sort of stuff doesn't belong in the CMS -- it belongs on the template.

Go to Top