nzart-exam-generator/includes/classes/class.question.php
2016-12-30 18:16:13 +13:00

40 lines
No EOL
788 B
PHP
Executable file

<?php
/**
* Created by PhpStorm.
* User: daniel
* Date: 12/30/16
* Time: 2:09 PM
*/
class Question extends DataItem {
public static function _getClass()
{
return "Question";
}
public static function _getType()
{
return "question";
}
public static function getQuestions($count = false)
{
$questions = static::getAllWhere(false, false, false, $count);
foreach ($questions as $q) {
$q->answers = $q->getAnswers();
shuffle($q->answers);
}
return $questions;
}
public function getQuestion()
{
return $this->questiondata_content;
}
public function getAnswers()
{
return Answer::getAllWhere("answerdata_question = ".$this->getId());
}
}