ILIAS  release_7 Revision v7.30-3-g800a261c036
ilSCORM13Package Class Reference
+ Collaboration diagram for ilSCORM13Package:

Public Member Functions

 __construct ($packageId=null)
 
 load ($packageId)
 
 rollback ()
 
 exportXML ()
 Export as internal XML. More...
 
 il_import ($packageFolder, $packageId, $ilias, $validate, $reimport=false)
 Imports an extracted SCORM 2004 module from ilias-data dir into database. More...
 
 il_importSco ($packageId, $sco_id, $packageFolder)
 Imports an extracted SCORM 2004 module from ilias-data dir into database. More...
 
 il_importAss ($packageId, $sco_id, $packageFolder)
 Imports an extracted SCORM 2004 module from ilias-data dir into database. More...
 
 il_importLM ($slm, $packageFolder, $a_import_sequencing=false)
 
 importGlossary ($slm, $packageFolder)
 
 dbImportLM ($node, $parent_id="", $a_import_sequencing=false)
 
 setSequencingInfo ($a_node, $a_seq_info, $a_import_sequencing, $a_fix_obj_id="")
 Save sequencing ingo. More...
 
 jsonNode ($node, &$sink)
 Helper for UploadAndImport Recursively copies values from XML into PHP array for export as json Elements are translated into sub array, attributes into literals. More...
 
 dbImportSco ($slm, $sco, $asset=false)
 
 dbImport ($node, &$lft=1, $depth=1, $parent=0)
 
 removeCMIData ()
 
 removeCPData ()
 
 dbRemoveAll ()
 
 transform ($inputdoc, $xslfile, $outputpath=null)
 
 validate ($doc, $schema)
 

Static Public Member Functions

static _removeTrackingDataForUser ($user_id)
 

Data Fields

const DB_ENCODE_XSL = './Modules/Scorm2004/templates/xsl/op/op-scorm13.xsl'
 
const CONVERT_XSL = './Modules/Scorm2004/templates/xsl/op/scorm12To2004.xsl'
 
const DB_DECODE_XSL = './Modules/Scorm2004/templates/xsl/op/op-scorm13-revert.xsl'
 
const VALIDATE_XSD = './libs/ilias/Scorm2004/xsd/op/op-scorm13.xsd'
 
const WRAPPER_HTML = './Modules/Scorm2004/scripts/converter/GenericRunTimeWrapper1.0_aadlc/GenericRunTimeWrapper.htm'
 
const WRAPPER_JS = './Modules/Scorm2004/scripts/converter/GenericRunTimeWrapper1.0_aadlc/SCOPlayerWrapper.js'
 
 $imsmanifest
 
 $manifest
 
 $diagnostic
 
 $status
 
 $packageId
 
 $packageName
 
 $packageHash
 
 $userId
 

Private Member Functions

 setProgress ($progress, $msg='')
 

Private Attributes

 $packageFile
 
 $packageFolder
 
 $packagesFolder
 
 $packageData
 
 $slm
 
 $slm_tree
 
 $idmap = array()
 
 $progress = 0.0
 

Static Private Attributes

static $elements
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

ilSCORM13Package::__construct (   $packageId = null)

Definition at line 73 of file ilSCORM13Package.php.

74 {
75 $this->packagesFolder = ''; // #25372
76 $this->load($packageId);
77 // $this->userId = $GLOBALS['DIC']['USER']['usr_id'];
78 }

References $packageId, and load().

+ Here is the call graph for this function:

Member Function Documentation

◆ _removeTrackingDataForUser()

static ilSCORM13Package::_removeTrackingDataForUser (   $user_id)
static

Definition at line 1193 of file ilSCORM13Package.php.

1194 {
1195 include_once("./Modules/Scorm2004/classes/class.ilSCORM2004DeleteData.php");
1197 //missing updatestatus
1198 }

References ilSCORM2004DeleteData\removeCMIDataForUser().

Referenced by ilObjUser\delete().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ dbImport()

ilSCORM13Package::dbImport (   $node,
$lft = 1,
  $depth = 1,
  $parent = 0 
)

Definition at line 886 of file ilSCORM13Package.php.

