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:
@ -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;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user