DEPRECATION WARNING

This documentation is not using the current rendering mechanism and is probably outdated. The extension maintainer should switch to the new system. Details on how to use the rendering mechanism can be found here.

Calendar for Date and Datetime Fields

Author:Kasper Skårhøj
Created:2002-11-01T00:32:00
Changed:2010-01-12T22:28:19
Classification:date2cal
Keywords:calendar, backend, frontend, api, jscalendar, natural language parser
Author:Stefan Galinski
Email:stefan.galinski@gmail.com
Info 4:
Language:en

img-1 img-2 Calendar for Date and Datetime Fields - date2cal

Calendar for Date and Datetime Fields

Extension Key: date2cal

Language: en

Keywords: calendar, backend, frontend, api, jscalendar, natural language parser

Copyright 2000-2008, Stefan Galinski, <stefan.galinski@gmail.com>

This document is published under the Open Content License

available from http://www.opencontent.org/opl.shtml

The content of this document is related to TYPO3

- a GNU/GPL CMS/Framework available from www.typo3.org

Table of Contents

Calendar for Date and Datetime Fields 1

`Introduction 3 <#1.1.Introduction|outline>`_

What does it do? 3

Screenshots 3

`Users manual 5 <#1.2.Users%20manual|outline>`_

`Administration 6 <#1.3.Administration|outline>`_

`Configuration 7 <#1.4.Configuration|outline>`_

Reference 7

`Tutorial 8 <#1.5.Tutorial|outline>`_

`API 9 <#1.6.API|outline>`_

`Known problems 10 <#1.7.Known%20problems|outline>`_

`To-Do list 11 <#1.8.To-Do%20list|outline>`_

`ChangeLog 12 <#1.9.ChangeLog|outline>`_

Introduction

What does it do?

This extension provides an easy and highly configurable way to integrate a calendar in your own forms. Also any existing backend date and datetime fields are extended with this calendar if the option is activated in the configuration. The calendar is based upon jscalendar ( http://www.dynarch.com/projects/calendar ) with some additional bugfixes and an extension to enter dates in a natural way, like “today”, “tomorrow”.

Important Notes
  • Please note that all versions >= 7.0.0 do *not* work with PHP4.
  • The release 7.2.0 of date2cal has gained support of the “ddmmyy” option of TYPO3. You can set your own date format now. If not it will fallback to “%d-%m-%y” (short year syntax). You need to add the following line into your localconf.php to return to the old format:$TYPO3_CONF_VARS['SYS']['ddmmyy'] = 'd-m-Y';This issue doesn't appears in the backend part, but any extension that makes usage of the integrated API. The backend version can't make usage of this feature due the hardcoded date evaluation from TYPO3.

Screenshots

img-3

img-4

Users manual

The extension contains an inline help for the natural language parser mode. Please be aware that this mode depends on your current selected language!

Administration

Just install and have fun!

Configuration

The preferred language option “lang” can be only set in the user/group typoscript configuration field. You can use language codes from TYPO3 (TLD), because “date2cal” converts them always automatically to ISO 639.

In version 3.1.0 a new option was introduced: “tx_date2cal.secOptionsAlwaysOn” . Set this option to '1' if you want to activate the “show secondary options (palette)” always as default for the user/group. The user can deactivate the option temporarily for a page. Please note that the settings is only restored if the form contains a date or datetime field.

Furthermore all global options can be overridden by the user or group typoscript configuration in the namespace “tx_date2cal” .

Reference

calendarCSS

Property

calendarCSS

Data type

Enumeration (aqua, t3skin, t3skin2, skin_grey_2)

Description

Calendar Theme

Default

aqua

enableBackendIntegration

Property

enableBackendIntegration

Data type

Booolean

Description

Enables the backend part of this extension

Default

true

firstDay

Property

firstDay

Data type

boolean

Description

First Day of the Week (true = Monday, false = Sunday)

Default

true

doCache

Property

doCache

Data type

boolean

Description

Enable the Internal Cache System

Default

true

natLangParser

Property

natLangParser

Data type

boolean

Description

Enable the Natural Language Parser (requires prototype)

Default

true

datetime

Property

datetime

Data type

boolean

Description

Start/Stop fields of pages and content elements with time selection (doesn't work really)

Default

false

secOptionsAlwaysOn

Property

secOptionsAlwaysOn

Data type

boolean

Description

Activate the "secondary options/fields" always automaticallly

Default

false

calendarIcon

Property

calendarIcon

Data type

file

Description

calendar image

Default

EXT:date2cal/res/calendar.pngEXT:date2cal/resources/images/calendar.pn g

helpIcon

Property

helpIcon

Data type

file

Description

help image

Default

EXT:date2cal/resources/images/helpIcon.png

lang

Property

lang

Data type

string

Description

language code (TLD or ISO 639 format)

Default

depends on the selected backend language

Tutorial

A full point-a-to-b-to-c walk-through of an application of the extension. Include screendumps.

Language: As tutorials are...

Target group: Whatever fits.

API

Hint: The open office manual includes a much nicer view of the following code listings.

This is an example how to add the calendar to your frontend extension. You can use a nearly similar code to add the calendar to a backend module. All the needed calendar configuration is preconfigured.

// include jscalendar

a

// 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', 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 an example of a minified version for a simple date calendar.

include_once(t3lib_extMgm::siteRelPath('date2cal') .

a

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"! You can update the documentation by using “doxygen”. You will find the doxygen configuration file in the root directory.

Known problems

  • If you have problems with the encoding then please set the option $TYPO3_CONF_VARS['BE']['forceCharset'] to “ utf-8 ” or define a working language ( tx_date2cal.lang ) in your user/group typoscript configuration.
  • The calendar doesn't work in the palette if you use PHP4 and TYPO3 3.8.x. Please enable “Show secondary options (palettes)” to prevent this problem. You can use the date2cal configuration option “secOptionsAlwaysOn” to do this automatically.
  • If you get error messages like "too much recursions" or "stack overflow", you have multiple initialisations of the calendar on the page. This could happened by using another calendar extension like “erotea_date2cal” or “kj_becalendar” at the same time.
  • The initial values of the date boxes in the TYPO3 backend are filled out by TYPO3, but it doesn't respect the “ddmmyy” setting. If you doesn't change the “ddmmyy” setting to “d-m-Y”, you will always get an incorrect displayed initial value. This is only a visual issue, but doesn't breaks the functionality.

ChangeLog

See Changelog file inside the extension!

12