Ejemplo n.º 1
0
 function GetGuestsAccessability($Params)
 {
     $iblockId = $this->userIblockId;
     $curEventId = $Params['curEventId'] > 0 ? $Params['curEventId'] : false;
     $arSelect = array("ID", "NAME", "IBLOCK_ID", "ACTIVE_FROM", "ACTIVE_TO", "CREATED_BY", "PROPERTY_*");
     $arFilter = array("IBLOCK_ID" => $iblockId, "ACTIVE" => "Y", "CHECK_PERMISSIONS" => 'N', "CREATED_BY" => $Params['users'], "PROPERTY_PRIVATE" => false, "!=PROPERTY_CONFIRMED" => $this->GetConfirmedID($iblockId, "N"), ">=DATE_ACTIVE_TO" => $Params['from'], "<=DATE_ACTIVE_FROM" => $Params['to']);
     $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
         if ($curEventId > 0 && isset($props['PARENT']) && $props['PARENT']['VALUE'] == $curEventId) {
             continue;
         }
         $uid = $arItem['CREATED_BY'];
         if (!isset($arResult[$uid])) {
             $arResult[$uid] = array();
         }
         $arItem["ACCESSIBILITY"] = $props['ACCESSIBILITY']['VALUE'] ? $props['ACCESSIBILITY']['VALUE'] : 'busy';
         $arItem["IMPORTANCE"] = $props['IMPORTANCE']['VALUE'] ? $props['IMPORTANCE']['VALUE'] : 'normal';
         $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' ? 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[$uid], array('arItem' => $arItem, 'perType' => $per_type, 'count' => $count, 'length' => $length, 'additional' => $additional, 'fromLimit' => $Params['from'], 'toLimit' => $Params['to']));
         } else {
             $this->HandleElement($arResult[$uid], $arItem);
         }
     }
     if (count($arResult) > 0) {
         CEventCalendar::DisplayJSGuestsAccessability($arResult);
     }
 }