Bitrix-D7
23.9
Загрузка...
Поиск...
Не найдено
observance.php
1
<?php
2
3
4
namespace
Bitrix\Calendar\ICal\Basic
;
5
6
7
use
Bitrix\Calendar\ICal\MailInvitation\Helper
;
8
use
Bitrix\Calendar\Util
;
9
use DateTimeZone;
10
11
abstract
class
Observance
extends
BasicComponent
12
{
13
protected
$start
;
14
protected
$offsetFrom
;
15
protected
$offsetTo
;
16
protected
$timezone
;
17
18
public
static
function
createInstance
():
Observance
19
{
20
return
new
static
();
21
}
22
23
public
function
getProperties
(): array
24
{
25
return
[
26
'DTSTART'
,
27
'TZOFFSETFROM'
,
28
'TZOFFSETTO'
,
29
];
30
}
31
36
public
function
setDTStart
(
$start
=
null
):
Observance
37
{
38
$this->start =
$start
?
$start
:
Helper::getIcalDateTimeShort
(
'19700101T000000'
);
39
40
return
$this;
41
}
42
47
public
function
setOffsetFrom
(DateTimeZone $tz):
Observance
48
{
49
$time =
Util::getDateObject
(
null
,
false
, $tz->getName());
50
$this->offsetFrom = $time->format(
'O'
);
51
52
return
$this;
53
}
54
55
public
function
setOffsetFromValue
(
string
$value):
Observance
56
{
57
$this->offsetFrom = $value;
58
return
$this;
59
}
60
65
public
function
setOffsetTo
(DateTimeZone $tz):
Observance
66
{
67
$time =
Util::getDateObject
(
null
,
false
, $tz->getName());
68
$this->offsetTo = $time->format(
'O'
);
69
return
$this;
70
}
71
72
public
function
setOffsetToValue
(
string
$value):
Observance
73
{
74
$this->offsetTo = $value;
75
return
$this;
76
}
77
78
public
function
setAbbrTimezone
($tz):
Observance
79
{
80
$exp = (new \DateTime($tz))->format(
'T'
);
81
$this->timezone = (new \DateTime())->setTimeZone(
new
DateTimeZone($tz))->format(
'T'
);
82
return
$this;
83
}
84
85
public
function
setTimezoneFromAbbr
(?
string
$abbr):
Observance
86
{
87
$this->timezone = $abbr;
88
return
$this;
89
}
90
91
public
function
setContent
():
Content
92
{
93
return
Content::getInstance
($this->
getType
())
94
->
dateTimeProperty
(
'DTSTART'
, $this->start,
true
,
false
)
95
->textProperty(
'TZOFFSETFROM'
, $this->offsetFrom)
96
->textProperty(
'TZOFFSETTO'
, $this->offsetTo)
97
->textProperty(
'TZNAME'
, $this->timezone);
98
}
99
}
Bitrix\Calendar\ICal\Basic\BasicComponent
Definition
basiccomponent.php:10
Bitrix\Calendar\ICal\Basic\BasicComponent\getType
getType()
Bitrix\Calendar\ICal\Basic\Content
Definition
content.php:8
Bitrix\Calendar\ICal\Basic\Content\getInstance
static getInstance(string $type)
Definition
content.php:13
Bitrix\Calendar\ICal\Basic\Content\dateTimeProperty
dateTimeProperty( $names, Date $value, bool $withTime=false, bool $withTimeZone=false, bool $isUTC=false)
Definition
content.php:32
Bitrix\Calendar\ICal\Basic\Observance
Definition
observance.php:12
Bitrix\Calendar\ICal\Basic\Observance\setOffsetTo
setOffsetTo(DateTimeZone $tz)
Definition
observance.php:65
Bitrix\Calendar\ICal\Basic\Observance\$offsetTo
$offsetTo
Definition
observance.php:15
Bitrix\Calendar\ICal\Basic\Observance\setTimezoneFromAbbr
setTimezoneFromAbbr(?string $abbr)
Definition
observance.php:85
Bitrix\Calendar\ICal\Basic\Observance\setOffsetFromValue
setOffsetFromValue(string $value)
Definition
observance.php:55
Bitrix\Calendar\ICal\Basic\Observance\setDTStart
setDTStart($start=null)
Definition
observance.php:36
Bitrix\Calendar\ICal\Basic\Observance\$start
$start
Definition
observance.php:13
Bitrix\Calendar\ICal\Basic\Observance\setOffsetToValue
setOffsetToValue(string $value)
Definition
observance.php:72
Bitrix\Calendar\ICal\Basic\Observance\setContent
setContent()
Definition
observance.php:91
Bitrix\Calendar\ICal\Basic\Observance\$offsetFrom
$offsetFrom
Definition
observance.php:14
Bitrix\Calendar\ICal\Basic\Observance\getProperties
getProperties()
Definition
observance.php:23
Bitrix\Calendar\ICal\Basic\Observance\setOffsetFrom
setOffsetFrom(DateTimeZone $tz)
Definition
observance.php:47
Bitrix\Calendar\ICal\Basic\Observance\createInstance
static createInstance()
Definition
observance.php:18
Bitrix\Calendar\ICal\Basic\Observance\$timezone
$timezone
Definition
observance.php:16
Bitrix\Calendar\ICal\Basic\Observance\setAbbrTimezone
setAbbrTimezone($tz)
Definition
observance.php:78
Bitrix\Calendar\ICal\MailInvitation\Helper
Definition
helper.php:34
Bitrix\Calendar\ICal\MailInvitation\Helper\getIcalDateTimeShort
static getIcalDateTimeShort(string $dateTime=null, string $tz='UTC')
Definition
helper.php:761
Bitrix\Calendar\Util
Definition
util.php:16
Bitrix\Calendar\Util\getDateObject
static getDateObject(string $date=null, ?bool $fullDay=true, ?string $tz='UTC')
Definition
util.php:102
Bitrix\Calendar\ICal\Basic
Definition
attachmentmanager.php:4
modules
calendar
lib
ical
basic
observance.php
Создано системой
1.10.0