887 {
888 global $DIC;
889 $ilDB = $DIC['ilDB'];
890
891 switch ($node->nodeType) {
892 case XML_DOCUMENT_NODE:
893
894 // insert into cp_package
895
896 $res = $ilDB->queryF(
897 'SELECT * FROM cp_package WHERE obj_id = %s AND c_identifier = %s',
898 array('integer', 'text'),
899 array($this->packageId, $this->packageName)
900 );
901 if ($num_rows = $ilDB->numRows($res)) {
902 $query = 'UPDATE cp_package '
903 . 'SET persistprevattempts = %s, c_settings = %s '
904 . 'WHERE obj_id = %s AND c_identifier= %s';
905 $ilDB->manipulateF(
906 $query,
907 array('integer', 'text', 'integer', 'text'),
908 array(0, null, $this->packageId, $this->packageName)
909 );
910 } else {
911 $query = 'INSERT INTO cp_package (obj_id, c_identifier, persistprevattempts, c_settings) '
912 . 'VALUES (%s, %s, %s, %s)';
913 $ilDB->manipulateF(
914 $query,
915 array('integer','text','integer', 'text'),
916 array($this->packageId, $this->packageName, 0, null)
917 );
918 }
919
920 // run sub nodes
921 $this->dbImport($node->documentElement); // RECURSION
922 break;
923
924 case XML_ELEMENT_NODE:
925 if ($node->nodeName === 'manifest') {
926 if ($node->getAttribute('uri') == "") {
927 // default URI is md5 hash of zip file, i.e. packageHash
928 $node->setAttribute('uri', 'md5:' . $this->packageHash);
929 }
930 }
931
932 $cp_node_id = $ilDB->nextId('cp_node');
933
934 $query = 'INSERT INTO cp_node (cp_node_id, slm_id, nodename) '
935 . 'VALUES (%s, %s, %s)';
936 $ilDB->manipulateF(
937 $query,
938 array('integer', 'integer', 'text'),
939 array($cp_node_id, $this->packageId, $node->nodeName)
940 );
941
942 $query = 'INSERT INTO cp_tree (child, depth, lft, obj_id, parent, rgt) '
943 . 'VALUES (%s, %s, %s, %s, %s, %s)';
944 $ilDB->manipulateF(
945 $query,
946 array('integer', 'integer', 'integer', 'integer', 'integer', 'integer'),
947 array($cp_node_id, $depth, $lft++, $this->packageId, $parent, 0)
948 );
949
950 // insert into cp_*
951 //$a = array('cp_node_id' => $cp_node_id);
952 $names = array('cp_node_id');
953 $values = array($cp_node_id);
954 $types = array('integer');
955
956 foreach ($node->attributes as $attr) {
957 switch (strtolower($attr->name)) {
958 case 'completionsetbycontent': $names[] = 'completionbycontent';break;
959 case 'objectivesetbycontent': $names[] = 'objectivebycontent';break;
960 case 'type': $names[] = 'c_type';break;
961 case 'mode': $names[] = 'c_mode';break;
962 case 'language': $names[] = 'c_language';break;
963 case 'condition': $names[] = 'c_condition';break;
964 case 'operator': $names[] = 'c_operator';break;
965 case 'condition': $names[] = 'c_condition';break;
966 case 'readnormalizedmeasure': $names[] = 'readnormalmeasure';break;
967 case 'writenormalizedmeasure': $names[] = 'writenormalmeasure';break;
968 case 'minnormalizedmeasure': $names[] = 'minnormalmeasure';break;
969 case 'primary': $names[] = 'c_primary';break;
970 case 'minnormalizedmeasure': $names[] = 'minnormalmeasure';break;
971 case 'persistpreviousattempts': $names[] = 'persistprevattempts';break;
972 case 'identifier': $names[] = 'c_identifier';break;
973 case 'settings': $names[] = 'c_settings';break;
974 case 'activityabsolutedurationlimit': $names[] = 'activityabsdurlimit';break;
975 case 'activityexperienceddurationlimit': $names[] = 'activityexpdurlimit';break;
976 case 'attemptabsolutedurationlimit': $names[] = 'attemptabsdurlimit';break;
977 case 'measuresatisfactionifactive': $names[] = 'measuresatisfactive';break;
978 case 'objectivemeasureweight': $names[] = 'objectivemeasweight';break;
979 case 'requiredforcompleted': $names[] = 'requiredcompleted';break;
980 case 'requiredforincomplete': $names[] = 'requiredincomplete';break;
981 case 'requiredfornotsatisfied': $names[] = 'requirednotsatisfied';break;
982 case 'rollupobjectivesatisfied': $names[] = 'rollupobjectivesatis';break;
983 case 'rollupprogresscompletion': $names[] = 'rollupprogcompletion';break;
984 case 'usecurrentattemptobjectiveinfo': $names[] = 'usecurattemptobjinfo';break;
985 case 'usecurrentattemptprogressinfo': $names[] = 'usecurattemptproginfo';break;
986 default: $names[] = strtolower($attr->name);break;
987 }
988
989 if (in_array(
990 $names[count($names) - 1],
991 array('flow', 'completionbycontent',
992 'objectivebycontent', 'rollupobjectivesatis',
993 'tracked', 'choice',
994 'choiceexit', 'satisfiedbymeasure',
995 'c_primary', 'constrainchoice',
996 'forwardonly', 'global_to_system',
997 'writenormalmeasure', 'writesatisfiedstatus',
998 'readnormalmeasure', 'readsatisfiedstatus',
999 'preventactivation', 'measuresatisfactive',
1000 'reorderchildren', 'usecurattemptproginfo',
1001 'usecurattemptobjinfo', 'rollupprogcompletion',
1002 'read_shared_data', 'write_shared_data',
1003 'shared_data_global_to_system', 'completedbymeasure')
1004 )) {
1005 if ($attr->value == 'true') {
1006 $values[] = 1;
1007 } elseif ($attr->value == 'false') {
1008 $values[] = 0;
1009 } else {
1010 $values[] = (int) $attr->value;
1011 }
1012 } else {
1013 $values[] = $attr->value;
1014 }
1015
1016 if (in_array(
1017 $names[count($names) - 1],
1018 array('objectivesglobtosys', 'attemptlimit',
1019 'flow', 'completionbycontent',
1020 'objectivebycontent', 'rollupobjectivesatis',
1021 'tracked', 'choice',
1022 'choiceexit', 'satisfiedbymeasure',
1023 'c_primary', 'constrainchoice',
1024 'forwardonly', 'global_to_system',
1025 'writenormalmeasure', 'writesatisfiedstatus',
1026 'readnormalmeasure', 'readsatisfiedstatus',
1027 'preventactivation', 'measuresatisfactive',
1028 'reorderchildren', 'usecurattemptproginfo',
1029 'usecurattemptobjinfo', 'rollupprogcompletion',
1030 'read_shared_data', 'write_shared_data',
1031 'shared_data_global_to_system')
1032 )) {
1033 $types[] = 'integer';
1034 } elseif (in_array(
1035 $names[count($names) - 1],
1036 array('jsdata', 'xmldata', 'activitytree', 'data')
1037 )) {
1038 $types[] = 'clob';
1039 } elseif (in_array(
1040 $names[count($names) - 1],
1041 array('objectivemeasweight')
1042 )) {
1043 $types[] = 'float';
1044 } else {
1045 $types[] = 'text';
1046 }
1047 }
1048
1049 if ($node->nodeName === 'datamap') {
1050 $names[] = 'slm_id';
1051 $values[] = $this->packageId;
1052 $types[] = 'integer';
1053
1054 $names[] = 'sco_node_id';
1055 $values[] = $parent;
1056 $types[] = 'integer';
1057 }
1058
1059 // we have to change the insert method because of clob fields ($ilDB->manipulate does not work here)
1060 $insert_data = array();
1061 foreach ($names as $key => $db_field) {
1062 $insert_data[$db_field] = array($types[$key], trim($values[$key]));
1063 }
1064 $ilDB->insert('cp_' . strtolower($node->nodeName), $insert_data);
1065
1066 $node->setAttribute('foreignId', $cp_node_id);
1067 $this->idmap[$node->getAttribute('id')] = $cp_node_id;
1068
1069 // run sub nodes
1070 foreach ($node->childNodes as $child) {
1071 $this->dbImport($child, $lft, $depth + 1, $cp_node_id); // RECURSION
1072 }
1073
1074 // update cp_tree (rgt value for pre order walk in sql tree)
1075 $query = 'UPDATE cp_tree SET rgt = %s WHERE child = %s';
1076 $ilDB->manipulateF(
1077 $query,
1078 array('integer', 'integer'),
1079 array($lft++, $cp_node_id)
1080 );
1081
1082 break;
1083 }
1084 }
dbImport($node, &$lft=1, $depth=1, $parent=0)
global $DIC
Definition: goto.php:24
$query
foreach($_POST as $key=> $value) $res
global $ilDB

References $DIC, $ilDB, $packageId, $query, $res, and dbImport().

Referenced by dbImport(), and il_import().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ dbImportLM()

ilSCORM13Package::dbImportLM (   $node,
  $parent_id = "",
  $a_import_sequencing = false 
)

Definition at line 489 of file ilSCORM13Package.php.

