1C-Bitrix 25.700.0
Загрузка...
Поиск...
Не найдено
observance.php
См. документацию.
1<?php
2
3
4namespace Bitrix\Calendar\ICal\Basic;
5
6
7use Bitrix\Calendar\ICal\MailInvitation\Helper;
8use Bitrix\Calendar\Util;
9use DateTimeZone;
10
11abstract 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}
static getInstance(string $type)
Определения content.php:13
dateTimeProperty( $names, Date $value, bool $withTime=false, bool $withTimeZone=false, bool $isUTC=false)
Определения content.php:32
setOffsetTo(DateTimeZone $tz)
Определения observance.php:65
setTimezoneFromAbbr(?string $abbr)
Определения observance.php:85
setOffsetFromValue(string $value)
Определения observance.php:55
setDTStart($start=null)
Определения observance.php:36
setOffsetToValue(string $value)
Определения observance.php:72
setOffsetFrom(DateTimeZone $tz)
Определения observance.php:47
static createInstance()
Определения observance.php:18
static getDateObject(string $date=null, ?bool $fullDay=true, ?string $tz='UTC')
Определения util.php:107
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)
Определения file_new.php:804
$time
Определения payment.php:61