21 public const TYPE =
'location';
32 if (Loader::includeModule(
'intranet') && !\
Bitrix\Intranet\Util::isIntranetUser())
37 $typeModel = TypeModel::createFromXmlId(Dictionary::CALENDAR_TYPE[
'location']);
40 !$accessController->check(ActionDictionary::ACTION_TYPE_EDIT, $typeModel, [])
48 $builder = new \Bitrix\Calendar\Core\Builders\Rooms\RoomBuilderFromRequest($this->
getRequest());
50 Rooms\Manager::createInstanceWithRoom($builder->build())
54 ->eventHandler(
'OnAfterCalendarRoomCreate')
55 ->addPullEvent(
'create_room')
58 if ($manager->getError())
65 return $manager->prepareResponseData();
77 if (Loader::includeModule(
'intranet') && !\
Bitrix\Intranet\Util::isIntranetUser())
82 $sectionId = (int)$this->
getRequest()->getPost(
'id');
83 $section = \CCalendarSect::GetById($sectionId);
84 $sectionModel = SectionModel::createFromArray($section);
87 !$accessController->check(ActionDictionary::ACTION_SECTION_EDIT, $sectionModel, [])
95 $builder = new \Bitrix\Calendar\Core\Builders\Rooms\RoomBuilderFromRequest($this->
getRequest());
97 Rooms\Manager::createInstanceWithRoom($builder->build())
101 ->eventHandler(
'OnAfterCalendarRoomUpdate')
102 ->addPullEvent(
'update_room')
105 if ($manager->getError())
112 return $manager->prepareResponseData();
124 if (Loader::includeModule(
'intranet') && !\
Bitrix\Intranet\Util::isIntranetUser())
129 $sectionId = (int)$this->
getRequest()->getPost(
'id');
130 $section = \CCalendarSect::GetById($sectionId);
131 $sectionModel = SectionModel::createFromArray($section);
134 !$accessController->check(ActionDictionary::ACTION_SECTION_EDIT, $sectionModel, [])
142 $builder = new \Bitrix\Calendar\Core\Builders\Rooms\RoomBuilderFromRequest($this->
getRequest());
144 Rooms\Manager::createInstanceWithRoom($builder->build())
147 ->deleteEmptyEvents()
148 ->deleteLocationFromEvents()
151 ->eventHandler(
'OnAfterCalendarRoomDelete')
152 ->addPullEvent(
'delete_room')
155 if ($manager->getError())
162 return $manager->prepareResponseData();
174 if (Loader::includeModule(
'intranet') && !\
Bitrix\Intranet\Util::isIntranetUser())
179 $typeModel = TypeModel::createFromXmlId(Dictionary::CALENDAR_TYPE[
'location']);
181 if (!$accessController->check(ActionDictionary::ACTION_TYPE_VIEW, $typeModel, []))
187 return Rooms\Manager::prepareRoomManagerData();
200 if (Loader::includeModule(
'intranet') && !\
Bitrix\Intranet\Util::isIntranetUser())
205 $typeModel = TypeModel::createFromXmlId(Dictionary::CALENDAR_TYPE[
'location']);
207 if (!$accessController->check(ActionDictionary::ACTION_TYPE_VIEW, $typeModel, []))
213 $result[
'rooms'] = Rooms\Manager::getRoomsList();
224 if (Loader::includeModule(
'intranet') && !\
Bitrix\Intranet\Util::isIntranetUser())
229 $typeModel = TypeModel::createFromXmlId(Dictionary::CALENDAR_TYPE[
'location']);
231 if (!$accessController->check(ActionDictionary::ACTION_TYPE_VIEW, $typeModel, []))
239 Rooms\AccessibilityManager::createInstance()
240 ->setLocationList(
$request->getPost(
'locationList'))
241 ->setDatesRange(
$request->getPost(
'datesRange'))
242 ->getLocationAccessibility()
252 $value = (
$request->getPost(
'value') ===
'true');
254 \CUserOptions::SetOption(
256 'hideSettingsHintLocation',
261 public function cancelBookingAction(): ?array
263 if (Loader::includeModule(
'intranet') && !\
Bitrix\Intranet\Util::isIntranetUser())
270 $params[
'recursion_mode'] =
$request->getPost(
'recursion_mode');
271 $params[
'parent_event_id'] = (int)
$request->getPost(
'parent_event_id');
272 $params[
'section_id'] = (int)
$request->getPost(
'section_id');
273 $params[
'current_event_date_from'] =
$request->getPost(
'current_event_date_from');
274 $params[
'current_event_date_to'] =
$request->getPost(
'current_event_date_to');
275 $params[
'owner_id'] = (int)
$request->getPost(
'owner_id');
279 SectionModel::createFromId($params[
'section_id'])
280 ->setType(Dictionary::CALENDAR_TYPE[
'location'])
282 $accessController =
new SectionAccessController(CCalendar::GetUserId());
283 if (!$accessController->check(ActionDictionary::ACTION_SECTION_ACCESS, $sectionModel, []))
290 Rooms\Manager::createInstance()
291 ->cancelBooking($params)
294 if ($manager->getError())
306 if (Loader::includeModule(
'intranet') && !\
Bitrix\Intranet\Util::isIntranetUser())
311 $typeModel = TypeModel::createFromXmlId(Dictionary::CALENDAR_TYPE[
'location']);
314 !$accessController->check(ActionDictionary::ACTION_TYPE_EDIT, $typeModel, [])
322 $builder = new \Bitrix\Calendar\Core\Builders\Rooms\Categories\CategoryBuilderFromRequest($this->
getRequest());
324 Rooms\Categories\Manager::createInstance($builder->build())
327 ->addPullEvent(
'create_category')
330 if ($manager->getError())
337 return Rooms\Categories\Manager::getCategoryList();
342 if (Loader::includeModule(
'intranet') && !\
Bitrix\Intranet\Util::isIntranetUser())
347 $typeModel = TypeModel::createFromXmlId(Dictionary::CALENDAR_TYPE[
'location']);
350 !$accessController->check(ActionDictionary::ACTION_TYPE_EDIT, $typeModel, [])
358 $builder = new \Bitrix\Calendar\Core\Builders\Rooms\Categories\CategoryBuilderFromRequest($this->
getRequest());
360 Rooms\Categories\Manager::createInstance($builder->build())
363 ->addPullEvent(
'update_category')
366 if ($manager->getError())
373 return Rooms\Categories\Manager::getCategoryList();
378 if (Loader::includeModule(
'intranet') && !\
Bitrix\Intranet\Util::isIntranetUser())
383 $typeModel = TypeModel::createFromXmlId(Dictionary::CALENDAR_TYPE[
'location']);
386 !$accessController->check(ActionDictionary::ACTION_TYPE_EDIT, $typeModel, [])
394 $builder = new \Bitrix\Calendar\Core\Builders\Rooms\Categories\CategoryBuilderFromRequest($this->
getRequest());
396 Rooms\Categories\Manager::createInstance($builder->build())
399 ->addPullEvent(
'delete_category')
402 if ($manager->getError())
409 return Rooms\Categories\Manager::getCategoryList();
414 if (Loader::includeModule(
'intranet') && !\
Bitrix\Intranet\Util::isIntranetUser())
419 $typeModel = TypeModel::createFromXmlId(Dictionary::CALENDAR_TYPE[
'location']);
421 if (!$accessController->check(ActionDictionary::ACTION_TYPE_VIEW, $typeModel, []))
428 $response[
'categories'] = Rooms\Categories\Manager::getCategoryList();
435 if (Loader::includeModule(
'intranet') && !\
Bitrix\Intranet\Util::isIntranetUser())
440 $categoryManagerData = [];
441 $categoryManagerData[
'permissions'] = Rooms\PermissionManager::getAvailableOperations() ?? [];
442 $categoryManagerData[
'categories'] = Rooms\Categories\Manager::getCategoryList() ?? [];
444 return $categoryManagerData;
static loadMessages($file)
static getMessage($code, $replace=null, $language=null)