Beispiel #1
0
                 $nextAttemptAfterH = floor(($nextAttemptAfter - $nextAttemptAfterD * 60 * 24) / 60);
                 $nextAttemptAfterM = $nextAttemptAfter - $nextAttemptAfterD * 60 * 24 - $nextAttemptAfterH * 60;
                 $sessAttemptError = GetMessage("LEARNING_TEST_TIME_INTERVAL_ERROR") . " " . ($nextAttemptAfterD > 0 ? $nextAttemptAfterD . " " . GetMessage("LEARNING_TEST_TIME_INTERVAL_ERROR_D") . " " : "") . ($nextAttemptAfterH > 0 ? $nextAttemptAfterH . " " . GetMessage("LEARNING_TEST_TIME_INTERVAL_ERROR_H") . " " : "") . $nextAttemptAfterM . " " . GetMessage("LEARNING_TEST_TIME_INTERVAL_ERROR_M") . "";
                 LocalRedirect($arResult["REDIRECT_PAGE"]);
             }
         }
     }
     //Add new attempt
     $rsAttempt = new CTestAttempt();
     $attemptID = $rsAttempt->Add(array("TEST_ID" => $arParams["TEST_ID"], "STUDENT_ID" => $USER->GetID(), "STATUS" => "B"));
     if (!$attemptID) {
         $sessAttemptError = ($ex = $APPLICATION->GetException()) ? $ex->GetString() : GetMessage("LEARNING_ATTEMPT_CREATE_ERROR");
         LocalRedirect($arResult["REDIRECT_PAGE"]);
     }
     //Create test questions
     $success = CTestAttempt::CreateAttemptQuestions($attemptID);
     if (!$success) {
         $sessAttemptError = ($ex = $APPLICATION->GetException()) ? $ex->GetString() : GetMessage("LEARNING_ATTEMPT_CREATE_ERROR");
         CTestAttempt::Delete($attemptID);
         LocalRedirect($arResult["REDIRECT_PAGE"]);
     }
     $sessAttemptID = $attemptID;
     LocalRedirect($arResult["REDIRECT_PAGE"]);
 } elseif ($bPostAnswer) {
     $sessIncorrectMessage = null;
     //Check attempt from session
     if (!($arAttempt = _AttemptExists($arParams["TEST_ID"], $sessAttemptID))) {
         $sessAttemptID = null;
         $sessAttemptError = GetMessage("LEARNING_ATTEMPT_NOT_FOUND_ERROR") . ': ' . $sessAttemptID;
         LocalRedirect($arResult["REDIRECT_PAGE"]);
     }