Initial import of cal_ts_service.
authorjsegars <jsegars@735d13b6-9817-0410-8766-e36946ffe9aa>
Tue, 13 Sep 2011 20:38:00 +0000 (20:38 +0000)
committerjsegars <jsegars@735d13b6-9817-0410-8766-e36946ffe9aa>
Tue, 13 Sep 2011 20:38:00 +0000 (20:38 +0000)
git-svn-id: https://svn.typo3.org/TYPO3v4/Extensions/cal_ts_service/trunk@51923 735d13b6-9817-0410-8766-e36946ffe9aa

24 files changed:
ChangeLog [new file with mode: 0644]
doc/manual.sxw [new file with mode: 0644]
ext_emconf.php [new file with mode: 0755]
ext_icon.gif [new file with mode: 0755]
ext_localconf.php [new file with mode: 0755]
ext_tables.php [new file with mode: 0755]
icon_tx_cal_events.gif [new file with mode: 0755]
locallang.xml [new file with mode: 0755]
model/class.tx_cal_ts_model.php [new file with mode: 0644]
service/class.tx_cal_ts_category_service.php [new file with mode: 0755]
service/class.tx_cal_ts_service.php [new file with mode: 0755]
static/birthday/constants.txt [new file with mode: 0755]
static/birthday/setup.txt [new file with mode: 0755]
static/mbl_newsevent/constants.txt [new file with mode: 0755]
static/mbl_newsevent/setup.txt [new file with mode: 0755]
static/tt_news/constants.txt [new file with mode: 0755]
static/tt_news/setup.txt [new file with mode: 0755]
static/tt_products/constants.txt [new file with mode: 0755]
static/tt_products/setup.txt [new file with mode: 0755]
static/tx_seminars/constants.txt [new file with mode: 0755]
static/tx_seminars/setup.txt [new file with mode: 0755]
static/wec_sermons/constants.txt [new file with mode: 0755]
static/wec_sermons/setup.txt [new file with mode: 0755]
template/ts.tmpl [new file with mode: 0755]

