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

Extending Event Calendar


Go to End


3 Posts   1779 Views

Avatar
Victor

Community Member, 128 Posts

20 November 2009 at 12:31am

Edited: 20/11/2009 2:18am

I am extending event_calendar, so class Seminar extends Calendar and SeminarEvent extends CalendarEvent and SeminarDateTime Extends CalendarDateTime

So, SeminarDateTime contains plenty of fields like Location, Speaker, ....

at this moment what I achieved is far better than what I managed before

http://weyl.math.toronto.edu:8888/testsite/seminars

and there are some problems. At this moment the most serious one:

If I try to filter event not (only) by date but by "Category" (SeminarName) it returns an error

[Warning] Unknown class passed as parameter
GET /testsite/seminars/2009-11-19/2009-11-19?filter=1&filter_SeminarName=Applied+Math%2FPDE%2FAnalysis

Line 471 in /Applications/MAMP/htdocs/testsite/event_calendar/code/Calendar.php

ource

462 					$parts = explode(".",$db_field);
463 					$table = $parts[0];
464 					$field = $parts[1];
465 					$db_field = "`".$table."`.".$field;
466 				}
467 				else {
468 					$table = $db_field;
469 					$db_field = "`".$table."`";
470 				}
471         if($table == "CalendarEvent" || is_subclass_of($table, "CalendarEvent"))
472           $event_filters[] = $table;
473         else if($table == "CalendarDateTime" || is_subclass_of($table, "CalendarDateTime"))
474           $datetime_filters[] = $table;
475 				$for_db[] = "$db_field = '$value'";
476 			}
477 			return array($for_db, $event_filters, $datetime_filters);
Trace

is_subclass_of(SeminarName,CalendarEvent) 
Line 471 of Calendar.php
Calendar::getFiltersForDB() 
Line 760 of Calendar.php
Calendar_Controller->Events() 
call_user_func_array(Array,Array) 
Line 550 of ViewableData.php
ViewableData->cachedCall(Events,,) 
Line 591 of ViewableData.php
ViewableData->hasValue(Events) 
Line 82 of .cache.Applications.MAMP.htdocs.testsite.seminars.templates.Layout.Seminar.ss
include(/private/var/tmp/silverstripe-cache-Applications-MAMP-htdocs-testsite/.cache.Applications.MAMP.htdocs.testsite.seminars.templates.Layout.Seminar.ss) 
Line 354 of SSViewer.php
SSViewer->process(Seminar_Controller) 
Line 346 of SSViewer.php
SSViewer->process(Seminar_Controller) 
Line 175 of Controller.php
Controller->handleAction(HTTPRequest) 
Line 129 of RequestHandler.php
RequestHandler->handleRequest(HTTPRequest) 
Line 122 of Controller.php
Controller->handleRequest(HTTPRequest) 
Line 29 of ModelAsController.php
ModelAsController->handleRequest(HTTPRequest) 
Line 277 of Director.php
Director::handleRequest(HTTPRequest,Session) 
Line 121 of Director.php
Director::direct(/seminars/2009-11-19/2009-11-19) 
Line 118 of main.php

{color=blue]Any suggestions what I am doing wrong? (except trying to create this being (bloody) amateur - but everybody else in the Department is completely clueless :-()

Lesser problems:

1) in

http://weyl.math.toronto.edu:8888/testsite/applied-math-pde-analysis/

(etc) Last event date is lost

2) In

http://weyl.math.toronto.edu:8888/testsite/applied-math-pde-analysis/2009-11-20

(etc) footer is lost

but those are related with ss

Thank in advance for advice

Victor

Avatar
UncleCheese

Forum Moderator, 4102 Posts

20 November 2009 at 1:54pm

This is a little glitch in the way the event calendar works. Remember, the objects that get fed to the calendar are DateTime objects, so if you're going to filter by a field that exists on the Event object, you need to specify that. Change the name of your filter field to "SeminarEvent_Category", and you should be good.

Avatar
Victor

Community Member, 128 Posts

20 November 2009 at 2:51pm

Edited: 20/11/2009 11:48pm

Thanks! When it is done properly it works!

Victor