mirror of
https://github.com/idanoo/nzart-exam-generator
synced 2025-07-01 22:02:17 +00:00
progress
This commit is contained in:
parent
b6876e601e
commit
0824aca6b9
4 changed files with 42 additions and 9 deletions
|
@ -28,4 +28,9 @@ class Answer extends DataItem
|
|||
{
|
||||
return $this->answerdata_correct;
|
||||
}
|
||||
|
||||
public static function checkIfCorrect($answer)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
|
@ -8,10 +8,11 @@ class DataItem {
|
|||
$this->_db = new db(); //Will optimise this to get existing conn at some point.
|
||||
}
|
||||
|
||||
public function getById($id) {
|
||||
$this->_db->query("SELECT * FROM `".static::_getType()."` WHERE ".static::_getType()."_id = :id");
|
||||
$this->_db->bind(":id", $id);
|
||||
return $this->_db->getObject();
|
||||
public static function getById($id) {
|
||||
$db = new db();
|
||||
$db->query("SELECT * FROM `".static::_getType()."` WHERE ".static::_getType()."_id = :id");
|
||||
$db->bind(":id", $id);
|
||||
return $db->getObject();
|
||||
}
|
||||
|
||||
private function _getAllWhere($where = false, $orderBy = false, $join = false, $limit = false) {
|
||||
|
|
|
@ -38,6 +38,11 @@ class Question extends DataItem {
|
|||
return Answer::getAllWhere("answerdata_question = ".$this->getId());
|
||||
}
|
||||
|
||||
public function getCorrectAnswer()
|
||||
{
|
||||
return Answer::getWhere("answerdata_question = ".$this->getId()." and answerdata_correct = 1");
|
||||
}
|
||||
|
||||
public function getImage()
|
||||
{
|
||||
return $this->questiondata_image;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue