#!/usr/bin/php <?php include '../phplib/api.php'; $ot = new otulea("../data"); if ($argc < 2) { die("usage: ./getLatestMarks.php [userid] [testid]" . PHP_EOL); } $ot->set_user($argv[1]); $timestamp = $argc < 3 ? "" : $argv[2]; $tests = $ot->get_tests($timestamp); otulea::glue_session($tests, $timestamp); $test = reset($tests); $marks = $ot->get_marks($test); otulea::print_markarray($marks);
$testid_filter = false; } else { $testid_filter = true; $testid_orig = $testid; } $tests = $ot->get_tests($testid); if (!$tests) { api::response(500, "testindex file doesn't exist"); die; } if ($testid_filter && strcmp($testid_orig, $testid)) { api::response(404, "requested test doesn't exist"); die; } do { $it = otulea::glue_session($tests, $testid); //echo $it . " " . $testid . PHP_EOL; if (!$it) { api::response(500, "test history not found"); die; } if ($type_is_student) { $t = reset($tests); $tests = array($t); break; } } while (!is_null($testid)); if ($type_is_student) { $e = evaluate::student($tests, $ot, THRES_STUDENT, array(3, 2)); $ot->set_alphalist(); $data = $ot->results_student($e);