24 require_once(
"./Modules/Scorm2004/classes/seq_editor/class.ilSCORM2004Item.php");
25 require_once(
"./Modules/Scorm2004/classes/class.ilSCORM2004Chapter.php");
26 require_once(
"./Modules/Scorm2004/classes/class.ilSCORM2004SeqChapter.php");
27 require_once(
"./Modules/Scorm2004/classes/class.ilSCORM2004Sco.php");
42 const SEQ_TEMPLATE_DIR =
'./Modules/Scorm2004/templates/editor/seq_templates';
43 const SEQ_TEMPLATE_XSL =
'./Modules/Scorm2004/templates/editor/seq_templates/xsl/normalize_seqtemplate.xsl';
44 const SEQ_TEMPLATE_XSD =
'./Modules/Scorm2004/templates/editor/seq_templates/xsd/seq_template.xsd';
67 if ($a_identifier==null) {
return;}
70 $this->
template =
new DOMDocument;
71 $this->
template->async =
false;
76 if (file_exists(
$test))
78 $this->template_file =
$test;
80 $this->template_file = self::SEQ_TEMPLATE_DIR.
"/en/".$t_file;
82 if (!@$this->template->load($this->template_file))
84 $this->diagnostic[] =
'Template not wellformed';
85 $test = $this->
template->saveXML();
101 $array_metad = array();
102 $metadata = $this->
template->getElementsByTagName(
"metadata");
103 $nodes = $metadata->item(0)->childNodes;
104 for ($i = 0; $i < $nodes->length; $i++ ) {
105 $curNode = $nodes->item($i);
106 $array_metad[$curNode->localName] = $curNode->nodeValue;
115 $arr_templates = array();
116 $query =
"SELECT * FROM sahs_sc13_seq_templts ORDER BY identifier";
117 $result = $ilDB->query(
$query);
118 while(
$row = $ilDB->fetchAssoc($result))
120 if(
$row[
'identifier']!=
"pretestpost") {
121 array_push($arr_templates,
new ilScorm2004SeqTemplate(
$row[
'identifier']));
124 return $arr_templates;
136 $seqtemplate = $this->
template->getElementsByTagName(
"seqTemplate");
137 return $seqtemplate->item(0)->getAttribute(
"identifier");;
143 $this->importId = uniqid();
144 return $this->
importTemplate($a_target,$a_object,$a_parent, $this->template->getElementsByTagName(
"item")->item(0));
158 switch($node->getAttribute(
'type'))
161 if ($this->parentchapter==
true)
167 $chap->setTitle($node->getElementsByTagName(
"title")->item(0)->nodeValue);
168 $chap->setSLMId($a_object->getId());
170 $this->sahs_sc13_treeId = $chap->getId();
173 if ($this->parentchapter==
true)
175 $ilDB->manipulate(
"INSERT INTO sahs_sc13_seq_assign (identifier, sahs_sc13_tree_node_id) VALUES ".
176 "(".$ilDB->quote($this->getIdentifier(),
"text").
",".
177 $ilDB->quote($this->sahs_sc13_treeId,
"integer").
")");
178 $this->parentchapter =
false;
180 $new_id = $chap->getId();
184 $sco->setTitle($node->getElementsByTagName(
"title")->item(0)->nodeValue);
185 $sco->setSLMId($a_object->getId());
186 $sco->create(
false,
true);
187 $this->sahs_sc13_treeId = $sco->getId();
189 $new_id = $sco->getId();
193 $seq_node = $node->getElementsByTagName(
"sequencing")->item(0);
195 $obj_node = $seq_node->getElementsByTagName(
"objectives")->item(0);
198 foreach ($obj_node->childNodes as $objchild ) {
199 if ($objchild->nodeName ===
"objective" || $objchild->nodeName ===
"primaryObjective") {
200 $title = $objchild->getAttribute(
'objectiveID');
201 $objchild->setAttribute(
"title",
$title);
208 $seq_item->setTreeNodeId($this->sahs_sc13_treeId);
209 $seq_item->setImportid($this->importId);
210 $seq_item->setNocopy($seq_node->getAttribute(
'nocopy'));
211 $seq_item->setNodelete($seq_node->getAttribute(
'nodelete'));
212 $seq_item->setNomove($seq_node->getAttribute(
'nomove'));
214 $seq_doc =
new DOMDocument();
215 $toadd = $seq_doc->importNode($seq_node,
true);
216 $seq_doc->appendChild($toadd);
221 $xpath_obj =
new DOMXPath($seq_doc);
223 $found_nodes = $xpath_obj->query(
'//@objectiveID | //@referencedObjective | //@targetObjectiveID');
224 for ($i=0; $i<$found_nodes->length; $i++) {
226 $val = $found_nodes->item($i)->value;
228 if ($found_nodes->item($i)->name ==
"targetObjectiveID") {
231 $val = strtolower(preg_replace(
'/ +/',
'_',$val).
"_".$uid);
232 $element = $found_nodes->item($i)->ownerElement;
233 $element->setAttribute($found_nodes->item($i)->name,$val);
236 $seq_item->setDom($seq_doc);
240 foreach($node->childNodes as $child)
241 {
if ($child->nodeName ===
"item") {
261 if ($a_insert_node==
true) {$this->
setSeqNodeId(parent::insert());}
262 $sql =
"INSERT INTO sahs_sc13_seq_templ (seqnodeid,id)".
264 $this->db->quote($this->seqNodeId,
"integer").
",".
265 $this->db->quote($this->
id,
"text").
");";
266 $result = $this->db->manipulate($sql);
292 $this->seqNodeId = $a_seqnodeid;
305 $query =
"SELECT * FROM sahs_sc13_seq_templts WHERE identifier = ".
306 $ilDB->quote($a_identifier,
"text");
307 $obj_set = $ilDB->query(
$query);
308 $obj_rec = $ilDB->fetchAssoc($obj_set);
309 return $obj_rec[
"fileName"];
310 return $obj_rec[
"filename"];
317 $query =
"SELECT * FROM sahs_sc13_seq_assign WHERE sahs_sc13_tree_node_id = ".
318 $ilDB->quote($a_chapter_id,
"integer");
319 $obj_set = $ilDB->query(
$query);
320 $obj_rec = $ilDB->fetchAssoc($obj_set);
321 if ($obj_rec[
'identifier']) {
322 $template =
new ilScorm2004SeqTemplate($obj_rec[
'identifier']);