24 require_once(
"./Modules/ScormAicc/classes/SCORM/class.ilSCORMManifest.php");
25 require_once(
"./Modules/ScormAicc/classes/SCORM/class.ilSCORMOrganizations.php");
26 require_once(
"./Modules/ScormAicc/classes/SCORM/class.ilSCORMOrganization.php");
27 require_once(
"./Modules/ScormAicc/classes/SCORM/class.ilSCORMItem.php");
28 require_once(
"./Modules/ScormAicc/classes/SCORM/class.ilSCORMResources.php");
29 require_once(
"./Modules/ScormAicc/classes/SCORM/class.ilSCORMResource.php");
30 require_once(
"./Modules/ScormAicc/classes/SCORM/class.ilSCORMResourceFile.php");
31 require_once(
"./Modules/ScormAicc/classes/SCORM/class.ilSCORMResourceDependency.php");
32 require_once(
"./Modules/ScormAicc/classes/SCORM/class.ilSCORMTree.php");
65 parent::__construct($a_xml_file);
67 $this->current_element =
array();
68 $this->slm_object = $a_slm_object;
69 $this->tree_created =
false;
70 $this->parent_stack =
array();
71 $this->item_stack =
array();
81 xml_set_object($a_xml_parser, $this);
82 xml_set_element_handler($a_xml_parser,
'handlerBeginTag',
'handlerEndTag');
83 xml_set_character_data_handler($a_xml_parser,
'handlerCharacterData');
88 parent::startParsing();
101 if (!isset($this->status[
"$a_name"])) {
102 $this->cnt[$a_name] == 1;
104 $this->cnt[$a_name]++;
106 $this->current_element[count($this->current_element)] = $a_name;
114 $this->cnt[$a_name]--;
115 unset($this->current_element[count($this->current_element) - 1]);
123 return ($this->current_element[count($this->current_element) - 1]);
131 return ($this->current_element[count($this->current_element) - 1 - $nr]);
139 if (isset($this->cnt[$a_name])) {
140 return $this->cnt[$a_name];
157 if (
$type ==
"end") {
163 if (is_array($attr)) {
164 while (list($k, $v) = each($attr)) {
165 $tag.=
" " . $k .
"=\"$v\"";
176 return $this->parent_stack[count($this->parent_stack) - 1];
188 $manifest->setSLMId($this->slm_object->getId());
189 $manifest->setImportId($a_attribs[
"identifier"]);
190 $manifest->setVersion($a_attribs[
"version"]);
191 $manifest->setXmlBase($a_attribs[
"xml:base"]);
193 if (!$this->tree_created) {
194 $this->sc_tree =
new ilSCORMTree($this->slm_object->getId());
195 $this->sc_tree->
addTree($this->slm_object->getId(), $manifest->getId());
199 array_push($this->parent_stack, $manifest->getId());
202 case "organizations":
213 $organization->setSLMId($this->slm_object->getId());
214 $organization->setImportId($a_attribs[
"identifier"]);
215 $organization->setStructure($a_attribs[
"structure"]);
216 $organization->create();
217 $this->current_organization =&$organization;
218 $this->sc_tree->insertNode($organization->getId(), $this->
getCurrentParent());
219 array_push($this->parent_stack, $organization->getId());
224 $item->setSLMId($this->slm_object->getId());
225 $item->setImportId($a_attribs[
"identifier"]);
226 $item->setIdentifierRef($a_attribs[
"identifierref"]);
227 if (strtolower($a_attribs[
"isvisible"]) !=
"false") {
228 $item->setVisible(
true);
230 $item->setVisible(
false);
232 $item->setParameters($a_attribs[
"parameters"]);
235 array_push($this->parent_stack, $item->getId());
236 $this->item_stack[count($this->item_stack)] =&$item;
239 case "adlcp:prerequisites":
240 $this->item_stack[count($this->item_stack) - 1]->setPrereqType($a_attribs[
"type"]);
245 $resources->setSLMId($this->slm_object->getId());
246 $resources->setXmlBase($a_attribs[
"xml:base"]);
247 $resources->create();
249 array_push($this->parent_stack, $resources->getId());
254 $resource->setSLMId($this->slm_object->getId());
255 $resource->setImportId($a_attribs[
"identifier"]);
256 $resource->setResourceType($a_attribs[
"type"]);
257 $resource->setScormType($a_attribs[
"adlcp:scormtype"]);
258 $resource->setXmlBase($a_attribs[
"xml:base"]);
259 $resource->setHRef($a_attribs[
"href"]);
261 $this->current_resource =&$resource;
263 array_push($this->parent_stack, $resource->getId());
268 $file->setHRef($a_attribs[
"href"]);
269 $this->current_resource->addFile(
$file);
274 $dependency->setIdentifierRef($a_attribs[
"identifierref"]);
275 $this->current_resource->addDependency($dependency);
291 case "organizations":
293 array_pop($this->parent_stack);
297 $this->current_organization->update();
298 array_pop($this->parent_stack);
302 $this->item_stack[count($this->item_stack) - 1]->update();
303 unset($this->item_stack[count($this->item_stack) - 1]);
304 array_pop($this->parent_stack);
308 $this->current_resource->update();
309 array_pop($this->parent_stack);
323 $a_data = preg_replace(
"/\n/",
"", $a_data);
324 $a_data = preg_replace(
"/\t+/",
"", $a_data);
325 if (!empty($a_data)) {
330 $this->current_organization->setTitle(
331 $this->current_organization->getTitle() . $a_data
333 $this->package_title = $this->current_organization->getTitle();
337 $this->item_stack[count($this->item_stack) - 1]->setTitle(
338 $this->item_stack[count($this->item_stack) - 1]->getTitle() . $a_data
344 case "adlcp:prerequisites":
345 $this->item_stack[count($this->item_stack) - 1]->setPrerequisites($a_data);
348 case "adlcp:maxtimeallowed":
349 $this->item_stack[count($this->item_stack) - 1]->setMaxTimeAllowed($a_data);
352 case "adlcp:timelimitaction":
353 $this->item_stack[count($this->item_stack) - 1]->setTimeLimitAction($a_data);
356 case "adlcp:datafromlms":
357 $this->item_stack[count($this->item_stack) - 1]->setDataFromLms($a_data);
360 case "adlcp:masteryscore":
361 $this->item_stack[count($this->item_stack) - 1]->setMasteryScore($a_data);
setHandlers($a_xml_parser)
set event handler should be overwritten by inherited class private
SCORM Resource Dependency, DB accesses are done in ilSCORMResource.
getAncestorElement($nr=1)
handlerCharacterData($a_xml_parser, $a_data)
handler for character data
if($source===NULL) $organizations
Base class for sax-based expat parsing extended classes need to overwrite the method setHandlers and ...
Create styles array
The data for the language used.
buildTag($type, $name, $attr="")
generate a tag with given name and attributes
SCORM Resource File, DB accesses are done in ilSCORMResource.
__construct(&$a_slm_object, $a_xml_file)
Constructor.
handlerEndTag($a_xml_parser, $a_name)
handler for end of element
if(!file_exists("$old.txt")) if($old===$new) if(file_exists("$new.txt")) $file
handlerBeginTag($a_xml_parser, $a_name, $a_attribs)
handler for begin of element
addTree($a_tree_id, $a_node_id=-1)
create a new tree to do: ???
if(function_exists('posix_getuid') &&posix_getuid()===0) if(!array_key_exists('t', $options)) $tag