mirror of
https://gitlab.com/animath/si/plateforme-corres2math.git
synced 2025-06-24 09:08:47 +02:00
Phase 3 : réponse aux questions
This commit is contained in:
@ -10,6 +10,8 @@ class Question
|
||||
private $number;
|
||||
private $question;
|
||||
private $attached_file;
|
||||
private $answer;
|
||||
private $attached_file_answer;
|
||||
|
||||
private function __construct()
|
||||
{
|
||||
@ -35,8 +37,8 @@ class Question
|
||||
{
|
||||
global $DB;
|
||||
|
||||
$req = $DB->prepare("SELECT * FROM `questions` WHERE `attached_file` = ?;");
|
||||
$req->execute([htmlspecialchars($attached_file)]);
|
||||
$req = $DB->prepare("SELECT * FROM `questions` WHERE `attached_file` = ? OR `attached_file_answer` = ?;");
|
||||
$req->execute([htmlspecialchars($attached_file), htmlspecialchars($attached_file)]);
|
||||
$data = $req->fetch();
|
||||
|
||||
if ($data === false)
|
||||
@ -151,4 +153,30 @@ class Question
|
||||
$req = $DB->prepare("UPDATE `questions` SET `attached_file` = ? WHERE `id` = ?;");
|
||||
$req->execute([$attached_file, $this->id]);
|
||||
}
|
||||
|
||||
public function getAnswer()
|
||||
{
|
||||
return $this->answer;
|
||||
}
|
||||
|
||||
public function setAnswer($answer)
|
||||
{
|
||||
global $DB;
|
||||
$this->answer = $answer;
|
||||
$req = $DB->prepare("UPDATE `questions` SET `answer` = ? WHERE `id` = ?;");
|
||||
$req->execute([$answer, $this->id]);
|
||||
}
|
||||
|
||||
public function getAttachedFileAnswer()
|
||||
{
|
||||
return $this->attached_file_answer;
|
||||
}
|
||||
|
||||
public function setAttachedFileAnswer($attached_file)
|
||||
{
|
||||
global $DB;
|
||||
$this->attached_file_answer = $attached_file;
|
||||
$req = $DB->prepare("UPDATE `questions` SET `attached_file_answer` = ? WHERE `id` = ?;");
|
||||
$req->execute([$attached_file, $this->id]);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user