Calendar/Tinebase Export - fix some things
authorPaul Mehrer <p.mehrer@metaways.de>
Thu, 13 Jul 2017 14:18:05 +0000 (16:18 +0200)
committerPaul Mehrer <p.mehrer@metaways.de>
Fri, 14 Jul 2017 09:00:28 +0000 (11:00 +0200)
Change-Id: I429688c523bf0d3cb51f9c41c765835478030d55
Reviewed-on: http://gerrit.tine20.com/customers/5151
Reviewed-by: Paul Mehrer <p.mehrer@metaways.de>
Tested-by: Paul Mehrer <p.mehrer@metaways.de>
tine20/Calendar/Export/Doc.php
tine20/Calendar/Model/Event.php
tine20/Tinebase/Export/Abstract.php
tine20/Tinebase/Export/Doc.php

index 573b3a8..00b0236 100644 (file)
@@ -49,11 +49,10 @@ class Calendar_Export_Doc extends Tinebase_Export_Doc
      */
     protected function _getTwigContext(array $context)
     {
-        $tz = Tinebase_Core::getUserTimezone();
         return array_merge(parent::_getTwigContext($context), array(
             'calendar'      => array(
-                'from'          => null !== $this->_from ? $this->_from->getClone()->setTimezone($tz) : null,
-                'until'         => null !== $this->_until ? $this->_until->getClone()->setTimezone($tz) : null,
+                'from'          => $this->_from,
+                'until'         => $this->_until,
             )
         ));
     }
index ff875fb..77ce0b5 100644 (file)
@@ -40,6 +40,7 @@
  * @property Calendar_Model_Rrule           rrule
  * @property string                         transp
  * @property string                         status
+ * @property string                         summary
  */
 class Calendar_Model_Event extends Tinebase_Record_Abstract
 {
index a7a524d..1fc8635 100644 (file)
@@ -531,6 +531,9 @@ abstract class Tinebase_Export_Abstract implements Tinebase_Record_IteratableInt
         $twig->addFunction(new Twig_SimpleFunction('translate', function ($str) use($locale, $translate) {
             return $translate->_($str, $locale);
         }));
+        $twig->addFunction(new Twig_SimpleFunction('dateFormat', function ($date, $format) {
+            return Tinebase_Translation::dateToStringInTzAndLocaleFormat($date, null, null, $format);
+        }));
 
         $this->_twigTemplate = $twig->load($this->_templateFileName);
     }
index 7231841..16b9fbb 100644 (file)
@@ -56,6 +56,11 @@ class Tinebase_Export_Doc extends Tinebase_Export_Abstract implements Tinebase_R
     protected $_dataSources = array();
 
     /**
+     * @var string
+     */
+    protected $_currentDataSource = null;
+
+    /**
      * @var boolean
      */
     protected $_skip = false;
@@ -154,6 +159,7 @@ class Tinebase_Export_Doc extends Tinebase_Export_Abstract implements Tinebase_R
 
         $this->_firstIteration = true;
         $this->_currentProcessor = $this->_dataSources[$_name];
+        $this->_currentDataSource = $_name;
         $this->_rowCount = 0;
     }