Login / Status
developer.Resource
Home . Documentation . Document Library . Extension Manuals
Sponsors
hosted by punkt.deTYPO3 and Open Source Magazine

1.5. API

Example how to add the calendar to your frontend extension. Adding the calendar to your backend module its a similar code. All the needed calendar configuration is preconfigured.

// include jscalendar apiinclude_once(t3lib_extMgm::siteRelPath('date2cal') . '/src/class.jscalendar.php');

// init jscalendar class

$JSCalendar = JSCalendar::getInstance();

// datetime format (default: time)

$JSCalendar->setDateFormat(true);

// set options (!!! optional !!!)

$JSCalendar->setInputField($inputId);

$JSCalendar->setConfigOption('firstDay', 1 true);

$JSCalendar->setNLP($this->extConfig['natLangParser']);

$JSCalendar->setCSS($this->extConfig['calendarCSS']);

$JSCalendar->setLanguage($this->extConfig['lang']);

// render calendar stuff

$this->markerArray['###FIELD###'] .= $JSCalendar->render($value);

// get initialisation code of the calendar

if (($jsCode = $JSCalendar->getMainJS()) != '')

$GLOBALS['TSFE']->additionalHeaderData['powermail_date2cal'] = $jsCode;

Now a version of a minified version for a simple date calendar.

include_once(t3lib_extMgm::siteRelPath('date2cal') . '/src/class.jscalendar.php');

$JSCalendar = JSCalendar::getInstance();

$this->markerArray['###FIELD###'] .= $JSCalendar->render($value);

if (($jsCode = $JSCalendar->getMainJS()) != '')

$GLOBALS['TSFE']->additionalHeaderData['powermail_date2cal'] = $jsCode;

You can find the whole API documentation in the directory "doc/html" of "date2cal"!