22 if (\COption::GetOptionString(
'calendar',
'eventWithLocationConverted',
'N') ===
'Y')
24 $meetingRoomList = [];
25 self::$meetingRoomList = $meetingRoomList;
27 return $meetingRoomList;
29 if (isset(self::$meetingRoomList))
31 $meetingRoomList = self::$meetingRoomList;
35 $meetingRoomList = [];
36 if (!\CCalendar::IsBitrix24() && Loader::includeModule(
'iblock'))
38 if (!isset($params[
'RMiblockId']) && !isset($params[
'VMiblockId']))
40 $settings = \CCalendar::GetSettings();
41 $pathsForSite = \CCalendar::GetSettings([
42 'forseGetSitePathes' =>
true,
43 'site' => \CCalendar::GetSiteId()
45 $RMiblockId = $settings[
'rm_iblock_id'];
46 $pathToMR = $pathsForSite[
'path_to_rm'];
50 $RMiblockId = $params[
'RMiblockId'];
51 $pathToMR = $params[
'pathToMR'];
54 if (self::$allowReserveMeeting && !\CCalendar::IsAdmin() && (\CIBlock::GetPermission($RMiblockId) <
'R'))
56 self::$allowReserveMeeting =
false;
59 if ((
int)$RMiblockId > 0 && \CIBlock::GetPermission($RMiblockId) >=
'R' && self::$allowReserveMeeting)
66 'IBLOCK_ID' => $RMiblockId,
78 $res = \CIBlockSection::GetList($orderBy, $filter,
false, $selectFields );
79 while ($arMeeting = $res->GetNext())
81 $meetingRoomList[] = [
82 'ID' => $arMeeting[
'ID'],
83 'NAME' => $arMeeting[
'~NAME'],
84 'DESCRIPTION' => $arMeeting[
'~DESCRIPTION'],
85 'UF_PLACE' => $arMeeting[
'UF_PLACE'],
86 'UF_PHONE' => $arMeeting[
'UF_PHONE'],
96 self::$meetingRoomList = $meetingRoomList;
99 return $meetingRoomList;
110 if (!Loader::includeModule(
'iblock'))
115 if ((
int)$params[
'RMiblockId'] > 0 && \CIBlock::GetPermission($params[
'RMiblockId']) >=
'R')
118 'IBLOCK_ID' => $params[
'RMiblockId'],
120 'ID' => $params[
'id']
122 $selectFields = [
'NAME'];
123 $res = \CIBlockSection::GetList([], $filter,
false, $selectFields);
124 if ($meeting = $res->GetNext())
130 if ((
int)$params[
'VMiblockId'] > 0 && \CIBlock::GetPermission($params[
'VMiblockId']) >=
'R')
133 'IBLOCK_ID' => $params[
'VMiblockId'],
142 $res = \CIBlockSection::GetList([], $filter,
false, $selectFields);
143 if ($meeting = $res->GetNext())
146 'ID' => $params[
'VMiblockId'],
147 'NAME' => $meeting[
'NAME'],
148 'DESCRIPTION' => $meeting[
'DESCRIPTION'],
164 if (!Loader::includeModule(
'iblock'))
169 $tst = MakeTimeStamp($params[
'dateTo']);
170 if (date(
'H:i', $tst) ===
'00:00')
172 $params[
'dateTo'] = \CIBlockFormatProperties::DateFormat(
173 \CCalendar::DFormat(
true),
174 $tst + (23 * 60 + 59) * 60
178 $settings = \CCalendar::GetSettings([
'request' =>
false]);
179 $params[
'RMiblockId'] = $settings[
'rm_iblock_id'];
188 'IBLOCK_ID' => $params[
'RMiblockId'],
189 'IBLOCK_SECTION_ID' => $params[
'mrid'],
190 'NAME' => $params[
'name'],
191 'DATE_ACTIVE_FROM' => $params[
'dateFrom'],
192 'DATE_ACTIVE_TO' => $params[
'dateTo'],
193 'CREATED_BY' => \CCalendar::GetCurUserId(),
194 'DETAIL_TEXT' => $params[
'description'],
195 'PROPERTY_VALUES' => [
196 'UF_PERSONS' => $params[
'persons'],
197 'PERIOD_TYPE' =>
'NONE'
202 $iBlockElem= new \CIBlockElement;
203 $id = $iBlockElem->Add($fields);
206 $cache =
new CPHPCache;
207 $cache->CleanDir(
'event_calendar/');
208 $cache->CleanDir(
'event_calendar/events/');
209 $cache->CleanDir(
'event_calendar/events/'.$params[
'RMiblockId']);
220 if (!Loader::includeModule(
'iblock'))
225 $settings = \CCalendar::GetSettings([
'request' =>
false]);
226 $params[
'RMiblockId'] = $settings[
'rm_iblock_id'];
229 'ID' => $params[
'mrevid'],
230 'IBLOCK_ID' => $params[
'RMiblockId'],
231 'IBLOCK_SECTION_ID' => $params[
'mrid'],
232 'SECTION_ID' => [$params[
'mrid']]
235 $res = \CIBlockElement::GetList([], $filter,
false,
false, [
'ID']);
238 $iBlockElem = new \CIBlockElement;
239 $iBlockElem::Delete($params[
'mrevid']);
243 $cache =
new CPHPCache;
244 $cache->CleanDir(
'event_calendar/');
245 $cache->CleanDir(
'event_calendar/events/');
246 $cache->CleanDir(
'event_calendar/events/'.$params[
'RMiblockId']);
257 if (!Loader::includeModule(
'iblock'))
262 $allowReserveMeeting =
263 $params[
'allowReserveMeeting'] ?? self::$allowReserveMeeting
265 $settings = \CCalendar::GetSettings([
'request' =>
false]);
266 $RMiblockId = $settings[
'rm_iblock_id'];
267 $curEventId = $params[
'curEventId'] ??
false;
269 $offset = \CCalendar::GetOffset();
271 if ($allowReserveMeeting)
282 'IBLOCK_ID' => $RMiblockId,
283 'SECTION_ID' => $params[
'id'],
284 'INCLUDE_SUBSECTIONS' =>
'Y',
286 'CHECK_PERMISSIONS' =>
'N',
287 '>=DATE_ACTIVE_TO' => $params[
'from'],
288 '<=DATE_ACTIVE_FROM' => $params[
'to']
290 if ((
int)$curEventId > 0)
292 $filter[
'!ID'] = (int)$curEventId;
295 $rsElement = \CIBlockElement::GetList([
'ACTIVE_FROM' =>
'ASC'], $filter,
false,
false, $select);
296 while($iBlockElem = $rsElement->GetNextElement())
298 $item = $iBlockElem->GetFields();
299 $item[
'DISPLAY_ACTIVE_FROM'] = \CIBlockFormatProperties::DateFormat(
300 \CCalendar::DFormat(
true), MakeTimeStamp($item[
'ACTIVE_FROM'])
302 $item[
'DISPLAY_ACTIVE_TO'] = \CIBlockFormatProperties::DateFormat(
303 \CCalendar::DFormat(
true), MakeTimeStamp($item[
'ACTIVE_TO'])
307 'ID' => (int)$item[
'ID'],
308 'NAME' => $item[
'~NAME'],
309 'DT_FROM' => \CCalendar::CutZeroTime($item[
'DISPLAY_ACTIVE_FROM']),
310 'DT_TO' => \CCalendar::CutZeroTime($item[
'DISPLAY_ACTIVE_TO']),
311 'DT_FROM_TS' => (\CCalendar::Timestamp($item[
'DISPLAY_ACTIVE_FROM']) - $offset) * 1000,
312 'DT_TO_TS' => (\CCalendar::Timestamp($item[
'DISPLAY_ACTIVE_TO']) - $offset) * 1000
328 if (!Loader::includeModule(
'iblock'))
333 $fromDateTime = MakeTimeStamp($params[
'dateFrom']);
334 $toDateTime = MakeTimeStamp($params[
'dateTo']);
337 'IBLOCK_ID' => $params[
'RMiblockId'],
338 'SECTION_ID' => $params[
'mrid'],
339 '<DATE_ACTIVE_FROM' => $params[
'dateTo'],
340 '>DATE_ACTIVE_TO' => $params[
'dateFrom'],
341 'PROPERTY_PERIOD_TYPE' =>
'NONE',
344 if ($params[
'mrevid_old'] > 0)
346 $filter[
'!=ID'] = $params[
'mrevid_old'];
349 $dbElements = \CIBlockElement::GetList(
350 [
'DATE_ACTIVE_FROM' =>
'ASC'],
356 if ($elements = $dbElements->GetNext())
361 include_once($_SERVER[
'DOCUMENT_ROOT'].
'/bitrix/components/bitrix/intranet.reserve_meeting/init.php');
362 $periodicElements = __IRM_SearchPeriodic($fromDateTime, $toDateTime, $params[
'RMiblockId'], $params[
'mrid']);
364 foreach ($periodicElements as $element)
366 if (!$params[
'mrevid_old'] || (
int)$element[
'ID'] !== (
int)$params[
'mrevid_old'])