-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathExercise.class.php
58 lines (47 loc) · 1.89 KB
/
Exercise.class.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
<?php
class Exercise {
public $description;
private $hint;
private $solved = false;
private $updates = false;
private $solution;
private $verificationQuery;
private $verificationCount;
public $answer;
public $description2;
public $speaker;
public $speaker2;
public $leftimg;
public $rightimg;
function __construct($description = "") {
$this->Exercise($description);
}
public function Exercise($description = "") { $this->description = $description; }
public function getDescription() { return $this->description ; }
public function getDescription2() { return $this->description2; }
public function getHint() { return $this->hint; }
public function getSolved() { return $this->solved; }
public function getUpdates() { return $this->updates; }
public function getSolution() { return $this->solution; }
public function getVerificationQuery() { return $this->verificationQuery; }
public function getVerificationCount() { return $this->verificationCount; }
public function setDescription($s) { $this->description = $s; }
public function setHint($s) { $this->hint = $s; }
public function setSolved($b) { $this->solved = $b; }
public function setUpdates($b) { $this->updates = $b; }
public function setSolution($s) { $this->solution = $s; }
public function setVerificationQuery($s) { $this->verificationQuery = $s; $this->updates = true; }
public function setVerificationCount($c) { $this->verificationCount = $c; }
public function printExercise($player_name = null, $exercise_id = null) {
$description = $this->description;
$description = str_replace("\n", "<br>", $description);
if($player_name != null) {
$description = str_replace("%%%PLAYER_NAME%%%", $player_name, $description);
}
echo "<p style=\"color:darkblue;\" id=\"exercise".$exercise_id."\"><b><i>".$description."</i></b></p>";
if($this->solved) {
$_GET['query'] = $this->solution;
require("query.php");
}
}
}