Quiz.class.php 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. <?php
  2. /* For licensing terms, see /license.txt */
  3. require_once 'Resource.class.php';
  4. /**
  5. * An Quiz
  6. * Exercises backup script
  7. * @author Bart Mollet <bart.mollet@hogent.be>
  8. * @package chamilo.backup
  9. */
  10. class Quiz extends Coursecopy\Resource
  11. {
  12. /**
  13. * Create a new Quiz
  14. * @param string $title
  15. * @param string $description
  16. * @param int $random
  17. * @param int $type
  18. * @param int $active
  19. */
  20. public $obj; //question
  21. /**
  22. * Quiz constructor.
  23. * @param int $obj
  24. */
  25. public function __construct($obj)
  26. {
  27. $this->obj = $obj;
  28. $this->obj->quiz_type = $this->obj->type;
  29. parent::__construct($obj->id, RESOURCE_QUIZ);
  30. }
  31. /**
  32. * Add a question to this Quiz
  33. */
  34. public function add_question($id, $question_order)
  35. {
  36. $this->obj->question_ids[] = $id;
  37. $this->obj->question_orders[] = $question_order;
  38. }
  39. /**
  40. * Show this question
  41. */
  42. public function show()
  43. {
  44. parent::show();
  45. echo $this->obj->title;
  46. }
  47. }