11 require_once
"./Modules/Scorm2004/classes/ilSCORM13Package.php";
12 require_once
"./Modules/Scorm2004/classes/class.ilSCORM2004Chapter.php";
13 require_once
"./Modules/Scorm2004/classes/class.ilSCORM2004Sco.php";
14 require_once
"./Modules/Scorm2004/classes/class.ilSCORM2004PageNode.php";
15 require_once
"./Modules/Scorm2004/classes/adlparser/SeqTreeBuilder.php";
16 require_once(
"./Modules/ScormAicc/classes/SCORM/class.ilSCORMTree.php");
20 const DB_ENCODE_XSL =
'./Modules/Scorm2004/templates/xsl/op/op-scorm13.xsl';
21 const CONVERT_XSL =
'./Modules/Scorm2004/templates/xsl/op/scorm12To2004.xsl';
22 const DB_DECODE_XSL =
'./Modules/Scorm2004/templates/xsl/op/op-scorm13-revert.xsl';
23 const VALIDATE_XSD =
'./libs/ilias/Scorm2004/xsd/op/op-scorm13.xsd';
25 const WRAPPER_HTML =
'./Modules/Scorm2004/scripts/converter/GenericRunTimeWrapper1.0_aadlc/GenericRunTimeWrapper.htm';
26 const WRAPPER_JS =
'./Modules/Scorm2004/scripts/converter/GenericRunTimeWrapper1.0_aadlc/SCOPlayerWrapper.js';
75 $this->packagesFolder =
'';
91 $pg_set =
$ilDB->queryF(
'SELECT * FROM cp_package WHERE obj_id = %s', array(
'integer'), array(
$packageId));
94 $this->packageData = array_merge($lm_data, $pg_data);
96 $this->packageFolder = $this->packagesFolder .
'/' .
$packageId;
97 $this->packageFile = $this->packageFolder .
'.zip';
98 $this->imsmanifestFile = $this->packageFolder .
'/' .
'imsmanifest.xml';
106 if (is_dir($this->packageFolder)) {
107 dir_delete($this->packageFolder);
109 if (is_file($this->packageFile)) {
110 @unlink($this->packageFile);
122 $ilDB = $DIC[
'ilDB'];
124 header(
'content-type: text/xml');
125 header(
'content-disposition: attachment; filename="manifest.xml"');
128 'SELECT xmldata FROM cp_package WHERE obj_id = %s',
130 array($this->packageId)
134 print(
$row[
'xmldata']);
147 $ilDB = $DIC[
'ilDB'];
153 if ($reimport ===
true) {
160 $this->imsmanifestFile = $this->packageFolder .
'/' .
'imsmanifest.xml';
163 $this->imsmanifest->async =
false;
164 if (!@$this->imsmanifest->load($this->imsmanifestFile)) {
165 $this->diagnostic[] =
'XML not wellformed';
170 $this->manifest = $this->
transform($this->imsmanifest, self::DB_ENCODE_XSL);
172 if (!$this->manifest) {
173 $this->diagnostic[] =
'Cannot transform into normalized manifest';
177 $path =
new DOMXpath($this->manifest);
178 $path->registerNamespace(
"scorm",
"http://www.openpalms.net/scorm/scorm13");
179 $items =
$path->query(
"//scorm:item");
180 if ($items->length == 1) {
181 $n = $items->item(0);
182 $resource =
$path->query(
"//scorm:resource");
183 foreach ($resource as
$res) {
184 if ($res->getAttribute(
'id') ==
$n->getAttribute(
"resourceId")) {
185 $res->setAttribute(
'scormType',
'sco');
191 if ($validate ==
"y") {
192 if (!$this->
validate($this->manifest, self::VALIDATE_XSD)) {
194 "<b>The uploaded SCORM 1.2 / SCORM 2004 is not valid. You can try to import the package without the validation option checked on your own risk. </b><br><br>Validation Error(s):</b><br> Normalized XML is not conform to " . self::VALIDATE_XSD,
201 if (file_exists($this->packageFolder .
'/' .
'index.xml')) {
202 $doc = simplexml_load_file($this->packageFolder .
'/' .
'index.xml');
203 $l = $doc->xpath(
"/ContentObject/MetaData");
205 include_once
'Services/MetaData/classes/class.ilMDXMLCopier.php';
207 $mdxml->startParsing();
208 $mdxml->getMDObject()->update();
211 include_once(
"./Modules/Scorm2004/classes/class.ilSCORM13MDImporter.php");
214 $title = $importer->getTitle();
222 $x = simplexml_load_string($this->manifest->saveXML());
223 $x[
'persistPreviousAttempts'] = $this->packageData[
'persistprevattempts'];
226 $x[
'defaultLessonMode'] = $this->packageData[
'default_lesson_mode'];
227 $x[
'credit'] = $this->packageData[
'credit'];
228 $x[
'autoReview'] = $this->packageData[
'auto_review'];
232 foreach ($x->resource as $xe) {
233 $r[strval($xe[
'id'])] = $xe;
237 foreach ($x->xpath(
'//*[local-name()="item"]') as $xe) {
239 if ($b =
$r[strval($xe[
'resourceId'])]) {
240 $xe[
'href'] = strval($b[
'base']) . strval($b[
'href']);
241 unset($xe[
'resourceId']);
242 if (strval($b[
'scormType']) ==
'sco') {
250 self::jsonNode($x->organization, $j[
'item']);
251 foreach ($x->sequencing as
$s) {
252 self::jsonNode($s, $j[
'sequencing'][]);
255 $j[
'item'][
'base'] = strval($x[
'base']);
258 $j[
'foreignId'] = floatval($x[
'foreignId']);
259 $j[
'id'] = strval($x[
'id']);
264 $adl_tree = $act->buildNodeSeqTree($this->imsmanifestFile);
268 'xmldata' => array(
'clob', $x->asXML()),
269 'jsdata' => array(
'clob', json_encode($j)),
270 'activitytree' => array(
'clob', json_encode($adl_tree[
'tree'])),
271 'global_to_system' => array(
'integer', (
int) $adl_tree[
'global']),
272 'shared_data_global_to_system' => array(
'integer', (
int) $adl_tree[
'dataglobal'])
275 'obj_id' => array(
'integer', (
int) $this->packageId)
284 return $j[
'item'][
'title'];
297 $ilDB = $DIC[
'ilDB'];
302 $this->imsmanifestFile = $this->packageFolder .
'/' .
'index.xml';
304 $this->imsmanifest->async =
false;
306 if (!@$this->imsmanifest->load($this->imsmanifestFile)) {
307 $this->diagnostic[] =
'XML not wellformed';
316 $sco_xml_file = $this->packageFolder .
'/sco.xml';
317 if (is_file($sco_xml_file)) {
319 $scodoc->async =
false;
320 if (!@$scodoc->load($sco_xml_file)) {
321 $this->diagnostic[] =
'XML of sco.xml not wellformed';
327 $nodes = $xpath->query(
"/sco/objective");
328 foreach (
$nodes as $node) {
329 $t_node = $node->firstChild;
330 if (is_object($t_node)) {
331 $objective_text = $t_node->textContent;
332 if (trim($objective_text) !=
"") {
333 $objs = $sco->getObjectives();
334 foreach ($objs as $o) {
335 $mappings = $o->getMappings();
336 if ($mappings == null) {
337 $ob =
new ilScorm2004Objective($sco->getId(), $o->getId());
338 $ob->setObjectiveID($objective_text);
339 $ob->updateObjective();
358 $ilDB = $DIC[
'ilDB'];
363 $this->imsmanifestFile = $this->packageFolder .
'/' .
'index.xml';
365 $this->imsmanifest->async =
false;
367 if (!@$this->imsmanifest->load($this->imsmanifestFile)) {
368 $this->diagnostic[] =
'XML not wellformed';
422 $ilDB = $DIC[
'ilDB'];
426 $this->packageId =
$slm->getId();
427 $this->imsmanifestFile = $this->packageFolder .
'/' .
'imsmanifest.xml';
429 $this->imsmanifest->async =
false;
430 $this->imsmanifest->formatOutput =
false;
431 $this->imsmanifest->preserveWhiteSpace =
false;
433 if (!@$this->imsmanifest->load($this->imsmanifestFile)) {
434 $this->diagnostic[] =
'XML not wellformed';
438 $this->mani_xpath =
new DOMXPath($this->imsmanifest);
439 $this->mani_xpath->registerNamespace(
"d",
"http://www.imsproject.org/xsd/imscp_rootv1p1p2");
440 $this->mani_xpath->registerNamespace(
"imscp",
"http://www.imsglobal.org/xsd/imscp_v1p1");
441 $this->mani_xpath->registerNamespace(
"imsss",
"http://www.imsglobal.org/xsd/imsss");
445 simplexml_import_dom($this->imsmanifest->documentElement),
461 include_once(
"./Modules/Glossary/classes/class.ilObjGlossary.php");
463 $newObj->setType(
'glo');
464 $newObj->setTitle(
'');
465 $newObj->create(
true);
466 $newObj->createReference();
467 $newObj->putInTree(
$_GET[
"ref_id"]);
468 $newObj->setPermissions(
$_GET[
"ref_id"]);
473 if (!is_file($xml_file)) {
477 include_once(
"./Modules/LearningModule/classes/class.ilContObjParser.php");
479 $contParser->startParsing();
482 $slm->setAssignedGlossary($newObj->getId());
486 public function dbImportLM($node, $parent_id =
"", $a_import_sequencing =
false)
488 switch ($node->getName()) {
490 $this->slm_tree =
new ilTree($this->slm->getId());
492 $this->slm_tree->setTableNames(
'sahs_sc13_tree',
'sahs_sc13_tree_node');
493 $this->slm_tree->addTree($this->slm->getId(), 1);
496 include_once(
"./Modules/Scorm2004/classes/seq_editor/class.ilSCORM2004Sequencing.php");
500 $r = $this->mani_xpath->query(
"/d:manifest/d:organizations/d:organization/imsss:sequencing");
501 $this->imsmanifest->formatOutput =
false;
504 if ($a_import_sequencing) {
505 $seq_info->initDom();
510 if (file_exists($this->packageFolder .
'/' .
'index.xml')) {
511 $doc = simplexml_load_file($this->packageFolder .
'/' .
'index.xml');
512 $l = $doc->xpath(
"/ContentObject/MetaData");
514 include_once
'Services/MetaData/classes/class.ilMDXMLCopier.php';
515 $mdxml =
new ilMDXMLCopier(
$l[0]->asXML(), $this->slm->getId(), $this->slm->getId(), $this->slm->getType());
517 $mdxml->getMDObject()->update();
522 $this->slm->title = $node->title;
525 $a = $node->attributes();
526 if (preg_match(
"/il_\d+_chap_\d+/", $a[
'identifier'])) {
528 $chap->setTitle($node->title);
529 $chap->setSLMId($this->slm->getId());
533 $r = $this->mani_xpath->query(
"//d:item[@identifier='" . $a[
'identifier'] .
"']/imsss:sequencing");
537 $seq_info->initDom();
542 $parent_id = $chap->getId();
543 $doc = simplexml_load_file($this->packageFolder .
'/' .
'index.xml');
544 $l = $doc->xpath(
"/ContentObject/StructureObject/MetaData[General/Identifier/@Entry='" . $a[
'identifier'] .
"']");
546 include_once
'Services/MetaData/classes/class.ilMDXMLCopier.php';
547 $mdxml =
new ilMDXMLCopier(
$l[0]->asXML(), $this->slm->getId(), $chap->getId(), $chap->getType());
549 $mdxml->getMDObject()->update();
552 if (preg_match(
"/il_\d+_sco_(\d+)/", $a[
'identifier'], $match)) {
554 $sco->setTitle($node->title);
555 $sco->setSLMId($this->slm->getId());
559 $r = $this->mani_xpath->query(
"//d:item[@identifier='" . $a[
'identifier'] .
"']/imsss:sequencing");
565 $a_import_sequencing,
566 "local_obj_" . $sco->getID() .
"_0" 568 $seq_info->initDom();
574 $newPack->il_importSco($this->slm->getId(), $sco->getId(), $this->packageFolder .
"/" . $match[1]);
575 $parent_id = $sco->getId();
577 if (preg_match(
"/il_\d+_ass_(\d+)/", $a[
'identifier'], $match)) {
579 $ass->setTitle($node->title);
580 $ass->setSLMId($this->slm->getId());
584 $r = $this->mani_xpath->query(
"//d:item[@identifier='" . $a[
'identifier'] .
"']/imsss:sequencing");
590 $a_import_sequencing,
591 "local_obj_" . $ass->getID() .
"_0" 593 $seq_info->initDom();
599 $newPack->il_importAss($this->slm->getId(), $ass->getId(), $this->packageFolder .
"/" . $match[1]);
600 $parent_id = $ass->getId();
607 foreach ($node->children() as $child) {
608 $this->
dbImportLM($child, $parent_id, $a_import_sequencing);
619 public function setSequencingInfo($a_node, $a_seq_info, $a_import_sequencing, $a_fix_obj_id =
"")
621 $seq_xml = trim(str_replace(
"imsss:",
"", $this->imsmanifest->saveXML($a_node)));
622 if ($seq_xml !=
"") {
623 $a_seq_info->setImportSeqXml(
'<?xml version="1.0"?>' . $seq_xml);
625 if ($a_import_sequencing) {
626 if ($a_fix_obj_id !=
"") {
627 $seq_xml = preg_replace(
"/local_obj_[0-9]*_0/", $a_fix_obj_id, $seq_xml);
629 $a_seq_info->setSeqXml(
'<?xml version="1.0"?>' . $seq_xml);
637 $this->diagnostic[] = $msg;
650 foreach ($node->attributes() as $k => $v) {
655 } elseif ($v ===
"false") {
657 } elseif (is_numeric($v)) {
662 foreach ($node->children() as
$name => $child) {
663 self::jsonNode($child, $sink[$name][]);
673 if ($f[
"type"] ==
'file' && substr($f[
"entry"], 0, 4) ==
'qti_') {
677 $result = $qtiParser->startParsing();
678 $founditems = &$qtiParser->getFoundItems();
680 foreach ($founditems as $qp) {
695 $qtiParser->setTestObject($newObj);
696 $result = $qtiParser->startParsing();
698 $qtis = array_merge($qtis, $qtiParser->getImportMapping());
703 include_once
'Modules/Scorm2004/classes/class.ilSCORM2004Page.php';
705 $l = $doc->xpath(
"/ContentObject/MetaData");
707 include_once
'Services/MetaData/classes/class.ilMDXMLCopier.php';
708 $mdxml =
new ilMDXMLCopier($l[0]->asXML(),
$slm->getId(), $sco->getId(), $sco->getType());
710 $mdxml->getMDObject()->update();
712 $l = $doc->xpath(
"/ContentObject/PageObject");
713 foreach ($l as $page_xml) {
714 $tnode = $page_xml->xpath(
'MetaData/General/Title');
716 $page->setTitle($tnode [0]);
717 $page->setSLMId(
$slm->getId());
721 $pmd = $page_xml->xpath(
"MetaData");
723 include_once
'Services/MetaData/classes/class.ilMDXMLCopier.php';
724 $mdxml =
new ilMDXMLCopier($pmd[0]->asXML(),
$slm->getId(), $page->getId(), $page->getType());
726 $mdxml->getMDObject()->update();
728 $tnode = $page_xml->xpath(
"//MediaObject/MediaAlias | //InteractiveImage/MediaAlias");
729 foreach ($tnode as $ttnode) {
730 include_once
'./Services/MediaObjects/classes/class.ilObjMediaObject.php';
731 $OriginId = $ttnode[
"OriginId"];
732 $medianodes = $doc->xpath(
"//MediaObject[MetaData/General/Identifier/@Entry='" . $OriginId .
"']");
733 $medianode = $medianodes[0];
736 $media_object->setTitle($medianode->MetaData->General->Title);
737 $media_object->setDescription($medianode->MetaData->General->Description);
738 $media_object->create(
false);
739 $mmd = $medianode->xpath(
"MetaData");
741 include_once
'Services/MetaData/classes/class.ilMDXMLCopier.php';
742 $mdxml =
new ilMDXMLCopier($mmd[0]->asXML(), 0, $media_object->getId(), $media_object->getType());
744 $mdxml->getMDObject()->update();
747 $media_object->createDirectory();
749 foreach ($medianode->MediaItem as $xMediaItem) {
751 $media_object->addMediaItem($media_item);
752 $media_item->setPurpose($xMediaItem[
"Purpose"]);
753 $media_item->setFormat($xMediaItem->Format);
754 $media_item->setLocation($xMediaItem->Location);
755 $media_item->setLocationType($xMediaItem->Location[
"Type"]);
756 $media_item->setWidth($xMediaItem->Layout[
"Width"]);
757 $media_item->setHeight($xMediaItem->Layout[
"Height"]);
758 $media_item->setHAlign($xMediaItem->Layout[
"HorizontalAlign"]);
759 $media_item->setCaption($xMediaItem->Caption);
760 $media_item->setTextRepresentation($xMediaItem->TextRepresentation);
764 foreach ($xMediaItem->MapArea as
$n => $v) {
765 if ($v->ExtLink[
"Href"] !=
"") {
769 $map_area->setShape($v[
"Shape"]);
770 $map_area->setCoords($v[
"Coords"]);
772 $map_area->setTitle($v->ExtLink);
773 $map_area->setHref($v->ExtLink[
"Href"]);
775 $media_item->addMapArea($map_area);
779 if ($media_item->getLocationType() ==
"LocalFile") {
786 ilUtil::rCopy($this->packageFolder .
"/objects/" . $OriginId, $mob_dir);
793 $media_object->update(
true);
794 $ttnode [
"OriginId"] =
"il__mob_" . $media_object->getId();
797 include_once(
"./Modules/File/classes/class.ilObjFile.php");
798 include_once(
"./Services/Utilities/classes/class.ilFileUtils.php");
799 include_once(
"./Services/MediaObjects/classes/class.ilObjMediaObject.php");
801 $intlinks = $page_xml->xpath(
"//IntLink");
805 foreach ($intlinks as $intlink) {
806 if ($intlink[
"Type"]!=
"File") {
809 $path = $this->packageFolder .
"/objects/" . str_replace(
'dfile',
'file', $intlink[
"Target"]);
810 if (!is_dir(
$path)) {
817 $fileObj->setType(
"file");
824 $fileObj->setFileSize(filesize(
$path .
"/" . $filename));
826 $fileObj->createReference();
829 $fileObj->createDirectory();
831 $intlink[
"Target"]=
"il__dfile_" . $fileObj->getId();
834 $fileitems = $page_xml->xpath(
"//FileItem/Identifier");
837 foreach ($fileitems as $fileitem) {
838 $path = $this->packageFolder .
"/objects/" . $fileitem[
"Entry"];
839 if (!is_dir(
$path)) {
846 $fileObj->setType(
"file");
853 $fileObj->setFileSize(filesize(
$path .
"/" . $filename));
855 $fileObj->createReference();
858 $fileObj->createDirectory();
860 $fileitem[
"Entry"]=
"il__file_" . $fileObj->getId();
866 $ddoc->async =
false;
867 $ddoc->preserveWhiteSpace =
false;
868 $ddoc->formatOutput =
false;
869 $ddoc->loadXML($page_xml->asXML());
871 $tnode = $xpath->query(
'PageContent');
873 foreach ($tnode as $ttnode) {
874 $t .= str_replace(
"&",
"&", $ddoc->saveXML($ttnode));
876 $t .=
"</PageObject>";
877 foreach ($qtis as $old => $q) {
878 $t = str_replace($old,
'il__qst_' . $q[
'pool'],
$t);
880 $pagex->setXMLContent(
$t);
881 $pagex->updateFromXML();
885 public function dbImport($node, &$lft = 1, $depth = 1, $parent = 0)
888 $ilDB = $DIC[
'ilDB'];
890 switch ($node->nodeType) {
891 case XML_DOCUMENT_NODE:
896 'SELECT * FROM cp_package WHERE obj_id = %s AND c_identifier = %s',
897 array(
'integer',
'text'),
898 array($this->packageId, $this->packageName)
901 $query =
'UPDATE cp_package ' 902 .
'SET persistprevattempts = %s, c_settings = %s ' 903 .
'WHERE obj_id = %s AND c_identifier= %s';
906 array(
'integer',
'text',
'integer',
'text'),
907 array(0, null, $this->packageId, $this->packageName)
910 $query =
'INSERT INTO cp_package (obj_id, c_identifier, persistprevattempts, c_settings) ' 911 .
'VALUES (%s, %s, %s, %s)';
914 array(
'integer',
'text',
'integer',
'text'),
915 array($this->packageId, $this->packageName, 0, null)
920 $this->
dbImport($node->documentElement);
923 case XML_ELEMENT_NODE:
924 if ($node->nodeName ===
'manifest') {
925 if ($node->getAttribute(
'uri') ==
"") {
927 $node->setAttribute(
'uri',
'md5:' . $this->packageHash);
931 $cp_node_id =
$ilDB->nextId(
'cp_node');
933 $query =
'INSERT INTO cp_node (cp_node_id, slm_id, nodename) ' 934 .
'VALUES (%s, %s, %s)';
937 array(
'integer',
'integer',
'text'),
938 array($cp_node_id, $this->packageId, $node->nodeName)
941 $query =
'INSERT INTO cp_tree (child, depth, lft, obj_id, parent, rgt) ' 942 .
'VALUES (%s, %s, %s, %s, %s, %s)';
945 array(
'integer',
'integer',
'integer',
'integer',
'integer',
'integer'),
946 array($cp_node_id, $depth, $lft++, $this->packageId, $parent, 0)
951 $names = array(
'cp_node_id');
953 $types = array(
'integer');
955 foreach ($node->attributes as $attr) {
956 switch (strtolower($attr->name)) {
957 case 'completionsetbycontent': $names[] =
'completionbycontent';
break;
958 case 'objectivesetbycontent': $names[] =
'objectivebycontent';
break;
959 case 'type': $names[] =
'c_type';
break;
960 case 'mode': $names[] =
'c_mode';
break;
961 case 'language': $names[] =
'c_language';
break;
962 case 'condition': $names[] =
'c_condition';
break;
963 case 'operator': $names[] =
'c_operator';
break;
964 case 'condition': $names[] =
'c_condition';
break;
965 case 'readnormalizedmeasure': $names[] =
'readnormalmeasure';
break;
966 case 'writenormalizedmeasure': $names[] =
'writenormalmeasure';
break;
967 case 'minnormalizedmeasure': $names[] =
'minnormalmeasure';
break;
968 case 'primary': $names[] =
'c_primary';
break;
969 case 'minnormalizedmeasure': $names[] =
'minnormalmeasure';
break;
970 case 'persistpreviousattempts': $names[] =
'persistprevattempts';
break;
971 case 'identifier': $names[] =
'c_identifier';
break;
972 case 'settings': $names[] =
'c_settings';
break;
973 case 'activityabsolutedurationlimit': $names[] =
'activityabsdurlimit';
break;
974 case 'activityexperienceddurationlimit': $names[] =
'activityexpdurlimit';
break;
975 case 'attemptabsolutedurationlimit': $names[] =
'attemptabsdurlimit';
break;
976 case 'measuresatisfactionifactive': $names[] =
'measuresatisfactive';
break;
977 case 'objectivemeasureweight': $names[] =
'objectivemeasweight';
break;
978 case 'requiredforcompleted': $names[] =
'requiredcompleted';
break;
979 case 'requiredforincomplete': $names[] =
'requiredincomplete';
break;
980 case 'requiredfornotsatisfied': $names[] =
'requirednotsatisfied';
break;
981 case 'rollupobjectivesatisfied': $names[] =
'rollupobjectivesatis';
break;
982 case 'rollupprogresscompletion': $names[] =
'rollupprogcompletion';
break;
983 case 'usecurrentattemptobjectiveinfo': $names[] =
'usecurattemptobjinfo';
break;
984 case 'usecurrentattemptprogressinfo': $names[] =
'usecurattemptproginfo';
break;
985 default: $names[] = strtolower($attr->name);
break;
989 $names[count($names) - 1],
990 array(
'flow',
'completionbycontent',
991 'objectivebycontent',
'rollupobjectivesatis',
993 'choiceexit',
'satisfiedbymeasure',
994 'c_primary',
'constrainchoice',
995 'forwardonly',
'global_to_system',
996 'writenormalmeasure',
'writesatisfiedstatus',
997 'readnormalmeasure',
'readsatisfiedstatus',
998 'preventactivation',
'measuresatisfactive',
999 'reorderchildren',
'usecurattemptproginfo',
1000 'usecurattemptobjinfo',
'rollupprogcompletion',
1001 'read_shared_data',
'write_shared_data',
1002 'shared_data_global_to_system',
'completedbymeasure')
1004 if ($attr->value ==
'true') {
1006 } elseif ($attr->value ==
'false') {
1009 $values[] = (int) $attr->value;
1016 $names[count($names) - 1],
1017 array(
'objectivesglobtosys',
'attemptlimit',
1018 'flow',
'completionbycontent',
1019 'objectivebycontent',
'rollupobjectivesatis',
1020 'tracked',
'choice',
1021 'choiceexit',
'satisfiedbymeasure',
1022 'c_primary',
'constrainchoice',
1023 'forwardonly',
'global_to_system',
1024 'writenormalmeasure',
'writesatisfiedstatus',
1025 'readnormalmeasure',
'readsatisfiedstatus',
1026 'preventactivation',
'measuresatisfactive',
1027 'reorderchildren',
'usecurattemptproginfo',
1028 'usecurattemptobjinfo',
'rollupprogcompletion',
1029 'read_shared_data',
'write_shared_data',
1030 'shared_data_global_to_system')
1032 $types[] =
'integer';
1034 $names[count($names) - 1],
1035 array(
'jsdata',
'xmldata',
'activitytree',
'data')
1039 $names[count($names) - 1],
1040 array(
'objectivemeasweight')
1048 if ($node->nodeName ===
'datamap') {
1049 $names[] =
'slm_id';
1051 $types[] =
'integer';
1053 $names[] =
'sco_node_id';
1055 $types[] =
'integer';
1059 $insert_data = array();
1060 foreach ($names as
$key => $db_field) {
1061 $insert_data[$db_field] = array($types[
$key], trim(
$values[$key]));
1063 $ilDB->insert(
'cp_' . strtolower($node->nodeName), $insert_data);
1065 $node->setAttribute(
'foreignId', $cp_node_id);
1066 $this->idmap[$node->getAttribute(
'id')] = $cp_node_id;
1069 foreach ($node->childNodes as $child) {
1070 $this->
dbImport($child, $lft, $depth + 1, $cp_node_id);
1074 $query =
'UPDATE cp_tree SET rgt = %s WHERE child = %s';
1077 array(
'integer',
'integer'),
1078 array($lft++, $cp_node_id)
1106 include_once(
"./Modules/Scorm2004/classes/class.ilSCORM2004DeleteData.php");
1109 include_once(
"./Services/Tracking/classes/class.ilLPStatusWrapper.php");
1116 $ilDB = $DIC[
'ilDB'];
1120 $cp_nodes = array();
1123 'SELECT cp_node.cp_node_id FROM cp_node WHERE cp_node.slm_id = %s',
1125 array($this->packageId)
1128 $cp_nodes[] =
$data[
'cp_node_id'];
1132 foreach (self::$elements[
'cp'] as
$t) {
1135 $in =
$ilDB->in(strtolower($t) .
'.cp_node_id', $cp_nodes,
false,
'integer');
1136 $ilDB->manipulate(
'DELETE FROM ' . strtolower($t) .
' WHERE ' .
$in);
1141 'DELETE FROM cp_tree WHERE cp_tree.obj_id = %s',
1143 array($this->packageId)
1147 'DELETE FROM cp_node WHERE cp_node.slm_id = %s',
1149 array($this->packageId)
1154 'DELETE FROM cp_package WHERE cp_package.obj_id = %s',
1156 array($this->packageId)
1167 public function transform($inputdoc, $xslfile, $outputpath = null)
1170 $xsl->async =
false;
1171 if (!@$xsl->load($xslfile)) {
1172 die(
'ERROR: load StyleSheet ' . $xslfile);
1174 $prc =
new XSLTProcessor;
1175 $prc->registerPHPFunctions();
1176 $r = @$prc->importStyleSheet($xsl);
1177 if (
false === @$prc->importStyleSheet($xsl)) {
1178 die(
'ERROR: importStyleSheet ' . $xslfile);
1181 file_put_contents($outputpath, $prc->transformToXML($inputdoc));
1183 return $prc->transformToDoc($inputdoc);
1189 libxml_use_internal_errors(
true);
1190 $return = @$doc->schemaValidate($schema);
1193 LIBXML_ERR_ERROR =>
'Error',
1194 LIBXML_ERR_FATAL =>
'Fatal Error' 1196 foreach (libxml_get_errors() as $error) {
1197 $level = $levels[$error->level];
1198 if (isset($level)) {
1200 $this->diagnostic[] =
"XSLT $level (Line $error->line) $message";
1203 libxml_clear_errors();
1205 libxml_use_internal_errors(
false);
1212 include_once(
"./Modules/Scorm2004/classes/class.ilSCORM2004DeleteData.php");
Class ilSCORM2004PageNode.
dbImportSco($slm, $sco, $asset=false)
static putInTree($a_obj, $a_parent_id="", $a_target_node_id="")
put this object into content object tree
dbImportLM($node, $parent_id="", $a_import_sequencing=false)
transform($inputdoc, $xslfile, $outputpath=null)
jsonNode($node, &$sink)
Helper for UploadAndImport Recursively copies values from XML into PHP array for export as json Eleme...
dbImport($node, &$lft=1, $depth=1, $parent=0)
static rCopy($a_sdir, $a_tdir, $preserveTimeAttributes=false)
Copies content of a directory $a_sdir recursively to a directory $a_tdir.
startParsing()
stores xml data in array
removeCMIData()
add new sahs and package record NOT USED
il_import($packageFolder, $packageId, $ilias, $validate, $reimport=false)
Imports an extracted SCORM 2004 module from ilias-data dir into database.
SCORM 13 Metadata importer.
static getDir($a_dir, $a_rec=false, $a_sub_dir="")
get directory
Class ilSCORM2004Chapter.
static _refreshStatus($a_obj_id, $a_users=null)
Set dirty.
setSequencingInfo($a_node, $a_seq_info, $a_import_sequencing, $a_fix_obj_id="")
Save sequencing ingo.
catch(Exception $e) $message
exportXML()
Export as internal XML.
foreach($_POST as $key=> $value) $res
il_importAss($packageId, $sco_id, $packageFolder)
Imports an extracted SCORM 2004 module from ilias-data dir into database.
setProgress($progress, $msg='')
static removeCMIDataForUser($user_id)
static _removeTrackingDataForUser($user_id)
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
il_importLM($slm, $packageFolder, $a_import_sequencing=false)
Class ilSCORM2004Sequencing.
Tree class data representation in hierachical trees using the Nested Set Model with Gaps by Joe Celco...
static _lookupType($a_id, $a_reference=false)
lookup object type
setTreeTablePK($a_column_name)
set column containing primary key in tree table public
static _writeDescription($a_obj_id, $a_desc)
write description to db (static)
if(php_sapi_name() !='cli') $in
static utf8_encode($string)
utf8-encodes string if it is not a valid utf8-string.
static renameExecutables($a_dir)
Rename uploaded executables for security reasons.
Class ilObjSCORM2004LearningModule.
__construct($packageId=null)
il_importSco($packageId, $sco_id, $packageFolder)
Imports an extracted SCORM 2004 module from ilias-data dir into database.
static recursive_dirscan($dir, &$arr)
Recursively scans a given directory and writes path and filename into referenced array.
static removeCMIDataForPackage($packageId)
for($i=6; $i< 13; $i++) for($i=1; $i< 13; $i++) $d
importGlossary($slm, $packageFolder)