1
0
mirror of https://gitlab.com/animath/si/plateforme-corres2math.git synced 2025-06-24 08:28:46 +02:00

Phase 2 : pièces jointes dans les questions

This commit is contained in:
galaxyoyo
2019-09-21 13:37:48 +02:00
parent 80eeb71262
commit 41c4734624
4 changed files with 128 additions and 20 deletions

View File

@ -8,6 +8,7 @@ class Question
private $to;
private $problem;
private $question;
private $attached_file;
private function __construct()
{
@ -29,6 +30,22 @@ class Question
return $question;
}
public static function fromAttachedFile($attached_file)
{
global $DB;
$req = $DB->prepare("SELECT * FROM `questions` WHERE `attached_file` = ?;");
$req->execute([htmlspecialchars($attached_file)]);
$data = $req->fetch();
if ($data === false)
return null;
$question = new Question();
$question->fill($data);
return $question;
}
public function fill($data)
{
foreach ($data as $key => $value)
@ -88,4 +105,9 @@ class Question
{
return $this->question;
}
public function getAttachedFile()
{
return $this->attached_file;
}
}