- TestMgr foundations
This commit is contained in:
		
							parent
							
								
									99aae46ff5
								
							
						
					
					
						commit
						60e0402455
					
				@ -1,5 +1,7 @@
 | 
				
			|||||||
<?php
 | 
					<?php
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					require_once "globals.php";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
class Game
 | 
					class Game
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    public const DEFAULT_GAME_PROPERTIES = [
 | 
					    public const DEFAULT_GAME_PROPERTIES = [
 | 
				
			||||||
@ -42,7 +44,7 @@ class Game
 | 
				
			|||||||
    // Store modifications.
 | 
					    // Store modifications.
 | 
				
			||||||
    function storeMods(): void
 | 
					    function storeMods(): void
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        $this->patchUpGameDate();
 | 
					        //$this->patchUpGameDate();
 | 
				
			||||||
        $this->gameMgr->updateGame($this);
 | 
					        $this->gameMgr->updateGame($this);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -1,5 +1,7 @@
 | 
				
			|||||||
<?php
 | 
					<?php
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					require_once "globals.php";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
class Group
 | 
					class Group
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    private int $_id; // Group's ID (assigned by SleekDB)
 | 
					    private int $_id; // Group's ID (assigned by SleekDB)
 | 
				
			||||||
 | 
				
			|||||||
							
								
								
									
										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