490 {
491 switch ($node->getName()) {
492 case "manifest":
493 $this->slm_tree = new ilTree($this->slm->getId());
494 $this->slm_tree->setTreeTablePK("slm_id");
495 $this->slm_tree->setTableNames('sahs_sc13_tree', 'sahs_sc13_tree_node');
496 $this->slm_tree->addTree($this->slm->getId(), 1);
497
498 //add seqinfo for rootNode
499 include_once("./Modules/Scorm2004/classes/seq_editor/class.ilSCORM2004Sequencing.php");
500 $seq_info = new ilSCORM2004Sequencing($this->slm->getId(), true);
501
502 // get original sequencing information
503 $r = $this->mani_xpath->query("/d:manifest/d:organizations/d:organization/imsss:sequencing");
504 $this->imsmanifest->formatOutput = false;
505 if ($r) {
506 $this->setSequencingInfo($r->item(0), $seq_info, $a_import_sequencing);
507 if ($a_import_sequencing) {
508 $seq_info->initDom();
509 }
510 }
511 $seq_info->insert();
512
513 if (file_exists($this->packageFolder . '/' . 'index.xml')) {
514 $doc = simplexml_load_file($this->packageFolder . '/' . 'index.xml');
515 $l = $doc->xpath("/ContentObject/MetaData");
516 if ($l[0]) {
517 include_once 'Services/MetaData/classes/class.ilMDXMLCopier.php';
518 $mdxml = new ilMDXMLCopier($l[0]->asXML(), $this->slm->getId(), $this->slm->getId(), $this->slm->getType());
519 $mdxml->startParsing();
520 $mdxml->getMDObject()->update();
521 }
522 }
523 break;
524 case "organization":
525 $this->slm->title = $node->title;
526 break;
527 case "item":
528 $a = $node->attributes();
529 if (preg_match("/il_\d+_chap_\d+/", $a['identifier'])) {
530 $chap = new ilSCORM2004Chapter($this->slm);
531 $chap->setTitle($node->title);
532 $chap->setSLMId($this->slm->getId());
533 $chap->create(true);
534
535 // save sequencing information
536 $r = $this->mani_xpath->query("//d:item[@identifier='" . $a['identifier'] . "']/imsss:sequencing");
537 if ($r) {
538 $seq_info = new ilSCORM2004Sequencing($chap->getId());
539 $this->setSequencingInfo($r->item(0), $seq_info, $a_import_sequencing);
540 $seq_info->initDom();
541 $seq_info->insert();
542 }
543
544 ilSCORM2004Node::putInTree($chap, $parent_id, "");
545 $parent_id = $chap->getId();
546 $doc = simplexml_load_file($this->packageFolder . '/' . 'index.xml');
547 $l = $doc->xpath("/ContentObject/StructureObject/MetaData[General/Identifier/@Entry='" . $a['identifier'] . "']");
548 if ($l[0]) {
549 include_once 'Services/MetaData/classes/class.ilMDXMLCopier.php';
550 $mdxml = new ilMDXMLCopier($l[0]->asXML(), $this->slm->getId(), $chap->getId(), $chap->getType());
551 $mdxml->startParsing();
552 $mdxml->getMDObject()->update();
553 }
554 }
555 if (preg_match("/il_\d+_sco_(\d+)/", $a['identifier'], $match)) {
556 $sco = new ilSCORM2004Sco($this->slm);
557 $sco->setTitle($node->title);
558 $sco->setSLMId($this->slm->getId());
559 $sco->create(true);
560
561 // save sequencing information
562 $r = $this->mani_xpath->query("//d:item[@identifier='" . $a['identifier'] . "']/imsss:sequencing");
563 if ($r) {
564 $seq_info = new ilSCORM2004Sequencing($sco->getId());
565 $this->setSequencingInfo(
566 $r->item(0),
567 $seq_info,
568 $a_import_sequencing,
569 "local_obj_" . $sco->getID() . "_0"
570 );
571 $seq_info->initDom();
572 $seq_info->insert();
573 }
574
575 ilSCORM2004Node::putInTree($sco, $parent_id, "");
576 $newPack = new ilSCORM13Package();
577 $newPack->il_importSco($this->slm->getId(), $sco->getId(), $this->packageFolder . "/" . $match[1]);
578 $parent_id = $sco->getId();
579 }
580 if (preg_match("/il_\d+_ass_(\d+)/", $a['identifier'], $match)) {
581 $ass = new ilSCORM2004Asset($this->slm);
582 $ass->setTitle($node->title);
583 $ass->setSLMId($this->slm->getId());
584 $ass->create(true);
585
586 // save sequencing information
587 $r = $this->mani_xpath->query("//d:item[@identifier='" . $a['identifier'] . "']/imsss:sequencing");
588 if ($r) {
589 $seq_info = new ilSCORM2004Sequencing($ass->getId());
590 $this->setSequencingInfo(
591 $r->item(0),
592 $seq_info,
593 $a_import_sequencing,
594 "local_obj_" . $ass->getID() . "_0"
595 );
596 $seq_info->initDom();
597 $seq_info->insert();
598 }
599
600 ilSCORM2004Node::putInTree($ass, $parent_id, "");
601 $newPack = new ilSCORM13Package();
602 $newPack->il_importAss($this->slm->getId(), $ass->getId(), $this->packageFolder . "/" . $match[1]);
603 $parent_id = $ass->getId();
604 }
605
606 break;
607 }
608 //if($node->nodeType==XML_ELEMENT_NODE)
609 {
610 foreach ($node->children() as $child) {
611 $this->dbImportLM($child, $parent_id, $a_import_sequencing);
612 }
613 }
614 }
setSequencingInfo($a_node, $a_seq_info, $a_import_sequencing, $a_fix_obj_id="")
Save sequencing ingo.
dbImportLM($node, $parent_id="", $a_import_sequencing=false)
Class ilSCORM2004Asset.
Class ilSCORM2004Chapter.
static putInTree($a_obj, $a_parent_id="", $a_target_node_id="")
put this object into content object tree
Class ilSCORM2004Sco.
Class ilSCORM2004Sequencing.
Tree class data representation in hierachical trees using the Nested Set Model with Gaps by Joe Celco...
$a
thx to https://mlocati.github.io/php-cs-fixer-configurator for the examples

References Vendor\Package\$a, dbImportLM(), ilSCORM2004Node\putInTree(), and setSequencingInfo().

Referenced by dbImportLM(), and il_importLM().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ dbImportSco()

ilSCORM13Package::dbImportSco (   $slm,
  $sco,
  $asset = false 
)

Definition at line 670 of file ilSCORM13Package.php.

