ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
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 var $tree;
20
25 function __construct($a_slm_object, $a_id = 0)
26 {
27 parent::__construct($a_slm_object, $a_id);
28 $this->setType("chap");
29 }
30
34 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 {
50 $obj = ilSCORM2004NodeFactory::getInstance($this->slm_object, $child["obj_id"], false);
51 if (is_object($obj))
52 {
53 if ($obj->getType() == "chap")
54 {
55 $obj->delete_rec($a_tree, $a_delete_meta_data);
56 }
57 if ($obj->getType() == "sco")
58 {
59 $obj->delete($a_delete_meta_data);
60 }
61 }
62 unset($obj);
63 }
64 parent::delete($a_delete_meta_data);
65 }
66
70 function create($a_upload = false, $a_template = false)
71 {
72 include_once("./Modules/Scorm2004/classes/seq_editor/class.ilSCORM2004Item.php");
73 include_once("./Modules/Scorm2004/classes/seq_editor/class.ilSCORM2004Objective.php");
74 parent::create($a_upload);
75 if (!$a_template) {
77 }
78 }
79
87 {
88 $seq_item = new ilSCORM2004Item($this->getId());
89 $seq_item->setDefaultXml(true);
90 $seq_item->insert();
91 }
92
96 function copy($a_target_slm)
97 {
98 $chap = new ilSCORM2004Chapter($a_target_slm);
99 $chap->setTitle($this->getTitle());
100 if ($this->getSLMId() != $a_target_slm->getId())
101 {
102 $chap->setImportId("il__chap_".$this->getId());
103 }
104 $chap->setSLMId($a_target_slm->getId());
105 $chap->setType($this->getType());
106 $chap->setDescription($this->getDescription());
107 $chap->create(true);
108 $a_copied_nodes[$this->getId()] = $chap->getId();
109
110 // copy meta data
111 include_once("Services/MetaData/classes/class.ilMD.php");
112 $md = new ilMD($this->getSLMId(), $this->getId(), $this->getType());
113 $new_md = $md->cloneMD($a_target_slm->getId(), $chap->getId(), $this->getType());
114
115 return $chap;
116 }
117
124 function exportXML(&$a_xml_writer, $a_inst, &$expLog)
125 {
126// @todo
127 }
128
129
136 function exportXMLMetaData(&$a_xml_writer)
137 {
138 include_once("Services/MetaData/classes/class.ilMD2XML.php");
139 $md2xml = new ilMD2XML($this->getSLMId(), $this->getId(), $this->getType());
140 $md2xml->setExportMode(true);
141 $md2xml->startExport();
142 $a_xml_writer->appendXML($md2xml->getXML());
143 }
144}
145?>
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.