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 CcAssesmentRenderFibtype 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::ENCODING); |
14
|
|
|
$this->setSetting(CcQtiTags::CHARSET); |
15
|
|
|
$this->setSetting(CcQtiTags::ROWS); |
16
|
|
|
$this->setSetting(CcQtiTags::COLUMNS); |
17
|
|
|
$this->setSetting(CcQtiTags::MAXCHARS); |
18
|
|
|
$this->setSetting(CcQtiTags::MINNUMBER); |
19
|
|
|
$this->setSetting(CcQtiTags::MAXNUMBER); |
20
|
|
|
$this->setSetting(CcQtiTags::PROMPT, CcQtiValues::BOX); |
21
|
|
|
$this->setSetting(CcQtiTags::FIBTYPE, CcQtiValues::STRING); |
22
|
|
|
$this->qtype = CcQtiProfiletype::FIELD_ENTRY; |
23
|
|
|
} |
24
|
|
|
public function add_material(CcAssesmentMaterial $object) |
25
|
|
|
{ |
26
|
|
|
$this->materials[] = $object; |
27
|
|
|
} |
28
|
|
|
|
29
|
|
|
public function add_material_ref(CcAssesmentResponseMatref $object) |
30
|
|
|
{ |
31
|
|
|
$this->material_refs[] = $object; |
32
|
|
|
} |
33
|
|
|
|
34
|
|
|
public function addResponseLabel(CcAssesmentResponseLabeltype $object) |
35
|
|
|
{ |
36
|
|
|
$this->responseLabels[] = $object; |
37
|
|
|
} |
38
|
|
|
|
39
|
|
|
public function add_flow_label($object) |
40
|
|
|
{ |
41
|
|
|
$this->flow_labels[] = $object; |
42
|
|
|
} |
43
|
|
|
|
44
|
|
|
public function enableShuffle($value = true) |
45
|
|
|
{ |
46
|
|
|
$this->enableSettingYesno(CcQtiTags::SHUFFLE, $value); |
47
|
|
|
} |
48
|
|
|
|
49
|
|
|
public function generate(XMLGenericDocument &$doc, DOMNode &$item, $namespace) |
50
|
|
|
{ |
51
|
|
|
$node = $doc->appendNewElementNs($item, $namespace, CcQtiTags::RENDER_FIB); |
52
|
|
|
$this->generateAttributes($doc, $node, $namespace); |
53
|
|
|
|
54
|
|
|
if (!empty($this->materials)) { |
55
|
|
|
foreach ($this->materials as $mattag) { |
56
|
|
|
$mattag->generate($doc, $node, $namespace); |
57
|
|
|
} |
58
|
|
|
} |
59
|
|
|
|
60
|
|
|
if (!empty($this->material_refs)) { |
61
|
|
|
foreach ($this->material_refs as $matreftag) { |
62
|
|
|
$matreftag->generate($doc, $node, $namespace); |
63
|
|
|
} |
64
|
|
|
} |
65
|
|
|
|
66
|
|
|
if (!empty($this->responseLabels)) { |
67
|
|
|
foreach ($this->responseLabels as $resplabtag) { |
68
|
|
|
$resplabtag->generate($doc, $node, $namespace); |
69
|
|
|
} |
70
|
|
|
} |
71
|
|
|
|
72
|
|
|
if (!empty($this->flow_labels)) { |
73
|
|
|
foreach ($this->flow_labels as $flowlabtag) { |
74
|
|
|
$flowlabtag->generate($doc, $node, $namespace); |
75
|
|
|
} |
76
|
|
|
} |
77
|
|
|
} |
78
|
|
|
} |
79
|
|
|
|