671 {
672 $qtis = array();
673 $d = ilUtil::getDir($this->packageFolder);
674 foreach ($d as $f) {
675 //continue;
676 if ($f["type"] == 'file' && substr($f["entry"], 0, 4) == 'qti_') {
677 $qtiParser = new ilQTIParser($this->packageFolder . "/" . $f["entry"], IL_MO_VERIFY_QTI, 0, "");
678 $result = $qtiParser->startParsing();
679 $founditems = &$qtiParser->getFoundItems();
680 // die(print_r($founditems));
681 foreach ($founditems as $qp) {
682 $newObj = new ilObjTest(0, true);
683
684 // This creates a lot of invalid repository objects for each question
685 // question are not repository objects (see e.g. table object_data), alex 29 Sep 2009
686
687 // $newObj->setType ( $qp ['type'] );
688 // $newObj->setTitle ( $qp ['title'] );
689 // $newObj->create ( true );
690 // $newObj->createReference ();
691 // $newObj->putInTree ($_GET ["ref_id"]);
692 // $newObj->setPermissions ( $sco->getId ());
693 // $newObj->notify ("new", $_GET["ref_id"], $sco->getId (), $_GET["ref_id"], $newObj->getRefId () );
694 // $newObj->mark_schema->flush ();
695 $qtiParser = new ilQTIParser($this->packageFolder . "/" . $f["entry"], IL_MO_PARSE_QTI, 0, "");
696 $qtiParser->setTestObject($newObj);
697 $result = $qtiParser->startParsing();
698 // $newObj->saveToDb ();
699 $qtis = array_merge($qtis, $qtiParser->getImportMapping());
700 }
701 }
702 }
703 //exit;
704 include_once 'Modules/Scorm2004/classes/class.ilSCORM2004Page.php';
705 $doc = new SimpleXMLElement($this->imsmanifest->saveXml());
706 $l = $doc->xpath("/ContentObject/MetaData");
707 if ($l[0]) {
708 include_once 'Services/MetaData/classes/class.ilMDXMLCopier.php';
709 $mdxml = new ilMDXMLCopier($l[0]->asXML(), $slm->getId(), $sco->getId(), $sco->getType());
710 $mdxml->startParsing();
711 $mdxml->getMDObject()->update();
712 }
713 $l = $doc->xpath("/ContentObject/PageObject");
714 foreach ($l as $page_xml) {
715 $tnode = $page_xml->xpath('MetaData/General/Title');
716 $page = new ilSCORM2004PageNode($slm);
717 $page->setTitle($tnode [0]);
718 $page->setSLMId($slm->getId());
719 $page->create(true);
720 // ilSCORM2004Node::putInTree ( $page, $sco->getId (), $target );
721 ilSCORM2004Node::putInTree($page, $sco->getId(), "");
722 $pmd = $page_xml->xpath("MetaData");
723 if ($pmd[0]) {
724 include_once 'Services/MetaData/classes/class.ilMDXMLCopier.php';
725 $mdxml = new ilMDXMLCopier($pmd[0]->asXML(), $slm->getId(), $page->getId(), $page->getType());
726 $mdxml->startParsing();
727 $mdxml->getMDObject()->update();
728 }
729 $tnode = $page_xml->xpath("//MediaObject/MediaAlias | //InteractiveImage/MediaAlias");
730 foreach ($tnode as $ttnode) {
731 include_once './Services/MediaObjects/classes/class.ilObjMediaObject.php';
732 $OriginId = $ttnode["OriginId"];
733 $medianodes = $doc->xpath("//MediaObject[MetaData/General/Identifier/@Entry='" . $OriginId . "']");
734 $medianode = $medianodes[0];
735 if ($medianode) {
736 $media_object = new ilObjMediaObject();
737 $media_object->setTitle($medianode->MetaData->General->Title);
738 $media_object->setDescription($medianode->MetaData->General->Description);
739 $media_object->create(false);
740 $mmd = $medianode->xpath("MetaData");
741 if ($mmd[0]) {
742 include_once 'Services/MetaData/classes/class.ilMDXMLCopier.php';
743 $mdxml = new ilMDXMLCopier($mmd[0]->asXML(), 0, $media_object->getId(), $media_object->getType());
744 $mdxml->startParsing();
745 $mdxml->getMDObject()->update();
746 }
747 // determine and create mob directory, move uploaded file to directory
748 $media_object->createDirectory();
749 $mob_dir = ilObjMediaObject::_getDirectory($media_object->getId());
750 foreach ($medianode->MediaItem as $xMediaItem) {
751 $media_item = new ilMediaItem();
752 $media_object->addMediaItem($media_item);
753 $media_item->setPurpose($xMediaItem["Purpose"]);
754 $media_item->setFormat($xMediaItem->Format);
755 $media_item->setLocation($xMediaItem->Location);
756 $media_item->setLocationType($xMediaItem->Location["Type"]);
757 $media_item->setWidth($xMediaItem->Layout["Width"]);
758 $media_item->setHeight($xMediaItem->Layout["Height"]);
759 $media_item->setHAlign($xMediaItem->Layout["HorizontalAlign"]);
760 $media_item->setCaption($xMediaItem->Caption);
761 $media_item->setTextRepresentation($xMediaItem->TextRepresentation);
762 $nr = 0;
763
764 // add map areas (external links only)
765 foreach ($xMediaItem->MapArea as $n => $v) {
766 if ($v->ExtLink["Href"] != "") {
767 $ma = new ilMapArea();
768
769 $map_area = new ilMapArea();
770 $map_area->setShape($v["Shape"]);
771 $map_area->setCoords($v["Coords"]);
772 $map_area->setLinkType(IL_EXT_LINK);
773 $map_area->setTitle($v->ExtLink);
774 $map_area->setHref($v->ExtLink["Href"]);
775
776 $media_item->addMapArea($map_area);
777 }
778 }
779
780 if ($media_item->getLocationType() == "LocalFile") {
781 // $tmp_name = $this->packageFolder."/objects/".$OriginId."/".$xMediaItem->Location;
782// copy($tmp_name, $mob_dir."/".$xMediaItem->Location);
783 }
784 }
785
786 // copy whole directory
787 ilUtil::rCopy($this->packageFolder . "/objects/" . $OriginId, $mob_dir);
788
789
790 // alex: fixed media import: these lines have been
791 // behind the next curly bracket which makes it fail
792 // when no medianode is given. (id=0 -> fatal error)
794 $media_object->update(true);
795 $ttnode ["OriginId"] = "il__mob_" . $media_object->getId();
796 }
797 }
798 include_once("./Modules/File/classes/class.ilObjFile.php");
799 include_once("./Services/Utilities/classes/class.ilFileUtils.php");
800 include_once("./Services/MediaObjects/classes/class.ilObjMediaObject.php");
801
802 $intlinks = $page_xml->xpath("//IntLink");
803 //die($intlinks);
804 //if($intlinks )
805 {
806 foreach ($intlinks as $intlink) {
807 if ($intlink["Type"] != "File") {
808 continue;
809 }
810 $path = $this->packageFolder . "/objects/" . str_replace('dfile', 'file', $intlink["Target"]);
811 if (!is_dir($path)) {
812 continue;
813 }
814 $ffiles = array();
815 ilFileUtils::recursive_dirscan($path, $ffiles);
816 $filename = $ffiles["file"][0];
817 $fileObj = new ilObjFile();
818 $fileObj->setType("file");
821
822 // better use this, mime_content_type is deprecated
823 $fileObj->setFileType(ilObjMediaObject::getMimeType($path . "/" . $filename));
824
825 $fileObj->setFileSize(filesize($path . "/" . $filename));
826 $fileObj->create();
827 $fileObj->createReference();
828 //$fileObj->putInTree($_GET["ref_id"]);
829 //$fileObj->setPermissions($slm->getId ());
830 $fileObj->createDirectory();
831 $fileObj->storeUnzipedFile($path . "/" . $filename, ilFileUtils::utf8_encode(ilUtil::stripSlashes($filename)));
832 $intlink["Target"] = "il__dfile_" . $fileObj->getId();
833 }
834 }
835 $fileitems = $page_xml->xpath("//FileItem/Identifier");
836 //if($intlinks )
837 {
838 foreach ($fileitems as $fileitem) {
839 $path = $this->packageFolder . "/objects/" . $fileitem["Entry"];
840 if (!is_dir($path)) {
841 continue;
842 }
843 $ffiles = array();
844 ilFileUtils::recursive_dirscan($path, $ffiles);
845 $filename = $ffiles["file"][0];
846 $fileObj = new ilObjFile();
847 $fileObj->setType("file");
850
851 // better use this, mime_content_type is deprecated
852 $fileObj->setFileType(ilObjMediaObject::getMimeType($path . "/" . $filename));
853
854 $fileObj->setFileSize(filesize($path . "/" . $filename));
855 $fileObj->create();
856 $fileObj->createReference();
857 //$fileObj->putInTree($_GET["ref_id"]);
858 //$fileObj->setPermissions($slm->getId ());
859 $fileObj->createDirectory();
860 $fileObj->storeUnzipedFile($path . "/" . $filename, ilFileUtils::utf8_encode(ilUtil::stripSlashes($filename)));
861 $fileitem["Entry"] = "il__file_" . $fileObj->getId();
862 }
863 }
864 $pagex = new ilSCORM2004Page($page->getId());
865
866 $ddoc = new DOMDocument();
867 $ddoc->async = false;
868 $ddoc->preserveWhiteSpace = false;
869 $ddoc->formatOutput = false;
870 $ddoc->loadXML($page_xml->asXML());
871 $xpath = new DOMXPath($ddoc);
872 $tnode = $xpath->query('PageContent');
873 $t = "<PageObject>";
874 foreach ($tnode as $ttnode) {
875 $t .= str_replace("&amp;", "&", $ddoc->saveXML($ttnode));
876 }
877 $t .= "</PageObject>";
878 foreach ($qtis as $old => $q) {
879 $t = str_replace($old, 'il__qst_' . $q['pool'], $t);
880 }
881 $pagex->setXMLContent($t);
882 $pagex->updateFromXML();
883 }
884 }
$result
$n
Definition: RandomTest.php:85
$filename
Definition: buildRTE.php:89
const IL_EXT_LINK
const IL_MO_VERIFY_QTI
const IL_MO_PARSE_QTI
static utf8_encode($string)
utf8-encodes string if it is not a valid utf8-string.
static recursive_dirscan($dir, &$arr)
Recursively scans a given directory and writes path and filename into referenced array.
Class ilMapArea.
Class ilMediaItem Media Item, component of a media object (file or reference)
Class ilObjFile.
Class ilObjMediaObject.
static getMimeType($a_file, $a_external=null)
get mime type for file
static _getDirectory($a_mob_id)
Get absolute directory.
Class ilSCORM2004PageNode.
Class ilSCORM2004Page.
static rCopy($a_sdir, $a_tdir, $preserveTimeAttributes=false)
Copies content of a directory $a_sdir recursively to a directory $a_tdir.
static getDir($a_dir, $a_rec=false, $a_sub_dir="")
get directory
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
static renameExecutables($a_dir)
Rename uploaded executables for security reasons.
for( $i=6;$i< 13;$i++) for($i=1; $i< 13; $i++) $d
Definition: date.php:296

