Documentation

CTestAttempt::Update

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

The Update method modifies the parameters of an attempt identified by the ID.

Parameters

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

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

  • Attempt fields
  • CTestAttempt::Add

    Example

    
    <?
    if (CModule::IncludeModule("learning"))
    {
        $ATTEMPT_ID = 596;
    
        $arFields = Array(
            "STATUS" => "F",
            "DATE_END" => ConvertTimeStamp(false,"FULL")
        );
    
        $attempt = new CTestAttempt;
        $ID = $attempt->Update($ATTEMPT_ID, $arFields);
        $success = ($ID>0);
    
        if($success)
        {
            echo "Ok!";
        }
        else
        {
            if($e = $APPLICATION->GetException())
                echo "Error: ".$e->GetString();
        }
    }
    ?>
  • © «Bitrix24», 2001-2024