[TYPO3-calendar] Use of a cal service
Chris Müller
mueller at cyperfection.de
Mon Nov 5 09:02:25 CET 2012
Now it works, just for the records.
First you have to register some stuff (like done in the tx_cal_controller):
$rightsObj = &tx_cal_registry::Registry('basic','rightscontroller');
$rightsObj = t3lib_div::makeInstanceService('cal_rights_model', 'rights');
$rightsObj->setDefaultSaveToPage();
$modelObj = &tx_cal_registry::Registry('basic','modelcontroller');
$modelObj = new tx_cal_modelcontroller();
$viewObj = &tx_cal_registry::Registry('basic','viewcontroller');
$viewObj = new tx_cal_viewcontroller();
$myCobj = &tx_cal_registry::Registry('basic','cobj');
$myCobj = $this->cObj;
If you want e.g. to get events for a distinct category, you have to
initialize a conf array:
$conf['category'] = $yourCategoriesCommaSeparated;
You have to set explicitly that you want to get only the events of these
categories:
$conf['view.']['categoryMode'] = '1';
Then throw it into the registry:
$myConf = &tx_cal_registry::Registry('basic','conf');
$myConf = $conf;
Then get the event service and get the events you desired:
$service = &tx_cal_functions::getEventService();
$events = $service->findAllWithin(&$startDate, &$endDate, $pidList);
You are getting an array structure which you can traverse through.
Regards,
Chris.
More information about the TYPO3-project-calendar
mailing list