- Модуль: intranet
- Путь к файлу: ~/bitrix/modules/intranet/classes/general/event_calendar.php
- Класс: CEventCalendar
- Вызов: CEventCalendar::GetSuperposedEvents
function GetSuperposedEvents($arParams = array())
{
$bJS = isset($arParams['bJS']) ? $arParams['bJS'] : false;
$forExport = isset($arParams['forExport']) ? $arParams['forExport'] : false;
$bLoadAll = isset($arParams['bLoadAll']) ? $arParams['bLoadAll'] : false;
$result = $bJS ? '[]' : Array();
if (!$this->bSuperpose)
return $result;
$bCache = $bDontCache ? false : $this->bCache;
$arIblockIds = array();
$ids = array();
// Get array of iblockIds
for($i = 0, $l = count($this->arSPCalShow); $i < $l; $i++)
{
$id = $this->arSPCalShow[$i]['IBLOCK_ID'];
if (!in_array($id, $arIblockIds))
$arIblockIds[] = $id;
if (!isset($ids[$id]))
$ids[$id] = array();
$ids[$id][] = $this->arSPCalShow[$i]['ID'];
}
if ($bCache)
$cache = new CPHPCache;
for($i = 0, $l = count($arIblockIds); $i < $l; $i++)
{
$res = null;
if ($bCache)
{
$cachePath = $this->cachePath.'events/'.$arIblockIds[$i].'/sp_events/';
$arCacheId = array($this->curUserId, $bJS, $forExport);
if ($bLoadAll)
$arCacheId[] = $bLoadAll;
else
$arCacheId[] = $this->fromLimit." - ".$this->toLimit;
$arCacheId[] = $ids[$arIblockIds[$i]];
$cacheId = serialize($arCacheId);
if ($cache->InitCache($this->cacheTime, $cacheId, $cachePath))
{
$res = $cache->GetVars();
$res = $res['result'];
}
}
if (!$bCache || empty($res['result']))
{
$res = $this->GetEvents(array(
'iblockId' => $arIblockIds[$i],
'bJS' => $bJS,
'bSuperposed' => true,
'DontSaveOptions' => false,
'forExport' => $forExport,
'bLoadAll' => $bLoadAll
));
if ($bCache)
{
$cache->StartDataCache($this->cacheTime, $cacheId, $cachePath);
$cache->EndDataCache(array("result" => $res));
}
}
if ($bJS)
{
if (!$res || $res == '[]')
continue;
if ($result == '[]')
$result = $res;
else
$result = mb_substr($result, 0, -1).','.mb_substr($res, 1);
}
else
{
$result = array_merge($result, $res);
}
}
return $result;
}