...
 
Commits (3)
cache:
key: "$CI_BUILD_REF_NAME-$CI_BUILD_STAGE"
paths:
- .composer/
- .php_cs.cache
variables:
COMPOSER_CACHE_DIR: ".composer"
COMPOSER_PROCESS_TIMEOUT: "1800"
COMPOSER_ALLOW_SUPERUSER: "1"
TYPO3_PATH_WEB: "$CI_PROJECT_DIR/.Build/Web"
TYPO3_VERSION: ^9
MYSQL_DATABASE: "typo3"
MYSQL_ROOT_PASSWORD: "joh316"
typo3DatabaseName: "typo3"
typo3DatabaseHost: "mysql"
typo3DatabaseUsername: "root"
typo3DatabasePassword: "joh316"
cgl:
image: composer
stage: test
before_script:
- composer require typo3/minimal="${TYPO3_VERSION}"
- composer install
script:
- .Build/bin/php-cs-fixer fix --config=Build/.php_cs.php -v --dry-run --using-cache=no --path-mode=intersection `git diff --name-only --diff-filter=ACMRTUXB $COMMIT_RANGE`
typo3_8lts_php70:
variables:
TYPO3_VERSION: ^8
image: php:7.0-alpine
stage: test
services:
- mysql:5
before_script:
- apk --no-cache add bash curl git mercurial openssh openssl parallel subversion tini
- docker-php-ext-install mysqli
- wget https://composer.github.io/installer.sig -O - -q | tr -d '\n' > installer.sig
- php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
- php -r "if (hash_file('SHA384', 'composer-setup.php') === file_get_contents('installer.sig')) { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;"
- php composer-setup.php --no-ansi --install-dir=/usr/bin --filename=composer
- php -r "unlink('composer-setup.php'); unlink('installer.sig');"
- composer require typo3/cms="${TYPO3_VERSION}"
script:
- .Build/bin/phpunit --colors -c .Build/vendor/typo3/testing-framework/Resources/Core/Build/UnitTests.xml Tests/Unit/
typo3_8lts_php71:
variables:
TYPO3_VERSION: ^8
image: php:7.1-alpine
stage: test
services:
- mysql:5
before_script:
- apk --no-cache add bash curl git mercurial openssh openssl parallel subversion tini
- docker-php-ext-install mysqli
- wget https://composer.github.io/installer.sig -O - -q | tr -d '\n' > installer.sig
- php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
- php -r "if (hash_file('SHA384', 'composer-setup.php') === file_get_contents('installer.sig')) { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;"
- php composer-setup.php --no-ansi --install-dir=/usr/bin --filename=composer
- php -r "unlink('composer-setup.php'); unlink('installer.sig');"
- composer require typo3/cms="${TYPO3_VERSION}"
script:
- .Build/bin/phpunit --colors -c .Build/vendor/typo3/testing-framework/Resources/Core/Build/UnitTests.xml Tests/Unit/
typo3_8lts_php72:
variables:
TYPO3_VERSION: ^8
image: php:7.2-alpine
stage: test
services:
- mysql:5
before_script:
- apk --no-cache add bash curl git mercurial openssh openssl parallel subversion tini
- docker-php-ext-install mysqli
- wget https://composer.github.io/installer.sig -O - -q | tr -d '\n' > installer.sig
- php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
- php -r "if (hash_file('SHA384', 'composer-setup.php') === file_get_contents('installer.sig')) { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;"
- php composer-setup.php --no-ansi --install-dir=/usr/bin --filename=composer
- php -r "unlink('composer-setup.php'); unlink('installer.sig');"
- composer require typo3/cms="${TYPO3_VERSION}"
script:
- .Build/bin/phpunit --colors -c .Build/vendor/typo3/testing-framework/Resources/Core/Build/UnitTests.xml Tests/Unit/
typo3_8lts_php73:
variables:
TYPO3_VERSION: ^8
image: php:7.3-alpine
stage: test
services:
- mysql:5
before_script:
- apk --no-cache add bash curl git mercurial openssh openssl parallel subversion tini
- docker-php-ext-install mysqli
- wget https://composer.github.io/installer.sig -O - -q | tr -d '\n' > installer.sig
- php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
- php -r "if (hash_file('SHA384', 'composer-setup.php') === file_get_contents('installer.sig')) { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;"
- php composer-setup.php --no-ansi --install-dir=/usr/bin --filename=composer
- php -r "unlink('composer-setup.php'); unlink('installer.sig');"
- composer require typo3/cms="${TYPO3_VERSION}"
script:
- .Build/bin/phpunit --colors -c .Build/vendor/typo3/testing-framework/Resources/Core/Build/UnitTests.xml Tests/Unit/
typo3_9lts_php72:
variables:
TYPO3_VERSION: ^9
image: php:7.2-alpine
stage: test
services:
- mysql:5
before_script:
- apk --no-cache add bash curl git mercurial openssh openssl parallel subversion tini
- docker-php-ext-install mysqli
- wget https://composer.github.io/installer.sig -O - -q | tr -d '\n' > installer.sig
- php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
- php -r "if (hash_file('SHA384', 'composer-setup.php') === file_get_contents('installer.sig')) { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;"
- php composer-setup.php --no-ansi --install-dir=/usr/bin --filename=composer
- php -r "unlink('composer-setup.php'); unlink('installer.sig');"
- composer require typo3/minimal="${TYPO3_VERSION}"
script:
- .Build/bin/phpunit --colors -c .Build/vendor/typo3/testing-framework/Resources/Core/Build/UnitTests.xml Tests/Unit/
typo3_9lts_php73:
variables:
TYPO3_VERSION: ^9
image: php:7.3-alpine
stage: test
services:
- mysql:5
before_script:
- apk --no-cache add bash curl git mercurial openssh openssl parallel subversion tini
- docker-php-ext-install mysqli
- wget https://composer.github.io/installer.sig -O - -q | tr -d '\n' > installer.sig
- php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
- php -r "if (hash_file('SHA384', 'composer-setup.php') === file_get_contents('installer.sig')) { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;"
- php composer-setup.php --no-ansi --install-dir=/usr/bin --filename=composer
- php -r "unlink('composer-setup.php'); unlink('installer.sig');"
- composer require typo3/minimal="${TYPO3_VERSION}"
script:
- .Build/bin/phpunit --colors -c .Build/vendor/typo3/testing-framework/Resources/Core/Build/UnitTests.xml Tests/Unit/
<?php
/**
* This file represents the configuration for Code Sniffing PSR-2-related
* automatic checks of coding guidelines
* Install @fabpot's great php-cs-fixer tool via
*
* $ composer global require friendsofphp/php-cs-fixer
*
* And then simply run
*
* $ php-cs-fixer fix --config ../Build/.php_cs
*
* inside the TYPO3 directory. Warning: This may take up to 10 minutes.
*
* For more information read:
* https://www.php-fig.org/psr/psr-2/
* https://cs.sensiolabs.org
*/
if (PHP_SAPI !== 'cli') {
die('This script supports command line usage only. Please check your command.');
}
// Define in which folders to search and which folders to exclude
// Exclude some directories that are excluded by Git anyways to speed up the sniffing
$finder = PhpCsFixer\Finder::create()
->in(__DIR__ . '/../');
// Return a Code Sniffing configuration using
// all sniffers needed for PSR-2
// and additionally:
// - Remove leading slashes in use clauses.
// - PHP single-line arrays should not have trailing comma.
// - Single-line whitespace before closing semicolon are prohibited.
// - Remove unused use statements in the PHP source code
// - Ensure Concatenation to have at least one whitespace around
// - Remove trailing whitespace at the end of blank lines.
return PhpCsFixer\Config::create()
->setRiskyAllowed(true)
->setRules([
'@PSR2' => true,
'@DoctrineAnnotation' => true,
'no_leading_import_slash' => true,
'no_trailing_comma_in_singleline_array' => true,
'no_singleline_whitespace_before_semicolons' => true,
'no_unused_imports' => true,
'concat_space' => ['spacing' => 'one'],
'no_whitespace_in_blank_line' => true,
'ordered_imports' => true,
'single_quote' => true,
'no_empty_statement' => true,
'no_extra_consecutive_blank_lines' => true,
'phpdoc_no_package' => true,
'phpdoc_scalar' => true,
'no_blank_lines_after_phpdoc' => true,
'array_syntax' => ['syntax' => 'short'],
'whitespace_after_comma_in_array' => true,
'function_typehint_space' => true,
'hash_to_slash_comment' => true,
'no_alias_functions' => true,
'lowercase_cast' => true,
'no_leading_namespace_whitespace' => true,
'native_function_casing' => true,
'no_short_bool_cast' => true,
'no_unneeded_control_parentheses' => true,
'phpdoc_no_empty_return' => true,
'phpdoc_trim' => true,
'no_superfluous_elseif' => true,
'no_useless_else' => true,
'phpdoc_types' => true,
'phpdoc_types_order' => ['null_adjustment' => 'always_last', 'sort_algorithm' => 'none'],
'return_type_declaration' => ['space_before' => 'none'],
'cast_spaces' => ['space' => 'none'],
'declare_equal_normalize' => ['space' => 'single'],
'dir_constant' => true,
'phpdoc_no_access' => true
])
->setFinder($finder);
......@@ -20,7 +20,7 @@ use TYPO3\CMS\Backend\Module\BaseScriptClass;
use TYPO3\CMS\Backend\Template\ModuleTemplate;
use TYPO3\CMS\Backend\Utility\BackendUtility;
use TYPO3\CMS\Cal\Controller\DateParser;
use TYPO3\CMS\Cal\Model\CalDate;
use TYPO3\CMS\Cal\Model\CalendarDateTime;
use TYPO3\CMS\Cal\Utility\RecurrenceGenerator;
use TYPO3\CMS\Core\Exception;
use TYPO3\CMS\Core\Messaging\FlashMessage;
......@@ -359,9 +359,9 @@ class CalIndexer extends BaseScriptClass
/**
* @param $timeString
* @return CalDate
* @return CalendarDateTime
*/
private function getTimeParsed($timeString): CalDate
private function getTimeParsed($timeString): CalendarDateTime
{
$dp = GeneralUtility::makeInstance(DateParser::class);
$dp->parse($timeString, 0, '');
......
......@@ -18,7 +18,7 @@ use TYPO3\CMS\Backend\Module\BaseScriptClass;
use TYPO3\CMS\Backend\Template\DocumentTemplate;
use TYPO3\CMS\Backend\Utility\BackendUtility;
use TYPO3\CMS\Cal\Controller\DateParser;
use TYPO3\CMS\Cal\Model\CalDate;
use TYPO3\CMS\Cal\Model\CalendarDateTime;
use TYPO3\CMS\Cal\Utility\RecurrenceGenerator;
use TYPO3\CMS\Core\Exception;
use TYPO3\CMS\Core\Messaging\FlashMessage;
......@@ -265,9 +265,9 @@ class CalIndexerOld extends BaseScriptClass
/**
* @param $timeString
* @return CalDate
* @return CalendarDateTime
*/
private function getTimeParsed($timeString): CalDate
private function getTimeParsed($timeString): CalendarDateTime
{
$dp = GeneralUtility::makeInstance(DateParser::class);
$dp->parse($timeString, 0, '');
......
......@@ -15,7 +15,7 @@ namespace TYPO3\CMS\Cal\Backend\TCA;
* The TYPO3 extension Calendar Base (cal) project - inspiring people to share!
*/
use TYPO3\CMS\Backend\Utility\BackendUtility;
use TYPO3\CMS\Cal\Model\CalDate;
use TYPO3\CMS\Cal\Model\CalendarDateTime;
/**
* Class Labels
......@@ -30,27 +30,17 @@ class Labels
*/
public function getEventRecordLabel(&$params, &$pObj)
{
if ($params['table'] != 'tx_cal_event' && $params['table'] != 'tx_cal_exception_event') {
if ($params['table'] !== 'tx_cal_event' && $params['table'] !== 'tx_cal_exception_event') {
return '';
}
// Get complete record
$rec = BackendUtility::getRecordWSOL($params['table'], $params['row']['uid']);
$dateObj = new CalDate($rec['start_date'] . '000000');
$dateObj = new CalendarDateTime($rec['start_date'] . '000000');
$dateObj->setTZbyID('UTC');
$format = str_replace([
'd',
'm',
'y',
'Y'
], [
'%d',
'%m',
'%y',
'%Y'
], $GLOBALS['TYPO3_CONF_VARS']['SYS']['ddmmyy']);
if ($rec['allday'] || $params['table'] == 'tx_cal_exception_event') {
$format = $GLOBALS['TYPO3_CONF_VARS']['SYS']['ddmmyy'];
if ($rec['allday'] || $params['table'] === 'tx_cal_exception_event') {
/* If we have an all day event, only show the date */
$datetime = $dateObj->format($format);
$params['start_date'] = $datetime;
......@@ -81,7 +71,7 @@ class Labels
*/
public function getAttendeeRecordLabel(&$params, &$pObj)
{
if (!$params['table'] == 'tx_cal_attendee') {
if (!$params['table'] === 'tx_cal_attendee') {
return '';
}
......@@ -107,7 +97,7 @@ class Labels
*/
public function getMonitoringRecordLabel(&$params, &$pObj)
{
if (!$params['table'] == 'tx_cal_fe_user_event_monitor_mm') {
if (!$params['table'] === 'tx_cal_fe_user_event_monitor_mm') {
return '';
}
......@@ -142,7 +132,7 @@ class Labels
*/
public function getDeviationRecordLabel(&$params, &$pObj)
{
if (!$params['table'] == 'tx_cal_event_deviation') {
if (!$params['table'] === 'tx_cal_event_deviation') {
return '';
}
......@@ -152,7 +142,7 @@ class Labels
$label = $GLOBALS['LANG']->sL('LLL:EXT:cal/Resources/Private/Language/locallang_db.xml:tx_cal_event.deviation') . ': ';
if ($rec['orig_start_date']) {
$dateObj = new CalDate($rec['orig_start_date'] . '000000');
$dateObj = new CalendarDateTime($rec['orig_start_date'] . '000000');
$dateObj->setTZbyID('UTC');
$format = str_replace([
......
......@@ -396,7 +396,7 @@ class Api
*/
public function findEventsWithin($startTimestamp, $endTimestamp, $type = '', $pidList = ''): array
{
return $this->modelObj->findAllWithin('cal_event_model', $startTimestamp, $endTimestamp, $type, 'event', $pidList);
return $this->modelObj->findAllWithin('cal_event_model', clone $startTimestamp, clone $endTimestamp, $type, 'event', $pidList);
}
/**
......
......@@ -14,8 +14,7 @@ namespace TYPO3\CMS\Cal\Controller;
*
* The TYPO3 extension Calendar Base (cal) project - inspiring people to share!
*/
use TYPO3\CMS\Cal\Model\CalDate;
use TYPO3\CMS\Cal\Model\Pear\Date\Calc;
use TYPO3\CMS\Cal\Model\CalendarDateTime;
/**
* This class combines all the time related functions
......@@ -86,116 +85,96 @@ class Calendar
}
/**
* @param string $dateObject
* @return CalDate
* @param CalendarDateTime $dateObject
* @return CalendarDateTime
*/
public static function calculateStartDayTime($dateObject = ''): CalDate
public static function calculateStartDayTime(CalendarDateTime $dateObject): CalendarDateTime
{
$timeObj = new CalDate();
$timeObj->setTZbyID('UTC');
if ($dateObject) {
$timeObj->copy($dateObject);
}
$timeObj->setHour(0);
$timeObj->setMinute(0);
$timeObj->setSecond(0);
return $timeObj;
$dateObject->setTZbyID('UTC');
$dateObject->setHour(0);
$dateObject->setMinute(0);
$dateObject->setSecond(0);
return $dateObject;
}
/**
* @param string $dateObject
* @return CalDate
* @param CalendarDateTime $dateObject
* @return CalendarDateTime
*/
public static function calculateEndDayTime($dateObject = ''): CalDate
public static function calculateEndDayTime(CalendarDateTime $dateObject): CalendarDateTime
{
$timeObj = new CalDate();
$timeObj->setTZbyID('UTC');
if ($dateObject) {
$timeObj->copy($dateObject);
}
$timeObj->setHour(23);
$timeObj->setMinute(59);
$timeObj->setSecond(59);
return $timeObj;
$dateObject->setTZbyID('UTC');
$dateObject->setHour(23);
$dateObject->setMinute(59);
$dateObject->setSecond(59);
return $dateObject;
}
/**
* @param string $dateObject
* @return CalDate
* @param CalendarDateTime $dateObject
* @return CalendarDateTime
*/
public static function calculateStartWeekTime($dateObject = ''): CalDate
public static function calculateStartWeekTime(CalendarDateTime $dateObject): CalendarDateTime
{
$timeObj = self::calculateStartDayTime($dateObject);
$timeObj = new CalDate(Calc::beginOfWeek(
$timeObj->getDay(),
$timeObj->getMonth(),
$timeObj->getYear()
));
$timeObj->setTZbyID('UTC');
return $timeObj;
$dateObject = self::calculateStartDayTime($dateObject);
$dateObject->setDay($dateObject->format('j') - $dateObject->format('w'));
return $dateObject;
}
/**
* @param string $dateObject
* @return CalDate
* @param CalendarDateTime $dateObject
* @return CalendarDateTime
*/
public static function calculateEndWeekTime($dateObject = ''): CalDate
public static function calculateEndWeekTime(CalendarDateTime $dateObject): CalendarDateTime
{
$timeObj = self::calculateStartWeekTime($dateObject);
$timeObj->addSeconds(604799);
return $timeObj;
$dateObject = self::calculateStartWeekTime($dateObject);
$dateObject->addSeconds(604799);
return $dateObject;
}
/**
* @param string $dateObject
* @return CalDate
* @param CalendarDateTime $dateObject
* @return CalendarDateTime
*/
public static function calculateStartMonthTime($dateObject = ''): CalDate
public static function calculateStartMonthTime(CalendarDateTime $dateObject): CalendarDateTime
{
$timeObj = self::calculateStartDayTime($dateObject);
$timeObj->setDay(1);
return $timeObj;
$dateObject = self::calculateStartDayTime($dateObject);
$dateObject->setDay(1);
return $dateObject;
}
/**
* @param string $dateObject
* @return CalDate
* @param CalendarDateTime $dateObject
* @return CalendarDateTime
*/
public static function calculateEndMonthTime($dateObject = ''): CalDate
public static function calculateEndMonthTime(CalendarDateTime $dateObject): CalendarDateTime
{
$timeObj = self::calculateStartDayTime($dateObject);
$timeObj = new CalDate(Calc::endOfNextMonth(
$timeObj->getDay(),
$timeObj->getMonth(),
$timeObj->getYear()
));
$timeObj->setDay(1);
$timeObj->subtractSeconds(1);
$timeObj->setTZbyID('UTC');
return $timeObj;
$dateObject = self::calculateEndDayTime($dateObject);
$dateObject->setDay($dateObject->format('t'));
return $dateObject;
}
/**
* @param string $dateObject
* @return CalDate
* @param CalendarDateTime $dateObject
* @return CalendarDateTime
*/
public static function calculateStartYearTime($dateObject = ''): CalDate
public static function calculateStartYearTime(CalendarDateTime $dateObject): CalendarDateTime
{
$timeObj = self::calculateStartMonthTime($dateObject);
$timeObj->setMonth(1);
return $timeObj;
$dateObject = self::calculateStartMonthTime($dateObject);
$dateObject->setMonth(1);
return $dateObject;
}
/**
* @param string $dateObject
* @return CalDate
* @param CalendarDateTime $dateObject
* @return CalendarDateTime
*/
public static function calculateEndYearTime($dateObject = ''): CalDate
public static function calculateEndYearTime(CalendarDateTime $dateObject): CalendarDateTime
{
$timeObj = self::calculateStartYearTime($dateObject);
$timeObj->setYear($timeObj->getYear() + 1);
$timeObj->subtractSeconds(1);
return $timeObj;
$dateObject = self::calculateStartYearTime($dateObject);
$dateObject->setYear($dateObject->getYear() + 1);
$dateObject->subtractSeconds(1);
return $dateObject;
}
/**
......
This diff is collapsed.
......@@ -14,7 +14,7 @@ namespace TYPO3\CMS\Cal\Controller;
*
* The TYPO3 extension Calendar Base (cal) project - inspiring people to share!
*/
use TYPO3\CMS\Cal\Model\CalDate;
use TYPO3\CMS\Cal\Model\CalendarDateTime;
use TYPO3\CMS\Cal\Model\Pear\Date\Calc;
/**
......@@ -68,7 +68,7 @@ class DateParser
public $special = '';
/**
* @var CalDate
* @var CalendarDateTime
*/
public $timeObj;
......@@ -85,7 +85,7 @@ class DateParser
public function parse($value, $conf = [], $timeObj = '')
{
if ($timeObj === '') {
$timeObj = new CalDate();
$timeObj = new CalendarDateTime();
$timeObj->setTZbyID('UTC');
}
$this->timeObj = $timeObj;
......@@ -271,27 +271,27 @@ class DateParser
break;
case 'now':
$this->stack[] = [
'abs' => $this->timeObj->getTime()
'abs' => $this->timeObj->format('U')
];
break;
case 'today':
$this->stack[] = [
'today' => $this->timeObj->getTime()
'today' => $this->timeObj->format('U')
];
break;
case 'current':
$this->stack[] = [
'today' => $this->timeObj->getTime()
'today' => $this->timeObj->format('U')
];
break;
case 'tomorrow':
$this->stack[] = [
'tomorrow' => $this->timeObj->getTime()
'tomorrow' => $this->timeObj->format('U')
];
break;
case 'yesterday':
$this->stack[] = [
'yesterday' => $this->timeObj->getTime()
'yesterday' => $this->timeObj->format('U')
];
break;
......@@ -540,11 +540,11 @@ class DateParser
}
/**
* @return CalDate
* @return CalendarDateTime
*/
public function getDateObjectFromStack(): CalDate
public function getDateObjectFromStack(): CalendarDateTime
{
$date = new CalDate();
$date = new CalendarDateTime();
$date->setTZbyID('UTC');
$date->copy($this->timeObj);
$lastKey = '';
......@@ -696,7 +696,7 @@ class DateParser
}
/**
* @param CalDate$date
* @param CalendarDateTime$date
* @param $range
* @param $rangeValue
*/
......@@ -721,7 +721,7 @@ class DateParser
$date->getMonth(),
$date->getYear()
);
$date = new CalDate($formatedDate);
$date = new CalendarDateTime($formatedDate);
$date->setTZbyID('UTC');
}
} elseif ($key === 'weekday' && $range < 0) {
......@@ -732,7 +732,7 @@ class DateParser
$date->getMonth(),
$date->getYear()
);
$date = new CalDate($formatedDate);
$date = new CalendarDateTime($formatedDate);
$date->setTZbyID('UTC');
}
} elseif ($value === 'week' && $range > 0) {
......@@ -745,7 +745,7 @@ class DateParser
if ($rangeValue === 'month') {
for ($i = 0; $i < $range; $i++) {
$days = Calc::daysInMonth($date->getMonth(), $date->getYear());
$endOfNextMonth = new CalDate(Calc::endOfNextMonth(
$endOfNextMonth = new CalendarDateTime(Calc::endOfNextMonth(
$date->getDay(),
$date->getMonth(),
$date->getYear()
......@@ -769,7 +769,7 @@ class DateParser
} elseif ($range < 0) {
if ($rangeValue === 'month') {
for ($i = 0; $i > $range; $i--) {
$endOfPrevMonth = new CalDate(Calc::endOfPrevMonth(
$endOfPrevMonth = new CalendarDateTime(Calc::endOfPrevMonth(
$date->getDay(),
$date->getMonth(),
$date->getYear()
......
......@@ -21,6 +21,7 @@ use TYPO3\CMS\Cal\Model\EventModel;
use TYPO3\CMS\Cal\Model\Location;
use TYPO3\CMS\Cal\Model\Organizer;
use TYPO3\CMS\Cal\Service\AttendeeService;
use TYPO3\CMS\Cal\Service\CalculateDateTimeService;
use TYPO3\CMS\Cal\Service\CalendarService;
use TYPO3\CMS\Cal\Service\EventService;
use TYPO3\CMS\Cal\Service\LocationService;
......@@ -593,9 +594,9 @@ class ModelController extends BaseController
*/
public function findEventsForDay(&$dateObject, $type = '', $pidList = '', $eventType = '0,1,2,3'): array
{
$starttime = Calendar::calculateStartDayTime($dateObject);
$endtime = Calendar::calculateEndDayTime($dateObject);
return $this->findAllWithin('cal_event_model', $starttime, $endtime, $type, 'event', $pidList, $eventType);
$starttime = CalculateDateTimeService::calculateStartOfDay(clone $dateObject);
$endtime = CalculateDateTimeService::calculateEndOfDay(clone $dateObject);
return $this->findAllWithin('cal_event_model', clone $starttime, clone $endtime, $type, 'event', $pidList, $eventType);
}
/**
......@@ -607,9 +608,9 @@ class ModelController extends BaseController
*/
public function findEventsForWeek(&$dateObject, $type = '', $pidList = '', $eventType = '0,1,2,3'): array
{
$starttime = Calendar::calculateStartWeekTime($dateObject);
$endtime = Calendar::calculateEndWeekTime($dateObject);
return $this->findAllWithin('cal_event_model', $starttime, $endtime, $type, 'event', $pidList, $eventType);
$starttime = CalculateDateTimeService::calculateStartOfWeek(clone $dateObject);
$endtime = CalculateDateTimeService::calculateEndOfWeek(clone $dateObject);
return $this->findAllWithin('cal_event_model', clone $starttime, clone $endtime, $type, 'event', $pidList, $eventType);
}
/**
......@@ -621,9 +622,9 @@ class ModelController extends BaseController
*/
public function findEventsForMonth(&$dateObject, $type = '', $pidList = '', $eventType = '0,1,2,3'): array
{
$starttime = Calendar::calculateStartMonthTime($dateObject);
$endtime = Calendar::calculateEndMonthTime($dateObject);
return $this->findAllWithin('cal_event_model', $starttime, $endtime, $type, 'event', $pidList, $eventType);
$starttime = CalculateDateTimeService::calculateStartOfMonth(clone $dateObject);
$endtime = CalculateDateTimeService::calculateEndOfMonth(clone $dateObject);
return $this->findAllWithin('cal_event_model', clone $starttime, clone $endtime, $type, 'event', $pidList, $eventType);
}
/**
......@@ -635,9 +636,9 @@ class ModelController extends BaseController
*/
public function findEventsForYear(&$dateObject, $type = '', $pidList = '', $eventType = '0,1,2,3'): array
{
$starttime = Calendar::calculateStartYearTime($dateObject);
$endtime = Calendar::calculateEndYearTime($dateObject);
return $this->findAllWithin('cal_event_model', $starttime, $endtime, $type, 'event', $pidList, $eventType);
$starttime = CalculateDateTimeService::calculateStartOfYear(clone $dateObject);
$endtime = CalculateDateTimeService::calculateEndOfYear(clone $dateObject);
return $this->findAllWithin('cal_event_model', clone $starttime, clone $endtime, $type, 'event', $pidList, $eventType);
}
/**
......@@ -657,7 +658,7 @@ class ModelController extends BaseController
$eventType = '0,1,2,3',
$additionalWhere = ''
): array {
return $this->findAllWithin('cal_event_model', $startDateObject, $endDateObject, $type, 'event', $pidList, $eventType, $additionalWhere);
return $this->findAllWithin('cal_event_model', clone $startDateObject, clone $endDateObject, $type, 'event', $pidList, $eventType, $additionalWhere);
}
/**
......@@ -669,9 +670,9 @@ class ModelController extends BaseController
*/
public function findTodosForDay(&$dateObject, $type = '', $pidList = '', $eventType = '4'): array
{
$starttime = Calendar::calculateStartDayTime($dateObject);
$endtime = Calendar::calculateEndDayTime($dateObject);
return $this->findAllWithin('cal_event_model', $starttime, $endtime, $type, $this->todoSubtype, $pidList, $eventType);
$starttime = CalculateDateTimeService::calculateStartOfDay(clone $dateObject);
$endtime = CalculateDateTimeService::calculateEndOfDay(clone $dateObject);
return $this->findAllWithin('cal_event_model', clone $starttime, clone $endtime, $type, $this->todoSubtype, $pidList, $eventType);
}
/**
......@@ -683,9 +684,9 @@ class ModelController extends BaseController
*/
public function findTodosForWeek(&$dateObject, $type = '', $pidList = '', $eventType = '4'): array
{
$starttime = Calendar::calculateStartWeekTime($dateObject);
$endtime = Calendar::calculateEndWeekTime($dateObject);
return $this->findAllWithin('cal_event_model', $starttime, $endtime, $type, $this->todoSubtype, $pidList, $eventType);
$starttime = CalculateDateTimeService::calculateStartOfWeek(clone $dateObject);
$endtime = CalculateDateTimeService::calculateEndOfWeek(clone $dateObject);
return $this->findAllWithin('cal_event_model', clone $starttime, clone $endtime, $type, $this->todoSubtype, $pidList, $eventType);
}
/**
......@@ -697,9 +698,9 @@ class ModelController extends BaseController
*/
public function findTodosForMonth(&$dateObject, $type = '', $pidList = '', $eventType = '4'): array
{
$starttime = Calendar::calculateStartMonthTime($dateObject);
$endtime = Calendar::calculateEndMonthTime($dateObject);
return $this->findAllWithin('cal_event_model', $starttime, $endtime, $type, $this->todoSubtype, $pidList, $eventType);
$starttime = CalculateDateTimeService::calculateStartOfMonth(clone $dateObject);
$endtime = CalculateDateTimeService::calculateEndOfMonth(clone $dateObject);
return $this->findAllWithin('cal_event_model', clone $starttime, clone $endtime, $type, $this->todoSubtype, $pidList, $eventType);
}
/**
......@@ -711,9 +712,9 @@ class ModelController extends BaseController
*/
public function findTodosForYear(&$dateObject, $type = '', $pidList = '', $eventType = '4'): array
{
$starttime = Calendar::calculateStartYearTime($dateObject);
$endtime = Calendar::calculateEndYearTime($dateObject);
return $this->findAllWithin('cal_event_model', $starttime, $endtime, $type, $this->todoSubtype, $pidList, $eventType);
$starttime = CalculateDateTimeService::calculateStartOfYear(clone $dateObject);
$endtime = CalculateDateTimeService::calculateEndOfYear(clone $dateObject);
return $this->findAllWithin('cal_event_model', clone $starttime, clone $endtime, $type, $this->todoSubtype, $pidList, $eventType);
}
/**
......@@ -726,7 +727,7 @@ class ModelController extends BaseController
*/
public function findTodosForList(&$startDateObject, &$endDateObject, $type = '', $pidList = '', $eventType = '4'): array
{
return $this->findAllWithin('cal_event_model', $startDateObject, $endDateObject, $type, $this->todoSubtype, $pidList, $eventType);
return $this->findAllWithin('cal_event_model', clone $startDateObject, clone $endDateObject, $type, $this->todoSubtype, $pidList, $eventType);
}
/**
......@@ -768,7 +769,7 @@ class ModelController extends BaseController
*/
public function findEventsForRss(&$startDateObject, &$endDateObject, $type, $pidList): array
{
return $this->findAllWithin('cal_event_model', $startDateObject, $endDateObject, $type, 'event', $pidList, '0,1,2,3');
return $this->findAllWithin('cal_event_model', clone $startDateObject, clone $endDateObject, $type, 'event', $pidList, '0,1,2,3');
}
/**
......@@ -790,7 +791,7 @@ class ModelController extends BaseController
*/
public function findTodosForRss(&$startDateObject, &$endDateObject, $type, $pidList): array
{
return $this->findAllWithin('cal_event_model', $startDateObject, $endDateObject, $type, $this->todoSubtype, $pidList, '4');
return $this->findAllWithin('cal_event_model', clone $startDateObject, clone $endDateObject, $type, $this->todoSubtype, $pidList, '4');
}
/**
......@@ -905,8 +906,8 @@ class ModelController extends BaseController
*/
public function findAllWithin(
$serviceName,
&$startDateObject,
&$endDateObject,
$startDateObject,
$endDateObject,
$type = '',
$subtype = '',
$pidList = '',
......@@ -917,12 +918,11 @@ class ModelController extends BaseController
if ($type === '') {
$serviceChain = '';
$events = [];
/* Iterate over all classes providing the cal_model service */
while (is_object($service = GeneralUtility::makeInstanceService($serviceName, $subtype, $serviceChain))) {
$serviceChain .= ',' . $service->getServiceKey();
/* Gets all events from the current model as an array */
$eventsFromService = $service->findAllWithin($startDateObject, $endDateObject, $pidList, $eventType, $additionalWhere);
$eventsFromService = $service->findAllWithin(clone $startDateObject, clone $endDateObject, $pidList, $eventType, $additionalWhere);
if (!empty($eventsFromService)) {
if (empty($events)) {
......
......@@ -2,8 +2,6 @@
namespace TYPO3\CMS\Cal\Hooks;
use TYPO3\CMS\Cal\Model\CalDate;
/**
* This file is part of the TYPO3 extension Calendar Base (cal).
*
......@@ -40,7 +38,7 @@ class Befunc
public function postprocessvalue(&$conf): string
{
if ($conf['colConf']['tx_cal_event']) {
$value = new CalDate($conf['value'] . '000000');
$value = new CalendarDateTime($conf['value'] . '000000');
if ($GLOBALS['TYPO3_CONF_VARS']['SYS']['USdateFormat'] === '1') {
$conf['value'] = $value->format('d.m.Y');
} else {
......
......@@ -15,7 +15,6 @@ namespace TYPO3\CMS\Cal\Hooks;
* The TYPO3 extension Calendar Base (cal) project - inspiring people to share!
*/
use TYPO3\CMS\Backend\Utility\BackendUtility;
use TYPO3\CMS\Cal\Model\CalDate;
/**
* This hook extends the tcemain class.
......@@ -101,9 +100,9 @@ class TceFormsGetmainfields
public function formatDate($ymdDate, $format)
{
if ($ymdDate) {
$dateObj = new CalDate(intval($ymdDate) . '000000');
$dateObj = new CalendarDateTime(intval($ymdDate) . '000000');
$dateObj->setTZbyID('UTC');
return $dateObj->getTime();
return $dateObj->format('U');
}
$dateString = '';
......
......@@ -17,7 +17,7 @@ use PDO;
use RuntimeException;
use TYPO3\CMS\Backend\Utility\BackendUtility;
use TYPO3\CMS\Cal\Controller\Api;
use TYPO3\CMS\Cal\Model\CalDate;
use TYPO3\CMS\Cal\Model\CalendarDateTime;
use TYPO3\CMS\Cal\Service\ICalendarService;
use TYPO3\CMS\Cal\Utility\Functions;
use TYPO3\CMS\Cal\Utility\RecurrenceGenerator;
......@@ -118,7 +118,7 @@ class TceMainProcessdatamap
$fileInfo = GeneralUtility::split_fileref($oldPath);
$GLOBALS ['TSFE']->tmpl->allowedPaths [] = $fileInfo ['path'];
$notificationService->controller->getDateTimeObject = new CalDate($event ['start_date'] . '000000');
$notificationService->controller->getDateTimeObject = new CalendarDateTime($event ['start_date'] . '000000');
$notificationService->notifyOfChanges($event, $fieldArray);
if ($fieldArray ['send_invitation']) {
$notificationService->invite($event);
......@@ -225,7 +225,7 @@ class TceMainProcessdatamap
$fileInfo = GeneralUtility::split_fileref($oldPath);
$GLOBALS ['TSFE']->tmpl->allowedPaths [] = $fileInfo ['path'];
$notificationService->controller->getDateTimeObject = new CalDate($event ['start_date'] . '000000');
$notificationService->controller->getDateTimeObject = new CalendarDateTime($event ['start_date'] . '000000');
if ($status === 'new') {
$notificationService->notify($event);
......@@ -257,15 +257,15 @@ class TceMainProcessdatamap
if (is_array($deviationRow)) {
$startDate = null;
if ($deviationRow['start_date']) {
$startDate = new CalDate($deviationRow['start_date']);
$startDate = new CalendarDateTime($deviationRow['start_date']);
} else {
$startDate = new CalDate($deviationRow['orig_start_date']);
$startDate = new CalendarDateTime($deviationRow['orig_start_date']);
}
$endDate = null;
if ($deviationRow['end_date']) {
$endDate = new CalDate($deviationRow['end_date']);
$endDate = new CalendarDateTime($deviationRow['end_date']);
} else {
$endDate = new CalDate($deviationRow['orig_end_date']);
$endDate = new CalendarDateTime($deviationRow['orig_end_date']);
}
if (! $deviationRow['allday']) {
......@@ -569,7 +569,7 @@ class TceMainProcessdatamap
}
/**
* @param CalDate $date
* @param CalendarDateTime $date
* @return array
*/
public static function getWeekdayOccurrence($date): array
......@@ -584,13 +584,13 @@ class TceMainProcessdatamap
* Converts a date from the backend (m-d-Y or d-m-Y) into a PEAR Date object.
*
* @param string The date to convert.
* @return CalDate the date object
* @return CalendarDateTime the date object
* @throws \Exception
*/
public static function convertBackendDateToPear($dateString): CalDate
public static function convertBackendDateToPear($dateString): CalendarDateTime
{
$ymdString = self::convertBackendDateToYMD($dateString);
return new CalDate($ymdString . '000000');
return new CalendarDateTime($ymdString . '000000');
}
/**
......@@ -603,7 +603,7 @@ class TceMainProcessdatamap
*/
public static function convertBackendDateToYMD($dateString): string
{
$date = new CalDate($dateString);
$date = new CalendarDateTime($dateString);
return $date->format('Ymd');
}
}
......@@ -41,7 +41,7 @@ if (!defined('DATE_CALC_FORMAT')) {
* functions in order to able to leave a lot of function calls untouched
* for now.
*/
class CalDate extends \DateTime
class CalendarDateTime extends \DateTime
{
/**
......@@ -62,10 +62,10 @@ class CalDate extends \DateTime
private $conf;
/**
* @param CalDate $compareDate
* @param CalendarDateTime $compareDate
* @return bool
*/
public function equals(CalDate $compareDate): bool
public function equals(CalendarDateTime $compareDate): bool
{
$a = floatval($compareDate->format('YmdHMS'));
$b = floatval($this->format('YmdHMS'));
......@@ -73,10 +73,10 @@ class CalDate extends \DateTime
}
/**
* @param CalDate $compareDate
* @param CalendarDateTime $compareDate
* @return bool
*/
public function before(CalDate $compareDate): bool
public function before(CalendarDateTime $compareDate): bool
{
$a = floatval($compareDate->format('YmdHMS'));
$b = floatval($this->format('YmdHMS'));
......@@ -84,10 +84,10 @@ class CalDate extends \DateTime
}
/**
* @param CalDate $compareDate
* @param CalendarDateTime $compareDate
* @return bool
*/
public function after(CalDate $compareDate): bool
public function after(CalendarDateTime $compareDate): bool
{
$a = floatval($compareDate->format('YmdHMS'));
$b = floatval($this->format('YmdHMS'));
......@@ -99,7 +99,7 @@ class CalDate extends \DateTime
* @param $compareDateB
* @return int
*/
public function compare(CalDate $compareDateA, CalDate $compareDateB): int
public function compare(CalendarDateTime $compareDateA, CalendarDateTime $compareDateB): int
{
$a = floatval($compareDateA->format('YmdHMS'));
$b = floatval($compareDateB->format('YmdHMS'));
......@@ -224,9 +224,9 @@ class CalDate extends \DateTime
* uses a bytesafe cropping function if possible in order to not destroy multibyte chars from strings (e.g.
* names in UTF-8)
*
* @param string $value The value to crop
* @param bool $length The length
* @return string
* @param string $value
* @param bool $length
* @return string the cropped string
*/
public function crop($value = '', $length = false): string
{
......@@ -244,7 +244,7 @@ class CalDate extends \DateTime
*/
public function setTZbyID($id)
{
$this->setTimezone(new \DateTimeZone($id));
//$this->setTimezone(new \DateTimeZone($id));
}
/**
......@@ -266,7 +266,7 @@ class CalDate extends \DateTime
/**
* @param $date
*/
public function copy(CalDate $date)
public function copy(CalendarDateTime $date)
{
$this->setYear($date->getYear());
$this->setMonth($date->getMonth());
......@@ -352,7 +352,7 @@ class CalDate extends \DateTime
/**
* @param int $h
*/
public function setHour(int $h)
public function setHour(int $h = 0)
{
$this->setTime($h, $this->format('i'), $this->format('s'));
}
......@@ -360,7 +360,7 @@ class CalDate extends \DateTime
/**
* @param int $m
*/
public function setMinute(int $m)
public function setMinute(int $m = 0)
{
$this->setTime($this->format('H'), $m, $this->format('s'));
}
......@@ -368,7 +368,7 @@ class CalDate extends \DateTime
/**
* @param int $s
*/
public function setSecond(int $s)
public function setSecond(int $s = 0)
{
$this->setTime($this->format('H'), $this->format('i'), $s);
}
......
This diff is collapsed.
......@@ -23,7 +23,7 @@ use TYPO3\CMS\Cal\Utility\Functions;
class EventRecDeviationModel extends EventModel
{
/**
* @var CalDate
* @var CalendarDateTime
*/
private $origStartDate;
......@@ -61,7 +61,7 @@ class EventRecDeviationModel extends EventModel
$this->setEnd($end);
$this->setAllDay($row['allday']);
$this->origStartDate = new CalDate($row['orig_start_date']);
$this->origStartDate = new CalendarDateTime($row['orig_start_date']);
$this->origStartDate->addSeconds($row['orig_start_time']);
$this->setCategories($event->getCategories());
......@@ -82,11 +82,11 @@ class EventRecDeviationModel extends EventModel
if ($this->isAllday()) {
$sims['###RRULE###'] = 'RECURRENCE-ID;VALUE=DATE:' . $eventStart->format('Ymd');
} elseif ($this->conf['view.']['ics.']['timezoneId'] !== '') {
$sims['###RRULE###'] = 'RECURRENCE-ID;TZID=' . $this->conf['view.']['ics.']['timezoneId'] . ':' . $eventStart->format('YmdTHMS');
$sims['###RRULE###'] = 'RECURRENCE-ID;TZID=' . $this->conf['view.']['ics.']['timezoneId'] . ':' . $eventStart->format('YmdTHis');
} else {
$offset = Functions::strtotimeOffset($eventStart->getTime());
$offset = Functions::strtotimeOffset($eventStart->format('U'));
$eventStart->subtractSeconds($offset);
$sims['###RRULE###'] = 'RECURRENCE-ID:' . $eventStart->format('YmdTHMSZ');
$sims['###RRULE###'] = 'RECURRENCE-ID:' . $eventStart->format('YmdTHisZ');
$eventStart->addSeconds($offset);
}
}
......
......@@ -28,12 +28,12 @@ class EventRecModel extends Model
public $parentEvent;
/**
* @var CalDate
* @var CalendarDateTime
*/
public $start;
/**
* @var CalDate
* @var CalendarDateTime
*/
public $end;
......@@ -852,7 +852,7 @@ class EventRecModel extends Model
if ($rightsObj->isAllowedToEditStartedEvent()) {
$eventHasntStartedYet = true;
} else {
$temp = new CalDate();
$temp = new CalendarDateTime();
$temp->setTZbyID('UTC');
$temp->addSeconds($editOffset);
$eventStart = $this->getStart();
......@@ -893,7 +893,7 @@ class EventRecModel extends Model
if ($rightsObj->isAllowedToDeleteStartedEvents()) {
$eventHasntStartedYet = true;
} else {
$temp = new CalDate();
$temp = new CalendarDateTime();
$temp->setTZbyID('UTC');
$temp->addSeconds($deleteOffset);
$eventStart = $this->getStart();
......@@ -961,7 +961,7 @@ class EventRecModel extends Model
public function getEventIdMarker(& $template, & $sims, & $rems, & $wrapped, $view)
{
$start = $this->getStart();
$sims['###EVENT_ID###'] = $this->parentEvent->getType() . $this->parentEvent->getUid() . $start->format('YmdHM');
$sims['###EVENT_ID###'] = $this->parentEvent->getType() . $this->parentEvent->getUid() . $start->format('YmdHi');
}
/**
......@@ -1204,9 +1204,9 @@ class EventRecModel extends Model
}
/**
* @return CalDate
* @return CalendarDateTime
*/
public function getUntil(): CalDate
public function getUntil(): CalendarDateTime
{
return $this->parentEvent->getUntil();
}
......
......@@ -1320,7 +1320,7 @@ class ICalendar
$temp['minute'] = date('i', $value);
$temp['second'] = date('s', $value);
} else {
$dateOb = new CalDate($value);
$dateOb = new CalendarDateTime($value);
return self::_exportDateTime($dateOb->timestamp());
}
......
......@@ -16,6 +16,7 @@ namespace TYPO3\CMS\Cal\Model;
*/
use SJBR\StaticInfoTables\PiBaseApi;
use SJBR\StaticInfoTables\PiBaseApi;
use SJBR\StaticInfoTables\PiBaseApi;
use SJBR\StaticInfoTables\Utility\LocalizationUtility;
use TYPO3\CMS\Cal\Utility\Registry;
use TYPO3\CMS\Core\Utility\ExtensionManagementUtility;
......
......@@ -26,12 +26,12 @@ use TYPO3\CMS\Core\Utility\GeneralUtility;
abstract class Model extends BaseModel
{
/**
* @var CalDate
* @var CalendarDateTime
*/
protected $start;
/**
* @var CalDate
* @var CalendarDateTime
*/
protected $end;
......@@ -135,7 +135,7 @@ abstract class Model extends BaseModel
public $_class;
/**
* @var CalDate
* @var CalendarDateTime
*/
public $until;
......@@ -467,7 +467,7 @@ abstract class Model extends BaseModel
$d = nl2br($cObj->parseFunc($this->getDescription(), $this->conf['parseFunc.']));
$eventStart = $this->getStart();
$eventEnd = $this->getEnd();
return '<h3>' . $this->getTitle() . '</h3><span color="#000000"><ul>' . '<li>Start: ' . $eventStart->format('H:M') . '</li>' . '<li>End: ' . $eventEnd->format('%H:%M') . '</li>' . '<li> Organizer: ' . $this->getOrganizer() . '</li>' . '<li>Location: ' . $this->getLocation() . '</li>' . '<li>Description: ' . $d . '</li></ul></span>';
return '<h3>' . $this->getTitle() . '</h3><span color="#000000"><ul>' . '<li>Start: ' . $eventStart->format('H:i') . '</li>' . '<li>End: ' . $eventEnd->format('H:i') . '</li>' . '<li> Organizer: ' . $this->getOrganizer() . '</li>' . '<li>Location: ' . $this->getLocation() . '</li>' . '<li>Description: ' . $d . '</li></ul></span>';
}
/**
......@@ -593,9 +593,9 @@ abstract class Model extends BaseModel
/**
* Returns the startdate object.
*
* @return CalDate startdate timeObject
* @return CalendarDateTime startdate timeObject
*/
public function getStart(): CalDate
public function getStart(): CalendarDateTime
{
return $this->start;
}
......@@ -603,9 +603,9 @@ abstract class Model extends BaseModel
/**
* Returns the enddate object.
*
* @return CalDate enddate timeObject
* @return CalendarDateTime enddate timeObject
*/
public function getEnd(): CalDate
public function getEnd(): CalendarDateTime
{
if (!$this->end) {
$this->setEnd($this->getStart());
......@@ -617,11 +617,11 @@ abstract class Model extends BaseModel
/**
* Sets the event start.
*
* @param CalDate $start
* @param CalendarDateTime $start
*/
public function setStart($start)
{
$this->start = new CalDate();
$this->start = new CalendarDateTime();
$this->start->copy($start);
$this->row['start_date'] = $start->format('Ymd');
$this->row['start_time'] = $start->getHour() * 3600 + $start->getMinute() * 60;
......@@ -630,11 +630,11 @@ abstract class Model extends BaseModel
/**
* Sets the event end.
*
* @param CalDate $end
* @param CalendarDateTime $end
*/
public function setEnd($end)
{
$this->end = new CalDate();
$this->end = new CalendarDateTime();
$this->end->copy($end);
$this->row['end_date'] = $end->format('Ymd');
$this->row['end_time'] = $end->getHour() * 3600 + $end->getMinute() * 60;
......@@ -647,6 +647,8 @@ abstract class Model extends BaseModel
*/
public function getStartAsTimestamp(): int
{
return $this->getStart()->format('U');
$start = &$this->getStart();
return $start->getDate(DATE_FORMAT_UNIXTIME);
}
......@@ -658,6 +660,7 @@ abstract class Model extends BaseModel
*/
public function getEndAsTimestamp(): int
{
return $this->getEnd()->format('U');
$end = &$this->getEnd();
return $end->getDate(DATE_FORMAT_UNIXTIME);
}
......@@ -774,7 +777,7 @@ abstract class Model extends BaseModel
*/
public function getDuration(): int
{
return $this->end->getTime() - $this->start->getTime();
return $this->end->format('U') - $this->start->format('U');
}
/**
......@@ -1232,7 +1235,7 @@ abstract class Model extends BaseModel
/**
* Returns the until date object
*/
public function getUntil(): CalDate
public function getUntil(): CalendarDateTime
{
return $this->until;
}
......@@ -1240,7 +1243,7 @@ abstract class Model extends BaseModel
/**
* Sets the until object.
*
* @param CalDate $until
* @param CalendarDateTime $until
*/
public function setUntil($until)
{
......@@ -1812,7 +1815,7 @@ abstract class Model extends BaseModel
$values['intrval'] = $this->getInterval();
$values['cnt'] = $this->getCount();
/** @var CalDate $until */
/** @var CalendarDateTime $until */
$until = $this->getUntil();
if (is_object($until)) {
$values['until'] = $until->format('Ymd');
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
......@@ -2,7 +2,6 @@
namespace TYPO3\CMS\Cal\Service;
use TYPO3\CMS\Cal\Model\CalDate;
use TYPO3\CMS\Cal\Model\EventModel;
use TYPO3\CMS\Cal\Utility\Functions;
......@@ -36,7 +35,7 @@ class FnbEventService extends EventService
* @param string $additionalWhere
* @return array
*/
public function findAllWithin(&$start_date, &$end_date, $pidList, $eventType = '0,1,2,3', $additionalWhere = ''): array
public function findAllWithin($start_date, $end_date, $pidList, $eventType = '0,1,2,3', $additionalWhere = ''): array
{
// How to get the events
......@@ -52,17 +51,17 @@ class FnbEventService extends EventService
$this->setStartAndEndPoint($start_date, $end_date);
$dontShowOldEvents = (int)$this->conf['view.'][$this->conf['view'] . '.']['dontShowOldEvents'];
if ($dontShowOldEvents > 0) {
$now = new CalDate();
$now = new CalendarDateTime();
if ($dontShowOldEvents === 2) {
$now->setHour(0);
$now->setMinute(0);
$now->setSecond(0);
}
if ($start_date->getTime() <= $now->getTime()) {
if ($start_date->format('U') <= $now->format('U')) {
$start_date->copy($now);
}
if ($end_date->getTime() <= $now->getTime()) {
if ($end_date->format('U') <= $now->format('U')) {
$end_date->copy($now);
$end_date->addSeconds(86400);
}
......
......@@ -20,7 +20,7 @@ use RuntimeException;
use TYPO3\CMS\Backend\Utility\BackendUtility;
use TYPO3\CMS\Cal\Controller\Controller;
use TYPO3\CMS\Cal\Cron\CalendarScheduler;
use TYPO3\CMS\Cal\Model\CalDate;
use TYPO3\CMS\Cal\Model\CalendarDateTime;
use TYPO3\CMS\Cal\Model\ICalendar;
use TYPO3\CMS\Cal\Utility\Functions;
use TYPO3\CMS\Cal\Utility\RecurrenceGenerator;
......@@ -502,7 +502,7 @@ class ICalendarService extends BaseService
/**
* @param $component
* @return CalDate|null
* @return CalendarDateTime|null
*/
private function getDtstart($component)
{
......@@ -511,7 +511,7 @@ class ICalendarService extends BaseService
/**
* @param $component
* @return CalDate|null
* @return CalendarDateTime|null
*/
private function getDtend($component)
{
......@@ -520,7 +520,7 @@ class ICalendarService extends BaseService
/**
* @param $component
* @return CalDate|null
* @return CalendarDateTime|null
*/
private function getTstamp($component)
{
......@@ -530,16 +530,16 @@ class ICalendarService extends BaseService
/**
* @param $component
* @param $attribute
* @return CalDate|null
* @return CalendarDateTime|null
*/
private function getDateValue($component, $attribute)
{
if ($component->getAttribute($attribute)) {
$value = $component->getAttribute($attribute);
if (is_array($value)) {
$dateTime = new CalDate($value['year'] . $value['month'] . $value['mday'] . '000000');
$dateTime = new CalendarDateTime($value['year'] . $value['month'] . $value['mday'] . '000000');
} else {
$dateTime = new CalDate($value);
$dateTime = new CalendarDateTime($value);
}
$params = $component->getAttributeParameters($attribute);
$timezone = $params['TZID'];
......@@ -650,7 +650,7 @@ class ICalendarService extends BaseService
*/
private function setRecurrenceId($component, $eventUid, &$insertFields)
{
$recurrenceIdStart = new CalDate($component->getAttribute('RECURRENCE-ID'));
$recurrenceIdStart = new CalendarDateTime($component->getAttribute('RECURRENCE-ID'));
$params = $component->getAttributeParameters('RECURRENCE-ID');
$timezone = $params['TZID'];
if ($timezone) {
......@@ -669,7 +669,7 @@ class ICalendarService extends BaseService
$recurrenceIdStart->setHour(0);
$recurrenceIdStart->setMinute(0);
$recurrenceIdStart->setSecond(0);
$insertFields['orig_start_date'] = $recurrenceIdStart->getTime();
$insertFields['orig_start_date'] = $recurrenceIdStart->format('U');
unset($insertFields['calendar_id']);
if ($indexEntry['event_deviation_uid'] > 0) {
......@@ -1028,13 +1028,13 @@ class ICalendarService extends BaseService
$tstamp = $this->getTstamp($component);
// Update only events that have changed!
if ($tstamp != null && $tstamp->getTime() == $eventRow['tstamp']) {
if ($tstamp != null && $tstamp->format('U') == $eventRow['tstamp']) {
$insertedOrUpdatedEventUids[] = $eventRow['uid'];
continue;
}
if (isset($eventRow['tstamp']) && $tstamp != null) {
$insertFields['tstamp'] = $tstamp->getTime();
$insertFields['tstamp'] = $tstamp->format('U');
}
$dtend = $this->getDtend($component);
......@@ -1045,7 +1045,7 @@ class ICalendarService extends BaseService
if ($component->getAttribute('DURATION')) {
$enddate = $insertFields['start_time'] + $component->getAttribute('DURATION');
$dateTime = new CalDate($insertFields['start_date']);
$dateTime = new CalendarDateTime($insertFields['start_date']);
$dateTime->addSeconds($enddate);
$params = $component->getAttributeParameters('DURATION');
$timezone = $params['TZID'];
......@@ -1058,7 +1058,7 @@ class ICalendarService extends BaseService
// Fix for allday events
if ($insertFields['start_time'] == 0 && $insertFields['end_time'] == 0 && $insertFields['start_date'] != 0) {
$date = new CalDate($insertFields['end_date'] . '000000');
$date = new CalendarDateTime($insertFields['end_date'] . '000000');
$date->setTZbyID('UTC');
$date->subtractSeconds(86400);
$insertFields['end_date'] = $date->format('Ymd');
......@@ -1200,7 +1200,7 @@ class ICalendarService extends BaseService
*/
private function createException($pid, $cruserId, $eventUid, $exceptionDescription)
{
$exceptionDate = new CalDate($exceptionDescription);
$exceptionDate = new CalendarDateTime($exceptionDescription);
$insertFields = [];
$insertFields['tstamp'] = time();
......
......@@ -15,7 +15,6 @@ namespace TYPO3\CMS\Cal\Service;