Server IP : 80.87.202.40 / Your IP : 216.73.216.169 Web Server : Apache System : Linux rospirotorg.ru 5.14.0-539.el9.x86_64 #1 SMP PREEMPT_DYNAMIC Thu Dec 5 22:26:13 UTC 2024 x86_64 User : bitrix ( 600) PHP Version : 8.2.27 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /home/bitrix/ext_www/rospirotorg.ru/bitrix/modules/lists/lib/entity/ |
Upload File : |
<? namespace Bitrix\Lists\Entity; class Utils { /** * Returns an iblock id by code or id. * * @param array $params Incoming parameters. * * @return int */ public static function getIblockId(array $params) { if ($params["IBLOCK_ID"]) { return (int) $params["IBLOCK_ID"]; } elseif ($params["IBLOCK_CODE"] ?? null) { $queryObject = \CIBlock::getList([], [ "CHECK_PERMISSIONS" => "N", "=CODE" => $params["IBLOCK_CODE"] ]); if ($iblock = $queryObject->fetch()) { return (int) $iblock["ID"]; } } return 0; } /** * Returns an element id by code or id. * * @param array $params Incoming parameters. * * @return int */ public static function getElementId(array $params) { if (!empty($params["ELEMENT_ID"])) { return (int) $params["ELEMENT_ID"]; } elseif (is_scalar($params["ELEMENT_CODE"] ?? null)) { $queryObject = \CIBlockElement::getList([], [ "IBLOCK_ID" => Utils::getIblockId($params), "CHECK_PERMISSIONS" => "N", "=CODE" => $params["ELEMENT_CODE"], ], false, false, ["ID"]); if ($element = $queryObject->fetch()) { return (int) $element["ID"]; } } return 0; } /** * Returns an section id by code or id. * * @param array $params Incoming parameters. * * @return int */ public static function getSectionId(array $params) { if ($params["SECTION_ID"]) { return (int)$params["SECTION_ID"]; } elseif ($params["SECTION_CODE"]) { $queryObject = \CIBlockSection::getList([], [ "CHECK_PERMISSIONS" => "N", "CODE" => $params["SECTION_CODE"] ], false, false, ["ID"]); if ($section = $queryObject->fetch()) { return (int) $section["ID"]; } } return 0; } }