References $d, Vendor\Package\$f, $filename, $n, $result, $slm, ilObjMediaObject\_getDirectory(), ilUtil\getDir(), ilObjMediaObject\getMimeType(), IL_EXT_LINK, IL_MO_PARSE_QTI, IL_MO_VERIFY_QTI, ilSCORM2004Node\putInTree(), ilUtil\rCopy(), ilFileUtils\recursive_dirscan(), ilUtil\renameExecutables(), ilUtil\stripSlashes(), and ilFileUtils\utf8_encode().

Referenced by il_importAss(), and il_importSco().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ dbRemoveAll()

ilSCORM13Package::dbRemoveAll ( )

Definition at line 1143 of file ilSCORM13Package.php.

1144 {
1145 //dont change order of calls
1146 $this->removeCMIData();
1147 $this->removeCPData();
1148 }

References removeCMIData(), and removeCPData().

Referenced by il_import(), and rollback().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ exportXML()

ilSCORM13Package::exportXML ( )

Export as internal XML.

Definition at line 119 of file ilSCORM13Package.php.

120 {
121 global $DIC;
122 $ilDB = $DIC['ilDB'];
123
124 header('content-type: text/xml');
125 header('content-disposition: attachment; filename="manifest.xml"');
126
127 $res = $ilDB->queryF(
128 'SELECT xmldata FROM cp_package WHERE obj_id = %s',
129 array('integer'),
130 array($this->packageId)
131 );
132 $row = $ilDB->fetchAssoc($res);
133
134 print($row['xmldata']);
135 }
if(! $in) print

References $DIC, $ilDB, $res, and print.

◆ il_import()

ilSCORM13Package::il_import (   $packageFolder,
  $packageId,
  $ilias,
  $validate,
  $reimport = false 
)

Imports an extracted SCORM 2004 module from ilias-data dir into database.

@access public

Returns
string title of package

Definition at line 144 of file ilSCORM13Package.php.

145 {
146 global $DIC;
147 $ilDB = $DIC['ilDB'];
148 $ilLog = $DIC['ilLog'];
149 $ilErr = $DIC['ilErr'];
150
151 $title = "";
152
153 if ($reimport === true) {
154 $this->packageId = $packageId;
155 $this->dbRemoveAll();
156 }
157
158 $this->packageFolder = $packageFolder;
159 $this->packageId = $packageId;
160 $this->imsmanifestFile = $this->packageFolder . '/' . 'imsmanifest.xml';
161 //step 1 - parse Manifest-File and validate
162 $this->imsmanifest = new DOMDocument;
163 $this->imsmanifest->async = false;
164 if (!@$this->imsmanifest->load($this->imsmanifestFile)) {
165 $this->diagnostic[] = 'XML not wellformed';
166 return false;
167 }
168
169 //step 2 tranform
170 $this->manifest = $this->transform($this->imsmanifest, self::DB_ENCODE_XSL);
171
172 if (!$this->manifest) {
173 $this->diagnostic[] = 'Cannot transform into normalized manifest';
174 return false;
175 }
176 //setp 2.5 if only a single item, make sure the scormType of it's linked resource is SCO
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");//[&id='"+$n->getAttribute("resourceId")+"']");
183 foreach ($resource as $res) {
184 if ($res->getAttribute('id') == $n->getAttribute("resourceId")) {
185 $res->setAttribute('scormType', 'sco');
186 }
187 }
188 }
189 //$this->manifest->save("C:\Users\gratat\after.xml");
190 //step 3 validation -just for normalized XML
191 if ($validate == "y") {
192 if (!$this->validate($this->manifest, self::VALIDATE_XSD)) {
193 $ilErr->raiseError(
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,
195 $ilErr->MESSAGE
196 );
197 }
198 }
199 $this->dbImport($this->manifest);
200
201 if (file_exists($this->packageFolder . '/' . 'index.xml')) {
202 $doc = simplexml_load_file($this->packageFolder . '/' . 'index.xml');
203 $l = $doc->xpath("/ContentObject/MetaData");
204 if ($l[0]) {
205 include_once 'Services/MetaData/classes/class.ilMDXMLCopier.php';
206 $mdxml = new ilMDXMLCopier($l[0]->asXML(), $packageId, $packageId, ilObject::_lookupType($packageId));
207 $mdxml->startParsing();
208 $mdxml->getMDObject()->update();
209 }
210 } else {
211 include_once("./Modules/Scorm2004/classes/class.ilSCORM13MDImporter.php");
212 $importer = new ilSCORM13MDImporter($this->imsmanifest, $packageId);
213 $importer->import();
214 $title = $importer->getTitle();
215 $description = $importer->getDescription();
216 if ($description != "") {
218 }
219 }
220
221 //step 5
222 $x = simplexml_load_string($this->manifest->saveXML());
223 $x['persistPreviousAttempts'] = $this->packageData['persistprevattempts'];
224 // $x['online'] = !$this->getOfflineStatus();//$this->packageData['c_online'];
225
226 $x['defaultLessonMode'] = $this->packageData['default_lesson_mode'];
227 $x['credit'] = $this->packageData['credit'];
228 $x['autoReview'] = $this->packageData['auto_review'];
229 $j = array();
230 // first read resources into flat array to resolve item/identifierref later
231 $r = array();
232 foreach ($x->resource as $xe) {
233 $r[strval($xe['id'])] = $xe;
234 unset($xe);
235 }
236 // iterate through items and set href and scoType as activity attributes
237 foreach ($x->xpath('//*[local-name()="item"]') as $xe) {
238 // get reference to resource and set href accordingly
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') {
243 $xe['sco'] = true;
244 }
245 }
246 }
247 // iterate recursivly through activities and build up simple php object
248 // with items and associated sequencings
249 // top node is the default organization which is handled as an item
250 self::jsonNode($x->organization, $j['item']);
251 foreach ($x->sequencing as $s) {
252 self::jsonNode($s, $j['sequencing'][]);
253 }
254 // combined manifest+resources xml:base is set as organization base
255 $j['item']['base'] = strval($x['base']);
256 // package folder is base to whole playing process
257 $j['base'] = $packageFolder . '/';
258 $j['foreignId'] = floatval($x['foreignId']); // manifest cp_node_id for associating global (package wide) objectives
259 $j['id'] = strval($x['id']); // manifest id for associating global (package wide) objectives
260 $j['item']['title'] = ilUtil::stripSlashes($j['item']['title']);
261 for ($i = 0; $i < count($j['item']['item']); $i++) {
262 $j['item']['item'][$i]['title'] = ilUtil::stripSlashes($j['item']['item'][$i]['title']);
263 }
264
265
266 //last step - build ADL Activity tree
267 $act = new SeqTreeBuilder();
268 $adl_tree = $act->buildNodeSeqTree($this->imsmanifestFile);
269 $ilDB->update(
270 'cp_package',
271 array(
272 'xmldata' => array('clob', $x->asXML()),
273 'jsdata' => array('clob', json_encode($j)),
274 'activitytree' => array('clob', json_encode($adl_tree['tree'])),
275 'global_to_system' => array('integer', (int) $adl_tree['global']),
276 'shared_data_global_to_system' => array('integer', (int) $adl_tree['dataglobal'])
277 ),
278 array(
279 'obj_id' => array('integer', (int) $this->packageId)
280 )
281 );
282
283 // title retrieved by importer
284 if ($title != "") {
285 return $title;
286 }
287
288 return $j['item']['title'];
289 }
static _lookupType($a_id, $a_reference=false)
lookup object type
static _writeDescription($a_obj_id, $a_desc)
write description to db (static)
SCORM 13 Metadata importer.
transform($inputdoc, $xslfile, $outputpath=null)
jsonNode($node, &$sink)
Helper for UploadAndImport Recursively copies values from XML into PHP array for export as json Eleme...
validate($doc, $schema)
$i
Definition: metadata.php:24
$ilErr
Definition: raiseError.php:18

