5 require_once(
"./Modules/Scorm2004/classes/seq_editor/class.ilSCORM2004Item.php");
6 require_once(
"./Modules/Scorm2004/classes/class.ilSCORM2004Chapter.php");
7 require_once(
"./Modules/Scorm2004/classes/class.ilSCORM2004SeqChapter.php");
8 require_once(
"./Modules/Scorm2004/classes/class.ilSCORM2004Sco.php");
23 const SEQ_TEMPLATE_XSL =
'./Modules/Scorm2004/templates/editor/seq_templates/xsl/normalize_seqtemplate.xsl';
24 const SEQ_TEMPLATE_XSD =
'./Modules/Scorm2004/templates/editor/seq_templates/xsd/seq_template.xsd';
45 $this->db = $DIC->database();
47 parent::__construct();
50 if ($a_identifier == null) {
53 $t_file = self::getFileNameForIdentifier($a_identifier);
56 $this->
template->async =
false;
60 $test = self::SEQ_TEMPLATE_DIR .
"/" .
$_SESSION[
"lang"] .
"/" . $t_file;
61 if (file_exists(
$test)) {
62 $this->template_file =
$test;
64 $this->template_file = self::SEQ_TEMPLATE_DIR .
"/en/" . $t_file;
66 if (!@$this->template->load($this->template_file)) {
67 $this->diagnostic[] =
'Template not wellformed';
68 $test = $this->
template->saveXML();
84 $array_metad = array();
85 $metadata = $this->
template->getElementsByTagName(
"metadata");
89 $array_metad[$curNode->localName] = $curNode->nodeValue;
99 $ilDB = $DIC->database();
100 $arr_templates = array();
101 $query =
"SELECT * FROM sahs_sc13_seq_templts ORDER BY identifier";
104 if (
$row[
'identifier'] !=
"pretestpost") {
105 array_push($arr_templates,
new ilScorm2004SeqTemplate(
$row[
'identifier']));
108 return $arr_templates;
120 $seqtemplate = $this->
template->getElementsByTagName(
"seqTemplate");
121 return $seqtemplate->item(0)->getAttribute(
"identifier");
128 $this->importId = uniqid();
129 return $this->
importTemplate($a_target, $a_object, $a_parent, $this->template->getElementsByTagName(
"item")->item(0));
144 switch ($node->getAttribute(
'type')) {
146 if ($this->parentchapter ==
true) {
151 $chap->setTitle($node->getElementsByTagName(
"title")->item(0)->nodeValue);
152 $chap->setSLMId($a_object->getId());
154 $this->sahs_sc13_treeId = $chap->getId();
157 if ($this->parentchapter ==
true) {
158 $ilDB->manipulate(
"INSERT INTO sahs_sc13_seq_assign (identifier, sahs_sc13_tree_node_id) VALUES " .
159 "(" .
$ilDB->quote($this->getIdentifier(),
"text") .
"," .
160 $ilDB->quote($this->sahs_sc13_treeId,
"integer") .
")");
161 $this->parentchapter =
false;
163 $new_id = $chap->getId();
167 $sco->setTitle($node->getElementsByTagName(
"title")->item(0)->nodeValue);
168 $sco->setSLMId($a_object->getId());
169 $sco->create(
false,
true);
170 $this->sahs_sc13_treeId = $sco->getId();
172 $new_id = $sco->getId();
176 $seq_node = $node->getElementsByTagName(
"sequencing")->item(0);
178 $obj_node = $seq_node->getElementsByTagName(
"objectives")->item(0);
181 foreach ($obj_node->childNodes as $objchild) {
182 if ($objchild->nodeName ===
"objective" || $objchild->nodeName ===
"primaryObjective") {
183 $title = $objchild->getAttribute(
'objectiveID');
184 $objchild->setAttribute(
"title",
$title);
191 $seq_item->setTreeNodeId($this->sahs_sc13_treeId);
192 $seq_item->setImportid($this->importId);
193 $seq_item->setNocopy($seq_node->getAttribute(
'nocopy'));
194 $seq_item->setNodelete($seq_node->getAttribute(
'nodelete'));
195 $seq_item->setNomove($seq_node->getAttribute(
'nomove'));
198 $toadd = $seq_doc->importNode($seq_node,
true);
199 $seq_doc->appendChild($toadd);
204 $xpath_obj =
new DOMXPath($seq_doc);
206 $found_nodes = $xpath_obj->query(
'//@objectiveID | //@referencedObjective | //@targetObjectiveID');
207 for (
$i = 0;
$i < $found_nodes->length;
$i++) {
209 $val = $found_nodes->item(
$i)->value;
211 if ($found_nodes->item(
$i)->name ==
"targetObjectiveID") {
214 $val = strtolower(preg_replace(
'/ +/',
'_', $val) .
"_" . $uid);
215 $element = $found_nodes->item(
$i)->ownerElement;
216 $element->setAttribute($found_nodes->item(
$i)->name, $val);
219 $seq_item->setDom($seq_doc);
223 foreach ($node->childNodes as $child) {
224 if ($child->nodeName ===
"item") {
242 public function insert($a_insert_node =
false)
244 if ($a_insert_node ==
true) {
247 $sql =
"INSERT INTO sahs_sc13_seq_templ (seqnodeid,id)" .
249 $this->db->quote($this->seqNodeId,
"integer") .
"," .
250 $this->db->quote($this->
id,
"text") .
");";
251 $result = $this->db->manipulate($sql);
277 $this->seqNodeId = $a_seqnodeid;
291 $ilDB = $DIC->database();
292 $query =
"SELECT * FROM sahs_sc13_seq_templts WHERE identifier = " .
293 $ilDB->quote($a_identifier,
"text");
295 $obj_rec =
$ilDB->fetchAssoc($obj_set);
296 return $obj_rec[
"fileName"];
297 return $obj_rec[
"filename"];
304 $ilDB = $DIC->database();
306 $query =
"SELECT * FROM sahs_sc13_seq_assign WHERE sahs_sc13_tree_node_id = " .
307 $ilDB->quote($a_chapter_id,
"integer");
309 $obj_rec =
$ilDB->fetchAssoc($obj_set);
310 if ($obj_rec[
'identifier']) {
311 $template =
new ilScorm2004SeqTemplate($obj_rec[
'identifier']);
Class ilSCORM2004Condition.
importTemplate($a_target, $a_object, $a_parent, $node)
function import Template
static putInTree($a_obj, $a_parent_id="", $a_target_node_id="")
put this object into content object tree
insertTemplateForObjectAtParent($a_object, $a_parent, $a_target)
static getFileNameForIdentifier($a_identifier)
Class ilSCORM2004Chapter.
Class ilSCORM2004Chapter.
$metadata['__DYNAMIC:1__']
setSeqNodeId($a_seqnodeid)
__construct($a_identifier)
static availableTemplates()
Class ilSCORM2004Chapter.
Class ilSCORM2004Condition.
insert($a_insert_node=false)
getIdentifier()
function getIdentifier
getMetadataProperties()
function getMetadataProperties
static templateForChapter($a_chapter_id)