if (str_replace(DIRECTORY_SEPARATOR, "/", __FILE__) == $_SERVER['SCRIPT_FILENAME']) { exit; } $loadScripts[] = 'scriptaculous/controls'; $loadScripts[] = 'includes/tests'; if (!$_student_) { $showTest = new EfrontTest($_GET['view_unit'], true); if (isset($_GET['show_all'])) { $showTest->options['random_pool'] = false; $showTest->options['onebyone'] = 0; } if (isset($_GET['preview_correct']) && $_SESSION['s_lesson_user_type'] != 'student') { $showTest->preview_correct = true; } if (isset($_GET['print'])) { $testString = $showTest->toHTML($showTest->toHTMLQuickForm(), false, true); } else { $testString = $showTest->toHTML($showTest->toHTMLQuickForm(), false); } $smarty->assign("T_TEST", $testString); } else { $test = new EfrontTest($currentUnit['id'], true); $status = $test->getStatus($currentUser, $_GET['show_solved_test']); $form = new HTML_QuickForm("test_form", "post", basename($_SERVER['PHP_SELF']) . '?view_unit=' . $_GET['view_unit'], "", 'onsubmit = "$(\'submit_test\').disabled=true;"', true); switch ($status['status']) { case 'incomplete': //$test -> getQuestionsRandomTest(true); if (!($testInstance = unserialize($status['completedTest']['test']))) { throw new EfrontTestException(_TESTCORRUPTEDASKRESETEXECUTION, EfrontTestException::CORRUPTED_TEST); } if ($testInstance->time['pause'] && isset($_GET['resume'])) {
if (isset($_GET['show_solved_test']) && eF_checkParameter($_GET['show_solved_test'], 'id') && isset($_GET['lesson']) && eF_checkParameter($_GET['lesson'], 'id')) { try { //pr($_GET['lesson']);pr($currentUser -> getLessons()); if (in_array($_GET['lesson'], array_keys($currentUser->getLessons()))) { $result = eF_getTableData("done_tests, tests, content", "done_tests.tests_ID, done_tests.users_LOGIN", "content.id=tests.content_ID and content.lessons_ID=" . $_GET['lesson'] . " and tests.id = done_tests.tests_ID and done_tests.users_LOGIN = '******'login'] . "' and done_tests.id=" . $_GET['show_solved_test']); if (sizeof($result) > 0) { $showTest = new EfrontTest($result[0]['tests_ID']); //Set "show answers" and "show given answers" to true, since if it is not the student that sees the test if ($currentUser->user['user_type'] != 'student') { $showTest->options['answers'] = 1; $showTest->options['given_answers'] = 1; } $showTest->setDone($result[0]['users_LOGIN']); $smarty->assign("T_CURRENT_TEST", $showTest->test); $smarty->assign("T_SOLVED_TEST_DATA", $showTest->doneInfo); $smarty->assign("T_TEST_SOLVED", $showTest->toHTMLQuickForm(new HTML_Quickform(), false, true)); } else { $message = _USERHASNOTDONETEST; $message_type = 'failure'; } } else { $message = _USERHASNOTTHISLESSON; $message_type = 'failure'; } } catch (Exception $e) { $smarty->assign("T_EXCEPTION_TRACE", $e->getTraceAsString()); $message = $e->getMessage() . ' (' . $e->getCode() . ') <a href = "javascript:void(0)" onclick = "eF_js_showDivPopup(event, \'' . _ERRORDETAILS . '\', 2, \'error_details\')">' . _MOREINFO . '</a>'; $message_type = 'failure'; } } else { /**The statistics funtions*/