References Vendor\Package\$b, $DIC, $i, $ilDB, $ilErr, $n, $packageFolder, $packageId, $res, ilObject\_lookupType(), ilObject\_writeDescription(), dbImport(), dbRemoveAll(), jsonNode(), ilUtil\stripSlashes(), transform(), and validate().

+ Here is the call graph for this function:

◆ il_importAss()

ilSCORM13Package::il_importAss (   $packageId,
  $sco_id,
  $packageFolder 
)

Imports an extracted SCORM 2004 module from ilias-data dir into database.

@access public

Returns
string title of package

Definition at line 359 of file ilSCORM13Package.php.

360 {
361 global $DIC;
362 $ilDB = $DIC['ilDB'];
363 $ilLog = $DIC['ilLog'];
364
365 $this->packageFolder = $packageFolder;
366 $this->packageId = $packageId;
367 $this->imsmanifestFile = $this->packageFolder . '/' . 'index.xml';
368 $this->imsmanifest = new DOMDocument;
369 $this->imsmanifest->async = false;
370
371 if (!@$this->imsmanifest->load($this->imsmanifestFile)) {
372 $this->diagnostic[] = 'XML not wellformed';
373 return false;
374 }
375
377 $sco = new ilSCORM2004Asset($slm, $sco_id);
378 $this->dbImportSco($slm, $sco, true);
379
380 // import sco.xml
381 /*
382 $sco_xml_file = $this->packageFolder . '/sco.xml';
383 if (is_file($sco_xml_file))
384 {
385 $scodoc = new DOMDocument;
386 $scodoc->async = false;
387 if (!@$scodoc->load($sco_xml_file))
388 {
389 $this->diagnostic[] = 'XML of sco.xml not wellformed';
390 return false;
391 }
392 //$doc = new SimpleXMLElement($scodoc->saveXml());
393 //$l = $doc->xpath("/sco/objective");
394 $xpath = new DOMXPath($scodoc);
395 $nodes = $xpath->query("/sco/objective");
396 foreach($nodes as $node)
397 {
398 $t_node = $node->firstChild;
399 if (is_object($t_node))
400 {
401 $objective_text = $t_node->textContent;
402 if (trim($objective_text) != "")
403 {
404 $objs = $sco->getObjectives();
405 foreach ($objs as $o)
406 {
407 $mappings = $o->getMappings();
408 if ($mappings == null)
409 {
410 $ob = new ilScorm2004Objective($sco->getId(), $o->getId());
411 $ob->setObjectiveID($objective_text);
412 $ob->updateObjective();
413 }
414 }
415 }
416 }
417 }
418 }
419 */
420 return "";
421 }
Class ilObjSCORM2004LearningModule.
dbImportSco($slm, $sco, $asset=false)

References $DIC, $ilDB, $packageFolder, $packageId, $slm, and dbImportSco().

+ Here is the call graph for this function:

◆ il_importLM()

ilSCORM13Package::il_importLM (   $slm,
  $packageFolder,
  $a_import_sequencing = false 
)

Definition at line 423 of file ilSCORM13Package.php.

424 {
425 global $DIC;
426 $ilDB = $DIC['ilDB'];
427 $ilLog = $DIC['ilLog'];
428
429 $this->packageFolder = $packageFolder;
430 $this->packageId = $slm->getId();
431 $this->imsmanifestFile = $this->packageFolder . '/' . 'imsmanifest.xml';
432 $this->imsmanifest = new DOMDocument;
433 $this->imsmanifest->async = false;
434 $this->imsmanifest->formatOutput = false;
435 $this->imsmanifest->preserveWhiteSpace = false;
436 $this->slm = $slm;
437 if (!@$this->imsmanifest->load($this->imsmanifestFile)) {
438 $this->diagnostic[] = 'XML not wellformed';
439 return false;
440 }
441
442 $this->mani_xpath = new DOMXPath($this->imsmanifest);
443 $this->mani_xpath->registerNamespace("d", "http://www.imsproject.org/xsd/imscp_rootv1p1p2");
444 $this->mani_xpath->registerNamespace("imscp", "http://www.imsglobal.org/xsd/imscp_v1p1");
445 $this->mani_xpath->registerNamespace("imsss", "http://www.imsglobal.org/xsd/imsss");
446
447
448 $this->dbImportLM(
449 simplexml_import_dom($this->imsmanifest->documentElement),
450 "",
451 $a_import_sequencing
452 );
453
454 if (is_dir($packageFolder . "/glossary")) {
455 $this->importGlossary($slm, $packageFolder . "/glossary");
456 }
457 //die($slm->title);
458
459 return $slm->title;
460 }
importGlossary($slm, $packageFolder)

References $DIC, $ilDB, $packageFolder, $slm, dbImportLM(), and importGlossary().

+ Here is the call graph for this function:

◆ il_importSco()

ilSCORM13Package::il_importSco (   $packageId,
  $sco_id,
  $packageFolder 
)

Imports an extracted SCORM 2004 module from ilias-data dir into database.

@access public

Returns
string title of package

Definition at line 298 of file ilSCORM13Package.php.

