ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
class.ilSCORM2004Chapter.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
5require_once("./Modules/Scorm2004/classes/class.ilSCORM2004Node.php");
6
18{
19 public $tree;
20
25 public function __construct($a_slm_object, $a_id = 0)
26 {
27 parent::__construct($a_slm_object, $a_id);
28 $this->setType("chap");
29 }
30
34 public function delete($a_delete_meta_data = true)
35 {
36 $node_data = $this->tree->getNodeData($this->getId());
37 $this->delete_rec($a_delete_meta_data);
38 $this->tree->deleteTree($node_data);
39 parent::deleteSeqInfo();
40 }
41
45 private function delete_rec($a_delete_meta_data = true)
46 {
47 $childs = $this->tree->getChilds($this->getId());
48 foreach ($childs as $child) {
49 $obj = ilSCORM2004NodeFactory::getInstance($this->slm_object, $child["obj_id"], false);
50 if (is_object($obj)) {
51 if ($obj->getType() == "chap") {
52 $obj->delete_rec($a_delete_meta_data);
53 }
54 if ($obj->getType() == "sco") {
55 $obj->delete($a_delete_meta_data);
56 }
57 }
58 unset($obj);
59 }
60 parent::delete($a_delete_meta_data);
61 }
62
66 public function create($a_upload = false, $a_template = false)
67 {
68 include_once("./Modules/Scorm2004/classes/seq_editor/class.ilSCORM2004Item.php");
69 include_once("./Modules/Scorm2004/classes/seq_editor/class.ilSCORM2004Objective.php");
70 parent::create($a_upload);
71 if (!$a_template) {
73 }
74 }
75
83 {
84 $seq_item = new ilSCORM2004Item($this->getId());
85 $seq_item->setDefaultXml(true);
86 $seq_item->insert();
87 }
88
92 public function copy($a_target_slm)
93 {
94 $chap = new ilSCORM2004Chapter($a_target_slm);
95 $chap->setTitle($this->getTitle());
96 if ($this->getSLMId() != $a_target_slm->getId()) {
97 $chap->setImportId("il__chap_" . $this->getId());
98 }
99 $chap->setSLMId($a_target_slm->getId());
100 $chap->setType($this->getType());
101 $chap->setDescription($this->getDescription());
102 $chap->create(true);
103 $a_copied_nodes[$this->getId()] = $chap->getId();
104
105 // copy meta data
106 include_once("Services/MetaData/classes/class.ilMD.php");
107 $md = new ilMD($this->getSLMId(), $this->getId(), $this->getType());
108 $new_md = $md->cloneMD($a_target_slm->getId(), $chap->getId(), $this->getType());
109
110 return $chap;
111 }
112
119 public function exportXML(&$a_xml_writer, $a_inst, &$expLog)
120 {
121 // @todo
122 }
123
124
131 public function exportXMLMetaData(&$a_xml_writer)
132 {
133 include_once("Services/MetaData/classes/class.ilMD2XML.php");
134 $md2xml = new ilMD2XML($this->getSLMId(), $this->getId(), $this->getType());
135 $md2xml->setExportMode(true);
136 $md2xml->startExport();
137 $a_xml_writer->appendXML($md2xml->getXML());
138 }
139}
An exception for terminatinating execution or to throw for unit testing.
Class ilSCORM2004Chapter.
exportXMLMetaData(&$a_xml_writer)
export structure objects meta data to xml (see ilias_co.dtd)
delete_rec($a_delete_meta_data=true)
Delete data records of chapter (and nested objects)
insertDefaultSequencingItem()
Insert default sequencing item.
create($a_upload=false, $a_template=false)
Create asset.
__construct($a_slm_object, $a_id=0)
Constructor @access public.
exportXML(&$a_xml_writer, $a_inst, &$expLog)
Export object to xml (see ilias_co.dtd)
copy($a_target_slm)
Copy chapter.
Class ilSCORM2004Condition.
static getInstance($a_slm_object, $a_id=0, $a_halt=true)
getSLMId()
Get ID of parent Scorm Learning Module Object.
setType($a_type)
Set type.
getDescription()
Get description.