• Модуль: intranet
  • Путь к файлу: ~/bitrix/modules/intranet/classes/general/utils.php
  • Класс: CIntranetUtils
  • Вызов: CIntranetUtils::getB24FirstPageLink
static function getB24FirstPageLink()
{
	global $USER;

	$firstPagePath = CUserOptions::GetOption("intranet", "left_menu_first_page_".SITE_ID);
	$firstPagePath = ltrim($firstPagePath);
	if (empty($firstPagePath))
	{
		$firstPagePath = COption::GetOptionString("intranet", "left_menu_first_page", "");

		if (
			preg_match("~^".SITE_DIR."crm~i", $firstPagePath)
			&& BitrixMainLoader::includeModule("crm")
		)
		{
			if (!CCrmPerms::IsAccessEnabled())
			{
				$firstPagePath = SITE_DIR."company/personal/user/".$USER->GetID()."/tasks/";
			}
		}

		$firstPagePath = str_replace("#USER_ID#", $USER->GetID(), $firstPagePath);
	}

	if (
		BitrixMainLoader::includeModule("crm")
		&& preg_match("~^".SITE_DIR."crm/lead/~i", $firstPagePath)
		&& !BitrixCrmSettingsLeadSettings::isEnabled()
	)
	{
		if (BitrixCrmSettingsDealSettings::getCurrent()->getCurrentListViewID() == BitrixCrmSettingsDealSettings::VIEW_KANBAN)
			$firstPagePath = SITE_DIR."crm/deal/kanban/";
		else
			$firstPagePath = CCrmOwnerType::GetListUrl(CCrmOwnerType::Deal);
	}

	if (
		empty($firstPagePath)
		|| preg_match("~^(/(\?.*)?|/index.php(\?.*)?)$~i", $firstPagePath)
		|| preg_match("~^(http|//|/company/personal/mail/)~i", $firstPagePath)
	)
	{
		$firstPagePath = SITE_DIR."stream/";
	}

	if (!empty($_SERVER["QUERY_STRING"]))
	{
		if (mb_strrpos($firstPagePath, "?") === false)
		{
			$firstPagePath .= "?".$_SERVER["QUERY_STRING"];
		}
		else
		{
			$firstPagePath .= "&".$_SERVER["QUERY_STRING"];
		}
	}

	return $firstPagePath;
}