299 {
300 global $DIC;
301 $ilDB = $DIC['ilDB'];
302 $ilLog = $DIC['ilLog'];
303
304 $this->packageFolder = $packageFolder;
305 $this->packageId = $packageId;
306 $this->imsmanifestFile = $this->packageFolder . '/' . 'index.xml';
307 $this->imsmanifest = new DOMDocument;
308 $this->imsmanifest->async = false;
309
310 if (!@$this->imsmanifest->load($this->imsmanifestFile)) {
311 $this->diagnostic[] = 'XML not wellformed';
312 return false;
313 }
314
316 $sco = new ilSCORM2004Sco($slm, $sco_id);
317 $this->dbImportSco($slm, $sco);
318
319 // import sco.xml
320 $sco_xml_file = $this->packageFolder . '/sco.xml';
321 if (is_file($sco_xml_file)) {
322 $scodoc = new DOMDocument;
323 $scodoc->async = false;
324 if (!@$scodoc->load($sco_xml_file)) {
325 $this->diagnostic[] = 'XML of sco.xml not wellformed';
326 return false;
327 }
328 //$doc = new SimpleXMLElement($scodoc->saveXml());
329 //$l = $doc->xpath("/sco/objective");
330 $xpath = new DOMXPath($scodoc);
331 $nodes = $xpath->query("/sco/objective");
332 foreach ($nodes as $node) {
333 $t_node = $node->firstChild;
334 if (is_object($t_node)) {
335 $objective_text = $t_node->textContent;
336 if (trim($objective_text) != "") {
337 $objs = $sco->getObjectives();
338 foreach ($objs as $o) {
339 $mappings = $o->getMappings();
340 if ($mappings == null) {
341 $ob = new ilScorm2004Objective($sco->getId(), $o->getId());
342 $ob->setObjectiveID($objective_text);
343 $ob->updateObjective();
344 }
345 }
346 }
347 }
348 }
349 }
350 return "";
351 }

References $DIC, $ilDB, $packageFolder, $packageId, $slm, and dbImportSco().

+ Here is the call graph for this function:

◆ importGlossary()

ilSCORM13Package::importGlossary (   $slm,
  $packageFolder 
)

Definition at line 462 of file ilSCORM13Package.php.

463 {
464 // create and insert object in objecttree
465 $newObj = new ilObjGlossary();
466 $newObj->setType('glo');
467 $newObj->setTitle('');
468 $newObj->create(true);
469 $newObj->createReference();
470 $newObj->putInTree($_GET["ref_id"]);
471 $newObj->setPermissions($_GET["ref_id"]);
472
473 $xml_file = $packageFolder . "/glossary.xml";
474
475 // check whether xml file exists within zip file
476 if (!is_file($xml_file)) {
477 return;
478 }
479
480 include_once("./Modules/LearningModule/classes/class.ilContObjParser.php");
481 $contParser = new ilContObjParser($newObj, $xml_file, $packageFolder);
482 $contParser->startParsing();
483 $newObj->update();
484 //ilObject::_writeImportId($newObj->getId(), $newObj->getImportId());
485 $slm->setAssignedGlossary($newObj->getId());
486 $slm->update();
487 }
$_GET["client_id"]
Content Object Parser.
Class ilObjGlossary.

References $_GET, $packageFolder, and $slm.

Referenced by il_importLM().

+ Here is the caller graph for this function:

◆ jsonNode()

ilSCORM13Package::jsonNode (   $node,
$sink 
)

Helper for UploadAndImport Recursively copies values from XML into PHP array for export as json Elements are translated into sub array, attributes into literals.

Parameters
xmlelement to process
referenceto array object where to copy values
Returns
void

Definition at line 651 of file ilSCORM13Package.php.

652 {
653 foreach ($node->attributes() as $k => $v) {
654 // cast to boolean and number if possible
655 $v = strval($v);
656 if ($v === "true") {
657 $v = true;
658 } elseif ($v === "false") {
659 $v = false;
660 } elseif (is_numeric($v)) {
661 $v = (float) $v;
662 }
663 $sink[$k] = $v;
664 }
665 foreach ($node->children() as $name => $child) {
666 self::jsonNode($child, $sink[$name][]); // RECURSION
667 }
668 }
if($format !==null) $name
Definition: metadata.php:230

References $name, and jsonNode().

Referenced by il_import(), and jsonNode().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ load()

ilSCORM13Package::load (   $packageId)

Definition at line 80 of file ilSCORM13Package.php.

81 {
82 global $DIC;
83 $ilDB = $DIC['ilDB'];
84
85 if (!is_numeric($packageId)) {
86 return false;
87 }
88
89 $lm_set = $ilDB->queryF('SELECT * FROM sahs_lm WHERE id = %s', array('integer'), array($packageId));
90 $lm_data = $ilDB->fetchAssoc($lm_set);
91 $pg_set = $ilDB->queryF('SELECT * FROM cp_package WHERE obj_id = %s', array('integer'), array($packageId));
92 $pg_data = $ilDB->fetchAssoc($lm_set);
93
94 $this->packageData = array_merge($lm_data, $pg_data);
95 $this->packageId = $packageId;
96 $this->packageFolder = $this->packagesFolder . '/' . $packageId;
97 $this->packageFile = $this->packageFolder . '.zip';
98 $this->imsmanifestFile = $this->packageFolder . '/' . 'imsmanifest.xml';
99 return true;
100 }
$lm_set

References $DIC, $ilDB, $lm_set, and $packageId.

Referenced by __construct().

+ Here is the caller graph for this function:

◆ removeCMIData()

ilSCORM13Package::removeCMIData ( )

Definition at line 1087 of file ilSCORM13Package.php.

1088 {
1089 include_once("./Modules/Scorm2004/classes/class.ilSCORM2004DeleteData.php");
1091
1092 include_once("./Services/Tracking/classes/class.ilLPStatusWrapper.php");
1093 ilLPStatusWrapper::_refreshStatus($this->packageId);
1094 }
static _refreshStatus($a_obj_id, $a_users=null)
Set dirty.
static removeCMIDataForPackage($packageId)

References ilLPStatusWrapper\_refreshStatus(), and ilSCORM2004DeleteData\removeCMIDataForPackage().

Referenced by dbRemoveAll().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ removeCPData()

ilSCORM13Package::removeCPData ( )

Definition at line 1096 of file ilSCORM13Package.php.

1097 {
1098 global $DIC;
1099 $ilDB = $DIC['ilDB'];
1100 $ilLog = $DIC['ilLog'];
1101
1102 //get relevant nodes
1103 $cp_nodes = array();
1104
1105 $res = $ilDB->queryF(
1106 'SELECT cp_node.cp_node_id FROM cp_node WHERE cp_node.slm_id = %s',
1107 array('integer'),
1108 array($this->packageId)
1109 );
1110 while ($data = $ilDB->fetchAssoc($res)) {
1111 $cp_nodes[] = $data['cp_node_id'];
1112 }
1113
1114 //remove package data
1115 foreach (self::$elements['cp'] as $t) {
1116 $t = 'cp_' . $t;
1117
1118 $in = $ilDB->in(strtolower($t) . '.cp_node_id', $cp_nodes, false, 'integer');
1119 $ilDB->manipulate('DELETE FROM ' . strtolower($t) . ' WHERE ' . $in);
1120 }
1121
1122 // remove CP structure entries in tree and node
1123 $ilDB->manipulateF(
1124 'DELETE FROM cp_tree WHERE cp_tree.obj_id = %s',
1125 array('integer'),
1126 array($this->packageId)
1127 );
1128
1129 $ilDB->manipulateF(
1130 'DELETE FROM cp_node WHERE cp_node.slm_id = %s',
1131 array('integer'),
1132 array($this->packageId)
1133 );
1134
1135 // remove general package entry
1136 $ilDB->manipulateF(
1137 'DELETE FROM cp_package WHERE cp_package.obj_id = %s',
1138 array('integer'),
1139 array($this->packageId)
1140 );
1141 }
if(php_sapi_name() !='cli') $in
Definition: Utf8Test.php:37
$data
Definition: storeScorm.php:23

References $data, $DIC, $ilDB, $in, and $res.

Referenced by dbRemoveAll().

+ Here is the caller graph for this function:

◆ rollback()

ilSCORM13Package::rollback ( )

Definition at line 102 of file ilSCORM13Package.php.

