int CTest::Add( array arFields );
The Add method adds a new test.
| Parameter | Description |
|---|---|
| arFields | The array Array("field"=>"value", ...). Contains values of all test fields. Required fields must be present. |
The method returns the ID of an added test on success, or false otherwise. If an error occurs, the exception will contain the error description.
<?
if (CModule::IncludeModule("learning"))
{
$COURSE_ID = 97;
$arFields = Array(
"COURSE_ID" => $COURSE_ID,
"NAME" => "New test!",
"INCLUDE_SELF_TEST" => "Y"
);
$test = new CTest;
$ID = $test->Add($arFields);
$success = ($ID>0);
if($success)
{
echo "Ok!";
}
else
{
if($e = $APPLICATION->GetException())
echo "Error: ".$e->GetString();
}
}
?>| © 2001-2007 Bitrix | Bitrix Site Manager - Content Management & Portal Solutions |