Documentation

CLesson::Update

bool
CLesson::Update(
 int   ID,
 array arFields
);

The Update method modifies the parameters of a lesson identified by the ID.

Parameters

ParameterDescription
ID The lesson ID.
arFields An array in the format Array("field"=>"value", ...). The array contains values of all lesson fields. Required fields must be present.

Return Values

The method returns true on successful update, or false otherwise. If an error occurs, the exception will contain the error description.

See Also

  • Lesson fields
  • CLesson::Add

    Example

    
    <?
    if (CModule::IncludeModule("learning"))
    {
        $LESSON_ID = 732;
    
        $arFields = Array(
            "ACTIVE" => "N",
            "NAME" => "New name of Lesson 1",
            "SORT" => "555",
        );
    
        $lesson = new CLesson;
        $success = $lesson->Update($LESSON_ID, $arFields);
    
        if($success)
        {
            echo "Ok!";
        }
        else
        {
            if($e = $APPLICATION->GetException())
                echo "Error: ".$e->GetString();
        }
    }
    ?>
  • © «Bitrix24», 2001-2024
    Up