ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
class.ilSCORM2004Objective.php
Go to the documentation of this file.
1<?php
2
3/* Copyright (c) 1998-2011 ILIAS open source, Extended GPL, see docs/LICENSE */
4
15require_once("./Modules/Scorm2004/classes/seq_editor/class.ilSCORM2004Item.php");
16require_once("./Modules/Scorm2004/classes/seq_editor/class.ilSCORM2004MapInfo.php");
17
18
20{
21
22 //db fields
23
24 private $node = null;
25 private $id = null; //userd as ID
26 private $objectiveID = null; //used as title
27
28 //not supported in GUI yet
29 private $minNormalizedMeasure = 1.0;
30 private $primary = true;
31 private $satisfiedByMeasure = false;
32
33 //mappings
34 private $mappings =array();
35
40 function ilSCORM2004Objective($a_treeid = null, $a_obj_id = null)
41 {
42 parent::ilSCORM2004Item($a_treeid);
43
44 if ($a_obj_id !=null && $a_treeid != null) {
45 $xpath_obj = new DOMXPath($this->dom);
46 $obj_node_list = $xpath_obj->query('//objective[@objectiveID = "'.$a_obj_id.'"] | '.
47 '//primaryObjective[@objectiveID = "'.$a_obj_id.'"]');
48 $this->setNode($obj_node_list->item(0));
49 } else {
50 if ($a_obj_id ==null && $a_treeid != null) {
51 $obj_con = $this->dom->createElement("objectives");
52 $obj = $this->dom->createElement("primaryObjective");
53 $root = $this->dom->getElementsByTagName("sequencing")->item(0);
54 $obj_con->appendChild($obj);
55 $root->appendChild($obj_con);
56 $this->node =$this->dom->getElementsByTagName("primaryObjective")->item(0);
57 }
58 }
59 }
60
61
62
63 // **********************
64 // GETTER METHODS
65 // **********************
66
67 public function getId()
68 {
69 return $this->node->getAttribute("objectiveID");
70 }
71
72 public function getMinNormalizedMeasure()
73 {
74 return $this->node->getAttribute("minNormalizedMeasure");
75 }
76
77 public function getObjectiveID()
78 {
79 return $this->node->getAttribute("title");
80 }
81
82 public function getPrimary()
83 {
84 return $this->primary;
85 }
86
87 public function getSatisfiedByMeasure()
88 {
89 return $this->node->getAttribute("satisfiedByMeasure");
90 }
91
92 public function getMappings()
93 {
94 return $this->mappings;
95 }
96
97 // **********************
98 // Setter METHODS
99 // **********************
100
101 public function setSeqNodeId($a_seqnodeid)
102 {
103 $this->seqNodeId = $a_seqnodeid;
104 }
105
106 public function setId($a_id)
107 {
108 $this->node->setAttribute("objectiveID",$a_id);
109 }
110
111
112 public function setMinNormalizedMeasure($a_minmeasure)
113 {
114 $this->node->setAttribute("minNormalizedMeasure",$a_minmeasure);
115 }
116
117 public function setObjectiveID($a_objectiveid)
118 {
119 $this->node->setAttribute("title",$a_objectiveid);
120 }
121
122 public function setPrimary($a_primary)
123 {
124 $this->primary = $a_primary;
125 }
126
127 public function setSatisfiedByMeasure($a_satisfied)
128 {
129 $this->node->setAttribute("satisfiedByMeasure",$a_satisfied);
130 }
131
132 public function setMappings($a_mappings)
133 {
134 $this->mappings = $a_mappings;
135 }
136
137 public function setNode($a_node)
138 {
139 $this->node = $a_node;
140 }
141
142 public function setDom($a_dom)
143 {
144 $this->dom = $a_dom;
145 }
146
147 // **********************
148 // Standard Operations for Object
149 // **********************
150
151
152 public function updateObjective() {
153 parent::update();
154 }
155
156 static function fetchAllObjectives($a_slm_object,$a_tree_node_id)
157 {
158 global $ilDB;
159
160 $objectives = array();
161 $seq_item = new ilSCORM2004Item($a_tree_node_id);
162 $xpath_obj = new DOMXPath($seq_item->dom);
163 $obj_node_list = $xpath_obj->query('//objective | //primaryObjective');
164 for ($i=0;$i<$obj_node_list->length;$i++) {
165 $obj = new ilSCORM2004Objective();
166 $obj->setNode($obj_node_list->item($i));
167 $mapping_node_list = $xpath_obj->query('//objective | //primaryObjective');
168 //check for mapping
169 array_push($objectives,$obj);
170 }
171 return $objectives;
172
173 }
174
175}
176?>
Class ilSCORM2004Condition.
ilSCORM2004Item($a_treeid=null, $a_rootlevel=false)
Constructor @access public.
Class ilSCORM2004Objective.
static fetchAllObjectives($a_slm_object, $a_tree_node_id)
ilSCORM2004Objective($a_treeid=null, $a_obj_id=null)
Constructor @access public.
global $ilDB