103 {
104 $this->setProgress(0, 'Rolling back...');
105 $this->dbRemoveAll();
106 if (is_dir($this->packageFolder)) {
107 dir_delete($this->packageFolder);
108 }
109 if (is_file($this->packageFile)) {
110 @unlink($this->packageFile);
111 }
112 $this->setProgress(0, 'Roll back finished: Ok. ');
113 }
setProgress($progress, $msg='')

References dbRemoveAll(), and setProgress().

+ Here is the call graph for this function:

◆ setProgress()

ilSCORM13Package::setProgress (   $progress,
  $msg = '' 
)
private

Definition at line 637 of file ilSCORM13Package.php.

638 {
639 $this->progress = $progress;
640 $this->diagnostic[] = $msg;
641 }

References $progress.

Referenced by rollback().

+ Here is the caller graph for this function:

◆ setSequencingInfo()

ilSCORM13Package::setSequencingInfo (   $a_node,
  $a_seq_info,
  $a_import_sequencing,
  $a_fix_obj_id = "" 
)

Save sequencing ingo.

Parameters

return

Definition at line 622 of file ilSCORM13Package.php.

623 {
624 $seq_xml = trim(str_replace("imsss:", "", $this->imsmanifest->saveXML($a_node)));
625 if ($seq_xml != "") {
626 $a_seq_info->setImportSeqXml('<?xml version="1.0"?>' . $seq_xml);
627 }
628 if ($a_import_sequencing) {
629 if ($a_fix_obj_id != "") {
630 $seq_xml = preg_replace("/local_obj_[0-9]*_0/", $a_fix_obj_id, $seq_xml);
631 }
632 $a_seq_info->setSeqXml('<?xml version="1.0"?>' . $seq_xml);
633 }
634 }

Referenced by dbImportLM().

+ Here is the caller graph for this function:

◆ transform()

ilSCORM13Package::transform (   $inputdoc,
  $xslfile,
  $outputpath = null 
)

Definition at line 1150 of file ilSCORM13Package.php.

1151 {
1152 $xsl = new DOMDocument;
1153 $xsl->async = false;
1154 if (!@$xsl->load($xslfile)) {
1155 die('ERROR: load StyleSheet ' . $xslfile);
1156 }
1157 $prc = new XSLTProcessor;
1158 $prc->registerPHPFunctions();
1159 $r = @$prc->importStyleSheet($xsl);
1160 if (false === @$prc->importStyleSheet($xsl)) {
1161 die('ERROR: importStyleSheet ' . $xslfile);
1162 }
1163 if ($outputpath) {
1164 file_put_contents($outputpath, $prc->transformToXML($inputdoc));
1165 } else {
1166 return $prc->transformToDoc($inputdoc);
1167 }
1168 }

Referenced by il_import().

+ Here is the caller graph for this function:

◆ validate()

ilSCORM13Package::validate (   $doc,
  $schema 
)

Definition at line 1170 of file ilSCORM13Package.php.

1171 {
1172 libxml_use_internal_errors(true);
1173 $return = @$doc->schemaValidate($schema);
1174 if (!$return) {
1175 $levels = array(
1176 LIBXML_ERR_ERROR => 'Error',
1177 LIBXML_ERR_FATAL => 'Fatal Error'
1178 );
1179 foreach (libxml_get_errors() as $error) {
1180 $level = $levels[$error->level];
1181 if (isset($level)) {
1182 $message = trim($error->message);
1183 $this->diagnostic[] = "XSLT $level (Line $error->line) $message";
1184 }
1185 }
1186 libxml_clear_errors();
1187 }
1188 libxml_use_internal_errors(false);
1189 return $return;
1190 }
$message
Definition: xapiexit.php:14

References $message.

Referenced by il_import().

+ Here is the caller graph for this function:

Field Documentation

◆ $diagnostic

ilSCORM13Package::$diagnostic

Definition at line 38 of file ilSCORM13Package.php.

◆ $elements

ilSCORM13Package::$elements
staticprivate
Initial value:
= array(
'cp' => array(
'manifest',
'organization',
'item',
'hideLMSUI',
'resource',
'file',
'dependency',
'sequencing',
'rule',
'auxilaryResource',
'condition',
'mapinfo',
'objective',
),
'cmi' => array(
'comment',
'correct_response',
'interaction',
'node',
'objective',
),
)

Definition at line 48 of file ilSCORM13Package.php.

◆ $idmap

ilSCORM13Package::$idmap = array()
private

Definition at line 45 of file ilSCORM13Package.php.

◆ $imsmanifest

ilSCORM13Package::$imsmanifest

Definition at line 36 of file ilSCORM13Package.php.

◆ $manifest

ilSCORM13Package::$manifest

Definition at line 37 of file ilSCORM13Package.php.

◆ $packageData

ilSCORM13Package::$packageData
private

Definition at line 32 of file ilSCORM13Package.php.

◆ $packageFile

ilSCORM13Package::$packageFile
private

Definition at line 29 of file ilSCORM13Package.php.

◆ $packageFolder

ilSCORM13Package::$packageFolder
private

◆ $packageHash

ilSCORM13Package::$packageHash

Definition at line 42 of file ilSCORM13Package.php.

◆ $packageId

ilSCORM13Package::$packageId

Definition at line 40 of file ilSCORM13Package.php.

Referenced by __construct(), dbImport(), il_import(), il_importAss(), il_importSco(), and load().

◆ $packageName

ilSCORM13Package::$packageName

Definition at line 41 of file ilSCORM13Package.php.

◆ $packagesFolder

ilSCORM13Package::$packagesFolder
private

Definition at line 31 of file ilSCORM13Package.php.

◆ $progress

ilSCORM13Package::$progress = 0.0
private

Definition at line 46 of file ilSCORM13Package.php.

Referenced by setProgress().

◆ $slm

ilSCORM13Package::$slm
private

◆ $slm_tree

ilSCORM13Package::$slm_tree
private

Definition at line 34 of file ilSCORM13Package.php.

◆ $status

ilSCORM13Package::$status

Definition at line 39 of file ilSCORM13Package.php.

◆ $userId

ilSCORM13Package::$userId

Definition at line 43 of file ilSCORM13Package.php.

◆ CONVERT_XSL

const ilSCORM13Package::CONVERT_XSL = './Modules/Scorm2004/templates/xsl/op/scorm12To2004.xsl'

Definition at line 21 of file ilSCORM13Package.php.

◆ DB_DECODE_XSL

const ilSCORM13Package::DB_DECODE_XSL = './Modules/Scorm2004/templates/xsl/op/op-scorm13-revert.xsl'

Definition at line 22 of file ilSCORM13Package.php.

◆ DB_ENCODE_XSL

const ilSCORM13Package::DB_ENCODE_XSL = './Modules/Scorm2004/templates/xsl/op/op-scorm13.xsl'

Definition at line 20 of file ilSCORM13Package.php.

◆ VALIDATE_XSD

const ilSCORM13Package::VALIDATE_XSD = './libs/ilias/Scorm2004/xsd/op/op-scorm13.xsd'

Definition at line 23 of file ilSCORM13Package.php.

◆ WRAPPER_HTML

const ilSCORM13Package::WRAPPER_HTML = './Modules/Scorm2004/scripts/converter/GenericRunTimeWrapper1.0_aadlc/GenericRunTimeWrapper.htm'

Definition at line 25 of file ilSCORM13Package.php.

◆ WRAPPER_JS

const ilSCORM13Package::WRAPPER_JS = './Modules/Scorm2004/scripts/converter/GenericRunTimeWrapper1.0_aadlc/SCOPlayerWrapper.js'

Definition at line 26 of file ilSCORM13Package.php.


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