.. ================================================== .. FOR YOUR INFORMATION .. -------------------------------------------------- .. -*- coding: utf-8 -*- with BOM. .. include:: ../Includes.txt .. _developer: Developer Corner ================ In the developer corner, you can learn the basics for templating with ``dm_simplecalendar`` The Template System requires two main templates - `Templates/Calendar/Show.html` For displaying calendar, mainly uses the variable ``{viewCalendar}`` - Templates/Appointment/Show.html For displaying appointment detail view, mainly uses the variable ``{appointment}`` How to build a calendar ----------------------- Introduction ^^^^^^^^^^^^ The Template ``Templates/Calendar/Show.html`` just should redirect to the needed **Partials** .. code-block:: html Required ViewHelpers to build a calendar ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ **Include** ``{namespace dmc=DieMedialen\DmSimplecalendar\ViewHelpers}`` **on top of every template and partial to use the following ViewHelpers** .. code-block:: html .. code-block:: html .. code-block:: html Simple HTML Example to display a full year! ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Lets say, you choose **year** as dispaly mode in plugin, the property ``{viewCalendar.mode}`` will be "year". .. code-block:: html
{viewCalendar.timestamp}
{viewCalendar.timestamp}
{dayCalendar.timestamp}
The generated HTML Code will be: .. code-block:: html
2015
January
30.12.2013
31.12.2013
01.01.2015
02.01.2015
......
...
06.01.2015
...
...
February
...
02.02.2015
03.02.2015
...
06.01.2015
...
... ...
You may ask, why the first days in January are "30.12.2013" and "31.12.2013". This comes, because we rendered the ``{monthCalendar}`` to ``{weekCalendar}`` and then to ``{dayCalendar}``. A week has always 7 days, so the pre-month days are shown. If you render the ``{monthCalendar}`` directly to an ``{dayCalendar}``, there will be only ``{dayCalendar}`` in loop, what are realy in the month! Main Variables -------------- ``{viewCalendar}`` ^^^^^^^^^^^^^^^^^ ``DieMedialen\DmSimplecalendar\Domain\Model\ViewCalendar`` +---------------------+------------------------------------------------------------------------------------+-----------------------------+ | Properties | Type | Description | +=====================+====================================================================================+=============================+ | timestamp | integer | timestamp of current | | | | calendar | +---------------------+------------------------------------------------------------------------------------+-----------------------------+ | mode | string | year/month/week/day | +---------------------+------------------------------------------------------------------------------------+-----------------------------+ | appointments | ``TYPO3\CMS\Extbase\Persistence\ObjectStorage<`` | | | | | | | | ``DieMedialen\DmSimplecalendar\Domain\Model\Appointment`` | | | | | | | | ``>`` | | +---------------------+------------------------------------------------------------------------------------+-----------------------------+ | previous | integer | timestamp of previous | | | | calendar of same mode | +---------------------+------------------------------------------------------------------------------------+-----------------------------+ | next | integer | timestamp of next | | | | calendar of same mode | +---------------------+------------------------------------------------------------------------------------+-----------------------------+ | uid | integer | | +---------------------+------------------------------------------------------------------------------------+-----------------------------+ | pid | integer | | +---------------------+------------------------------------------------------------------------------------+-----------------------------+ ``{appointment}`` ^^^^^^^^^^^^^^^^^ ``DieMedialen\DmSimplecalendar\Domain\Model\Appointment`` +---------------------+------------------------------------------------------------------------------------+-----------------------------+ | Properties | Type | Description | +=====================+====================================================================================+=============================+ | media | ``DieMedialen\DmSimplecalendar\Domain\Model\Media`` | Model with 2 FAL properties | | | | Unlimited attachments | +---------------------+------------------------------------------------------------------------------------+-----------------------------+ | categories | ``TYPO3\CMS\Extbase\Persistence\ObjectStorage<`` | | | | | | | | ``DieMedialen\DmSimplecalendar\Domain\Model\Category`` | | | | | | | | ``>`` | | +---------------------+------------------------------------------------------------------------------------+-----------------------------+ | location | string | Use for city, name of | | | | organisation or something | +---------------------+------------------------------------------------------------------------------------+-----------------------------+ | description | string | The main description text | +---------------------+------------------------------------------------------------------------------------+-----------------------------+ | shortdescription | string | A short teaser text | +---------------------+------------------------------------------------------------------------------------+-----------------------------+ | startdate | DateTime | StartDate of appointment | +---------------------+------------------------------------------------------------------------------------+-----------------------------+ | enddate | DateTime | EndDate of appointment | +---------------------+------------------------------------------------------------------------------------+-----------------------------+ | title | string | The appointments title | +---------------------+------------------------------------------------------------------------------------+-----------------------------+ | uid | integer | | +---------------------+------------------------------------------------------------------------------------+-----------------------------+ | pid | integer | | +---------------------+------------------------------------------------------------------------------------+-----------------------------+ ``{appointment.media}`` ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ``DieMedialen\DmSimplecalendar\Domain\Model\Media`` +---------------------+------------------------------------------------------------------------------------+-----------------------------+ | Properties | Type | Description | +=====================+====================================================================================+=============================+ | files | string | FAL resources | +---------------------+------------------------------------------------------------------------------------+-----------------------------+ | images | string | FAL resources | +---------------------+------------------------------------------------------------------------------------+-----------------------------+ | uid | integer | | +---------------------+------------------------------------------------------------------------------------+-----------------------------+ | pid | integer | | +---------------------+------------------------------------------------------------------------------------+-----------------------------+ ``{appointment.categories}`` ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ``TYPO3\CMS\Extbase\Persistence\ObjectStorage`` +---------------------+------------------------------------------------------------------------------------+-----------------------------+ | Properties | Type | Description | +=====================+====================================================================================+=============================+ | title | string | | +---------------------+------------------------------------------------------------------------------------+-----------------------------+ | color | string | you can use strings or | | | | HEX code for coloring | +---------------------+------------------------------------------------------------------------------------+-----------------------------+ | uid | integer | | +---------------------+------------------------------------------------------------------------------------+-----------------------------+ | pid | integer | | +---------------------+------------------------------------------------------------------------------------+-----------------------------+ Navigation and Links in calendar templates ------------------------------------------ #. Generate a link to an appointment detail view: .. code-block:: typoscript {appointment.title} The ACTION must be ``show``, the CONTROLLER must be ``Appointment`` and an ``appointment`` must be given in ARGUMENTS #. Generate a prev/next link to navigate through your calendar .. code-block:: typoscript PREV The ACTION must be ``show``, the CONTROLLER must be ``Calendar`` and a ``viewTimestamp`` and a ``viewMode`` must be given in ARGUMENTS Tutorials / Examples -------------------- Limit the number of listed appointments ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ To limit the displayed appointments, you can use the setting ``{settings.appointmentAmountLimit}``. You can define this setting in each calendar-plugin in tab "Template" or you can define the setting in TypoScript-Setup: .. code-block:: typoscript plugin.tx_dmsimplecalendar { settings { appointmentAmountLimit = 3 } } .. code-block:: html ... {appointment.title} ...

{f:translate(key:'tx_dmsimplecalendar_view_appointment_none',default:'')}

...