Bitrix Site Manager

CEventMessage::Update

bool
CEventMessage::Update(
 int id,
 array fields
)

The method Update modifies the mail template defined by the ID. Returns "true" on success. In case of error the method will return false, and the LAST_ERROR property will contain the error description.  

Parameters

ParameterDescription
id the ID of the updated record
fields An array of the fields values in the format array("field"=>"value" [, ...]).

See Also

Example



<?
if($REQUEST_METHOD=="POST" && (strlen($save)>0 || strlen($apply)>0)&& $MAIN_RIGHT=="W")
{
    $em = new CEventMessage;
    $arFields = Array(
        "ACTIVE"        => $ACTIVE,
        "EVENT_NAME"    => $EVENT_NAME,
        "LID"           => $LID,
        "EMAIL_FROM"    => $EMAIL_FROM,
        "EMAIL_TO"      => $EMAIL_TO,
        "BCC"           => $BCC,
        "SUBJECT"       => $SUBJECT,
        "MESSAGE"       => $MESSAGE,
        "BODY_TYPE"     => $BODY_TYPE
        );
    if($ID>0)
    {
        $res = $em->Update($ID, $arFields);
    }
    else
    {
        $ID = $em->Add($arFields);
        $res = ($ID>0);
    }
    if(!$res)
    {
        $strError .= $em->LAST_ERROR."<br>";
        $bVarsFromForm = true;
    }
    else
    {
        if (strlen($save)>0) 
            LocalRedirect(BX_ROOT."/admin/message_admin.php?lang=".LANGUAGE_ID);
        else
            LocalRedirect(BX_ROOT."/admin/message_edit.php?lang=".LANGUAGE_ID."&ID=".$ID);
    }
}
?>