diff --git a/ChangeLog b/ChangeLog
new file mode 100644 (file)
index 0000000..34c3077
--- /dev/null
+++ b/ChangeLog
@@ -0,0 +1 @@
+Please refer to the "ChangeLog" section in the manual to get an overview about what changed in which release.
\ No newline at end of file
diff --git a/doc/manual.sxw b/doc/manual.sxw
new file mode 100644 (file)
index 0000000..24d30db
Binary files /dev/null and b/doc/manual.sxw differ
diff --git a/ext_emconf.php b/ext_emconf.php
new file mode 100755 (executable)
index 0000000..28c346a
--- /dev/null
@@ -0,0 +1,49 @@
+<?php
+
+########################################################################
+# Extension Manager/Repository config file for ext "cal_ts_service".
+#
+# Auto generated 03-05-2011 13:45
+#
+# Manual updates:
+# Only the data in the array - everything else is removed by next
+# writing. "version" and "dependencies" must not be touched!
+########################################################################
+
+$EM_CONF[$_EXTKEY] = array(
+       'title' => 'Typoscript Service for Calendar Base',
+       'description' => 'Connects external tables to Calendar Base through a Typoscript-based configuration.',
+       'category' => 'plugin',
+       'shy' => 0,
+       'dependencies' => 'cal',
+       'conflicts' => '',
+       'priority' => '',
+       'loadOrder' => '',
+       'module' => '',
+       'state' => 'stable',
+       'uploadfolder' => 0,
+       'createDirs' => '',
+       'modify_tables' => '',
+       'clearCacheOnLoad' => 0,
+       'lockType' => '',
+       'author' => 'Mario Matzulla',
+       'author_email' => 'mario@matzullas.de',
+       'author_company' => '',
+       'CGLcompliance' => '',
+       'CGLcompliance_note' => '',
+       'version' => '1.2-dev',
+       'constraints' => array(
+               'depends' => array(
+                       'cal' => '',
+               ),
+               'conflicts' => array(
+               ),
+               'suggests' => array(
+               ),
+       ),
+       '_md5_values_when_last_written' => 'a:23:{s:9:"ChangeLog";s:4:"c4c3";s:12:"ext_icon.gif";s:4:"35b9";s:17:"ext_localconf.php";s:4:"e718";s:14:"ext_tables.php";s:4:"a833";s:22:"icon_tx_cal_events.gif";s:4:"475a";s:13:"locallang.xml";s:4:"6ad6";s:14:"doc/manual.sxw";s:4:"6289";s:31:"model/class.tx_cal_ts_model.php";s:4:"eee1";s:44:"service/class.tx_cal_ts_category_service.php";s:4:"03fa";s:35:"service/class.tx_cal_ts_service.php";s:4:"96ff";s:29:"static/birthday/constants.txt";s:4:"4569";s:25:"static/birthday/setup.txt";s:4:"7424";s:34:"static/mbl_newsevent/constants.txt";s:4:"77f9";s:30:"static/mbl_newsevent/setup.txt";s:4:"916c";s:28:"static/tt_news/constants.txt";s:4:"bd51";s:24:"static/tt_news/setup.txt";s:4:"a678";s:32:"static/tt_products/constants.txt";s:4:"af8e";s:28:"static/tt_products/setup.txt";s:4:"3347";s:32:"static/tx_seminars/constants.txt";s:4:"6a19";s:28:"static/tx_seminars/setup.txt";s:4:"fb77";s:32:"static/wec_sermons/constants.txt";s:4:"a1ff";s:28:"static/wec_sermons/setup.txt";s:4:"96d2";s:16:"template/ts.tmpl";s:4:"477f";}',
+       'suggests' => array(
+       ),
+);
+
+?>
\ No newline at end of file
diff --git a/ext_icon.gif b/ext_icon.gif
new file mode 100755 (executable)
index 0000000..7c024a0
Binary files /dev/null and b/ext_icon.gif differ
diff --git a/ext_localconf.php b/ext_localconf.php
new file mode 100755 (executable)
index 0000000..e5d29f8
--- /dev/null
@@ -0,0 +1,35 @@
+<?php\r
+if (!defined ('TYPO3_MODE'))   die ('Access denied.');\r
+\r
+/**\r
+ *  Both views and model are provided using TYPO3 services.  Models should be\r
+ *  of the type 'cal_model' with a an extension key specific to that model.\r
+ *  Views can be of two types.  The 'cal_view' type is used for views that \r
+ *  display multiple days.  Within this type, subtypes for 'single', 'day', \r
+ *  'week', 'month', 'year', and 'custom' are available.  The default views \r
+ *  each have the key 'default'.  Custom views tied to a specific model should \r
+ *  have service keys identical to the key of that model.\r
+ */\r
+\r
+/* Cal Example Concrete Model */\r
+t3lib_extMgm::addService($_EXTKEY,  'cal_event_model' /* sv type */,  'tx_cal_ts_service' /* sv key */,\r
+       array(\r
+               'title' => 'Cal Example Model', 'description' => '', 'subtype' => 'event',\r
+               'available' => TRUE, 'priority' => 50, 'quality' => 50,\r
+               'os' => '', 'exec' => '',\r
+               'classFile' => t3lib_extMgm::extPath($_EXTKEY).'service/class.tx_cal_ts_service.php',\r
+               'className' => 'tx_cal_ts_service',\r
+       )\r
+);\r
+\r
+/* Cal ttnews category Model */\r
+t3lib_extMgm::addService($_EXTKEY,  'cal_category_model' /* sv type */,  'tx_cal_ts_category_service' /* sv key */,\r
+       array(\r
+               'title' => 'Cal Example Model', 'description' => '', 'subtype' => 'category',\r
+               'available' => TRUE, 'priority' => 50, 'quality' => 50,\r
+               'os' => '', 'exec' => '',\r
+               'classFile' => t3lib_extMgm::extPath($_EXTKEY).'service/class.tx_cal_ts_category_service.php',\r
+               'className' => 'tx_cal_ts_category_service',\r
+       )\r
+);\r
+?>
\ No newline at end of file
diff --git a/ext_tables.php b/ext_tables.php
new file mode 100755 (executable)
index 0000000..1afae85
--- /dev/null
@@ -0,0 +1,26 @@
+<?php\r
+if (!defined ('TYPO3_MODE'))   die ('Access denied.');\r
+\r
+if(t3lib_extMgm::isLoaded('tt_news')) {\r
+       t3lib_extMgm::addStaticFile($_EXTKEY,'static/tt_news/','tt_news');      \r
+}\r
+\r
+if(t3lib_extMgm::isLoaded('seminars')) {\r
+       t3lib_extMgm::addStaticFile($_EXTKEY,'static/tx_seminars/','tx_seminars');      \r
+}\r
+\r
+if(t3lib_extMgm::isLoaded('tt_products')) {\r
+       t3lib_extMgm::addStaticFile($_EXTKEY,'static/tt_products/','tt_products');      \r
+}\r
+\r
+if(t3lib_extMgm::isLoaded('wec_sermons')) {\r
+       t3lib_extMgm::addStaticFile($_EXTKEY,'static/wec_sermons/','wec_sermons');      \r
+}\r
+\r
+if(t3lib_extMgm::isLoaded('mbl_newsevent')) {\r
+       t3lib_extMgm::addStaticFile($_EXTKEY,'static/mbl_newsevent/','mbl_newsevent');\r
+}\r
+\r
+t3lib_extMgm::addStaticFile($_EXTKEY,'static/birthday/','birthday');\r
+\r
+?>
\ No newline at end of file
diff --git a/icon_tx_cal_events.gif b/icon_tx_cal_events.gif
new file mode 100755 (executable)
index 0000000..eb01f27
Binary files /dev/null and b/icon_tx_cal_events.gif differ
diff --git a/locallang.xml b/locallang.xml
new file mode 100755 (executable)
index 0000000..9ccf467
--- /dev/null
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
+<T3locallang>
+       <meta type="array">
+               <description></description>
+               <type>module</type>
+               <csh_table></csh_table>
+               <labelContext type="array">
+               </labelContext>
+       </meta>
+       <data type="array">
+               <languageKey index="default" type="array">
+                       <label index="l_birthday">Birthday</label>
+               </languageKey>
+               <languageKey index="de" type="array">
+                       <label index="l_birthday">Geburtstag von</label>
+               </languageKey>
+       </data>
+       <orig_text>
+       </orig_text>
+</T3locallang>
\ No newline at end of file
diff --git a/model/class.tx_cal_ts_model.php b/model/class.tx_cal_ts_model.php
new file mode 100644 (file)
index 0000000..b28ed96
--- /dev/null
@@ -0,0 +1,259 @@
+<?php
+/***************************************************************
+*  Copyright notice
+*
+*  (c) 2004 
+*  All rights reserved
+*
+*  This script is part of the TYPO3 project. The TYPO3 project is
+*  free software; you can redistribute it and/or modify
+*  it under the terms of the GNU General Public License as published by
+*  the Free Software Foundation; either version 2 of the License, or
+*  (at your option) any later version.
+*
+*  The GNU General Public License can be found at
+*  http://www.gnu.org/copyleft/gpl.html.
+*
+*  This script is distributed in the hope that it will be useful,
+*  but WITHOUT ANY WARRANTY; without even the implied warranty of
+*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+*  GNU General Public License for more details.
+*
+*  This copyright notice MUST APPEAR in all copies of the script!
+***************************************************************/
+
+require_once(t3lib_extMgm::extPath('cal').'model/class.tx_cal_phpicalendar_model.php');
+
+/**
+ * A concrete model for the calendar.
+ *
+ * @author Mario Matzulla <mario(at)matzullas.de>
+ */
+class tx_cal_ts_model extends tx_cal_phpicalendar_model {
+       
+       var $thisConf;
+       
+       function tx_cal_ts_model($row, $isException, $serviceKey, $conf=Array()){
+               $this->tx_cal_phpicalendar_model($row, false, $serviceKey);
+               $this->controller = &tx_cal_registry::Registry('basic','controller');
+               $this->thisConf = $conf;
+               $this->conf['view.'][$this->conf['view'].'.']['event.'] = array_merge($this->conf['view.'][$this->conf['view'].'.']['event.'],(array)$conf[$this->conf['view'].'.']['event.']);
+               $this->isException = $isException;      
+               $this->createEvent($row, $isException);
+               $this->setType('tx_cal_ts_service');
+       }
+       
+       # @override
+       function tx_cal_base_model(&$serviceKey){
+               $this->conf = tx_cal_registry::Registry('basic','conf');
+               $this->serviceKey = &$serviceKey;
+       }
+       
+       function createEvent($row){
+               $this->setType($this->serviceKey);
+               $this->row = $row;
+               $this->setUid($row['uid']);
+               $this->setAllday($row['allday']);
+               $this->setExtUrl($row['ext_url']);
+
+               $start = new tx_cal_date(gmdate('Ymd',$row[$this->thisConf['startTimeField']]));
+               $start->setTZbyId('UTC');
+               $start->setMinute(gmdate('i',$row[$this->thisConf['startTimeField']]));
+               $start->setHour(gmdate('H',$row[$this->thisConf['startTimeField']]));
+               
+               if(!$row[$this->thisConf['endTimeField']] && $this->thisConf['defaultLength'] && !$this->isAllday()){
+                       $end = new tx_cal_date();
+                       $end->copy($start);
+                       $end->addSeconds($this->thisConf['defaultLength']*60);
+               }else{
+                       $end = new tx_cal_date(gmdate('Ymd',$row[$this->thisConf['endTimeField']]));
+                       $end->setTZbyId('UTC');
+                       $end->setMinute(gmdate('i',$row[$this->thisConf['endTimeField']]));
+                       $end->setHour(gmdate('H',$row[$this->thisConf['endTimeField']]));
+               }
+               
+               $this->setStart($start);
+               $this->setEnd($end);
+               
+               $this->setFreq($row['freq']);
+               $this->setByDay($row['byday']);
+               $this->setByMonthDay($row['bymonthday']);
+               $this->setByMonth($row['bymonth']);
+               if(isset($row['until'])){
+                       $until = new tx_cal_date($row['until']);
+                       $until->setTZbyId('UTC');
+                       $this->setUntil($until);
+               }       
+               foreach((Array)$this->thisConf['fieldMapping.'] as $field => $value){
+                       switch ($field){
+                               case 'image':
+                                       $this->setImage(t3lib_div::trimExplode(',',$row[$this->thisConf['fieldMapping.']['image']]));
+                                       break;
+                               default:
+                                       $funcName = 'set'.ucwords(strtolower($field));
+                                       if(method_exists($this,$funcName)) {
+                                               $this->$funcName($row[$this->thisConf['fieldMapping.'][$field]]);
+                                       }
+                       }
+               }
+               
+               $this->externalPlugin = $this->thisConf['externalPlugin'];
+       }
+       
+       function getCategoryHeaderStyle(&$template, &$rems, &$sims, $view){
+               $sims['###HEADERSTYLE###'] = $this->thisConf['headerStyle'];
+       }
+       
+       function getCategoryBodyStyle(&$template, &$rems, &$sims, $view){
+               $sims['###BODYSTYLE###'] = $this->thisConf['bodyStyle'];
+       }
+       
+       /**
+         * Returns the headerstyle name
+         */
+        function getHeaderStyle(){
+               return $this->thisConf['headerStyle'];
+        }
+        
+        /**
+         * Returns the bodystyle name
+         */
+        function getBodyStyle(){
+               return $this->thisConf['bodyStyle'];
+        }
+
+       function renderEventForDay() {
+               return $this->fillTemplate('###TEMPLATE_TS_EVENT_DAY###');
+       }
+
+       function renderEventForWeek() {
+               return $this->fillTemplate('###TEMPLATE_TS_EVENT_WEEK###');
+       }
+
+       function renderEventForAllDay() {
+               return $this->fillTemplate('###TEMPLATE_TS_EVENT_ALLDAY###');
+       }
+
+       function renderEventForMonth() {
+               if($this->isAllday()){
+                       return $this->renderEventFor('MONTH_ALLDAY');
+               }
+               return $this->renderEventFor('MONTH');
+       }
+       
+       function renderEventForYear() {
+               return $this->fillTemplate('###TEMPLATE_TS_EVENT_YEAR###');
+       }
+
+       function renderEvent() {
+               return $this->fillTemplate('###TEMPLATE_TS_EVENT###');
+       }
+       
+       function renderTomorrowsEvent() {
+               $this->isTomorrow = true;
+               return $this->fillTemplate('###TEMPLATE_TS_EVENT_TOMORROW###');
+       }
+       
+       function renderEventFor($viewType){
+               return $this->fillTemplate('###TEMPLATE_TS_EVENT_'.strtoupper($viewType).'###');
+       }
+       
+       function fillTemplate($subpartMarker){
+#              $this->controller->piVars['ts_table'] = $this->thisConf['table'];
+               $cObj = &$this->controller->cObj;
+               $page = $cObj->fileResource($this->thisConf['template']);
+               if ($page == '') {
+                       return '<h3>calendar: no template file found:</h3>' . $this->thisConf['template'];
+               }
+               $page = $cObj->getSubpart($page,$subpartMarker);
+               $rems = array ();
+               $sims = array ();
+               $wrapped = array();
+               $this->getMarker($page, $sims, $rems, $wrapped);
+#              unset($this->controller->piVars['ts_table']);
+               $return = $this->finish($cObj->substituteMarkerArrayCached($page, $sims, $rems, $wrapped));
+               return $return;
+       }
+       
+       function getSubheader(){
+               return $this->subheader;
+       }
+       
+       function setSubheader($s){
+               $this->subheader = $s;
+       }
+       
+       function getUntil(){
+               if(!isset($this->until) || $this->until==0){
+                       return new tx_cal_date('00000101');
+               }
+               return $this->until;    
+       }
+       
+       function getCategory(){
+               return $this->category;
+       }
+       
+       function setCategory($cat){
+               $this->category = $cat;
+       }
+       
+       function getImageMarker(& $template, & $sims, & $rems, & $wrapped, $view){
+               $tempConfig = $this->conf['view.'][$view.'.'][$this->objectType.'.']['image.'];
+               $this->conf['view.'][$view.'.'][$this->objectType.'.']['image.'] = $this->thisConf[$this->conf['view'].'.'][$this->objectType.'.']['image.'];
+               parent::getImageMarker($template, $sims, $rems, $wrapped, $view);
+               $this->conf['view.'][$view.'.'][$this->objectType.'.']['image.'] = $tempConfig;
+       }
+       
+       /**
+        * Returns the Link to the external plugin
+        */
+       function getExternalPluginEventLink() {
+               $cObj = &$this->controller->cObj;
+               if ($this->ext_url) {
+                       return $this->controller->pi_linkTP(
+                               '|',
+                               array(),
+                               0,
+                               $this->ext_url
+                       );
+               }
+               $params = $cObj->stdWrap($this->thisConf['externalPlugin.']['additionalParams'],$this->thisConf['externalPlugin.']['additionalParams.']);
+               $rems = array ();
+               $sims = array ();
+               $wrapped = array();
+               $this->getMarker($params, $rems, $sims, $wrapped);
+               $params = $cObj->substituteMarkerArrayCached($params, $sims, $rems, $wrapped);
+               $paramArray = t3lib_div::trimExplode('|',$params,1);
+               $urlParams = array();
+               foreach($paramArray as $parameter){
+                       $valArray = t3lib_div::trimExplode('=',$parameter,1);
+                       $urlParams[$valArray[0]]=$valArray[1];
+               }
+
+               return $this->controller->pi_linkTP(
+                       '|',
+                       $urlParams,
+                       $this->conf['cache'],
+                       $this->thisConf['externalPlugin.']['singleViewPid']
+               );
+               
+       }
+       
+       function addAdditionalSingleViewUrlParams(&$currentParams){
+               $currentParams['ts_table'] = str_replace('.','',$this->row['ts_key']);
+       }
+       
+       function cloneEvent() {
+               $event = t3lib_div :: makeInstance(get_class($this), $this->getValuesAsArray(), $this->isException, $this->getType(), $this->thisConf);
+               $event->setIsClone(true);
+               return $event;
+       }
+}
+
+
+
+if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/cal_ts_service/model/class.tx_cal_ts_model.php'])     {
+       include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/cal_ts_service/model/class.tx_cal_ts_model.php']);
+}
+?>
\ No newline at end of file
diff --git a/service/class.tx_cal_ts_category_service.php b/service/class.tx_cal_ts_category_service.php
new file mode 100755 (executable)
index 0000000..2edc741
--- /dev/null
@@ -0,0 +1,129 @@
+<?php
+/***************************************************************
+* Copyright notice
+*
+* (c) 2005 Foundation for Evangelism
+* All rights reserved
+*
+* This file is part of the Web-Empowered Church (WEC)
+* (http://webempoweredchurch.org) ministry of the Foundation for Evangelism
+* (http://evangelize.org). The WEC is developing TYPO3-based
+* (http://typo3.org) free software for churches around the world. Our desire
+* is to use the Internet to help offer new life through Jesus Christ. Please
+* see http://WebEmpoweredChurch.org/Jesus.
+*
+* You can redistribute this file and/or modify it under the terms of the
+* GNU General Public License as published by the Free Software Foundation;
+* either version 2 of the License, or (at your option) any later version.
+*
+* The GNU General Public License can be found at
+* http://www.gnu.org/copyleft/gpl.html.
+*
+* This file is distributed in the hope that it will be useful for ministry,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+* GNU General Public License for more details.
+*
+* This copyright notice MUST APPEAR in all copies of the file!
+***************************************************************/
+
+require_once(t3lib_extMgm::extPath('cal').'service/class.tx_cal_category_service.php');
+
+/**
+ * Base model for the category.  Provides basic model functionality that other
+ * models can use or override by extending the class.  
+ *
+ * @author Mario Matzulla <mario@matzullas.de>
+ * @package TYPO3
+ * @subpackage cal
+ */
+class tx_cal_ts_category_service extends tx_cal_category_service {
+       
+       var $key = '';
+       
+       function tx_cal_ts_category_service(){
+               $this->tx_cal_category_service();
+       }
+       
+       function getCategorySearchString($pidList, $includePublic){
+               return '';
+               if($this->conf['category']!=''){
+                       $categorySearchString .= ' AND tt_news_cat_mm.uid_foreign IN ('.$this->conf['category'].')';
+               }
+               return $categorySearchString;
+       }
+       
+       /**
+        * Search for categories
+        */
+       function getCategoryArray($pidList, &$categoryArrayToBeFilled, $showPublicCategories=true){
+               
+               if($this->conf['display.']){
+                       foreach($this->conf['display.'] as $this->key => $conf){
+                               $this->thisConf = $conf;
+                               $this->categoryArrayByUid = array();
+                               $this->categoryArrayByEventUid = array();
+                               $this->categoryArrayByCalendarUid = array();
+                               $this->_getCategoryArray($pidList, $showPublicCategories);
+                               $categoryArrayToBeFilled[$this->key] = array($this->categoryArrayByUid,$this->categoryArrayByEventUid,$this->categoryArrayByCalendarUid);
+                       }
+               }
+       }
+               
+       /**
+        * Search for categories
+        */
+       function _getCategoryArray($pidList, $showPublicCategories=true){
+               if($this->rightsObj->isLoggedIn() && $showPublicCategories){
+                       $feUserId = $this->rightsObj->getUserId();
+               }else if($this->rightsObj->isLoggedIn()){
+                       $feUserId = $this->rightsObj->getUserId();
+               }
+
+               $categoryIds = array();
+               $dbIds = array();
+               $fileIds = array();
+               $extUrlIds = array();
+               if($this->thisConf['cat_select.']){
+                       $this->thisConf['cat_select.']['pidInList'] = $pidList;\r
+                       if($this->thisConf['enableLocalizationAndVersioningCat']){\r
+                               $this->thisConf['cat_select.']['andWhere'] .= $this->getAdditionalWhereForLocalizationAndVersioning($this->thisConf['catTable']);\r
+                       }
+                       $queryArray = $this->cObj->getQuery($this->thisConf['catTable'],$this->thisConf['cat_select.'],true);
+                       $result = $GLOBALS['TYPO3_DB']->exec_SELECT_queryArray($queryArray);
+                       while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result)) {
+                               if($this->thisConf['enableLocalizationAndVersioningCat']){\r
+                                       if ($GLOBALS['TSFE']->sys_language_content) {\r
+                                               $row = $GLOBALS['TSFE']->sys_page->getRecordOverlay($this->thisConf['catTable'], $row, $GLOBALS['TSFE']->sys_language_content, $GLOBALS['TSFE']->sys_language_contentOL, '');\r
+                                       }\r
+                                       if ($this->versioningEnabled) {\r
+                                               // get workspaces Overlay\r
+                                               $GLOBALS['TSFE']->sys_page->versionOL($this->thisConf['catTable'],$row);\r
+                                       }\r
+                               }\r
+                               if(!$this->categoryArrayByUid[$row['uid']]){
+                                       $category = $this->createCategory($row);
+                                       $category->setHeaderStyle($this->thisConf['headerStyle']);
+                                       $category->setBodyStyle($this->thisConf['bodyStyle']);
+                                       if($row['uid_local']){
+                                               $this->categoryArrayByEventUid[$row['uid_local']] = $category;
+                                       }
+                                       $this->categoryArrayByUid[$row['uid']] = $category;
+                                       $this->categoryArrayByCalendarUid['0'.'###'.$this->thisConf['legendDescription']][] = $category->getUid();
+                               }
+                       }\r
+               }
+               return;
+       }
+       
+       function createCategory($row){
+               return t3lib_div::makeInstance('tx_cal_category_model',$row, $this->getServiceKey());
+       }
+       
+
+}
+
+if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/cal_ts_service/service/class.tx_cal_ts_category_service.php'])        {
+       include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/cal_ts_service/service/class.tx_cal_ts_category_service.php']);
+}
+?>
\ No newline at end of file
diff --git a/service/class.tx_cal_ts_service.php b/service/class.tx_cal_ts_service.php
new file mode 100755 (executable)
index 0000000..9241e6b
--- /dev/null
@@ -0,0 +1,446 @@
+<?php
+/***************************************************************
+* Copyright notice
+*
+* (c) 2005 All rights reserved
+*
+* You can redistribute this file and/or modify it under the terms of the
+* GNU General Public License as published by the Free Software Foundation;
+* either version 2 of the License, or (at your option) any later version.
+*
+* The GNU General Public License can be found at
+* http://www.gnu.org/copyleft/gpl.html.
+*
+* This file is distributed in the hope that it will be useful for ministry,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+* GNU General Public License for more details.
+*
+* This copyright notice MUST APPEAR in all copies of the file!
+***************************************************************/
+
+require_once(t3lib_extMgm::extPath('cal').'service/class.tx_cal_event_service.php');
+require_once(t3lib_extMgm::extPath('cal_ts_service').'model/class.tx_cal_ts_model.php');
+require_once(t3lib_extMgm::extPath('cal').'controller/class.tx_cal_functions.php');
+
+
+/**
+ * This model fetches all tt_news between a start- and endtime or by uid.
+ *
+ * @author Mario Matzulla <mario@matzullas.de>
+ * @package TYPO3
+ * @subpackage cal
+ */
+class tx_cal_ts_service extends tx_cal_event_service {
+
+       var $thisConf;
+       var $key = '';
+       
+       /**
+        *  Finds all events.
+        *
+        *  @return             array                   The array of events represented by the model.
+        */
+       function findAllWithin($start_date, $end_date, $pidList) {
+               $this->setStartAndEndPoint($start_date, $end_date);
+               $events = array();
+               if($this->conf['display.']){
+                       foreach($this->conf['display.'] as $this->key => $conf){
+                               $this->thisConf = $conf;
+                               $eventsFromService = $this->_findAllWithin($start_date->getDate(DATE_FORMAT_UNIXTIME), $end_date->getDate(DATE_FORMAT_UNIXTIME), $pidList);
+                               $this->mergeEvents($events,$eventsFromService);
+                       }
+               }
+
+               return $events;
+       }
+       
+       function _findAllWithin($start_date, $end_date, $pidList) {
+               $events = array();
+               
+               // with categories
+               $service = &$this->getCategoryService();
+               $categories = array();
+               $service->getCategoryArray($pidList, $categories);
+               $processedUids = array(0);
+               $where = $this->cObj->substituteMarkerArrayCached($this->thisConf['findAllWithinWhere'], array('###START###'=>$start_date,'###END###'=>$end_date), array(), array());
+               if($this->thisConf['enableLocalizationAndVersioning']){
+                       $where .= $this->getAdditionalWhereForLocalizationAndVersioning($this->thisConf['pidTable']);
+               }
+               if($this->thisConf['event_select_with_cat.']){
+                       $this->thisConf['event_select_with_cat.']['pidInList'] = $pidList;
+                       $this->thisConf['event_select_with_cat.']['andWhere'] = $where;
+                       $queryArray = $this->cObj->getQuery($this->thisConf['pidTable'],$this->thisConf['event_select_with_cat.'],true);
+       
+                       $result = $GLOBALS['TYPO3_DB']->exec_SELECT_queryArray($queryArray);
+                       
+                       $event = null;
+                       while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result)) {
+                               if(!in_array($row['uid'],$processedUids)){
+                                       if($this->thisConf['enableLocalizationAndVersioning']){
+                                               if ($GLOBALS['TSFE']->sys_language_content) {
+                                                       $row = $GLOBALS['TSFE']->sys_page->getRecordOverlay($this->thisConf['pidTable'], $row, $GLOBALS['TSFE']->sys_language_content, $GLOBALS['TSFE']->sys_language_contentOL, '');
+                                               }
+                                               if ($this->versioningEnabled) {
+                                                       // get workspaces Overlay
+                                                       $GLOBALS['TSFE']->sys_page->versionOL($this->thisConf['pidTable'],$row);
+                                               }
+                                       }
+                                       $row['ts_key'] = $this->key;
+                                       $row[$this->thisConf['startTimeField']] += tx_cal_functions::strtotimeOffset($row[$this->thisConf['startTimeField']]);
+                                       if($this->thisConf['endTimeField']){
+                                               $row[$this->thisConf['endTimeField']] += tx_cal_functions::strtotimeOffset($row[$this->thisConf['endTimeField']]);
+                                       }
+                                       $event = $this->createEvent($row, false);
+                                       if ($this->extConf['useNewRecurringModel']){
+                                               $this->recurringEvent($event);
+                                               $events_tmp = $this->getRecurringEventsFromIndex($event);
+                                       } else {
+                                               $events_tmp = $this->recurringEvent($event);
+                                       }
+                                       if(!empty($events)){
+                                               $this->mergeEvents($events,$events_tmp);
+                                       }else{
+                                               $events = $events_tmp;
+                                       }
+                                       $processedUids[] = $row['uid'];
+                               }
+                               if($categories[$this->key][0][$row['uid_foreign']]){
+                                       $event->addCategory($categories[$this->key][0][$row['uid_foreign']]);
+                               }
+                       }
+               }
+               // without categories
+               $this->thisConf['event_select.']['pidInList'] = $pidList;
+               $this->thisConf['event_select.']['andWhere'] = $where.' AND '.$this->thisConf['pidTable'].'.uid NOT IN ('.implode(',',$processedUids).')';
+               $queryArray = $this->cObj->getQuery($this->thisConf['pidTable'],$this->thisConf['event_select.'],true);
+               $result = $GLOBALS['TYPO3_DB']->exec_SELECT_queryArray($queryArray);
+               $processedUids = array();
+
+               while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result)) {
+                       if(!in_array($row['uid'],$processedUids)){
+                               if($this->thisConf['enableLocalizationAndVersioning']){
+                                       if ($GLOBALS['TSFE']->sys_language_content) {
+                                               $row = $GLOBALS['TSFE']->sys_page->getRecordOverlay($this->thisConf['pidTable'], $row, $GLOBALS['TSFE']->sys_language_content, $GLOBALS['TSFE']->sys_language_contentOL, '');
+                                       }
+                                       if ($this->versioningEnabled) {
+                                               // get workspaces Overlay
+                                               $GLOBALS['TSFE']->sys_page->versionOL($this->thisConf['pidTable'],$row);
+                                       }
+                               }
+                               $row['ts_key'] = $this->key;
+                               $row[$this->thisConf['startTimeField']] += tx_cal_functions::strtotimeOffset($row[$this->thisConf['startTimeField']]);
+                               if($this->thisConf['endTimeField']){
+                                       $row[$this->thisConf['endTimeField']] += tx_cal_functions::strtotimeOffset($row[$this->thisConf['endTimeField']]);
+                               }
+                               $event = $this->createEvent($row, false);
+
+                               if ($this->extConf['useNewRecurringModel']){
+                                       $this->recurringEvent($event);
+                                       $events_tmp = $this->getRecurringEventsFromIndex($event);
+                               } else {
+                                       $events_tmp = $this->recurringEvent($event);
+                               }
+                               if(!empty($events)){
+                                       $this->mergeEvents($events,$events_tmp);
+                               }else{
+                                       $events = $events_tmp;
+                               }
+                               $processedUids[] = $row['uid'];
+                       }
+               }
+               return $events;
+       }
+       
+       /**
+        *  Finds all events.
+        *
+        *  @return             array                   The array of events represented by the model.
+        */
+       function findAll($pidList) {
+               $events = array();
+               if($this->conf['display.']){
+                       foreach($this->conf['display.'] as $this->key => $conf){
+                               $this->thisConf = $conf;
+                               $eventsFromService = $this->_findAll($pidList);
+                               $this->mergeEvents($events,$eventsFromService);
+                       }
+               }
+               return $events;
+       }
+       
+       function _findAll($pidList){
+               $events = array();
+               
+               // Find records with categories
+               $service = &$this->getCategoryService();
+               $categories = array();
+               $service->getCategoryArray($pidList, $categories);
+               
+               $where = $this->cObj->substituteMarkerArrayCached($this->thisConf['findAll'], array('###START###'=>$start_date,'###END###'=>$end_date), array(), array());
+               if($this->thisConf['enableLocalizationAndVersioning']){
+                       $where .= $this->getAdditionalWhereForLocalizationAndVersioning($this->thisConf['pidTable']);
+               }
+               $this->thisConf['event_select_with_cat.']['pidInList'] = $pidList;
+               $this->thisConf['event_select_with_cat.']['andWhere'] = $where;
+               $queryArray = $this->cObj->getQuery($this->thisConf['pidTable'],$this->thisConf['event_select_with_cat.'],true);
+               $result = $GLOBALS['TYPO3_DB']->exec_SELECT_queryArray($queryArray);
+               $processedUids = array(0);
+               while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result)) {
+                       if(!in_array($row['uid'],$processedUids)){
+                               if($this->thisConf['enableLocalizationAndVersioning']){
+                                       if ($GLOBALS['TSFE']->sys_language_content) {
+                                               $row = $GLOBALS['TSFE']->sys_page->getRecordOverlay($this->thisConf['pidTable'], $row, $GLOBALS['TSFE']->sys_language_content, $GLOBALS['TSFE']->sys_language_contentOL, '');
+                                       }
+                                       if ($this->versioningEnabled) {
+                                               // get workspaces Overlay
+                                               $GLOBALS['TSFE']->sys_page->versionOL($this->thisConf['pidTable'],$row);
+                                       }
+                               }
+                               $row['ts_key'] = $this->key;
+                               $row[$this->thisConf['startTimeField']] += tx_cal_functions::strtotimeOffset($row[$this->thisConf['startTimeField']]);
+                               if($this->thisConf['endTimeField']){
+                                       $row[$this->thisConf['endTimeField']] += tx_cal_functions::strtotimeOffset($row[$this->thisConf['endTimeField']]);
+                               }
+                               $event = $this->createEvent($row, false);
+                               $events[gmdate('Ymd',$row[$this->thisConf['startTimeField']])][(gmdate('Hi',$row[$this->thisConf['startTimeField']]+$this->thisConf['defaultLength']))][$row['uid']] = $event;
+                               $processedUids[] = $row['uid'];
+                       }
+                       if($categories[$this->key][0][$row['uid_foreign']]){
+                               $event->addCategory($categories[$this->key][0][$row['uid_foreign']]);
+                       }
+               }
+               
+               // Find records without categories
+               $this->thisConf['event_select.']['pidInList'] = $pidList;
+               $this->thisConf['event_select.']['andWhere'] = ($where!=''?$where.' AND ':'').$this->thisConf['pidTable'].'.uid NOT IN ('.implode(',',$processedUids).')';
+               $queryArray = $this->cObj->getQuery($this->thisConf['pidTable'],$this->thisConf['event_select.'],true);
+
+               $result = $GLOBALS['TYPO3_DB']->exec_SELECT_queryArray($queryArray);
+               $processedUids = array();
+               while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result)) {
+                       if(!in_array($row['uid'],$processedUids)){
+                               if($this->thisConf['enableLocalizationAndVersioning']){
+                                       if ($GLOBALS['TSFE']->sys_language_content) {
+                                               $row = $GLOBALS['TSFE']->sys_page->getRecordOverlay($this->thisConf['pidTable'], $row, $GLOBALS['TSFE']->sys_language_content, $GLOBALS['TSFE']->sys_language_contentOL, '');
+                                       }
+                                       if ($this->versioningEnabled) {
+                                               // get workspaces Overlay
+                                               $GLOBALS['TSFE']->sys_page->versionOL($this->thisConf['pidTable'],$row);
+                                       }
+                               }
+                               $row['ts_key'] = $this->key;
+                               $row[$this->thisConf['startTimeField']] += tx_cal_functions::strtotimeOffset($row[$this->thisConf['startTimeField']]);
+                               if($this->thisConf['endTimeField']){
+                                       $row[$this->thisConf['endTimeField']] += tx_cal_functions::strtotimeOffset($row[$this->thisConf['endTimeField']]);
+                               }
+                               $events[gmdate('Ymd',$row[$this->thisConf['startTimeField']])][(gmdate('Hi',$row[$this->thisConf['startTimeField']]+$this->thisConf['defaultLength']))][$row['uid']] = $this->createEvent($row, false);
+                               $processedUids[] = $row['uid'];
+                       }
+               }
+               
+               return $events;
+       }
+       
+       /**
+        *  Finds a single event.
+        *
+        *  @return             object                  The event represented by the model.
+        */     
+       function find($uid, $pidList) {
+               $this->key = $this->controller->piVars['ts_table'].'.';
+               $service = &$this->getCategoryService();
+               $categories = array();
+               $service->getCategoryArray($pidList, $categories);
+               if($this->conf['display.'][$this->controller->piVars['ts_table'].'.']){
+                       $this->thisConf = $this->conf['display.'][$this->controller->piVars['ts_table'].'.'];
+                       $where = $this->cObj->substituteMarkerArrayCached($this->thisConf['findWhere'], array('###START###'=>$start_date,'###END###'=>$end_date,'###UID###'=>$this->controller->piVars['uid']), array(), array());
+                       if($this->thisConf['enableLocalizationAndVersioning']){
+                               $where .= $this->getAdditionalWhereForLocalizationAndVersioning($this->thisConf['pidTable']);
+                       }
+                       // find with
+                       $this->thisConf['event_select_with_cat.']['pidInList'] = $pidList;
+                       $this->thisConf['event_select_with_cat.']['andWhere'] = $where;
+                       $queryArray = $this->cObj->getQuery($this->thisConf['pidTable'],$this->thisConf['event_select_with_cat.'],true);
+                       $result = $GLOBALS['TYPO3_DB']->exec_SELECT_queryArray($queryArray);
+                       $event = null;
+                       $processedUids = array(0);
+                       while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result)) { 
+                               if(!in_array($row['uid'],$processedUids)){
+                                       if($this->thisConf['enableLocalizationAndVersioning']){
+                                               if ($GLOBALS['TSFE']->sys_language_content) {
+                                                       $row = $GLOBALS['TSFE']->sys_page->getRecordOverlay($this->thisConf['pidTable'], $row, $GLOBALS['TSFE']->sys_language_content, $GLOBALS['TSFE']->sys_language_contentOL, '');
+                                               }
+                                               if ($this->versioningEnabled) {
+                                                       // get workspaces Overlay
+                                                       $GLOBALS['TSFE']->sys_page->versionOL($this->thisConf['pidTable'],$row);
+                                               }
+                                       }
+                                       $row['ts_key'] = $this->key;
+                                       $row[$this->thisConf['startTimeField']] += tx_cal_functions::strtotimeOffset($row[$this->thisConf['startTimeField']]);
+                                       if($this->thisConf['endTimeField']){
+                                               $row[$this->thisConf['endTimeField']] += tx_cal_functions::strtotimeOffset($row[$this->thisConf['endTimeField']]);
+                                       }
+                                       $event = $this->createEvent($row, false);
+                                       $processedUids[] = $row['uid'];
+                               }
+                               if($categories[$this->key][0][$row['uid_foreign']]){
+                                       $event->addCategory($categories[$this->key][0][$row['uid_foreign']]);
+                               }
+                       }
+                       if($event){
+                               return $event;
+                       }
+                       
+                       // find without
+                       $this->thisConf['event_select.']['pidInList'] = $pidList;
+                       $this->thisConf['event_select.']['andWhere'] = $where.' AND '.$this->thisConf['pidTable'].'.uid NOT IN ('.implode(',',$processedUids).')';
+                       $queryArray = $this->cObj->getQuery($this->thisConf['pidTable'],$this->thisConf['event_select.'],true);
+                       $result = $GLOBALS['TYPO3_DB']->exec_SELECT_queryArray($queryArray);
+                       $events = array();
+                       $processedUids = array();
+                       while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result)) { 
+                               if($this->thisConf['enableLocalizationAndVersioning']){
+                                       if ($GLOBALS['TSFE']->sys_language_content) {
+                                               $row = $GLOBALS['TSFE']->sys_page->getRecordOverlay($this->thisConf['pidTable'], $row, $GLOBALS['TSFE']->sys_language_content, $GLOBALS['TSFE']->sys_language_contentOL, '');
+                                       }
+                                       if ($this->versioningEnabled) {
+                                               // get workspaces Overlay
+                                               $GLOBALS['TSFE']->sys_page->versionOL($this->thisConf['pidTable'],$row);
+                                       }
+                               }
+                               $row['ts_key'] = $this->key;
+                               $row[$this->thisConf['startTimeField']] += tx_cal_functions::strtotimeOffset($row[$this->thisConf['startTimeField']]);
+                               if($this->thisConf['endTimeField']){
+                                       $row[$this->thisConf['endTimeField']] += tx_cal_functions::strtotimeOffset($row[$this->thisConf['endTimeField']]);
+                               }
+                               $event = $this->createEvent($row, false);
+                       }
+                       return $event;
+               }
+               return null;
+       }
+       
+       function createEvent($row, $isException){
+               return t3lib_div :: makeInstance('tx_cal_ts_model',$row, $isException, $this->getServiceKey(), $this->thisConf);
+       }
+
+       
+       function search($pidList='', $starttime, $endtime, $searchword, $locationIds){
+               $events = array();
+               if($this->conf['display.']){
+                       foreach($this->conf['display.'] as $this->key => $conf){
+                               $this->thisConf = $conf;
+                               $eventsFromService = $this->_search($pidList, $starttime, $endtime, $searchword, $locationIds);
+                               $this->mergeEvents($events,$eventsFromService);
+                       }
+               }
+               return $events;
+       }
+       
+       function _search($pidList='', $starttime, $endtime, $searchword, $locationIds){
+               $events=array();
+               $where = '';
+               if($searchword!=''){
+                       $where = $this->searchWhere($searchword);
+               }
+               
+               $events = array();
+               // Find records with categories
+               $service = &$this->getCategoryService();
+               $categories = array();
+               $service->getCategoryArray($pidList, $categories);
+               
+               if($this->thisConf['enableLocalizationAndVersioning']){
+                       $where .= $this->getAdditionalWhereForLocalizationAndVersioning($this->thisConf['pidTable']);
+               }
+               $this->thisConf['event_select_with_cat.']['pidInList'] = $pidList;
+               $this->thisConf['event_select_with_cat.']['where'] = '1=1'.$where;
+               $queryArray = $this->cObj->getQuery($this->thisConf['pidTable'],$this->thisConf['event_select_with_cat.'],true);
+               $result = $GLOBALS['TYPO3_DB']->exec_SELECT_queryArray($queryArray);
+               $processedUids = array(0);
+               while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result)) {
+                       if(!in_array($row['uid'],$processedUids)){
+                               if($this->thisConf['enableLocalizationAndVersioning']){
+                                       if ($GLOBALS['TSFE']->sys_language_content) {
+                                               $row = $GLOBALS['TSFE']->sys_page->getRecordOverlay($this->thisConf['pidTable'], $row, $GLOBALS['TSFE']->sys_language_content, $GLOBALS['TSFE']->sys_language_contentOL, '');
+                                       }
+                                       if ($this->versioningEnabled) {
+                                               // get workspaces Overlay
+                                               $GLOBALS['TSFE']->sys_page->versionOL($this->thisConf['pidTable'],$row);
+                                       }
+                               }
+                               $row['ts_key'] = $this->key;
+                               $row[$this->thisConf['startTimeField']] += tx_cal_functions::strtotimeOffset($row[$this->thisConf['startTimeField']]);
+                               if($this->thisConf['endTimeField']){
+                                       $row[$this->thisConf['endTimeField']] += tx_cal_functions::strtotimeOffset($row[$this->thisConf['endTimeField']]);
+                               }
+                               $event = $this->createEvent($row, false);
+                               $events[gmdate('Ymd',$row[$this->thisConf['startTimeField']])][(gmdate('Hi',$row[$this->thisConf['startTimeField']]+$this->thisConf['defaultLength']))][$row['uid']] = $event;
+                               $processedUids[] = $row['uid'];
+                       }
+                       if($categories[$this->key][0][$row['uid_foreign']]){
+                               $event->addCategory($categories[$this->key][0][$row['uid_foreign']]);
+                       }
+               }
+               
+               // Find records without categories
+               $this->thisConf['event_select.']['pidInList'] = $pidList;
+               $this->thisConf['event_select.']['where'] = '1=1 '.$where.' AND '.$this->thisConf['pidTable'].'.uid NOT IN ('.implode(',',$processedUids).')';
+               $queryArray = $this->cObj->getQuery($this->thisConf['pidTable'],$this->thisConf['event_select.'],true);
+
+               $result = $GLOBALS['TYPO3_DB']->exec_SELECT_queryArray($queryArray);
+               $processedUids = array();
+               while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result)) {
+                       if(!in_array($row['uid'],$processedUids)){
+                               if($this->thisConf['enableLocalizationAndVersioning']){
+                                       if ($GLOBALS['TSFE']->sys_language_content) {
+                                               $row = $GLOBALS['TSFE']->sys_page->getRecordOverlay($this->thisConf['pidTable'], $row, $GLOBALS['TSFE']->sys_language_content, $GLOBALS['TSFE']->sys_language_contentOL, '');
+                                       }
+                                       if ($this->versioningEnabled) {
+                                               // get workspaces Overlay
+                                               $GLOBALS['TSFE']->sys_page->versionOL($this->thisConf['pidTable'],$row);
+                                       }
+                               }
+                               $row['ts_key'] = $this->key;
+                               $row[$this->thisConf['startTimeField']] += tx_cal_functions::strtotimeOffset($row[$this->thisConf['startTimeField']]);
+                               if($this->thisConf['endTimeField']){
+                                       $row[$this->thisConf['endTimeField']] += tx_cal_functions::strtotimeOffset($row[$this->thisConf['endTimeField']]);
+                               }
+                               $events[gmdate('Ymd',$row[$this->thisConf['startTimeField']])][(gmdate('Hi',$row[$this->thisConf['startTimeField']]+$this->thisConf['defaultLength']))][$row['uid']] = $this->createEvent($row, false);
+                               $processedUids[] = $row['uid'];
+                       }
+               }
+               
+               return $events;
+       }
+       
+       /**
+        * Generates a search where clause.
+        *
+        * @param       string          $sw: searchword(s)
+        * @return      string          querypart
+        */
+       function searchWhere($sw) {
+               $where = $this->cObj->searchWhere($sw, $this->thisConf['search.']['searchEventFieldList'], $this->thisConf['table']);
+               return $where;
+       }
+       
+       function &getCategoryService(){
+               if(is_object($this->categoryService)){
+                       return $this->categoryService;  
+               }
+               require_once(t3lib_extMgm::extPath('cal_ts_service').'service/class.tx_cal_ts_category_service.php');
+               $this->categoryService = & t3lib_div :: makeInstance('tx_cal_ts_category_service');
+               return $this->categoryService;
+       }
+
+}
+
+
+
+if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/cal_ts_service/service/class.tx_cal_ts_service.php']) {
+       include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/cal_ts_service/service/class.tx_cal_ts_service.php']);
+}
+
+?>
\ No newline at end of file
diff --git a/static/birthday/constants.txt b/static/birthday/constants.txt
new file mode 100755 (executable)
index 0000000..e020bb3
--- /dev/null
@@ -0,0 +1,10 @@
+plugin.tx_cal_controller.display.birthday {
+       # cat=Birthday Service for Calendar Base/general/birthday-1; type=boolean; label=Use external plugin for birthdays?: Show birthdays using a plugin other than Calendar Base.
+       externalPlugin = 0
+
+       # cat=Birthday Service for Calendar Base/general/birthday-2; type=integer; label=Page ID for birthdays: Individual birthdays are shown on this page. Only applicable if external plugins are enabled.   
+       externalPlugin.singleViewPid = 
+       
+       # cat=Birthday Service for Calendar Base/general/birthday-3; type=string; label=URL parameters for birthdays: These parameters are used in addition to the Page ID when linking to an individual birthday.
+       externalPlugin.additionalParams = 
+}
\ No newline at end of file
diff --git a/static/birthday/setup.txt b/static/birthday/setup.txt
new file mode 100755 (executable)
index 0000000..6a35680
--- /dev/null
@@ -0,0 +1,95 @@
+plugin.tx_cal_controller {
+       display {
+               birthday {
+                       # @description  This is the heart of the connection SQL. It will be used in conjunction with 
+                       #                               the view-where (findallWithinWhere, findAll and findWhere) to retrieve the according records.
+                       event_select {
+                               selectFields = fe_users.*, 'year' as freq, 20301231 as until, 1 as allday
+                       }
+                       
+                       # @description  Configure the table the records come from.
+                       pidTable = fe_users
+                       
+                       # @description  Define the where clause for the views: day, week, month, year, list, rss
+                       #                               Use ###START### and ###END### as marker to be replaced during runtime with the timeframe
+                       findAllWithinWhere = (fe_users.date_of_birth < ###START### OR fe_users.date_of_birth < ###END###) and fe_users.date_of_birth > 0
+                       
+                       # @description  Define the where clause for the ? view.
+                       #                               Use ###START### and ###END### as marker to be replaced during runtime with the timeframe
+                       findAll =
+                       
+                       # @description  Define the where clause for the single event views: event, ics
+                       #                               Use ###START### and ###END### as marker to be replaced during runtime with the timeframe
+                       findWhere = fe_users.uid = ###UID###
+                       
+                       # @description  Enable this to create a link to another page containing the single view of the external plugin.
+                       #                               Use ###DB_FIELD### to retrieve record related informations from the database (DB_FIELD is a placeholder)
+                       externalPlugin = {$plugin.tx_cal_controller.display.birthday.externalPlugin}
+                       
+                       externalPlugin {
+                               
+                               # @description  Define the pid for the external plugin single view
+                               singleViewPid = {$plugin.tx_cal_controller.display.birthday.externalPlugin.singleViewPid}
+                               
+                               # @description  Array containing the url parameter to be added to the url
+                               additionalParams = {$plugin.tx_cal_controller.display.birthday.externalPlugin.additionalParams}
+                       }
+                       
+                       # @description  Enables the localization and/or versioning of the result record
+                       enableLocalizationAndVersioning = 0
+
+                       # @description  Define the field containing the timestamp for the start time
+                       startTimeField = date_of_birth
+                       
+                       # @description  Define the field containing the timestamp for the end time
+                       endTimeField = date_of_birth
+                       
+                       # @description  If there is no end time, you can define a default length (in minutes)
+                       defaultLength = 0
+                       
+                       # @description  For a quick and easy integration, map your record fields to the standard event fields
+                       #                               You can always use ###DB_FIELD### (where DB_FIELD is a placeholder for a database row entry) to insert database values  
+                       fieldMapping {
+                               title = name
+                               description = address
+                               location =
+                               organizer =
+                               image = image
+                       }
+                       
+                       # @description  The template to be used with these records
+                       template = EXT:cal_ts_service/template/ts.tmpl
+                       
+                       # @description  The header style class to be used
+                       headerStyle = pink_catheader
+                       
+                       # @description  The body style class to be used
+                       bodyStyle = pink_catbody
+                       
+                       # @description  The title in the legend description for these records
+                       legendDescription = Birthday
+                       
+                       search {
+                               # @description  The fields, which are allowed to be searched through
+                               searchEventFieldList = fe_users.name
+                       }
+                                               
+                       # @description  Retrieving and adopting the event configuration for the event view.
+                       event {
+                               event < plugin.tx_cal_controller.view.event.event
+                               event {
+                                       # @description  The default image path is related to the tx_cal_{object type}. Therefore the path has to be overwritten
+                                       image.overridePath = uploads/pics/
+                                       alldayTitle.dataWrap = {LLL:EXT:cal_ts_service/locallang.xml:l_birthday}:&nbsp; |
+                               }
+                       }
+                       
+                       month.event < plugin.tx_cal_controller.display.birthday.event.event
+                       week.event < plugin.tx_cal_controller.display.birthday.event.event
+                       day.event < plugin.tx_cal_controller.display.birthday.event.event
+                       list.event < plugin.tx_cal_controller.display.birthday.event.event
+               }
+       }
+}
+
+calRSS.10.display < plugin.tx_cal_controller.display
\ No newline at end of file
diff --git a/static/mbl_newsevent/constants.txt b/static/mbl_newsevent/constants.txt
new file mode 100755 (executable)
index 0000000..e829abb
--- /dev/null
@@ -0,0 +1,10 @@
+plugin.tx_cal_controller.display.mbl_newsevent {
+       # cat=News Event Service for Calendar Base/general/mblnewsevent-1; type=boolean; label=Use external plugin for news events?: Show news events using a plugin other than Calendar Base.
+       externalPlugin = 0
+
+       # cat=News Event Service for Calendar Base/general/mblnewsevent-2; type=integer; label=Page ID for news events: Individual news events are shown on this page. Only applicable if external plugins are enabled. 
+       externalPlugin.singleViewPid = 
+       
+       # cat=News Event Service for Calendar Base/general/mblnewsevent-3; type=string; label=URL parameters for news events: These parameters are used in addition to the Page ID when linking to an individual news event.
+       externalPlugin.additionalParams = tx_ttnews[tt_news]=###UID###
+}
\ No newline at end of file
diff --git a/static/mbl_newsevent/setup.txt b/static/mbl_newsevent/setup.txt
new file mode 100755 (executable)
index 0000000..4c3bf94
--- /dev/null
@@ -0,0 +1,106 @@
+plugin.tx_cal_controller {
+       display {
+               mbl_newsevent {
+                       # @description  This is the heart of the connection SQL. It will be used in conjunction with 
+                       #                               the view-where (findallWithinWhere, findAll and findWhere) to retrieve the according records.
+                       event_select {
+                               selectFields = tt_news.*, tx_mblnewsevent_from + tx_mblnewsevent_fromtime as tx_mblnewsevent_start, tx_mblnewsevent_to + tx_mblnewsevent_totime as tx_mblnewsevent_end
+                       }
+                       
+                       # @description  This is the heart of the connection SQL. It will be used in conjunction with 
+                       #                               the view-where (findallWithinWhere, findAll and findWhere) to retrieve the according records plus their categories.
+                       event_select_with_cat {
+                               selectFields = tt_news.*,tt_news_cat_mm.uid_foreign, tx_mblnewsevent_from + tx_mblnewsevent_fromtime as tx_mblnewsevent_start, tx_mblnewsevent_to + tx_mblnewsevent_totime as tx_mblnewsevent_end
+                               leftjoin = tt_news_cat_mm ON (tt_news.uid = tt_news_cat_mm.uid_local) JOIN tt_news_cat ON (tt_news_cat_mm.uid_foreign = tt_news_cat.uid)
+                       }
+                       
+                       # @description  Configure the table the records come from.
+                       pidTable = tt_news
+                       
+                       # @description  Define the where clause for the views: day, week, month, year, list, rss
+                       #                               Use ###START### and ###END### as marker to be replaced during runtime with the timeframe
+                       findAllWithinWhere = tt_news.tx_mblnewsevent_isevent = 1 AND ((tx_mblnewsevent_from >= ###START### AND tx_mblnewsevent_from < ###END###) OR (tx_mblnewsevent_to < ###END### AND tx_mblnewsevent_to > ###START###)  OR (tx_mblnewsevent_to > ###END### AND tx_mblnewsevent_from < ###START###))
+                       
+                       # @description  Define the where clause for the ? view.
+                       #                               Use ###START### and ###END### as marker to be replaced during runtime with the timeframe
+                       findAll =
+                       
+                       # @description  Define the where clause for the single event views: event, ics
+                       #                               Use ###START### and ###END### as marker to be replaced during runtime with the timeframe
+                       findWhere = tt_news.uid = ###UID### AND tt_news.tx_mblnewsevent_isevent = 1
+                       
+                       # @description  Enable this to create a link to another page containing the single view of the external plugin.
+                       #                               Use ###DB_FIELD### to retrieve record related informations from the database (DB_FIELD is a placeholder)
+                       externalPlugin = {$plugin.tx_cal_controller.display.mbl_newsevent.externalPlugin}
+                       
+                       externalPlugin {
+                               
+                               # @description  Define the pid for the external plugin single view
+                               singleViewPid = {$plugin.tx_cal_controller.display.mbl_newsevent.externalPlugin.singleViewPid}
+                               
+                               # @description  Array containing the url paramter to be added to the url
+                               additionalParams = {$plugin.tx_cal_controller.display.mbl_newsevent.externalPlugin.additionalParams}
+                       }
+                       
+                       # @description  Enables the localization and/or versioning of the result record
+                       enableLocalizationAndVersioning = 0
+
+                       # @description  Define the field containing the timestamp for the start time
+                       startTimeField = tx_mblnewsevent_start
+                       
+                       # @description  Define the field containing the timestamp for the end time
+                       endTimeField = tx_mblnewsevent_end
+                       
+                       # @description  If there is no end time, you can define a default length (in minutes)
+                       defaultLength = 0
+                       
+                       # @description  For a quick and easy integration, map your record fields to the standard event fields
+                       #                               You can always use ###DB_FIELD### (where DB_FIELD is a placeholder for a database row entry) to insert database values  
+                       fieldMapping {
+                               title = title
+                               description = bodytext
+                               location =
+                               organizer =
+                               image = image
+                       }
+                       
+                       # @description  The template to be used with these records
+                       template = EXT:cal_ts_service/template/ts.tmpl
+                       
+                       # @description  The header style class to be used
+                       headerStyle = green_catheader
+                       
+                       # @description  The body style class to be used
+                       bodyStyle = green_catbody
+                       
+                       # @description  The title in the legend description for these records
+                       legendDescription = News Event
+                       
+                       search {
+                               # @description  The fields, which are allowed to be searched through
+                               searchEventFieldList = tt_news.title,tt_news.bodytext
+                       }
+                       
+                       # @description  Define the SQL to retrieve the categories
+                       cat_select {
+                               selectFields = tt_news_cat.*,tt_news_cat_mm.uid_local
+                               leftjoin = tt_news_cat_mm ON (tt_news_cat_mm.uid_foreign = tt_news_cat.uid)
+                               andWhere = 
+                       }
+                       
+                       # @description  The table containing the category records
+                       catTable = tt_news_cat
+                       
+                       # @description  Retrieving and adopting the event configuration for the event view.
+                       event {
+                               event < plugin.tx_cal_controller.view.event.event
+                               event {
+                                       # @description  The default image path is related to the tx_cal_{object type}. Therefore the path has to be overwritten
+                                       image.overridePath = uploads/pics/
+                               }
+                       }
+               }
+       }
+}
+
+calRSS.10.display < plugin.tx_cal_controller.display
\ No newline at end of file
diff --git a/static/tt_news/constants.txt b/static/tt_news/constants.txt
new file mode 100755 (executable)
index 0000000..76fa868
--- /dev/null
@@ -0,0 +1,10 @@
+plugin.tx_cal_controller.display.tt_news {
+       # cat=News Service for Calendar Base/general/ttnews-1; type=boolean; label=Use external plugin for news?: Show news articles using a plugin other than Calendar Base.
+       externalPlugin = 0
+
+       # cat=News Service for Calendar Base/general/ttnews-2; type=integer; label=Page ID for news: Individual news articles are shown on this page. Only applicable if external plugins are enabled.  
+       externalPlugin.singleViewPid = 
+       
+       # cat=News Service for Calendar Base/general/ttnews-3; type=string; label=URL parameters for news: These parameters are used in addition to the Page ID when linking to an individual news article.
+       externalPlugin.additionalParams = tx_ttnews[tt_news]=###UID###
+}
\ No newline at end of file
diff --git a/static/tt_news/setup.txt b/static/tt_news/setup.txt
new file mode 100755 (executable)
index 0000000..6825df5
--- /dev/null
@@ -0,0 +1,109 @@
+plugin.tx_cal_controller {
+       display {
+               tt_news {
+                       # @description  This is the heart of the connection SQL. It will be used in conjunction with 
+                       #                               the view-where (findallWithinWhere, findAll and findWhere) to retrieve the according records.
+                       event_select {
+                               selectFields = tt_news.*
+                       }
+                       
+                       # @description  This is the heart of the connection SQL. It will be used in conjunction with 
+                       #                               the view-where (findallWithinWhere, findAll and findWhere) to retrieve the according records plus their categories.
+                       event_select_with_cat {
+                               selectFields = tt_news.*,tt_news_cat_mm.uid_foreign
+                               leftjoin = tt_news_cat_mm ON (tt_news.uid = tt_news_cat_mm.uid_local) JOIN tt_news_cat ON (tt_news_cat_mm.uid_foreign = tt_news_cat.uid)
+                       }
+                       
+                       # @description  Configure the table the records come from.
+                       pidTable = tt_news
+                       
+                       # @description  Define the where clause for the views: day, week, month, year, list, rss
+                       #                               Use ###START### and ###END### as marker to be replaced during runtime with the timeframe
+                       findAllWithinWhere = ((tt_news.datetime >=###START### AND tt_news.datetime+3600<=###END###) OR (tt_news.datetime+3600<=###END### AND tt_news.datetime+3600>=###START###) OR (tt_news.datetime+3600>=###END### AND tt_news.datetime<=###START###))
+                       
+                       # @description  Define the where clause for the ? view.
+                       #                               Use ###START### and ###END### as marker to be replaced during runtime with the timeframe
+                       findAll =
+                       
+                       # @description  Define the where clause for the single event views: event, ics
+                       #                               Use ###START### and ###END### as marker to be replaced during runtime with the timeframe
+                       findWhere = tt_news.uid = ###UID###
+                       
+                       # @description  Enable this to create a link to another page containing the single view of the external plugin.
+                       #                               Use ###DB_FIELD### to retrieve record related informations from the database (DB_FIELD is a placeholder)
+                       externalPlugin = {$plugin.tx_cal_controller.display.tt_news.externalPlugin}
+                       
+                       externalPlugin {
+                               
+                               # @description  Define the pid for the external plugin single view
+                               singleViewPid = {$plugin.tx_cal_controller.display.tt_news.externalPlugin.singleViewPid}
+                               
+                               # @description  Array containing the url paramter to be added to the url
+                               additionalParams = {$plugin.tx_cal_controller.display.tt_news.externalPlugin.additionalParams}
+                       }
+                       
+                       # @description  Enables the localization and/or versioning of the result record
+                       enableLocalizationAndVersioning = 0
+                       
+                       # @description  Enables the localization and/or versioning of the category result record
+                       enableLocalizationAndVersioningCat = 0
+
+                       # @description  Define the field containing the timestamp for the start time
+                       startTimeField = datetime
+                       
+                       # @description  Define the field containing the timestamp for the end time
+                       endTimeField =
+                       
+                       # @description  If there is no end time, you can define a default length (in minutes)
+                       defaultLength = 180
+                       
+                       # @description  For a quick and easy integration, map your record fields to the standard event fields
+                       #                               You can always use ###DB_FIELD### (where DB_FIELD is a placeholder for a database row entry) to insert database values  
+                       fieldMapping {
+                               title = title
+                               description = bodytext
+                               location =
+                               organizer =
+                               image = image
+                       }
+                       
+                       # @description  The template to be used with these records
+                       template = EXT:cal_ts_service/template/ts.tmpl
+                       
+                       # @description  The header style class to be used
+                       headerStyle = red_catheader
+                       
+                       # @description  The body style class to be used
+                       bodyStyle = red_catbody
+                       
+                       # @description  The title in the legend description for these records
+                       legendDescription = News
+                       
+                       search {
+                               # @description  The fields, which are allowed to be searched through
+                               searchEventFieldList = tt_news.title,tt_news.bodytext
+                       }
+                       
+                       # @description  Define the SQL to retrieve the categories
+                       cat_select {
+                               selectFields = tt_news_cat.*,tt_news_cat_mm.uid_local
+                               leftjoin = tt_news_cat_mm ON (tt_news_cat_mm.uid_foreign = tt_news_cat.uid)
+                               andWhere = 
+                       }
+                       
+                       # @description  The table containing the category records
+                       catTable = tt_news_cat
+                       
+                       # @description  Retrieving and adopting the event configuration for the event view.
+                       event {
+                               event < plugin.tx_cal_controller.view.event.event
+                               event {
+                                       # @description  The default image path is related to the tx_cal_{object type}. Therefore the path has to be overwritten
+                                       image.overridePath = uploads/pics/
+                               }
+                       }
+               }
+       }
+}
+
+calRSS.10.display < plugin.tx_cal_controller.display
\ No newline at end of file
diff --git a/static/tt_products/constants.txt b/static/tt_products/constants.txt
new file mode 100755 (executable)
index 0000000..8a4a8af
--- /dev/null
@@ -0,0 +1,10 @@
+plugin.tx_cal_controller.display.tt_products {
+       # cat=Products Service for Calendar Base/general/ttproducts-1; type=boolean; label=Use external plugin for products?: Show products using a plugin other than Calendar Base.
+       externalPlugin = 0
+
+       # cat=Products Service for Calendar Base/general/ttproducts-2; type=integer; label=Page ID for products: Individual products are shown on this page. Only applicable if external plugins are enabled.   
+       externalPlugin.singleViewPid = 
+       
+       # cat=Products Service for Calendar Base/general/ttproducts-3; type=string; label=URL Parameters for products: These parameters are used in addition to the Page ID when linking to an individual product.
+       externalPlugin.additionalParams = tx_ttproducts_pi1[product]=###UID###
+}
\ No newline at end of file
diff --git a/static/tt_products/setup.txt b/static/tt_products/setup.txt
new file mode 100755 (executable)
index 0000000..04e1ae6
--- /dev/null
@@ -0,0 +1,105 @@
+plugin.tx_cal_controller {
+       display {
+               tt_products {
+                       # @description  This is the heart of the connection SQL. It will be used in conjunction with 
+                       #                               the view-where (findallWithinWhere, findAll and findWhere) to retrieve the according records.
+                       event_select {
+                               selectFields = tt_products.*
+                       }
+                       
+                       # @description  This is the heart of the connection SQL. It will be used in conjunction with 
+                       #                               the view-where (findallWithinWhere, findAll and findWhere) to retrieve the according records plus their categories.
+                       event_select_with_cat {
+                       }
+                       
+                       # @description  Configure the table the records come from.
+                       pidTable = tt_products
+                       
+                       # @description  Define the where clause for the views: day, week, month, year, list, rss
+                       #                               Use ###START### and ###END### as marker to be replaced during runtime with the timeframe
+                       findAllWithinWhere = ((tt_products.sellstarttime>=###START### AND tt_products.sellstarttime<###END###) OR (tt_products.sellendtime<###END### AND tt_products.sellendtime>###START###) OR (tt_products.sellendtime>###END### AND tt_products.sellstarttime<###START###))
+                       
+                       # @description  Define the where clause for the single event views: event, ics
+                       #                               Use ###START### and ###END### as marker to be replaced during runtime with the timeframe
+                       findWhere = tt_products.uid = ###UID###
+                       
+                       # @description  Define the field containing the timestamp for the start time
+                       startTimeField = sellstarttime
+                       
+                       # @description  Define the field containing the timestamp for the end time
+                       endTimeField = sellendtime
+                       
+                       # @description  Enable this to create a link to another page containing the single view of the external plugin.
+                       #                               Use ###DB_FIELD### to retrieve record related informations from the database (DB_FIELD is a placeholder)
+                       externalPlugin = {$plugin.tx_cal_controller.display.tt_products.externalPlugin}
+                       
+                       externalPlugin {
+                               
+                               # @description  Define the pid for the external plugin single view
+                               singleViewPid = {$plugin.tx_cal_controller.display.tt_products.externalPlugin.singleViewPid}
+                               
+                               # @description  String containing the url paramter to be added to the url
+                               additionalParams = {$plugin.tx_cal_controller.display.tt_products.externalPlugin.additionalParams}
+                       }
+                       
+                       # @description  Enables the localization and/or versioning of the result record
+                       enableLocalizationAndVersioning = 0
+                       
+                       # @description  If there is no end time, you can define a default length (in minutes)
+                       defaultLength = 
+                                               
+                       # @description  For a quick and easy integration, map your record fields to the standard event fields
+                       #                               You can always use ###DB_FIELD### (where DB_FIELD is a placeholder for a database row entry) to insert database values  
+                       fieldMapping {
+                               title = title
+                               description = note
+                               location =
+                               organizer =
+                               image = image
+                       }
+                       
+                       # @description  The template to be used with these records
+                       template = EXT:cal_ts_service/template/ts.tmpl
+                       
+                       # @description  The header style class to be used
+                       headerStyle = green_catheader
+                       
+                       # @description  The body style class to be used
+                       bodyStyle = green_catbody
+                       
+                       # @description  The title in the legend description for these records
+                       legendDescription = Angebote
+                       
+                       search {
+                               # @description  The fields, which are allowed to be searched through
+                               searchEventFieldList = tt_products.title,tt_products.note
+                       }
+                       
+                       # @description  Define the SQL to retrieve the categories
+                       cat_select { 
+                       }
+                       
+                       # @description  The table containing the category records
+                       catTable = 
+                       
+                       # @description  Retrieving the event configuration for the event view.
+                       event {
+                               event < plugin.tx_cal_controller.view.event.event
+                               event {
+                                       # @description  The default image path is related to the tx_cal_{object type}. Therefore the path has to be overwritten
+                                       image.overridePath = uploads/pics/
+                               }
+                       }
+                       list {
+                               event < plugin.tx_cal_controller.view.list.event
+                               event {
+                                       # @description  The default image path is related to the tx_cal_{object type}. Therefore the path has to be overwritten
+                                       image.overridePath = uploads/pics/
+                               }
+                       }
+                       rss.event < plugin.tx_cal_controller.view.rss.event
+               }
+       }
+}
+
+calRSS.10.display < plugin.tx_cal_controller.display
\ No newline at end of file
diff --git a/static/tx_seminars/constants.txt b/static/tx_seminars/constants.txt
new file mode 100755 (executable)
index 0000000..1f0381f
--- /dev/null
@@ -0,0 +1,10 @@
+plugin.tx_cal_controller.display.tx_seminars {
+       # cat=Seminar Service for Calendar Base/general/txseminars-1; type=boolean; label=Use external plugin for seminars?: Show seminars using a plugin other than Calendar Base.
+       externalPlugin = 0
+
+       # cat=Seminar Service for Calendar Base/general/txseminars-2; type=integer; label=Page ID for seminars: Individual seminars are shown on this page. Only applicable if external plugins are enabled.    
+       externalPlugin.singleViewPid = 
+       
+       # cat=Seminar Service for Calendar Base/general/txseminars-3; type=string; label=URL Parameters for seminars: These parameters are used in addition to the Page ID when linking to an individual seminar.
+       externalPlugin.additionalParams = tx_seminars_pi1[showUid]=###UID###
+}
\ No newline at end of file
diff --git a/static/tx_seminars/setup.txt b/static/tx_seminars/setup.txt
new file mode 100755 (executable)
index 0000000..f98aac8
--- /dev/null
@@ -0,0 +1,135 @@
+plugin.tx_cal_controller {
+       display {
+               seminars {
+                       
+                       # @description  This is the heart of the connection SQL. It will be used in conjunction with 
+                       #                               the view-where (findallWithinWhere, findAll and findWhere) to retrieve the according records.
+                       event_select {
+                               selectFields = tx_seminars_seminars.*, tx_seminars_timeslots.*, tx_seminars_timeslots.begin_date as bgndt, tx_seminars_timeslots.end_date as nddt, tx_seminars_seminars.title as mytitle, tx_seminars_timeslots.begin_date as my_startdate, tx_seminars_timeslots.end_date as my_enddate
+                               leftjoin = tx_seminars_timeslots ON (tx_seminars_seminars.uid=tx_seminars_timeslots.seminar)
+                       }
+                       
+                       # @description  This is the heart of the connection SQL. It will be used in conjunction with 
+                       #                               the view-where (findallWithinWhere, findAll and findWhere) to retrieve the according records plus their categories.
+                       event_select_with_cat {
+                       }
+                       
+                       # @description  Configure the table the records come from.
+                       pidTable = tx_seminars_seminars
+                       
+                       # @description  Define the where clause for the views: day, week, month, year, list, rss
+                       #                               Use ###START### and ###END### as marker to be replaced during runtime with the timeframe
+                       findAllWithinWhere = ((tx_seminars_timeslots.begin_date>=###START### AND tx_seminars_timeslots.begin_date<###END###) OR (tx_seminars_timeslots.end_date<###END### AND tx_seminars_timeslots.end_date>###START###)  OR (tx_seminars_timeslots.end_date>###END### AND tx_seminars_timeslots.begin_date<###START###))
+                       
+                       # @description  Define the where clause for the ? view.
+                       #                               Use ###START### and ###END### as marker to be replaced during runtime with the timeframe
+                       findAll =
+                       
+                       # @description  Define the where clause for the single event views: event, ics
+                       #                               Use ###START### and ###END### as marker to be replaced during runtime with the timeframe
+                       findWhere = tx_seminars_seminars.uid = ###UID###
+                       
+                       # @description  Enable this to create a link to another page containing the single view of the external plugin.
+                       #                               Use ###DB_FIELD### to retrieve record related informations from the database (DB_FIELD is a placeholder)
+                       externalPlugin = {$plugin.tx_cal_controller.display.tx_seminars.externalPlugin}
+                       
+                       externalPlugin {
+                               
+                               # @description  Define the pid for the external plugin single view
+                               singleViewPid = {$plugin.tx_cal_controller.display.tx_seminars.externalPlugin.singleViewPid}
+                               
+                               # @description  Array containing the url paramter to be added to the url
+                               additionalParams = {$plugin.tx_cal_controller.display.tx_seminars.externalPlugin.additionalParams}
+                       }
+                       
+                       # @description  Enables the localization and/or versioning of the result record
+                       enableLocalizationAndVersioning = 0
+                       
+                       # @description  Define the field containing the timestamp for the start time
+                       startTimeField = my_startdate
+                       
+                       # @description  Define the field containing the timestamp for the end time
+                       endTimeField = my_enddate
+                       
+                       # @description  If there is no end time, you can define a default length (in minutes)
+                       defaultLength = 180
+                                               
+                       # @description  For a quick and easy integration, map your record fields to the standard event fields
+                       #                               You can always use ###DB_FIELD### (where DB_FIELD is a placeholder for a database row entry) to insert database values  
+                       fieldMapping {
+                               title = mytitle
+                               description = description
+                               location =
+                               organizer =
+                               image = image
+                       }
+                       
+                       # @description  The template to be used with these records
+                       template = EXT:cal_ts_service/template/ts.tmpl
+                       
+                       # @description  The header style class to be used
+                       headerStyle = yellow_catheader
+                       
+                       # @description  The body style class to be used
+                       bodyStyle = yellow_catbody
+                       
+                       # @description  The title in the legend description for these records
+                       legendDescription = Seminar
+                       
+                       search {
+                               # @description  The fields, which are allowed to be searched through
+                               searchEventFieldList = tx_seminars.title,tx_seminars.description
+                       }
+                       
+                       # @description  Define the SQL to retrieve the categories
+                       cat_select { 
+                       }
+                       
+                       # @description  The table containing the category records
+                       catTable = 
+                       
+                       # @description  Retrieving the event configuration for the event view.
+                       event {
+                               event < plugin.tx_cal_controller.view.event.event
+                               event {
+                                       # @description  The default image path is related to the tx_cal_{object type}. Therefore the path has to be overwritten
+                                       image.overridePath = uploads/pics/
+                               }
+                       }
+                       # @description  Retrieving the event configuration for the event view.
+                       list {
+                               event < plugin.tx_cal_controller.view.list.event
+                               event {
+                                       # @description  The default image path is related to the tx_cal_{object type}. Therefore the path has to be overwritten
+                                       image.overridePath = uploads/pics/
+                               }
+                       }
+                       rss.event < plugin.tx_cal_controller.view.rss.event
+               }
+
+               seminars2 < plugin.tx_cal_controller.display.seminars
+               seminars2 {
+                       # @description  This is the heart of the connection SQL. It will be used in conjunction with 
+                       #                               the view-where (findallWithinWhere, findAll and findWhere) to retrieve the according records.
+                       event_select {
+                               selectFields = tx_seminars_seminars.*, tx_seminars_seminars.title as mytitle
+                       }
+                       
+                       # @description  Define the where clause for the views: day, week, month, year, list, rss
+                       #                               Use ###START### and ###END### as marker to be replaced during runtime with the timeframe
+                       findAllWithinWhere = ((tx_seminars_seminars.begin_date>=###START### AND tx_seminars_seminars.begin_date<###END###) OR (tx_seminars_seminars.end_date<###END### AND tx_seminars_seminars.end_date>###START###) OR (tx_seminars_seminars.end_date>###END### AND tx_seminars_seminars.begin_date<###START###))
+                       
+                       # @description  Define the where clause for the single event views: event, ics
+                       #                               Use ###START### and ###END### as marker to be replaced during runtime with the timeframe
+                       findWhere = tx_seminars_seminars.uid = ###UID###
+                       
+                       # @description  Define the field containing the timestamp for the start time
+                       startTimeField = begin_date
+                       
+                       # @description  Define the field containing the timestamp for the end time
+                       endTimeField = end_date
+               }
+       }
+}
+
+calRSS.10.display < plugin.tx_cal_controller.display
\ No newline at end of file
diff --git a/static/wec_sermons/constants.txt b/static/wec_sermons/constants.txt
new file mode 100755 (executable)
index 0000000..81893dc
--- /dev/null
@@ -0,0 +1,9 @@
+plugin.tx_cal_controller.display.wec_sermons {
+       # cat=Sermons Service for Calendar Base/general/wecsermons-1; type=boolean; label=Use external plugin for sermons?: Show sermons using a plugin other than Calendar Base.
+       externalPlugin = 0
+
+       # cat=Sermons Service for Calendar Base/general/wecsermons-2; type=integer; label=Page ID for sermons: Individual sermons are shown on this page. Only applicable if external plugins are enabled.      
+       externalPlugin.singleViewPid = 
+       
+       # cat=Sermons Service for Calendar Base/general/wecsermons-3; type=string; label=URL Parameters for sermons: These parameters are used in addition to the Page ID when linking to an individual sermon.
+       externalPlugin.additionalParams = tx_wecsermons_pi1[showUid]=###UID###&tx_wecsermons_pi1[recordType]=tx_wecsermons_sermons
\ No newline at end of file
diff --git a/static/wec_sermons/setup.txt b/static/wec_sermons/setup.txt
new file mode 100755 (executable)
index 0000000..e905853
--- /dev/null
@@ -0,0 +1,101 @@
+plugin.tx_cal_controller {
+       display {
+               wec_sermons {
+                       # @description  This is the heart of the connection SQL. It will be used in conjunction with 
+                       #                               the view-where (findallWithinWhere, findAll and findWhere) to retrieve the according records.
+                       event_select {
+                               selectFields = tx_wecsermons_sermons.*, 1 AS allday
+                       }
+                       
+                       # @description  This is the heart of the connection SQL. It will be used in conjunction with 
+                       #                               the view-where (findallWithinWhere, findAll and findWhere) to retrieve the according records plus their categories.
+                       event_select_with_cat {
+                       }
+                       
+                       # @description  Configure the table the records come from.
+                       pidTable = tx_wecsermons_sermons
+                       
+                       # @description  Define the where clause for the views: day, week, month, year, list, rss
+                       #                               Use ###START### and ###END### as marker to be replaced during runtime with the timeframe
+                       findAllWithinWhere = ((tx_wecsermons_sermons.occurrence_date >=###START### AND tx_wecsermons_sermons.occurrence_date+3600<=###END###) OR (tx_wecsermons_sermons.occurrence_date+3600<=###END### AND tx_wecsermons_sermons.occurrence_date+3600>=###START###) OR (tx_wecsermons_sermons.occurrence_date+3600>=###END### AND tx_wecsermons_sermons.occurrence_date<=###START###))
+                       
+                       # @description  Define the where clause for the ? view.
+                       #                               Use ###START### and ###END### as marker to be replaced during runtime with the timeframe
+                       findAll =
+                       
+                       # @description  Define the where clause for the single event views: event, ics
+                       #                               Use ###START### and ###END### as marker to be replaced during runtime with the timeframe
+                       findWhere = tx_wecsermons_sermons.uid = ###UID###
+                       
+                       # @description  Enable this to create a link to another page containing the single view of the external plugin.
+                       #                               Use ###DB_FIELD### to retrieve record related informations from the database (DB_FIELD is a placeholder)
+                       externalPlugin = {$plugin.tx_cal_controller.display.wec_sermons.externalPlugin}
+                       
+                       externalPlugin {
+                               
+                               # @description  Define the pid for the external plugin single view
+                               singleViewPid = {$plugin.tx_cal_controller.display.wec_sermons.externalPlugin.singleViewPid}
+                               
+                               # @description  Array containing the url paramter to be added to the url
+                               additionalParams = {$plugin.tx_cal_controller.display.wec_sermons.externalPlugin.additionalParams}
+                       }
+                       
+                       # @description  Enables the localization and/or versioning of the result record
+                       enableLocalizationAndVersioning = 0
+
+                       # @description  Define the field containing the timestamp for the start time
+                       startTimeField = occurrence_date
+                       
+                       # @description  Define the field containing the timestamp for the end time
+                       endTimeField = occurrence_date
+                       
+                       # @description  If there is no end time, you can define a default length (in minutes)
+                       defaultLength = 0
+                       
+                       # @description  For a quick and easy integration, map your record fields to the standard event fields
+                       #                               You can always use ###DB_FIELD### (where DB_FIELD is a placeholder for a database row entry) to insert database values  
+                       fieldMapping {
+                               title = title
+                               description = description
+                               location =
+                               organizer =
+                               image = graphic
+                       }
+                       
+                       # @description  The template to be used with these records
+                       template = EXT:cal_ts_service/template/ts.tmpl
+                       
+                       # @description  The header style class to be used
+                       headerStyle = blue_catheader
+                       
+                       # @description  The body style class to be used
+                       bodyStyle = blue_catbody
+                       
+                       # @description  The title in the legend description for these records
+                       legendDescription = Sermons
+                       
+                       search {
+                               # @description  The fields, which are allowed to be searched through
+                               searchEventFieldList = tx_wecsermons_sermons.title,tx_wecsermons_sermons.description,tx_wecsermons_sermons.keywords
+                       }
+                       
+                       # @description  Define the SQL to retrieve the categories
+                       cat_select {
+                       }
+                       
+                       # @description  The table containing the category records
+                       catTable =
+                       
+                       # @description  Retrieving and adopting the event configuration for the event view.
+                       event {
+                               event < plugin.tx_cal_controller.view.event.event
+                               event {
+                                       # @description  The default image path is related to the tx_cal_{object type}. Therefore the path has to be overwritten
+                                       image.overridePath = uploads/tx_wecsermons/
+                               }
+                       }
+               }
+       }
+}
+
+calRSS.10.display < plugin.tx_cal_controller.display
\ No newline at end of file
diff --git a/template/ts.tmpl b/template/ts.tmpl
new file mode 100755 (executable)
index 0000000..aa91e9c
--- /dev/null
@@ -0,0 +1,146 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">\r
+<html xmlns="http://www.w3.org/1999/xhtml">\r
+<head>\r
+<title>ts event example template</title>\r
+</head>\r
+\r
+<body>\r
+\r
+<h1>TS EVENT TEMPLATE</h1>\r
+<h2>EXAMPLE</h2>\r
+\r
+<br />\r
+<pre>\r
+\r
+<strong>Common markers:</strong>\r
+\r
+\r
+<!--###TEMPLATE_TS_EVENT### begin -->\r
+<!--phpicalendar_event.tmpl-->\r
+<div class="news-single-item">\r
+       <div class="news-single-timedata">###STARTDATE### ###STARTTIME### </div>\r
+               <h2>###TITLE###</h2>\r
+               ###CATEGORY###\r
+               ###IMAGE### \r
+               ###DESCRIPTION###\r
+               ###BODYTEXT###\r
+</div>\r
+<!--/phpicalendar_event.tmpl-->\r
+<!--###TEMPLATE_TS_EVENT### end -->\r
+\r
+<!--###TEMPLATE_TS_EVENT_ALLDAY### begin -->\r
+<div class="###HEADERSTYLE###_allday"><!-- ###EVENT_LINK### start -->###TITLE###<!-- ###EVENT_LINK### end --></div>\r
+<!--###TEMPLATE_TS_EVENT_ALLDAY### end -->\r
+\r
+<!--###TEMPLATE_TS_EVENT_DAY### begin -->\r
+class="eventbg2 ###BODYSTYLE###">\r
+<div class="eventfont">\r
+       <div class="###HEADERSTYLE###">###STATUS###<b>###STARTTIME### - ###ENDTIME###</b></div>\r
+       <div class="padd">###EDIT_LINK###<!-- ###EVENT_LINK### start -->###TITLE###<!-- ###EVENT_LINK### end --></div>\r
+</div>\r
+<!--###TEMPLATE_TS_EVENT_DAY### end -->\r
+\r
+<!--###TEMPLATE_TS_EVENT_WEEK### begin -->\r
+class="eventbg2 ###BODYSTYLE###">\r
+<div class="eventfont">\r
+       <div class="###HEADERSTYLE###">###STATUS###<b>###STARTTIME### - ###ENDTIME###</b></div>\r
+       <div class="padd">###EDIT_LINK###<!-- ###EVENT_LINK### start -->###TITLE###<!-- ###EVENT_LINK### end --></div>\r
+</div>\r
+\r
+<!--###TEMPLATE_TS_EVENT_WEEK### end -->\r
+\r
+<!--###TEMPLATE_TS_EVENT_MONTH### begin -->\r
+<div class="V9"><span class="###HEADERSTYLE###_bullet" >&bull;</span><span class="###HEADERSTYLE###_text"><!-- ###EVENT_LINK### start -->###STARTTIME###: ###TITLE###<!-- ###EVENT_LINK### end --></span></div>\r
+<!--###TEMPLATE_TS_EVENT_MONTH### end -->\r
+\r
+<!--###TEMPLATE_TS_EVENT_MONTH_ALLDAY### begin -->\r
+<div class="V9"><span class="###HEADERSTYLE###_bullet" >&bull;</span><span class="###HEADERSTYLE###_text"><!-- ###EVENT_LINK### start -->###TITLE###<!-- ###EVENT_LINK### end --></span></div>\r
+<!--###TEMPLATE_TS_EVENT_MONTH_ALLDAY### end -->\r
+\r
+<!--###TEMPLATE_TS_EVENT_YEAR### begin -->\r
+<div class="V9"><!-- ###EVENT_LINK### start --><span class="###HEADERSTYLE###_bullet" >&bull;</span><!-- ###EVENT_LINK### end --></div>\r
+<!--###TEMPLATE_TS_EVENT_YEAR### end -->\r
+\r
+<!--###TEMPLATE_TS_EVENT_PREVIEW### begin -->\r
+<table>\r
+<tr><td>###TITLE_LABEL###</td><td>###TITLE###</td></tr>\r
+<tr><td>###STARTDATE_LABEL###</td><td>###STARTDATE###</td></tr>\r
+<tr><td>###ENDDATE_LABEL###</td><td>###ENDDATE###</td></tr>\r
+<tr><td>###STARTTIME_LABEL###</td><td>###STARTTIME###</td></tr>\r
+<tr><td>###ENDTIME_LABEL###</td><td>###ENDTIME###</td></tr>\r
+<tr><td>###DESCRIPTION_LABEL###</td><td>###DESCRIPTION###</td></tr>\r
+</table>\r
+<!--###TEMPLATE_TS_EVENT_PREVIEW### end -->\r
+\r
+<!--###TEMPLATE_TS_EVENT_TOMORROW### begin -->\r
+<div class="V9"><span class="###HEADERSTYLE###_bullet ###HEADERSTYLE###_legend_bullet">&bull;</span><span class="###HEADERSTYLE###_text ###HEADERSTYLE###_legend_text">###TITLE###</span></div>\r
+<!--###TEMPLATE_TS_EVENT_TOMORROW### end -->\r
+\r
+<!-- ###TEMPLATE_TS_EVENT_LIST_ODD### start -->\r
+       <dt>\r
+               ###IMAGE###\r
+               <!-- ###EVENT_LINK### start-->###TITLE###<!-- ###EVENT_LINK### end--><br />\r
+               ###STARTDATE### ###ENDDATE### <span class="V9G">###STARTTIME### ###ENDTIME###</span><br />\r
+               <br /><span class="V9G">###CATEGORY_LINK###</span>\r
+       </dt>\r
+       <dd>###DESCRIPTION###</dd>\r
+<!-- ###TEMPLATE_TS_EVENT_LIST_ODD### end -->\r
+<!-- ###TEMPLATE_TS_EVENT_LIST_EVEN### start -->\r
+       <dt class="even">\r
+               ###IMAGE###\r
+               <!-- ###EVENT_LINK### start-->###TITLE###<!-- ###EVENT_LINK### end--><br />\r
+               ###STARTDATE### ###ENDDATE### <span class="V9G">###STARTTIME### ###ENDTIME###</span><br />\r
+               <br /><span class="V9G">###CATEGORY_LINK###</span>\r
+       </dt>\r
+       <dd class="even">###DESCRIPTION###</dd>\r
+<!-- ###TEMPLATE_TS_EVENT_LIST_EVEN### end -->\r
+\r
+<!-- ###TEMPLATE_TS_EVENT_RSS### start -->\r
+               <item>\r
+                       <title>###TITLE###</title>\r
+                       <link><!-- ###EVENT_LINK### start --><!-- ###EVENT_LINK### end --></link>\r
+                       <guid><!-- ###EVENT_LINK### start --><!-- ###EVENT_LINK### end --></guid>\r
+                       <pubDate>###CREATE_DATE###</pubDate>\r
+                       <content:encoded>\r
+                       <![CDATA[\r
+                               ###CATEGORY###\r
+                               ###STARTDATE### ###STARTTIME###\r
+                               ###ENDDATE### ###ENDTIME###\r
+                               ###LOCATION###\r
+                               ###ORGANIZER###\r
+                               ###DESCRIPTION### <!-- ###EVENT_LINK### start -->###MORE_LABEL###<!-- ###EVENT_LINK### end -->\r
+                       ]]>\r
+                       </content:encoded>\r
+                       <description><![CDATA[\r
+                               ###CATEGORY###\r
+                               ###STARTDATE### ###STARTTIME###\r
+                               ###ENDDATE### ###ENDTIME###\r
+                               ###LOCATION###\r
+                               ###ORGANIZER###\r
+                               ###DESCRIPTION_STRIPTAGS### <!-- ###EVENT_LINK### start -->###MORE_LABEL###<!-- ###EVENT_LINK### end -->\r
+                               <hr/>\r
+                               ]]>\r
+                       </description>\r
+               </item>\r
+<!-- ###TEMPLATE_TS_EVENT_RSS### end -->\r
+\r
+<!-- ###TEMPLATE_TS_EVENT_ICS### start -->\r
+BEGIN:VEVENT\r
+UID:###GUID###\r
+###DTSTAMP###\r
+###DTSTART_YEAR_MONTH_DAY_HOUR_MINUTE###\r
+###DTEND_YEAR_MONTH_DAY_HOUR_MINUTE###\r
+###CATEGORY###\r
+###TITLE###\r
+###DESCRIPTION###\r
+###LOCATION###\r
+###ATTACHMENT_URL###\r
+###RRULE###\r
+###EXDATE###\r
+###EXRULE###\r
+###ORGANIZER###\r
+###ATTENDEE###\r
+END:VEVENT\r
+<!-- ###TEMPLATE_TS_EVENT_ICS### end -->\r
+</body>\r
+</html>        
\ No newline at end of file