• Модуль: intranet
  • Путь к файлу: ~/bitrix/modules/intranet/classes/general/event_calendar.php
  • Класс: CEventCalendar
  • Вызов: CEventCalendar::GetCommonSPCalendars
function GetCommonSPCalendars($arIDs)
{
	$bCache = $this->bCache;
	if ($bCache)
	{
		$cachePath = $this->cachePath.'sp_common/';
		$cache = new CPHPCache;
		$cacheId = 'ec_sp_'.implode('_', $arIDs).'ug'.implode('_', $GLOBALS['USER']->GetUserGroupArray());

		if ($cache->InitCache($this->cacheTime, $cacheId, $cachePath))
		{
			$res = $cache->GetVars();
			$arCals = $res['arCommonSPCals'];
		}
	}

	if (!$bCache || empty($arCals))
	{
		$arCals = array();
		for($i = 0, $l = count($arIDs); $i < $l; $i++)
		{
			$calIblockId= intval($arIDs[$i]);
			if ($calIblockId <= 0)
				continue;

			$res = CIBlock::GetList(array(), array("ID"=>$calIblockId, "CHECK_PERMISSIONS" => $this->bExportSP ? 'N' : 'Y'));
			if(!$res = $res->Fetch())
				continue;

			$arCals_ = $this->GetCalendars(array(
				'bOwner' => false,
				'sectionId' => 0,
				'iblockId' => $calIblockId,
				'forExport' => $this->bExportSP,
				'bSuperposed' => true
			));

			$arCals[] = Array(
				'ID' => $calIblockId,
				'NAME' => $res['NAME'],
				'GROUP_TITLE' => GetMessage('EC_SUPERPOSE_GR_COMMON'),
				'GROUP' => 'COMMON',
				'READONLY' => true,
				'ITEMS' => $this->ExtendCalArray($arCals_, array('GROUP_TITLE' => GetMessage('EC_SUPERPOSE_GR_COMMON'), "NAME" => $res['NAME']))
			);
		}

		if ($bCache)
		{
			$cache->StartDataCache($this->cacheTime, $cacheId, $cachePath);
			$cache->EndDataCache(array("arCommonSPCals" => $arCals));
		}
	}

	for($i = 0, $l = count($arCals); $i < $l; $i++)
	{
		if ($arCals[$i]["ID"] == $this->iblockId)
			$this->allowAdd2SP = true;

		if ($arCals[$i]["ID"] == $this->iblockId && !$this->bOwner)
			$this->_sp_par_name = $res['NAME'];

		$this->arSPCal[] = $arCals[$i];
	}

	if (!$this->bSuperpose)
		$this->bSuperpose = count($this->arSPCal) > 0;
}