- TestMgr added
This commit is contained in:
parent
b34045a89d
commit
dbed288e2d
39
class/TestMgr.php
Normal file
39
class/TestMgr.php
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
require_once "globals.php";
|
||||||
|
|
||||||
|
class TestSummary
|
||||||
|
{
|
||||||
|
public int $challengeN; // Number of challenges
|
||||||
|
public int $correctAnswerN; // Number of correct answers
|
||||||
|
}
|
||||||
|
|
||||||
|
class Test
|
||||||
|
{
|
||||||
|
public int $_id; // ID
|
||||||
|
public string $gameId; // ID of associated game
|
||||||
|
public string $gameName; // Name of the associated game
|
||||||
|
public string $state; // State of the test (ongoing/concluded)
|
||||||
|
public bool $timeLimited; // The user is allowed to submit the test in a given period of time.
|
||||||
|
public int $startTime; // Start time (UNIX timestamp)
|
||||||
|
public int $endTime; // End time (UNIX timestamp)
|
||||||
|
public int $endLimitTime; // Time limit on test submission (UNIX timestamp)
|
||||||
|
public TestSummary $summary; // Summmary, if game has ended
|
||||||
|
public array $challenges; // Test challenges
|
||||||
|
}
|
||||||
|
|
||||||
|
class TestMgr
|
||||||
|
{
|
||||||
|
private \SleekDB\Store $db; // test database
|
||||||
|
|
||||||
|
function __construct()
|
||||||
|
{
|
||||||
|
$this->db = new \SleekDB\Store(TESTDB, DATADIR, ["timeout" => false]);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Get test by ID.
|
||||||
|
function getTest(string $testid): Test|null
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user