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'])) {