• Модуль: intranet
  • Путь к файлу: ~/bitrix/modules/intranet/classes/general/event_calendar.php
  • Класс: CEventCalendar
  • Вызов: CEventCalendar::Init
public function Init($arParams)
{
	global $USER;
	// Owner params
	$this->ownerType = $arParams['ownerType'];

	if (CModule::IncludeModule('calendar') && COption::GetOptionString("intranet", "calendar_2", "N") == "Y")
	{
		$this->reserveMeetingReadonlyMode = $arParams['reserveMeetingReadonlyMode'];
		$this->pathToReserveNew = CHTTP::urlAddParams(preg_replace("/#user_id#/i", $USER->GetID(), $arParams['pathToUserCalendar']), array('EVENT_ID' => 'NEW', 'CHOOSE_MR' => 'Y'));
	}

	$this->ownerId = intval($arParams['ownerId']);
	$this->bOwner = $this->ownerType == 'GROUP' || $this->ownerType == 'USER';
	$this->curUserId = $USER->GetID();
	$this->bSocNet = $this->IsSocNet();

	if (!$this->bSocNet)
	{
		$arParams['allowSuperpose'] = false;
	}

	// Data source
	$this->iblockId = intval($arParams['iblockId']);

	// Cache params
	$this->cachePath = "event_calendar/";
	$this->cacheTime = intval($arParams['cacheTime']);
	$this->bCache = $this->cacheTime > 0;

	// Urls
	$page = preg_replace(
		array(
			"/action=.*?&/i",
			"/bx_event_calendar_request=.*?&/i",
			"/clear_cache=.*?&/i",
			"/bitrix_include_areas=.*?&/i",
			"/bitrix_show_mode=.*?&/i",
			"/back_url_admin=.*?&/i"
		),
		"", $arParams['pageUrl'].'&'
	);
	$page = preg_replace(array("/^(.*?)&$/i","/^(.*?)?$/i"), "$1", $page);
	$this->pageUrl = $page;
	$this->fullUrl = (CMain::IsHTTPS() ? "https://" : "http://").$_SERVER['HTTP_HOST'].$page;
	$this->outerUrl = $GLOBALS['APPLICATION']->GetCurPageParam('', array("action", "bx_event_calendar_request", "clear_cache", "bitrix_include_areas", "bitrix_show_mode", "back_url_admin", "SEF_APPLICATION_CUR_PAGE_URL"), false);

	$this->userIblockId = $arParams['userIblockId'];
	//$iblockId = COption::GetOptionInt("intranet", 'iblock_calendar'); // Get iblock id for users calendar from module-settings

	// Superposing
	$this->allowSuperpose = $arParams['allowSuperpose'];
	if (!$USER->IsAuthorized())
		$this->allowSuperpose = false;

	if ($this->allowSuperpose)
	{
		$this->allowAdd2SP = $this->ownerType == 'USER';
		$this->arSPIblIds = is_array($arParams['arSPIblIds']) ? $arParams['arSPIblIds'] : array();
		$this->spGroupsIblId = intval($arParams['spGroupsIblId']); // iblock id for groups calendars
		$this->superposeGroupsCals = $this->spGroupsIblId > 0 ? $arParams['superposeGroupsCals'] : false;
		$this->superposeUsersCals = $this->userIblockId > 0 ? $arParams['superposeUsersCals'] : false;
		$this->superposeCurUserCals = $arParams['superposeCurUserCals'];
		$this->arSPCalsDisplayedDef = is_array($arParams['arSPCalDispDef']) ? $arParams['arSPCalDispDef'] : array();
		$this->addCurUserCalDispByDef = $this->superposeCurUserCals && $arParams['addCurUserCalDispByDef'];
		$this->superposeExportLink = $this->GetSPExportLink();
	}

	// Reserve meeting and reserve video meeting
	$this->allowResMeeting = $arParams["allowResMeeting"] && $arParams["RMiblockId"] > 0;
	$this->RMiblockId = $arParams["RMiblockId"];
	$this->RMPath = $arParams["RMPath"];
	$this->RMUserGroups = $arParams["RMUserGroups"];
	// Check groups for reserve meeting access
	if(!$USER->IsAdmin() && (CIBlock::GetPermission($this->RMiblockId) < "R" || count(array_intersect($USER->GetUserGroupArray(), $this->RMUserGroups)) <= 0))
		$this->allowResMeeting = false;

	// Check groups for reserve video meeting access
	$this->allowVideoMeeting = $arParams["allowVideoMeeting"] && $arParams["VMiblockId"] > 0;
	$this->VMiblockId = $arParams["VMiblockId"];
	$this->VMPath = $arParams["VMPath"];
	$this->VMPathDetail = $arParams["VMPathDetail"];
	$this->VMUserGroups = $arParams["VMUserGroups"];

	if(!$USER->IsAdmin() && (CIBlock::GetPermission($this->VMiblockId) < "R" || count(array_intersect($USER->GetUserGroupArray(), $this->VMUserGroups)) <= 0))
		$this->allowVideoMeeting = false;

	// Init variables
	$this->arCalenderIndex = array();
	$this->sSPCalKey = "SP_CAL_DISPLAYED";
	$this->sSPTrackingUsersKey = "SP_CAL_TRACKING_USERS";

	$this->bSocNetLog = true;
	$this->pathToUser = $arParams['pathToUser'];
	$this->pathToUserCalendar = $arParams['pathToUserCalendar'];
	$this->pathToGroupCalendar = $arParams['pathToGroupCalendar'];
	$this->newSectionId = 'none';
	$this->reinviteParamsList = $arParams['reinviteParamsList'];

	$this->bExtranet = CModule::IncludeModule('extranet') && CExtranet::IsExtranetSite();
}