public static function GetUserUrl($userId = 0, $pathToUser = "") { if ($pathToUser == '') { if (self::$pathToUser == '') { if (empty(self::$pathesForSite)) { self::$pathesForSite = self::GetPathes(SITE_ID); } self::$pathToUser = self::$pathesForSite['path_to_user']; } $pathToUser = self::$pathToUser; } return CUtil::JSEscape(CComponentEngine::MakePathFromTemplate($pathToUser, array("user_id" => $userId, "USER_ID" => $userId))); }
function Init($Params) { global $USER; $access = new CAccess(); $access->UpdateCodes(); // Owner params self::$siteId = isset($Params['siteId']) ? $Params['siteId'] : SITE_ID; self::$type = $Params['type']; self::$arTypes = CCalendarType::GetList(); self::$bIntranet = CCalendar::IsIntranetEnabled(); self::$bSocNet = self::IsSocNet(); self::$userId = intVal(isset($Params['userId']) ? $Params['userId'] : $USER->GetID()); self::$bOwner = self::$type == 'user' || self::$type == 'group'; self::$settings = self::GetSettings(); self::$userSettings = self::GetUserSettings(); self::$pathesForSite = self::GetPathes(self::$siteId); self::$pathToUser = self::$pathesForSite['path_to_user']; self::$bSuperpose = $Params['allowSuperpose'] != false && self::$bSocNet; self::$bAnonym = !$USER || !$USER->IsAuthorized(); self::$userNameTemplate = self::$settings['user_name_template']; self::$bAMPM = IsAmPmMode(); self::$bWideDate = strpos(FORMAT_DATETIME, 'MMMM') !== false; if (isset($Params['SectionControlsDOMId'])) self::$SectionsControlsDOMId = $Params['SectionControlsDOMId']; if (self::$bOwner && isset($Params['ownerId']) && $Params['ownerId'] > 0) self::$ownerId = intVal($Params['ownerId']); self::$bTasks = self::$type == 'user' && $Params['showTasks'] !== false && CModule::IncludeModule('tasks'); if (self::$bTasks && self::$ownerId != self::$userId) self::$bTasks = false; self::GetPermissions(array( 'type' => self::$type, 'bOwner' => self::$bOwner, 'userId' => self::$userId, 'ownerId' => self::$ownerId, )); // Cache params if (isset($Params['cachePath'])) self::$cachePath = $Params['cachePath']; if (isset($Params['cacheTime'])) self::$cacheTime = $Params['cacheTime']; self::$bCache = self::$cacheTime > 0; // Urls $page = preg_replace( array( "/EVENT_ID=.*?\&/i", "/CHOOSE_MR=.*?\&/i", "/action=.*?\&/i", "/bx_event_calendar_request=.*?\&/i", "/clear_cache=.*?\&/i", "/bitrix_include_areas=.*?\&/i", "/bitrix_show_mode=.*?\&/i", "/back_url_admin=.*?\&/i" ), "", $Params['pageUrl'].'&' ); $page = preg_replace(array("/^(.*?)\&$/i","/^(.*?)\?$/i"), "\$1", $page); self::$actionUrl = $page; if (self::$bOwner && !empty(self::$ownerId)) self::$path = self::GetPath(self::$type, self::$ownerId, true); else self::$path = (CMain::IsHTTPS() ? "https://" : "http://").$_SERVER['HTTP_HOST'].$page; self::$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", "EVENT_ID", "CHOOSE_MR"), false); //$this->fullUrl = (CMain::IsHTTPS() ? "https://" : "http://").$_SERVER['HTTP_HOST'].$page; // Superposing self::$bCanAddToSuperpose = false; if (self::$bSuperpose) { if (self::$type == 'user' || self::$type == 'group') self::$bCanAddToSuperpose = true; foreach(self::$arTypes as $t) { if (is_array(self::$settings['denied_superpose_types']) && !in_array($t['XML_ID'], self::$settings['denied_superpose_types'])) self::$arSPTypes[] = $t['XML_ID']; } self::$bCanAddToSuperpose = (is_array(self::$arSPTypes) && in_array(self::$type, self::$arSPTypes)); } // **** Reserve meeting and reserve video meeting // *** Meeting room params *** $RMiblockId = self::$settings['rm_iblock_id']; self::$allowReserveMeeting = $Params["allowResMeeting"] && $RMiblockId > 0; if(self::$allowReserveMeeting && !$USER->IsAdmin() && (CIBlock::GetPermission($RMiblockId) < "R")) self::$allowReserveMeeting = false; // *** Video meeting room params *** $VMiblockId = self::$settings['vr_iblock_id']; self::$allowVideoMeeting = $Params["allowVideoMeeting"] && $VMiblockId > 0; if(self::$allowVideoMeeting && !$USER->IsAdmin() && (CIBlock::GetPermission($VMiblockId) < "R") && !CModule::IncludeModule("video")) self::$allowVideoMeeting = false; }