public static function getSefviceMediaspect($service_id, $section_id = false) { $result = false; if (!$section_id) { $res = CIBlockElement::GetByID($service_id); if ($element = $res->GetNext()) { $section_id = $element["IBLOCK_SECTION_ID"]; } } if ($section_id) { $section = DrclinicsHelper::getMediaspects($section_id); $section = end($section); if ($section) { $result = $section; } else { $nav = CIBlockSection::GetNavChain(false, $section_id, array("ID", "CODE", "SECTION_PAGE_URL", "DEPTH_LEVEL")); while (($arSectionPath = $nav->GetNext()) && $arSectionPath["DEPTH_LEVEL"] != 2) { } if ($arSectionPath) { $result = $arSectionPath; } } } return $result; }
if ($code) { if (substr($code, -1) == '/') { $code = substr($code, 0, -1); } $res = CIBlockSection::GetList(array(), array('IBLOCK_ID' => DrclinicsHelper::IBLOCK_SERVICES_ID, '=CODE' => trim($code), "UF_IS_MEDASPECTS" => "1"), false, false, array('ID', 'NAME')); if ($obj = $res->GetNext()) { $active_direction = $obj['ID']; } } } } $parent_id = false; if (isset($arParams["PARENT_SECTION_ID"])) { $parent_id = $arParams["PARENT_SECTION_ID"]; } $arItems = DrclinicsHelper::getMediaspects(false, NULL, false, $parent_id); $currentItem = array(); $k = 1; foreach ($arItems as $k => $arItem) { if (isset($arParams['HOME_USE']) && $arParams['HOME_USE'] == "Y") { if (!$arItem["UF_HOME"]) { unset($arItems[$k]); continue; } } if (!$active_direction) { $active_direction = $arItem["ID"]; } $arItems[$k]["INDEX"] = $k; $arItems[$k]["ACTIVE"] = $active_direction == $arItem["ID"]; if ($arItems[$k]["ACTIVE"]) {