• Модуль: extranet
  • Путь к файлу: ~/bitrix/modules/extranet/classes/general/wizard_utils.php
  • Класс: CExtranetWizardServices
  • Вызов: CExtranetWizardServices::GetThemes
static function GetThemes($relativePath)
{
	$arThemes = Array();

	if (!is_dir($_SERVER["DOCUMENT_ROOT"].$relativePath))
		return $arThemes;

	$themePath = $_SERVER["DOCUMENT_ROOT"].$relativePath;
	$themePath = str_replace("\", "/", $themePath);

	if ($handle = @opendir($themePath))
	{
		while (($file = readdir($handle)) !== false)
		{
			if ($file == "." || $file == ".." || !is_dir($themePath."/".$file))
				continue;

			$arTemplate = Array();
			if (is_file($themePath."/".$file."/description.php"))
			{
				if (LANGUAGE_ID != "en" && LANGUAGE_ID != "ru")
				{
					if (file_exists($themePath."/".$file."/lang/en/description.php"))
						__IncludeLang($themePath."/".$file."/lang/en/description.php");
				}

				if (file_exists($themePath."/".$file."/lang/".LANGUAGE_ID."/description.php"))
						__IncludeLang($themePath."/".$file."/lang/".LANGUAGE_ID."/description.php");

				@include($themePath."/".$file."/description.php");
			}

			$arThemes[$file] = $arTemplate + Array(
				"ID" => $file,
				"SORT" => (isset($arTemplate["SORT"]) && intval($arTemplate["SORT"]) > 0 ? intval($arTemplate["SORT"]) : 10),
				"NAME" => (isset($arTemplate["NAME"]) ? $arTemplate["NAME"] : $file),
				"PREVIEW" => (file_exists($themePath."/".$file."/preview.gif") ? $relativePath."/".$file."/preview.gif" : false),
				"SCREENSHOT" => (file_exists($themePath."/".$file."/screen.gif") ? $relativePath."/".$file."/screen.gif" : false),
			);

		}
		@closedir($handle);
	}

	uasort(
		$arThemes,
		function ($a, $b) {
			return strcmp($a["SORT"], $b["SORT"]);
		}
	);

	return $arThemes;
}