Quiz.class.php 984 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  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 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. public function __construct($obj)
  22. {
  23. $this->obj = $obj;
  24. $this->obj->quiz_type = $this->obj->type;
  25. parent::__construct($obj->id, RESOURCE_QUIZ);
  26. }
  27. /**
  28. * Add a question to this Quiz
  29. */
  30. public function add_question($id, $question_order)
  31. {
  32. $this->obj->question_ids[] = $id;
  33. $this->obj->question_orders[] = $question_order;
  34. }
  35. /**
  36. * Show this question
  37. */
  38. public function show()
  39. {
  40. parent::show();
  41. echo $this->obj->title;
  42. }
  43. }