Example #1
0
 /**
  * Returns iblock type information with additional language depended messages.<br>
  *
  * Additional to {@link CIBlockType} language depended fields:
  * <ul>
  * <li>NAME - Name of the type
  * <li>SECTION_NAME - How sections are called
  * <li>ELEMENT_NAME - How elements are called
  * </ul>
  *
  * <code>
  * if (CModule::IncludeModule('iblock'))
  * &#123;
  * 	$rsTypeLang = CIBlockType::GetByIDLang('test', 'en');
  * 	$arTypeLang = $rsTypeLang->GetNext();
  * 	if ($arTypeLang)
  * 	&#123;
  * 		echo '&lt;pre&gt;', htmlspecialcharsEx(print_r($arTypeLang, true)), '&lt;/pre&gt;';
  * 	&#125;
  * &#125;
  * </code>
  * @param string $ID iblock type ID
  * @param string $LID language ID
  * @param bool $bFindAny Forces strict search
  * @return array|bool
  */
 public static function GetByIDLang($ID, $LID, $bFindAny = true)
 {
     /** @global CDatabase $DB */
     global $DB;
     $LID = $DB->ForSQL($LID, 2);
     if (CACHED_b_iblock_type === false) {
         $strSql = "\n\t\t\t\tSELECT BTL.*, BT.*\n\t\t\t\tFROM b_iblock_type BT, b_iblock_type_lang BTL\n\t\t\t\tWHERE BTL.IBLOCK_TYPE_ID = '" . $DB->ForSQL($ID) . "'\n\t\t\t\tAND BTL.LID='" . $LID . "'\n\t\t\t\tAND BT.ID=BTL.IBLOCK_TYPE_ID\n\t\t\t";
         $res = $DB->Query($strSql);
         if ($r = $res->GetNext()) {
             return $r;
         }
     } else {
         $arResult = CIBlockType::_GetCache($ID);
         if ($arResult !== false && array_key_exists($LID, $arResult["_lang"])) {
             $res = $arResult["_lang"][$LID];
             unset($arResult["_lang"]);
             return array_merge($res, $arResult);
         }
     }
     if (!$bFindAny) {
         return false;
     }
     $strSql = "\n\t\t\tSELECT BTL.*, BT.*\n\t\t\tFROM b_iblock_type BT, b_iblock_type_lang BTL, b_language L\n\t\t\tWHERE BTL.IBLOCK_TYPE_ID = '" . $DB->ForSQL($ID) . "'\n\t\t\tAND BTL.LID = L.LID\n\t\t\tAND BT.ID=BTL.IBLOCK_TYPE_ID\n\t\t\tORDER BY L.DEF DESC, L.SORT\n\t\t";
     $res = $DB->Query($strSql);
     if ($r = $res->GetNext()) {
         return $r;
     }
     return false;
 }