ILIAS  release_7 Revision v7.30-3-g800a261c036
class.ilSCORM2004Utilities.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
5
18{
22 protected $db;
23
27 protected $log;
28
29
30
31 private $id = null;
32
33 /*
34 * Constructor
35 * @access public
36 */
37 public function __construct($a_id)
38 {
39 global $DIC;
40
41 $this->db = $DIC->database();
42 $this->log = $DIC["ilLog"];
43 $this->id = $a_id;
44 }
45
46 //following 2 functions not used
47 // public function parentHasSeqTemplate($a_slm_id)
48 // {
49 // require_once("./Modules/Scorm2004/classes/seq_editor/class.ilSCORM2004SeqTemplate.php");
50//
51 // $ilDB = $this->db;
52 // $ilLog = $this->log;
53 // $has_template = false;
54//
55 // $mtree = new ilTree($a_slm_id);
56 // $mtree->setTableNames('sahs_sc13_tree','sahs_sc13_tree_node');
57 // $mtree->setTreeTablePK("slm_id");
58 // //get all parents for current node
59 // $parents = $this -> getParentsForNode($a_parents=array(),$this->id);
60 // for ($i=0;$i<count($parents);$i++)
61 // {
62 // $template = ilSCORM2004SeqTemplate::templateForChapter($parents[$i]);
63 // if ($template) {
64 // $has_template = true;
65 // break;
66 // }
67 // }
68//
69 // return $has_template;
70 // }
71//
72 // private function getParentsForNode($a_parents,$a_id){
73 // $parent_id = $tree->getParentId($id);
74 // if ($parent_id != 0) {
75 // array_push($a_parents,$parent_id);
76 // $this->getParentsForNode($a_parents,$parent_id);
77 // } else {
78 // return $a_parents;
79 // }
80 // }
81
82
83 public function getLeftRightInfo()
84 {
86 $ilLog = $this->log;
87 $ilLog->write("SCORM: getLeftRightInfo");
88 $query = "SELECT * FROM sahs_sc13_seq_tree WHERE (child = " .
89 $ilDB->quote($this->getSeqNodeId(), "integer") .
90 " AND importid=" . $ilDB->quote($this->getImportIdent(), "text") . ")";
91 $obj_set = $ilDB->query($query);
92 $ilLog->write("SCORM: getLeftRightInfo executed" . $query);
93 $obj_rec = $ilDB->fetchAssoc($obj_set);
94 return array("left" => $obj_rec["lft"], "right" => $obj_rec["rgt"]);
95 }
96
97
98 protected function getSeqNodeId()
99 {
101 $ilLog = $this->log;
102 $all_props = $this->getAllSequencingProperties();
103 $ilLog->write("SCORM: getSeqNodeId: " . $all_props["seqnodeid"]);
104 return $all_props["seqnodeid"];
105 }
106
107 private function getSequencingId()
108 {
110 $ilLog = $this->log;
111 $ilLog->write("SCORM: getSequencingId for" . $this->getId());
112 $query = "SELECT * FROM sahs_sc13_seq_item WHERE sahs_sc13_tree_node_id = " .
113 $ilDB->quote($this->getId(), "integer");
114 $obj_set = $ilDB->query($query);
115 $obj_rec = $obj_set->fetchRow(ilDBConstants::FETCHMODE_ASSOC);
116 return $obj_rec['sequencingid'];
117 }
118
119 private function getItemId()
120 {
122 $ilLog = $this->log;
123 $ilLog->write("SCORM: getSequencingId for" . $this->getId);
124 $query = "SELECT * FROM sahs_sc13_seq_item WHERE sahs_sc13_tree_node_id = " .
125 $ilDB->quote($this->getId(), "integer");
126 $obj_set = $ilDB->query($query);
127 $obj_rec = $obj_set->fetchRow(ilDBConstants::FETCHMODE_ASSOC);
128 return $obj_rec['seqnodeid'];
129 }
130
131 public function getImportIdent()
132 {
134 $ilLog = $this->log;
135 $ilLog->write("SCORM: getImportIdent for" . $this->getId);
136 $query = "SELECT * FROM sahs_sc13_seq_item WHERE sahs_sc13_tree_node_id = " .
137 $ilDB->quote($this->getId(), "integer");
138 $obj_set = $ilDB->query($query);
139 $obj_rec = $obj_set->fetchRow(ilDBConstants::FETCHMODE_ASSOC);
140 return $obj_rec['importid'];
141 }
142
143
144
145 private function getId()
146 {
147 return $this->id;
148 }
149
150 public function getAllowedActions()
151 {
153 $ilLog = $this->log;
154 $ilLog->write("SCORM: getAllowedActions for" . $this->tree_node_id);
155 $query = "SELECT * FROM sahs_sc13_seq_item WHERE sahs_sc13_tree_node_id = " .
156 $ilDB->quote($this->getId(), "integer");
157 $obj_set = $ilDB->query($query);
158 $obj_rec = $obj_set->fetchRow(ilDBConstants::FETCHMODE_ASSOC);
159 return array("copy" => !$obj_rec['nocopy'],"move" => !$obj_rec['nomove'],"delete" => !$obj_rec['nodelete']);
160 }
161
162 public function getControlModeProperties()
163 {
165 $query = "SELECT * FROM sahs_sc13_seq_seq WHERE id = " .
166 $ilDB->quote($this->getSequencingId(), "text");
167 $obj_set = $ilDB->query($query);
168 $obj_rec = $obj_set->fetchRow(ilDBConstants::FETCHMODE_ASSOC);
169 $c_properties = array(
170 'flow' => $obj_rec['flow'],
171 'forwardOnly' => $obj_rec['forwardonly'],
172 'choice' => $obj_rec['choice'],
173 'choiceExit' => $obj_rec['choiceexit'] );
174 return $c_properties;
175 }
176
178 {
180 $ilLog = $this->log;
181 $query = "SELECT * FROM sahs_sc13_seq_seq WHERE (id = " .
182 $ilDB->quote($this->getSequencingId(), "text") .
183 " AND importid=" . $ilDB->quote($this->getImportIdent(), "text") . ")";
184 $obj_set = $ilDB->query($query);
185 $ilLog->write("SCORM: getAllSequencingProperties for" . $this->getSequencingId());
186 $obj_rec = $obj_set->fetchRow(ilDBConstants::FETCHMODE_ASSOC);
187 $sprop = array(
188 'importId' => $obj_rec['importid'],
189 'activityAbsoluteDurationLimit' => $obj_rec['activityabsolutedurationlimit'],
190 'activityExperiencedDurationLimit' => $obj_rec['activityexperienceddurlimit'],
191 'attemptAbsoluteDurationLimit' => $obj_rec['attemptabsolutedurationlimit'],
192 'attemptExperiencedDurationLimit' => $obj_rec['attemptexperienceddurlimit'],
193 'attemptLimit' => $obj_rec['attemptlimit'],
194 'beginTimeLimit' => $obj_rec['begintimelimit'],
195 'completionSetByContent' => $obj_rec['completionsetbycontent'],
196 'constrainChoice' => $obj_rec['constrainchoice'],
197 'seqNodeId' => $obj_rec['seqnodeid'],
198 'endTimeLimit' => $obj_rec['endtimelimit'],
199 'id' => $obj_rec['id'],
200 'measureSatisfactionIfActive' => $obj_rec['measuresatisfactionifactive'],
201 'objectiveMeasureWeight' => $obj_rec['objectivemeasureweight'],
202 'objectiveSetByContent' => $obj_rec['objectivesetbycontent'],
203 'preventActivation' => $obj_rec['preventactivation'],
204 'randomizationTiming' => $obj_rec['randomizationtiming'],
205 'reorderChildren' => $obj_rec['reorderchildren'],
206 'requiredForCompleted' => $obj_rec['requiredforcompleted'],
207 'requiredForIncomplete' => $obj_rec['requiredforincomplete'],
208 'requiredForNotSatisfied' => $obj_rec['requiredfornotsatisfied'],
209 'requiredForSatisfied' => $obj_rec['requiredforsatisfied'],
210 'rollupObjectiveSatisfied' => $obj_rec['rollupobjectivesatisfied'],
211 'rollupProgressCompletion' => $obj_rec['rollupprogresscompletion'],
212 'selectCount' => $obj_rec['selectcount'],
213 'selectionTiming' => $obj_rec['selectiontiming'],
214 'sequencingId' => $obj_rec['sequencingid'],
215 'tracked' => $obj_rec['tracked'],
216 'useCurrentAttemptObjectiveInfo' => $obj_rec['usecurrentattemptobjectiveinfo'],
217 'useCurrentAttemptProgressInfo' => $obj_rec['usecurrentattemptprogressinfo'],
218 'flow' => $obj_rec['flow'],
219 'forwardOnly' => $obj_rec['forwardonly'],
220 'choice' => $obj_rec['choice'],
221 'choiceExit' => $obj_rec['choiceexit'] );
222 return $sprop;
223 }
224}
An exception for terminatinating execution or to throw for unit testing.
Class ilSCORM2004Utilities.
global $DIC
Definition: goto.php:24
$query
global $ilDB