Documentation

CTest::Update

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

The Update method modifies the parameters of a specified test.

Parameters

ParameterDescription
ID The test ID.
arFields An array in the format Array("field"=>"value", ...). The array contains values of all test 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

  • Test fields
  • CTest::Add

    Example

    
    <?
    if (CModule::IncludeModule("learning"))
    {
    
        $TEST_ID = 99;
    
        $arFields = Array(
            "NAME" => "New name",
            "INCLUDE_SELF_TEST" => "N",
            "QUESTIONS_AMOUNT" => 5
        );
    
        $test = new CTest;
        $success = $test->Update($TEST_ID, $arFields);
    
        if($success)
        {
            echo "Ok!";
        }
        else
        {
            if($e = $APPLICATION->GetException())
                echo "Error: ".$e->GetString();
        }
    }
    ?>
  • © «Bitrix24», 2001-2024