ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
ilLMContObjectManifestBuilder Class Reference

Content Object (ILIAS native learning module / digilib book) Manifest export class. More...

+ Collaboration diagram for ilLMContObjectManifestBuilder:

Public Member Functions

 __construct ($a_cont_obj)
 Constructor public. More...
 
 buildManifest ()
 build manifest structure More...
 
 dump ($a_target_dir)
 dump manifest file into directory More...
 
 writeItemHierarchy ()
 write item hierarchy More...
 
 writeResources ()
 write resources More...
 

Data Fields

 $db
 
 $cont_obj
 
 $inst_id
 

Detailed Description

Content Object (ILIAS native learning module / digilib book) Manifest export class.

Author
Alex Killing alex..nosp@m.kill.nosp@m.ing@g.nosp@m.mx.d.nosp@m.e
Version
$Id$

Definition at line 16 of file class.ilLMContObjectManifestBuilder.php.

Constructor & Destructor Documentation

◆ __construct()

ilLMContObjectManifestBuilder::__construct (   $a_cont_obj)

Constructor public.

Definition at line 26 of file class.ilLMContObjectManifestBuilder.php.

References $DIC, and $ilDB.

27  {
28  global $DIC;
29 
30  $ilDB = $DIC->database();
31 
32  $this->cont_obj = $a_cont_obj;
33 
34  $this->db = $ilDB;
35 
36  $this->inst_id = IL_INST_ID;
37  }
global $DIC
Definition: saml.php:7
global $ilDB

Member Function Documentation

◆ buildManifest()

ilLMContObjectManifestBuilder::buildManifest ( )

build manifest structure

Definition at line 42 of file class.ilLMContObjectManifestBuilder.php.

References writeItemHierarchy(), writeResources(), and ilXmlWriter\xmlHeader().

43  {
44  require_once("./Services/Xml/classes/class.ilXmlWriter.php");
45 
46  $this->writer = new ilXmlWriter;
47 
48  // set xml header
49  $this->writer->xmlHeader();
50 
51  // manifest start tag
52  $attrs = array();
53  $attrs["identifier"] = "il_" . IL_INST_ID . "_" . "man" .
54  "_" . $this->cont_obj->getId();
55  $attrs["version"] = "";
56  $attrs["xmlns:xsi"] = "http://www.w3.org/2001/XMLSchema-instance";
57  $attrs["xsi:schemaLocation"] = "http://www.imsproject.org/xsd/imscp_rootv1p1p2" .
58  " imscp_rootv1p1p2.xsd" .
59  " http://www.imsglobal.org/xsd/imsmd_rootv1p2p1" .
60  " imsmd_rootv1p2p1.xsd" .
61  " http://www.adlnet.org/xsd/adlcp_rootv1p2" .
62  " adlcp_rootv1p2.xsd";
63  $attrs["xmlns:imsmd"] = "http://www.imsproject.org/xsd/imsmd_rootv1p2p1";
64  $attrs["xmlns:adlcp"] = "http://www.adlnet.org/xsd/adlcp_rootv1p2";
65  $attrs["xmlns"] = "http://www.imsproject.org/xsd/imscp_rootv1p1p2";
66  $this->writer->xmlStartTag("manifest", $attrs);
67 
68  // organizations start tag
69  $attrs = array();
70  $this->writer->xmlStartTag("organizations", $attrs);
71 
72  // organization start tag
73  $attrs = array();
74  $attrs["identifier"] = "il_" . IL_INST_ID . "_" . $this->cont_obj->getType() .
75  "_" . $this->cont_obj->getId();
76  $attrs["structure"] = "hierarchical";
77  $this->writer->xmlStartTag("organization", $attrs);
78 
79  // title element
80  $attrs = array();
81  $this->writer->xmlElement("title", $attrs, $this->cont_obj->getTitle());
82 
83  // write item hierarchy
84  $this->writeItemHierarchy();
85 
86  // organization end tag
87  $this->writer->xmlEndTag("organization");
88 
89  // organizations end tag
90  $this->writer->xmlEndTag("organizations");
91 
92  // resources start tag
93  $attrs = array();
94  $this->writer->xmlStartTag("resources", $attrs);
95 
96  // write resources
97  $this->writeResources();
98 
99  // resources end tag
100  $this->writer->xmlEndTag("resources");
101 
102  // manifest end tag
103  $this->writer->xmlEndTag("manifest");
104 
105  // write manifest file
106  //$this->xml->xmlDumpFile($this->export_dir."/".$this->subdir."/".$this->filename
107  // , false);
108 
109  // destroy writer object
110  $this->writer->_XmlWriter;
111  }
XML writer class.
xmlHeader()
Writes xml header public.
+ Here is the call graph for this function:

◆ dump()

ilLMContObjectManifestBuilder::dump (   $a_target_dir)

dump manifest file into directory

Definition at line 116 of file class.ilLMContObjectManifestBuilder.php.

117  {
118  $this->writer->xmlDumpFile($a_target_dir . "/imsmanifest.xml", false);
119  }

◆ writeItemHierarchy()

ilLMContObjectManifestBuilder::writeItemHierarchy ( )

write item hierarchy

this first version only writes one item for the whole learning module

Definition at line 126 of file class.ilLMContObjectManifestBuilder.php.

Referenced by buildManifest().

127  {
128  // start item
129  $attrs = array();
130  $attrs["identifier"] = "INDEX";
131  $attrs["identifierref"] = "RINDEX";
132  $this->writer->xmlStartTag("item", $attrs);
133 
134  // title element
135  $attrs = array();
136  $this->writer->xmlElement("title", $attrs, $this->cont_obj->getTitle());
137 
138  // end item
139  $this->writer->xmlEndTag("item");
140  }
+ Here is the caller graph for this function:

◆ writeResources()

ilLMContObjectManifestBuilder::writeResources ( )

write resources

this first version only writes one resource for the whole learning module

Definition at line 148 of file class.ilLMContObjectManifestBuilder.php.

Referenced by buildManifest().

149  {
150  $attrs = array();
151  $attrs["identifier"] = "RINDEX";
152  $attrs["type"] = "webcontent";
153  $attrs["adlcp:scormtype"] = "asset";
154  $attrs["href"] = "res/index.html";
155  $this->writer->xmlElement("resource", $attrs, "");
156  }
+ Here is the caller graph for this function:

Field Documentation

◆ $cont_obj

ilLMContObjectManifestBuilder::$cont_obj

Definition at line 19 of file class.ilLMContObjectManifestBuilder.php.

◆ $db

ilLMContObjectManifestBuilder::$db

Definition at line 18 of file class.ilLMContObjectManifestBuilder.php.

◆ $inst_id

ilLMContObjectManifestBuilder::$inst_id

Definition at line 20 of file class.ilLMContObjectManifestBuilder.php.


The documentation for this class was generated from the following file: