39 lines
		
	
	
		
			1.0 KiB
		
	
	
	
		
			PHP
		
	
	
	
	
	
			
		
		
	
	
			39 lines
		
	
	
		
			1.0 KiB
		
	
	
	
		
			PHP
		
	
	
	
	
	
<?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
 | 
						|
    {
 | 
						|
 | 
						|
    }
 | 
						|
} |