1
|
|
|
<?php |
2
|
|
|
/* Source: https://github.com/moodle/moodle/blob/MOODLE_310_STABLE/backup/cc/cc_lib/cc_asssesment.php under GNU/GPL license */ |
3
|
|
|
|
4
|
|
|
class CcAssesmentRenderEssaytype extends CcQuestionMetadataBase |
5
|
|
|
{ |
6
|
|
|
protected $materials = []; |
7
|
|
|
protected $material_refs = []; |
8
|
|
|
protected $responseLabels = []; |
9
|
|
|
protected $flow_labels = []; |
10
|
|
|
|
11
|
|
|
public function __construct() |
12
|
|
|
{ |
13
|
|
|
$this->setSetting(CcQtiTags::SHUFFLE, CcQtiValues::NO); |
14
|
|
|
} |
15
|
|
|
|
16
|
|
|
public function add_material(CcAssesmentMaterial $object) |
17
|
|
|
{ |
18
|
|
|
$this->materials[] = $object; |
19
|
|
|
} |
20
|
|
|
|
21
|
|
|
public function add_material_ref(CcAssesmentResponseMatref $object) |
22
|
|
|
{ |
23
|
|
|
$this->material_refs[] = $object; |
24
|
|
|
} |
25
|
|
|
|
26
|
|
|
public function addResponseLabel(CcAssesmentResponseLabeltype $object) |
27
|
|
|
{ |
28
|
|
|
$this->responseLabels[] = $object; |
29
|
|
|
} |
30
|
|
|
|
31
|
|
|
public function add_flow_label($object) |
32
|
|
|
{ |
33
|
|
|
$this->flow_labels[] = $object; |
34
|
|
|
} |
35
|
|
|
|
36
|
|
|
public function generate(XMLGenericDocument &$doc, DOMNode &$item, $namespace) |
37
|
|
|
{ |
38
|
|
|
$node = $doc->appendNewElementNs($item, $namespace, CcQtiTags::RENDER_CHOICE); |
39
|
|
|
$this->generateAttributes($doc, $node, $namespace); |
40
|
|
|
|
41
|
|
|
if (!empty($this->materials)) { |
42
|
|
|
foreach ($this->materials as $mattag) { |
43
|
|
|
$mattag->generate($doc, $node, $namespace); |
44
|
|
|
} |
45
|
|
|
} |
46
|
|
|
|
47
|
|
|
if (!empty($this->material_refs)) { |
48
|
|
|
foreach ($this->material_refs as $matreftag) { |
49
|
|
|
$matreftag->generate($doc, $node, $namespace); |
50
|
|
|
} |
51
|
|
|
} |
52
|
|
|
|
53
|
|
|
if (!empty($this->responseLabels)) { |
54
|
|
|
foreach ($this->responseLabels as $resplabtag) { |
55
|
|
|
$resplabtag->generate($doc, $node, $namespace); |
56
|
|
|
} |
57
|
|
|
} |
58
|
|
|
|
59
|
|
|
if (!empty($this->flow_labels)) { |
60
|
|
|
foreach ($this->flow_labels as $flowlabtag) { |
61
|
|
|
$flowlabtag->generate($doc, $node, $namespace); |
62
|
|
|
} |
63
|
|
|
} |
64
|
|
|
} |
65
|
|
|
} |
66
|
|
|
|