1C-Bitrix
25.700.0
Загрузка...
Поиск...
Не найдено
eventbuilderfromgetlist.php
См. документацию.
1
<?php
2
3
namespace
Bitrix\Calendar\Core\Builders;
4
5
use Bitrix\Calendar\Core\Base\Date;
6
use Bitrix\Calendar\Core\Event;
7
use Bitrix\Calendar\Core\Section\Section;
8
use Bitrix\Calendar\Internals\SectionTable;
9
use Bitrix\Calendar\Util;
10
use Bitrix\Main\ArgumentException;
11
use Bitrix\Main\ObjectException;
12
use Bitrix\Calendar\Core\Event\Properties\AttendeeCollection;
13
use Bitrix\Main\ObjectPropertyException;
14
use Bitrix\Main\SystemException;
15
16
class
EventBuilderFromGetList
extends
EventBuilderFromArray
17
{
22
protected
function
getRecurringRule
(): ?
Event
\
Properties
\
RecurringEventRules
23
{
24
if
(
25
isset($this->fields[
'RRULE'
])
26
&& isset($this->fields[
'RRULE'
][
'FREQ'
])
27
&& $this->fields[
'RRULE'
][
'FREQ'
] !==
'NONE'
28
)
29
{
30
$rule =
new
Event\Properties\RecurringEventRules
($this->fields[
'RRULE'
][
'FREQ'
]);
31
32
if
(isset($this->fields[
'RRULE'
][
'COUNT'
]))
33
{
34
$rule->setCount((
int
)$this->fields[
'RRULE'
][
'COUNT'
]);
35
}
36
37
if
(is_string($this->fields[
'RRULE'
][
'UNTIL'
]))
38
{
39
$rule->setUntil($this->
createDateForRecurrence
($this->fields[
'RRULE'
][
'UNTIL'
]));
40
}
41
42
if
(isset($this->fields[
'RRULE'
][
'INTERVAL'
]))
43
{
44
$rule->setInterval((
int
)$this->fields[
'RRULE'
][
'INTERVAL'
]);
45
}
46
47
if
(
48
is_string($this->fields[
'RRULE'
][
'BYDAY'
])
49
&& $this->fields[
'RRULE'
][
'FREQ'
] ===
Event
\
Properties
\RecurringEventRules::FREQUENCY_WEEKLY
50
)
51
{
52
$rule->setByDay(explode(
","
, $this->fields[
'RRULE'
][
'BYDAY'
]));
53
}
54
elseif
(
55
is_array($this->fields[
'RRULE'
][
'BYDAY'
])
56
&& $this->fields[
'RRULE'
][
'FREQ'
] ===
Event
\
Properties
\RecurringEventRules::FREQUENCY_WEEKLY
57
)
58
{
59
$rule->setByDay($this->fields[
'RRULE'
][
'BYDAY'
]);
60
}
61
62
return
$rule;
63
}
64
65
return
null
;
66
}
67
71
protected
function
getLocation
(): ?
Event
\
Properties
\
Location
72
{
73
if
(is_array($this->fields[
'LOCATION'
]) && isset($this->fields[
'LOCATION'
][
'NEW'
]))
74
{
75
$location
=
new
Event\Properties\Location
($this->fields[
'NEW'
]);
76
if
(isset($this->fields[
'LOCATION'
][
'OLD'
]))
77
{
78
$location
->setOriginalLocation($this->fields[
'LOCATION'
][
'OLD'
]);
79
}
80
81
return
$location
;
82
}
83
84
if
(is_string($this->fields[
'LOCATION'
]))
85
{
86
return
new
Event\Properties\Location
($this->fields[
'LOCATION'
]);
87
}
88
89
return
null
;
90
}
91
97
protected
function
getStart
():
Date
98
{
99
return
new
Date
(
100
Util::getDateObject
((is_object($this->fields[
'DATE_FROM'
])
101
? $this->fields[
'DATE_FROM'
]->format(
'd.m.y H:i:s'
)
102
: $this->fields[
'DATE_FROM'
]),
103
$this->fields[
'DT_SKIP_TIME'
] ===
'Y'
,
104
$this->fields[
'TZ_FROM'
] ??
null
)
105
);
106
}
107
113
protected
function
getEnd
():
Date
114
{
115
return
new
Date
(
116
Util::getDateObject
((is_object($this->fields[
'DATE_TO'
])
117
? $this->fields[
'DATE_TO'
]->format(
'd.m.y H:i:s'
)
118
: $this->fields[
'DATE_TO'
]),
119
$this->fields[
'DT_SKIP_TIME'
] ===
'Y'
,
120
$this->fields[
'TZ_TO'
] ??
null
)
121
);
122
}
123
127
protected
function
getFullDay
(): bool
128
{
129
return
isset($this->fields[
'DT_SKIP_TIME'
]) && $this->fields[
'DT_SKIP_TIME'
] ===
'Y'
;
130
}
131
135
protected
function
getAttendees
(): ?
AttendeeCollection
136
{
137
$collection =
new
AttendeeCollection
();
138
139
if
(is_string($this->fields[
'ATTENDEES_CODES'
]))
140
{
141
$collection->setAttendeesCodes(explode(
','
, $this->fields[
'ATTENDEES_CODES'
]));
142
}
143
else
if
(is_array($this->fields[
'ATTENDEE_LIST'
]))
144
{
145
$collection->setAttendeesId(array_column($this->fields[
'ATTENDEE_LIST'
],
'id'
));
146
}
147
else
148
{
149
$collection->setAttendeesId([(
int
)$this->fields[
'OWNER_ID'
]]);
150
}
151
152
153
return
$collection;
154
}
155
156
// /**
157
// * @return Event\Properties\RemindCollection|null
158
// */
159
// protected function getReminders(): Event\Properties\RemindCollection
160
// {
161
// if (!is_array($this->fields['REMIND']))
162
// {
163
// return new Event\Properties\RemindCollection();
164
// }
165
//
166
// $collection = new Event\Properties\RemindCollection();
169
// $collection->add((new Event\Properties\Remind())->setTimeBeforeEvent());
171
//
172
// return $collection;
173
// }
174
181
protected
function
getSection
():
Section
182
{
183
if
(
184
isset($this->fields[
'SECTION_ID'
])
185
&& $sectionDM = SectionTable::getById($this->fields[
'SECTION_ID'
])->fetchObject()
186
)
187
{
188
return
(
new
SectionBuilderFromDataManager
($sectionDM))->build();
189
}
190
191
throw
new
BuilderException
(
'it is impossible to find the section'
);
192
}
193
}
Bitrix\Calendar\Core\Builders\BuilderException
Определения
builderexception.php:8
Bitrix\Calendar\Core\Builders\EventBuilderFromArray
Определения
eventbuilderfromarray.php:32
Bitrix\Calendar\Core\Builders\EventBuilderFromGetList
Определения
eventbuilderfromgetlist.php:17
Bitrix\Calendar\Core\Builders\EventBuilderFromGetList\getEnd
getEnd()
Определения
eventbuilderfromgetlist.php:113
Bitrix\Calendar\Core\Builders\EventBuilderFromGetList\getLocation
getLocation()
Определения
eventbuilderfromgetlist.php:71
Bitrix\Calendar\Core\Builders\EventBuilderFromGetList\getFullDay
getFullDay()
Определения
eventbuilderfromgetlist.php:127
Bitrix\Calendar\Core\Builders\EventBuilderFromGetList\getAttendees
getAttendees()
Определения
eventbuilderfromgetlist.php:135
Bitrix\Calendar\Core\Builders\EventBuilderFromGetList\getStart
getStart()
Определения
eventbuilderfromgetlist.php:97
Bitrix\Calendar\Core\Builders\EventBuilderFromGetList\getSection
getSection()
Определения
eventbuilderfromgetlist.php:181
Bitrix\Calendar\Core\Builders\EventBuilderFromGetList\getRecurringRule
getRecurringRule()
Определения
eventbuilderfromgetlist.php:22
Bitrix\Calendar\Core\Builders\EventBuilder\createDateForRecurrence
createDateForRecurrence(string $date)
Определения
eventbuilder.php:523
Bitrix\Calendar\Core\Builders\SectionBuilderFromDataManager
Определения
sectionbuilderfromdatamanager.php:14
Bitrix\Calendar\Core\Event\Properties\AttendeeCollection
Определения
attendeecollection.php:11
Bitrix\Calendar\Core\Event\Properties\Location
Определения
location.php:9
Bitrix\Calendar\Core\Event\Properties\RecurringEventRules
Определения
recurringeventrules.php:11
Bitrix\Calendar\Core\Section\Section
Определения
section.php:12
Bitrix\Calendar\Util\getDateObject
static getDateObject(string $date=null, ?bool $fullDay=true, ?string $tz='UTC')
Определения
util.php:107
Bitrix\Main\Type\Date
Определения
date.php:9
Bitrix\Calendar\Core\Event\Properties
Определения
attendee.php:3
Bitrix\Calendar\Core\Event
Определения
event.php:3
elseif
if( $daysToExpire >=0 &&$daysToExpire< 60 elseif)( $daysToExpire< 0)
Определения
prolog_main_admin.php:393
$location
$location
Определения
options.php:2729
bitrix
modules
calendar
lib
core
builders
eventbuilderfromgetlist.php
Создано системой
1.14.0