AddEventHandler("iblock", "OnAfterIBlockElementAdd", Array("MyClass", "OnAfterIBlockElementAddHandler"));
class MyClass {
function OnAfterIBlockElementAddHandler(&$arFields) {
log_write($arFields["ID"]);
if ($arFields["IBLOCK_ID"] == 10) {
$EMail = "";
$resProp = CIBlockElement::GetProperty(12, $arFields["ID"], array("SORT"=>"ASC"), array("CODE"=>"EMAIL"));
if ($arProp = $resProp->GetNext()) {
$EMail = $arProp["VALUE"];
}
$arSend = array(
'TEXT' => 'Имя: '.$arFields['NAME'].'<br/>
E-mail: '.$EMail.'<br/>
Вопрос: '.$arFields['PREVIEW_TEXT']
);
CEvent::Send('QUEST_DOBAV', SITE_ID, $arSend);
}
}
}
|