• Модуль: intranet
  • Путь к файлу: ~/bitrix/modules/intranet/classes/general/event_calendar.php
  • Класс: CEventCalendar
  • Вызов: CEventCalendar::ReserveMR
function ReserveMR($Params)
{
	$tst = MakeTimeStamp($Params['dateTo']);
	if (date("H:i", $tst) == '00:00')
		$Params['dateTo'] = CIBlockFormatProperties::DateFormat(getDateFormat(true), $tst + (23 * 60 + 59) * 60);

	$check = CEventCalendar::CheckMR($Params);
	if ($check !== true)
		return $check;

	$arFields = array(
		"IBLOCK_ID" => $Params['RMiblockId'],
		"IBLOCK_SECTION_ID" => $Params['mrid'],
		"NAME" => $Params['name'],
		"DATE_ACTIVE_FROM" => $Params['dateFrom'],
		"DATE_ACTIVE_TO" => $Params['dateTo'],
		"CREATED_BY" => $GLOBALS["USER"]->GetID(),
		"DETAIL_TEXT" => $Params['description'],
		"PROPERTY_VALUES" => array(
			"UF_PERSONS" => $Params['persons'],
			"PERIOD_TYPE" => $Params['regularity'],
			"PERIOD_COUNT" => $Params['regularity_count'],
			"EVENT_LENGTH" => $Params['regularity_length'],
			"PERIOD_ADDITIONAL" => $Params['regularity_additional']
		),
		"ACTIVE" => "Y"
	);

	$bs = new CIBlockElement;
	$id = $bs->Add($arFields);

	return $id;
}