mirror of
https://github.com/idanoo/nzart-exam-generator.git
synced 2024-12-04 22:26:58 +00:00
Images now load on main page + styling
This commit is contained in:
parent
0727b3c2ab
commit
b6876e601e
@ -20,7 +20,7 @@ class Question extends DataItem {
|
|||||||
|
|
||||||
public static function getQuestions($count = false)
|
public static function getQuestions($count = false)
|
||||||
{
|
{
|
||||||
$questions = static::getAllWhere(false, false, false, $count);
|
$questions = static::getAllWhere(false, "order by rand()", false, $count);
|
||||||
foreach ($questions as $q) {
|
foreach ($questions as $q) {
|
||||||
$q->answers = $q->getAnswers();
|
$q->answers = $q->getAnswers();
|
||||||
shuffle($q->answers);
|
shuffle($q->answers);
|
||||||
@ -37,4 +37,9 @@ class Question extends DataItem {
|
|||||||
{
|
{
|
||||||
return Answer::getAllWhere("answerdata_question = ".$this->getId());
|
return Answer::getAllWhere("answerdata_question = ".$this->getId());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getImage()
|
||||||
|
{
|
||||||
|
return $this->questiondata_image;
|
||||||
|
}
|
||||||
}
|
}
|
@ -30,12 +30,18 @@ $questions = Question::getQuestions(QUESTION_COUNT);
|
|||||||
echo "<td>".($i+1)."</td>";
|
echo "<td>".($i+1)."</td>";
|
||||||
echo "<td>".$q->getQuestion()."</td>";
|
echo "<td>".$q->getQuestion()."</td>";
|
||||||
echo "</tr>";
|
echo "</tr>";
|
||||||
|
if(!empty($q->getImage())) {
|
||||||
|
echo "<tr>";
|
||||||
|
echo "<td></td><td><img src='img/".str_replace("\"",'',$q->getImage())."'></td>";
|
||||||
|
echo "</tr>";
|
||||||
|
}
|
||||||
foreach($q->answers as $x=>$ans) {
|
foreach($q->answers as $x=>$ans) {
|
||||||
echo "<tr>";
|
echo "<tr>";
|
||||||
echo "<td style='padding-left:10px'>".$letters[$x]."</td>";
|
echo "<td style='padding-left:10px'>".$letters[$x]."</td>";
|
||||||
echo "<td style='padding-left:10px'>".$ans->getAnswer()."</td>";
|
echo "<td style='padding-left:10px'>".$ans->getAnswer()."</td>";
|
||||||
echo "</tr>";
|
echo "</tr>";
|
||||||
}
|
}
|
||||||
|
echo "<tr><td> </td><td></td></tr>";
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
</tbody>
|
</tbody>
|
||||||
|
Loading…
Reference in New Issue
Block a user