function GetMRAccessability($Params)
{
global $USER;
if ($this->RMiblockId > 0 && $this->allowResMeeting)
{
$curEventId = $Params['curEventId'] > 0 ? $Params['curEventId'] : false;
$arSelect = array("ID", "NAME", "IBLOCK_ID", "ACTIVE_FROM", "ACTIVE_TO", "PROPERTY_*");
$arFilter = array(
"IBLOCK_ID" => $this->RMiblockId,
"IBLOCK_SECTION_ID" => $Params['id'],
"SECTION_ID" => array($Params['id']),
"INCLUDE_SUBSECTIONS" => "Y",
"ACTIVE" => "Y",
"CHECK_PERMISSIONS" => 'N',
">=DATE_ACTIVE_TO" => $Params['from'],
"<=DATE_ACTIVE_FROM" => $Params['to']
);
if(intval($curEventId) > 0)
$arFilter["!ID"] = intval($curEventId);
$arSort = Array('ACTIVE_FROM' => 'ASC');
$rsElement = CIBlockElement::GetList($arSort, $arFilter, false, false, $arSelect);
$arResult = array();
while($obElement = $rsElement->GetNextElement())
{
$arItem = $obElement->GetFields();
//if ($curEventId == $arItem['ID'])
//continue;
$props = $obElement->GetProperties(); // Get properties
$arItem["DISPLAY_ACTIVE_FROM"] = CIBlockFormatProperties::DateFormat(getDateFormat(true), MakeTimeStamp($arItem["ACTIVE_FROM"]));
$arItem["DISPLAY_ACTIVE_TO"] = CIBlockFormatProperties::DateFormat(getDateFormat(true), MakeTimeStamp($arItem["ACTIVE_TO"]));
$per_type = (isset($props['PERIOD_TYPE']['VALUE']) && $props['PERIOD_TYPE']['VALUE'] != 'NONE')? mb_strtoupper($props['PERIOD_TYPE']['VALUE']) : false;
if ($per_type)
{
$count = (isset($props['PERIOD_COUNT']['VALUE'])) ? intval($props['PERIOD_COUNT']['VALUE']) : '';
$length = (isset($props['EVENT_LENGTH']['VALUE'])) ? intval($props['EVENT_LENGTH']['VALUE']) : '';
$additional = (isset($props['PERIOD_ADDITIONAL']['VALUE'])) ? $props['PERIOD_ADDITIONAL']['VALUE'] : '';
$this->DisplayPeriodicEvent($arResult, array(
'arItem' => $arItem,
'perType' => $per_type,
'count' => $count,
'length' => $length,
'additional' => $additional,
'fromLimit' => $Params['from'],
'toLimit' => $Params['to']
));
}
else
{
$this->HandleElement($arResult, $arItem);
}
}
}
if ($this->VMiblockId > 0 && $this->allowVideoMeeting)
{
$curEventId = $Params['curEventId'] > 0 ? $Params['curEventId'] : false;
$arSelect = array("ID", "NAME", "IBLOCK_ID", "ACTIVE_FROM", "ACTIVE_TO", "PROPERTY_*");
$arFilter = array(
"IBLOCK_ID" => $this->VMiblockId,
//"IBLOCK_SECTION_ID" => $Params['id'],
//"SECTION_ID" => array($Params['id']),
//"INCLUDE_SUBSECTIONS" => "Y",
"ACTIVE" => "Y",
"CHECK_PERMISSIONS" => 'N',
">=DATE_ACTIVE_TO" => $Params['from'],
"<=DATE_ACTIVE_FROM" => $Params['to']
);
if(intval($curEventId) > 0)
$arFilter["!ID"] = intval($curEventId);
$arSort = Array('ACTIVE_FROM' => 'ASC');
$rsElement = CIBlockElement::GetList($arSort, $arFilter, false, false, $arSelect);
$arResult = array();
$arRes = Array();
while($obElement = $rsElement->GetNextElement())
{
$arItem = $obElement->GetFields();
//if ($curEventId == $arItem['ID'])
//continue;
$props = $obElement->GetProperties(); // Get properties
$arItem["DISPLAY_ACTIVE_FROM"] = CIBlockFormatProperties::DateFormat(getDateFormat(true), MakeTimeStamp($arItem["ACTIVE_FROM"]));
$arItem["DISPLAY_ACTIVE_TO"] = CIBlockFormatProperties::DateFormat(getDateFormat(true), MakeTimeStamp($arItem["ACTIVE_TO"]));
$per_type = (isset($props['PERIOD_TYPE']['VALUE']) && $props['PERIOD_TYPE']['VALUE'] != 'NONE')? mb_strtoupper($props['PERIOD_TYPE']['VALUE']) : false;
if ($per_type)
{
$count = (isset($props['PERIOD_COUNT']['VALUE'])) ? intval($props['PERIOD_COUNT']['VALUE']) : '';
$length = (isset($props['EVENT_LENGTH']['VALUE'])) ? intval($props['EVENT_LENGTH']['VALUE']) : '';
$additional = (isset($props['PERIOD_ADDITIONAL']['VALUE'])) ? $props['PERIOD_ADDITIONAL']['VALUE'] : '';
$this->DisplayPeriodicEvent($arResult, array(
'arItem' => $arItem,
'perType' => $per_type,
'count' => $count,
'length' => $length,
'additional' => $additional,
'fromLimit' => $Params['from'],
'toLimit' => $Params['to']
));
}
else
{
$vParams = Array(
"allowVideoMeeting" => true,
"dateFrom" => $arItem["ACTIVE_FROM"],
"dateTo" => $arItem["ACTIVE_TO"],
"VMiblockId" => $arItem["IBLOCK_ID"],
//"ID" => $arItem["ID"],
"regularity" => "NONE",
);
$check = false;
$check = CEventCalendar::CheckVR($vParams);
if ($check !== true && $check == "reserved")
{
//todo make only factical reserved, not any time
$this->HandleElement($arResult, $arItem);
}
}
}
}
CEventCalendar::DisplayJSMRAccessability($Params['id'], $arResult);
}