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");
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');
101 if(!isset($this->status[
"$a_name"]))
103 $this->cnt[$a_name] == 1;
107 $this->cnt[$a_name]++;
109 $this->current_element[count($this->current_element)] = $a_name;
117 $this->cnt[$a_name]--;
118 unset ($this->current_element[count($this->current_element) - 1]);
126 return ($this->current_element[count($this->current_element) - 1]);
134 return ($this->current_element[count($this->current_element) - 1 - $nr]);
142 if (isset($this->cnt[$a_name]))
144 return $this->cnt[$a_name];
171 while (list($k,$v) = each($attr))
172 $tag.=
" ".$k.
"=\"$v\"";
182 return $this->parent_stack[count($this->parent_stack) - 1];
195 $manifest->setSLMId($this->slm_object->getId());
196 $manifest->setImportId($a_attribs[
"identifier"]);
197 $manifest->setVersion($a_attribs[
"version"]);
198 $manifest->setXmlBase($a_attribs[
"xml:base"]);
200 if (!$this->tree_created)
202 $this->sc_tree =&
new ilSCORMTree($this->slm_object->getId());
203 $this->sc_tree->
addTree($this->slm_object->getId(), $manifest->getId());
209 array_push($this->parent_stack, $manifest->getId());
212 case "organizations":
214 $organizations->setSLMId($this->slm_object->getId());
215 $organizations->setDefaultOrganization($a_attribs[
"default"]);
216 $organizations->create();
217 $this->sc_tree->insertNode($organizations->getId(), $this->
getCurrentParent());
218 array_push($this->parent_stack, $organizations->getId());
223 $organization->setSLMId($this->slm_object->getId());
224 $organization->setImportId($a_attribs[
"identifier"]);
225 $organization->setStructure($a_attribs[
"structure"]);
226 $organization->create();
227 $this->current_organization =& $organization;
228 $this->sc_tree->insertNode($organization->getId(), $this->
getCurrentParent());
229 array_push($this->parent_stack, $organization->getId());
234 $item->setSLMId($this->slm_object->getId());
235 $item->setImportId($a_attribs[
"identifier"]);
236 $item->setIdentifierRef($a_attribs[
"identifierref"]);
237 if (strtolower($a_attribs[
"isvisible"]) !=
"false")
239 $item->setVisible(
true);
243 $item->setVisible(
false);
245 $item->setParameters($a_attribs[
"parameters"]);
248 array_push($this->parent_stack, $item->getId());
249 $this->item_stack[count($this->item_stack)] =& $item;
252 case "adlcp:prerequisites":
253 $this->item_stack[count($this->item_stack) - 1]->setPrereqType($a_attribs[
"type"]);
258 $resources->setSLMId($this->slm_object->getId());
259 $resources->setXmlBase($a_attribs[
"xml:base"]);
260 $resources->create();
262 array_push($this->parent_stack, $resources->getId());
267 $resource->setSLMId($this->slm_object->getId());
268 $resource->setImportId($a_attribs[
"identifier"]);
269 $resource->setResourceType($a_attribs[
"type"]);
270 $resource->setScormType($a_attribs[
"adlcp:scormtype"]);
271 $resource->setXmlBase($a_attribs[
"xml:base"]);
272 $resource->setHRef($a_attribs[
"href"]);
274 $this->current_resource =& $resource;
276 array_push($this->parent_stack, $resource->getId());
281 $file->setHRef($a_attribs[
"href"]);
282 $this->current_resource->addFile(
$file);
287 $dependency->setIdentifierRef($a_attribs[
"identifierref"]);
288 $this->current_resource->addDependency($dependency);
305 case "organizations":
307 array_pop($this->parent_stack);
311 $this->current_organization->update();
312 array_pop($this->parent_stack);
316 $this->item_stack[count($this->item_stack) - 1]->update();
317 unset($this->item_stack[count($this->item_stack) - 1]);
318 array_pop($this->parent_stack);
322 $this->current_resource->update();
323 array_pop($this->parent_stack);
338 $a_data = preg_replace(
"/\n/",
"",$a_data);
339 $a_data = preg_replace(
"/\t+/",
"",$a_data);
348 $this->current_organization->setTitle(
349 $this->current_organization->getTitle() . $a_data
351 $this->package_title = $this->current_organization->getTitle();
355 $this->item_stack[count($this->item_stack) - 1]->setTitle(
356 $this->item_stack[count($this->item_stack) - 1]->getTitle() . $a_data
362 case "adlcp:prerequisites":
363 $this->item_stack[count($this->item_stack) - 1]->setPrerequisites($a_data);
366 case "adlcp:maxtimeallowed":
367 $this->item_stack[count($this->item_stack) - 1]->setMaxTimeAllowed($a_data);
370 case "adlcp:timelimitaction":
371 $this->item_stack[count($this->item_stack) - 1]->setTimeLimitAction($a_data);
374 case "adlcp:datafromlms":
375 $this->item_stack[count($this->item_stack) - 1]->setDataFromLms($a_data);
378 case "adlcp:masteryscore":
379 $this->item_stack[count($this->item_stack) - 1]->setMasteryScore($a_data);