ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
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 
15 require_once("./Modules/Scorm2004/classes/seq_editor/class.ilSCORM2004Item.php");
16 require_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  public function __construct($a_treeid = null, $a_obj_id = null)
41  {
42  parent::__construct($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  {
154  parent::update();
155  }
156 
157  public static function fetchAllObjectives($a_slm_object, $a_tree_node_id)
158  {
159  global $DIC;
160 
161  $ilDB = $DIC->database();
162 
163  $objectives = array();
164  $seq_item = new ilSCORM2004Item($a_tree_node_id);
165  $xpath_obj = new DOMXPath($seq_item->dom);
166  $obj_node_list = $xpath_obj->query('//objective | //primaryObjective');
167  for ($i=0;$i<$obj_node_list->length;$i++) {
168  $obj = new ilSCORM2004Objective();
169  $obj->setNode($obj_node_list->item($i));
170  $mapping_node_list = $xpath_obj->query('//objective | //primaryObjective');
171  //check for mapping
172  array_push($objectives, $obj);
173  }
174  return $objectives;
175  }
176 }
Class ilSCORM2004Condition.
global $DIC
Definition: saml.php:7
__construct($a_treeid=null, $a_obj_id=null)
Constructor public.
Create styles array
The data for the language used.
update($pash, $contents, Config $config)
global $ilDB
$i
Definition: disco.tpl.php:19
Class ilSCORM2004Objective.
static fetchAllObjectives($a_slm_object, $a_tree_node_id)