Go to the documentation of this file.00001 <?php
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 require_once("content/classes/class.ilObjContentObject.php");
00025
00036 class ilContObjectManifestBuilder
00037 {
00038 var $db;
00039 var $ilias;
00040 var $cont_obj;
00041 var $inst_id;
00042
00047 function ilContObjectManifestBuilder(&$a_cont_obj)
00048 {
00049 global $ilDB, $ilias;
00050
00051 $this->cont_obj =& $a_cont_obj;
00052
00053 $this->ilias =& $ilias;
00054 $this->db =& $ilDB;
00055
00056 $this->inst_id = IL_INST_ID;
00057
00058 }
00059
00063 function buildManifest()
00064 {
00065 require_once("classes/class.ilXmlWriter.php");
00066
00067 $this->writer = new ilXmlWriter;
00068
00069
00070 $this->writer->xmlHeader();
00071
00072
00073 $attrs = array();
00074 $attrs["identifier"] = "il_".IL_INST_ID."_"."man".
00075 "_".$this->cont_obj->getId();
00076 $attrs["version"] = "";
00077 $attrs["xmlns:xsi"] = "http://www.w3.org/2001/XMLSchema-instance";
00078 $attrs["xsi:schemaLocation"] = "http://www.imsproject.org/xsd/imscp_rootv1p1p2".
00079 " imscp_rootv1p1p2.xsd".
00080 " http://www.imsglobal.org/xsd/imsmd_rootv1p2p1".
00081 " imsmd_rootv1p2p1.xsd".
00082 " http://www.adlnet.org/xsd/adlcp_rootv1p2".
00083 " adlcp_rootv1p2.xsd";
00084 $attrs["xmlns:imsmd"] = "http://www.imsproject.org/xsd/imsmd_rootv1p2p1";
00085 $attrs["xmlns:adlcp"] = "http://www.adlnet.org/xsd/adlcp_rootv1p2";
00086 $attrs["xmlns"] = "http://www.imsproject.org/xsd/imscp_rootv1p1p2";
00087 $this->writer->xmlStartTag("manifest", $attrs);
00088
00089
00090 $attrs = array();
00091 $this->writer->xmlStartTag("organizations", $attrs);
00092
00093
00094 $attrs = array();
00095 $attrs["identifier"] = "il_".IL_INST_ID."_".$this->cont_obj->getType().
00096 "_".$this->cont_obj->getId();
00097 $attrs["structure"] = "hierarchical";
00098 $this->writer->xmlStartTag("organization", $attrs);
00099
00100
00101 $attrs = array();
00102 $this->writer->xmlElement("title", $attrs, $this->cont_obj->getTitle());
00103
00104
00105 $this->writeItemHierarchy();
00106
00107
00108 $this->writer->xmlEndTag("organization");
00109
00110
00111 $this->writer->xmlEndTag("organizations");
00112
00113
00114 $attrs = array();
00115 $this->writer->xmlStartTag("resources", $attrs);
00116
00117
00118 $this->writeResources();
00119
00120
00121 $this->writer->xmlEndTag("resources");
00122
00123
00124 $this->writer->xmlEndTag("manifest");
00125
00126
00127
00128
00129
00130
00131 $this->writer->_XmlWriter;
00132 }
00133
00137 function dump($a_target_dir)
00138 {
00139 $this->writer->xmlDumpFile($a_target_dir."/imsmanifest.xml", false);
00140 }
00141
00147 function writeItemHierarchy()
00148 {
00149
00150 $attrs = array();
00151 $attrs["identifier"] = "INDEX";
00152 $attrs["identifierref"] = "RINDEX";
00153 $this->writer->xmlStartTag("item", $attrs);
00154
00155
00156 $attrs = array();
00157 $this->writer->xmlElement("title", $attrs, $this->cont_obj->getTitle());
00158
00159
00160 $this->writer->xmlEndTag("item");
00161 }
00162
00163
00169 function writeResources()
00170 {
00171 $attrs = array();
00172 $attrs["identifier"] = "RINDEX";
00173 $attrs["type"] = "webcontent";
00174 $attrs["adlcp:scormtype"] = "asset";
00175 $attrs["href"] = "res/index.html";
00176 $this->writer->xmlElement("resource", $attrs, "");
00177 }
00178
00179 }
00180
00181 ?>