1C-Bitrix
25.700.0
Загрузка...
Поиск...
Не найдено
datetimepropertytype.php
См. документацию.
1
<?php
2
3
4
namespace
Bitrix\Calendar\ICal\Basic;
5
6
use Bitrix\Main\Type\Date;
7
use Bitrix\Main\Type\DateTime;
8
9
class
DatetimePropertyType
extends
PropertyType
10
{
11
private
$dateTime;
12
private
$withTime;
13
private
$withTimezone;
14
private
$isUTC;
15
16
public
static
function
getInstance
(
17
$names
,
18
Date
$dateTime,
19
bool
$withTime =
false
,
20
bool
$withTimezone =
false
,
21
bool
$isUTC =
false
22
): DateTimePropertyType
23
{
24
return
new
self
(
$names
, $dateTime, $withTime, $withTimezone, $isUTC);
25
}
26
27
public
function
__construct
(
28
$names
,
29
Date
$dateTime,
30
bool
$withTime =
false
,
31
bool
$withTimezone =
false
,
32
bool
$isUTC =
false
33
)
34
{
35
parent::__construct(
$names
);
36
37
$this->dateTime = $dateTime;
38
$this->withTimezone = $withTimezone;
39
$this->withTime = $withTime;
40
$this->isUTC = $isUTC;
41
42
if
($this->withTimezone && $this->dateTime instanceof
DateTime
)
43
{
44
$timezone = $this->dateTime->getTimezone()->getName();
45
$this->
addParameter
(
new
Parameter
(
'TZID'
, $timezone));
46
}
47
elseif
(!$this->withTime)
48
{
49
$this->
addParameter
(
new
Parameter
(
'VALUE'
,
'DATE'
));
50
}
51
}
52
53
public
function
getValue
(): string
54
{
55
if
($this->isUTC)
56
{
57
$format =
'Ymd\THis\Z'
;
58
}
59
else
60
{
61
$format = $this->withTime ?
'Ymd\THis'
:
'Ymd'
;
62
}
63
64
return
$this->dateTime->format($format);
65
}
66
67
public
function
getOriginalValue
():
Date
68
{
69
return
$this->dateTime;
70
}
71
}
Bitrix\Calendar\ICal\Basic\DatetimePropertyType
Определения
datetimepropertytype.php:10
Bitrix\Calendar\ICal\Basic\DatetimePropertyType\getInstance
static getInstance( $names, Date $dateTime, bool $withTime=false, bool $withTimezone=false, bool $isUTC=false)
Определения
datetimepropertytype.php:16
Bitrix\Calendar\ICal\Basic\DatetimePropertyType\getOriginalValue
getOriginalValue()
Определения
datetimepropertytype.php:67
Bitrix\Calendar\ICal\Basic\DatetimePropertyType\getValue
getValue()
Определения
datetimepropertytype.php:53
Bitrix\Calendar\ICal\Basic\DatetimePropertyType\__construct
__construct( $names, Date $dateTime, bool $withTime=false, bool $withTimezone=false, bool $isUTC=false)
Определения
datetimepropertytype.php:27
Bitrix\Calendar\ICal\Basic\Parameter
Определения
parameter.php:8
Bitrix\Calendar\ICal\Basic\PropertyType
Определения
propertytype.php:8
Bitrix\Calendar\ICal\Basic\PropertyType\addParameter
addParameter(Parameter $parameter)
Определения
propertytype.php:54
Bitrix\Calendar\ICal\Basic\PropertyType\$names
$names
Определения
propertytype.php:9
Bitrix\Main\Type\Date
Определения
date.php:9
Bitrix\Main\Type\DateTime
Определения
datetime.php:9
elseif
if( $daysToExpire >=0 &&$daysToExpire< 60 elseif)( $daysToExpire< 0)
Определения
prolog_main_admin.php:393
bitrix
modules
calendar
lib
ical
basic
datetimepropertytype.php
Создано системой
1.14.0