AddEventHandler iblock OnIBlockPropertyBuil dList array CIBlockElement

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
<?
AddEventHandler('iblock', 'OnIBlockPropertyBuildList', array('CIBlockElementListExtended', 'GetUserTypeDescription'), 5000);
require dirname(__FILE__)."/lang/".LANGUAGE_ID."/property_type.php";
class CIBlockElementListExtended
{
function GetUserTypeDescription()
{
return array(
"PROPERTY_TYPE" => "E",
"USER_TYPE" => "ElementExtended",
"DESCRIPTION"=> GetMessage("PROP_TYPE_ELEMENT_LIST_EXTENDED_DESCRIPTION"),
"GetPropertyFieldHtml" => array("CIBlockElementListExtended","GetPropertyFieldHtml"),
);
}
function GetPropertyFieldHtml($arProperty, $value, $strHTMLControlName)
{
$strResult = "";
if(intval($value["VALUE"]) > 0)
{
$arFilter = Array(
"ID" => intval($value["VALUE"]),
"IBLOCK_ID" => $arProperty["LINK_IBLOCK_ID"],
);
$rsItem = CIBlockElement::GetList(Array(), $arFilter, false, false, Array("ID", "IBLOCK_ID", "NAME"));
$arItem = $rsItem->GetNext();
}
$strResult .=
'<input name="'.$strHTMLControlName["VALUE"].'" id="'.$strHTMLControlName["VALUE"].'" value="'.htmlspecialcharsex($value["VALUE"]).'" size="5" type="text">'.
'<input type="button" value="..." onClick="jsUtils.OpenWindow(\'/bitrix/admin/iblock_element_search.php?lang='.LANG.'&amp;IBLOCK_ID='.$arProperty["LINK_IBLOCK_ID"].'&amp;n='.$strHTMLControlName["VALUE"].'\', 600, 500);">'.
'&nbsp;<input type="text" name="'.$strHTMLControlName["DESCRIPTION"].'" value="'.htmlspecialcharsex($value["DESCRIPTION"]).'" />'.
'&nbsp;<span id="sp_'.md5($strHTMLControlName["VALUE"]).'_'.$key.'" >'.$arItem["NAME"].'</span>';
return $strResult;
}
}