Documentation

CTestResult::Add

int
CTestResult::Add(
 array arFields
);

The Add method adds a new examination question.

Parameters

ParameterDescription
arFields The array Array("field"=>"value", ...). Contains values of all fields of examination schema. Required fields must be present.

Return Values

The method returns the ID of the added record on success, or false otherwise. If an error occurs, the exception will contain the error description.

See Also

  • CTestAttempt::CreateAttemptQuestions
  • CTestResult::Update
  • CTestResult::AddResponse
  • Examination schema fields

    Example

    
    <?
    if (CModule::IncludeModule("learning"))
    {
        $ATTEMPT_ID = 588;
        $QUESTION_ID = 128;
    
        $arFields = Array(
            "ATTEMPT_ID" => $ATTEMPT_ID,
            "QUESTION_ID" => $QUESTION_ID
        );
    
        $plan = new CTestResult;
        $ID = $plan->Add($arFields);
        $success = ($ID>0);
    
        if($success)
        {
            echo "Ok!";
        }
        else
        {
            if($e = $APPLICATION->GetException())
                echo "Error: ".$e->GetString();
        }
    }
    ?>
  • © «Bitrix24», 2001-2024