Bitrix-D7
23.9
Загрузка...
Поиск...
Не найдено
attendeecollection.php
1
<?php
2
3
namespace
Bitrix\Calendar\Core\Event\Properties
;
4
5
use ArrayIterator;
6
use
Bitrix\Calendar\Core\Base\PropertyCollection
;
7
use
Bitrix\Calendar\Core\Role\Helper
;
8
9
10
class
AttendeeCollection
extends
PropertyCollection
11
{
13
private
array $attendeesIdCollection = [];
15
private
array $attendeesCodesCollection = [];
16
20
public
function
getFields
(): array
21
{
22
return
array_merge(parent::getFields(), [
23
'attendeesIdCollection'
=> $this->attendeesIdCollection,
24
'attendeesCodesCollection'
=> $this->attendeesCodesCollection
25
]);
26
}
27
34
public
function
getIterator
(): ArrayIterator
35
{
36
if
(!$this->collection && $this->attendeesIdCollection)
37
{
38
$this->loadAttendees();
39
}
40
41
return
parent::getIterator();
42
}
43
47
public
function
count
(): int
48
{
49
if
(!$this->collection && $this->attendeesIdCollection)
50
{
51
return
count
($this->attendeesIdCollection);
52
}
53
54
if
(!$this->collection && $this->attendeesCodesCollection)
55
{
56
return
count
($this->attendeesCodesCollection);
57
}
58
59
return
parent::count();
60
}
61
66
public
function
setAttendeesId
(array $attendeesId):
AttendeeCollection
67
{
68
$this->attendeesIdCollection = $attendeesId;
69
70
return
$this;
71
}
72
73
public
function
setAttendeesCodes
(array $attendeesCodes):
AttendeeCollection
74
{
75
$this->attendeesCodesCollection = $attendeesCodes;
76
77
return
$this;
78
}
79
80
public
function
getAttendeesCodes
(): array
81
{
82
return
$this->attendeesCodesCollection;
83
}
84
91
private
function
loadAttendees(): void
92
{
93
foreach
($this->attendeesIdCollection as $attendee)
94
{
95
if
(!$attendee)
96
{
97
continue
;
98
}
99
100
// if (mb_strpos($attendee, 'U') === 0)
101
// {
102
// $attendee = mb_substr($attendee, 1);
103
// }
104
if
((
int
)$attendee)
105
{
106
$this->
add
(
107
Helper::getUserRole((
int
)$attendee)
108
);
109
}
110
}
111
}
112
120
public
function
toString
($separator =
', '
): string
121
{
122
if
(!$this->collection)
123
{
124
$this->loadAttendees();
125
}
126
127
return
parent::toString($separator);
128
}
129
133
public
function
getAttendeesIdCollection
(): array
134
{
135
return
$this->attendeesIdCollection;
136
}
137
}
Bitrix\Calendar\Core\Base\Collection\add
add($item)
Definition
collection.php:45
Bitrix\Calendar\Core\Base\PropertyCollection
Definition
propertycollection.php:6
Bitrix\Calendar\Core\Event\Properties\AttendeeCollection
Definition
attendeecollection.php:11
Bitrix\Calendar\Core\Event\Properties\AttendeeCollection\getAttendeesIdCollection
getAttendeesIdCollection()
Definition
attendeecollection.php:133
Bitrix\Calendar\Core\Event\Properties\AttendeeCollection\getIterator
getIterator()
Definition
attendeecollection.php:34
Bitrix\Calendar\Core\Event\Properties\AttendeeCollection\toString
toString($separator=', ')
Definition
attendeecollection.php:120
Bitrix\Calendar\Core\Event\Properties\AttendeeCollection\getAttendeesCodes
getAttendeesCodes()
Definition
attendeecollection.php:80
Bitrix\Calendar\Core\Event\Properties\AttendeeCollection\count
count()
Definition
attendeecollection.php:47
Bitrix\Calendar\Core\Event\Properties\AttendeeCollection\setAttendeesId
setAttendeesId(array $attendeesId)
Definition
attendeecollection.php:66
Bitrix\Calendar\Core\Event\Properties\AttendeeCollection\setAttendeesCodes
setAttendeesCodes(array $attendeesCodes)
Definition
attendeecollection.php:73
Bitrix\Calendar\Core\Event\Properties\AttendeeCollection\getFields
getFields()
Definition
attendeecollection.php:20
Bitrix\Calendar\Core\Role\Helper
Definition
helper.php:10
Bitrix\Calendar\Core\Event\Properties
Definition
attendee.php:3
modules
calendar
lib
core
event
properties
attendeecollection.php
Создано системой
1.10.0