| 1234567891011121314151617181920212223242526272829303132333435363738394041424344 |
- <?php /** @noinspection PhpUnhandledExceptionInspection */
- /**
- * @var int $id
- */
- Core::addScript("public/js/app-test.js");
- $test = Test::get($id);
- if(!$test) {
- throw new RuntimeException(__("Test cannot be found."));
- }
- $location = $test->getLocation();
- $project = $test->getProject();
- $template = $project->getTemplate();
- $template_overrides = $project->getTemplateOverrides();
- if($template_overrides) $template->setOverrides($template_overrides);
- $template_keys = $project->getTemplateKeys();
- $template->setKeys($template_keys);
- $page_title = $location->name;
- $user = Core::$user;
- Core::addBreadcrumb("/account", "Account");
- Core::addBreadcrumb("/account/tests", "Tests");
- Core::addBreadcrumb("/account/tests/$id", $page_title);
- if($user->isTester()) {
- Core::addScript("public/js/app-test-requirements.js");
- require ROOT_DIR . "/controllers/test_tester_form.php";
- }
- else if($user->canVerifyTests()) {
- require ROOT_DIR . "/controllers/test_verify_form.php";
- }
- else if($user->canAccessTestResult()) {
- HTTP::redirect("/account/tests/$id/result");
- }
- else {
- throw new RuntimeException(__("Invalid request."));
- }
|