Passed
Push — 1.11.x ( bce6cd...c146d9 )
by Angel Fernando Quiroz
12:25
created

Component/CourseCopy/Resources/Quiz.php (1 issue)

1
<?php
2
/* For licensing terms, see /license.txt */
3
4
namespace Chamilo\CourseBundle\Component\CourseCopy\Resources;
5
6
/**
7
 * An Quiz
8
 * Exercises backup script.
9
 *
10
 * @author Bart Mollet <[email protected]>
11
 *
12
 * @package chamilo.backup
13
 */
14
class Quiz extends Resource
15
{
16
    /**
17
     * Create a new Quiz.
18
     *
19
     * @param string $title
20
     * @param string $description
21
     * @param int    $random
22
     * @param int    $type
23
     * @param int    $active
24
     */
25
    public $obj; //question
26
27
    /**
28
     * Quiz constructor.
29
     *
30
     * @param int $obj
31
     */
32
    public function __construct($obj)
33
    {
34
        $this->obj = $obj;
35
        $this->obj->quiz_type = $this->obj->type;
36
        parent::__construct($obj->iid, RESOURCE_QUIZ);
0 ignored issues
show
The property iid does not exist on integer.
Loading history...
37
    }
38
39
    /**
40
     * Add a question to this Quiz.
41
     *
42
     * @param int $id
43
     * @param int $questionOrder
44
     */
45
    public function add_question($id, $questionOrder)
46
    {
47
        $this->obj->question_ids[] = $id;
48
        $this->obj->question_orders[] = $questionOrder;
49
    }
50
51
    /**
52
     * Show this question.
53
     */
54
    public function show()
55
    {
56
        parent::show();
57
        echo $this->obj->title;
58
    }
59
}
60