function Add($arFields) { global $DB, $USER_FIELD_MANAGER; if(CTestAttempt::CheckFields($arFields) && $USER_FIELD_MANAGER->CheckFields("LEARN_ATTEMPT", 0, $arFields)) { unset($arFields["ID"]); //$ID = $DB->Add("b_learn_attempt", $arFields, Array(""), "learning"); $arInsert = $DB->PrepareInsert("b_learn_attempt", $arFields, "learning"); $ID = CTestAttempt::DoInsert($arInsert, $arFields); CGradeBook::RecountAttempts($arFields["STUDENT_ID"], $arFields["TEST_ID"]); if ($ID) { $USER_FIELD_MANAGER->Update("LEARN_ATTEMPT", $ID, $arFields); } return $ID; } return false; }