19 declare(strict_types=1);
    33     private \ILIAS\Filesystem\Util\Archive\LegacyArchives 
$archives;
    53     private \ILIAS\DI\Container 
$dic;
    66         $this->filesystemWeb = $DIC->filesystem()->web();
    67         $this->filesystemTemp = $DIC->filesystem()->temp();
    68         $this->archives = $DIC->legacyArchives();
    70         $this->_dataset->_cmixSettingsProperties[
'Title'] = 
'';
    71         $this->_dataset->_cmixSettingsProperties[
'Description'] = 
'';
    82         $this->_import_objId = $a_id;
    83         $this->_mapping = $a_mapping;
    85         if ($this->_newId = $a_mapping->
getMapping(
'components/ILIAS/Container', 
'objs', (
string) $this->_import_objId)) {
    93             $this->_isSingleImport = 
true;
   108         $this->_cmixObj->setType(
'cmix');
   110         $this->_cmixObj->setTitle(
"dummy");
   112         $this->_cmixObj->setDescription(
"test import");
   114         $this->_cmixObj->create(
true);
   115         $this->_newId = (string) $this->_cmixObj->getId();
   116         $this->_mapping->addMapping(
'components/ILIAS/CmiXapi', 
'cmix', (
string) $this->_import_objId, (
string) $this->_newId);
   118         $this->_cmixObj->update();
   128         $this->_newId = $this->_mapping->getMapping(
'components/ILIAS/Container', 
'objs', (
string) $this->_import_objId);
   129         if (!is_null($this->_newId) && $this->_newId != 
"") {
   133             $this->_cmixObj->save(); 
   135             $this->_mapping->addMapping(
"components/ILIAS/CmiXapi", 
"cmix", (
string) $this->_import_objId, $this->_newId);
   137         $this->_cmixObj->save();
   138         $this->_cmixObj->update();
   148         if (
true === $this->filesystemTemp->has($this->_relImportDir . 
'/content.zip')) {
   150             $this->_relWebDir = $this->_relWebDir . $this->_cmixObj->getId();
   151             if (
false === $this->filesystemWeb->has($this->_relWebDir)) {
   152                 $this->filesystemWeb->createDir($this->_relWebDir);
   153                 $this->filesystemWeb->put($this->_relWebDir . 
'/content.zip', $this->filesystemTemp->read($this->_relImportDir . 
'/content.zip'));
   155                 $this->archives->unzip($webDataDir . 
"/" . $this->_relWebDir . 
"/content.zip");
   156                 $this->filesystemWeb->delete($this->_relWebDir . 
'/content.zip');
   159             exit($this->_relImportDir . 
'not found');
   173         $xml = $this->filesystemTemp->readStream($this->_relImportDir . 
'/properties.xml');
   175             $use_internal_errors = libxml_use_internal_errors(
true);
   176             $xmlRoot = simplexml_load_string((
string) $xml);
   177             libxml_use_internal_errors($use_internal_errors);
   179         foreach ($this->_dataset->_cmixSettingsProperties as $key => $property) {
   180             $this->_moduleProperties[$key] = trim($xmlRoot->$key->__toString());
   191         $this->_cmixObj->setTitle($this->_moduleProperties[
'Title'] . 
" " . $this->dic->language()->txt(
"copy_of_suffix"));
   192         $this->_cmixObj->setDescription($this->_moduleProperties[
'Description']);
   193         $this->_cmixObj->update();
   195         if ($this->_moduleProperties[
'LrsTypeId']) {
   196             $this->_cmixObj->setLrsTypeId((
int) $this->_moduleProperties[
'LrsTypeId']);
   197             $this->_cmixObj->setLrsType(
new ilCmiXapiLrsType((
int) $this->_moduleProperties[
'LrsTypeId']));
   199         $this->_cmixObj->setContentType((
string) $this->_moduleProperties[
'ContentType']);
   200         $this->_cmixObj->setSourceType((
string) $this->_moduleProperties[
'SourceType']);
   201         $this->_cmixObj->setActivityId((
string) $this->_moduleProperties[
'ActivityId']);
   202         $this->_cmixObj->setInstructions((
string) $this->_moduleProperties[
'Instructions']);
   204         $this->_cmixObj->setLaunchUrl((
string) $this->_moduleProperties[
'LaunchUrl']);
   205         $this->_cmixObj->setAuthFetchUrlEnabled((
bool) $this->_moduleProperties[
'AuthFetchUrl']);
   206         $this->_cmixObj->setLaunchMethod((
string) $this->_moduleProperties[
'LaunchMethod']);
   207         $this->_cmixObj->setLaunchMode((
string) $this->_moduleProperties[
'LaunchMode']);
   208         $this->_cmixObj->setMasteryScore((
float) $this->_moduleProperties[
'MasteryScore']);
   209         $this->_cmixObj->setKeepLpStatusEnabled((
bool) $this->_moduleProperties[
'KeepLp']);
   210         $this->_cmixObj->setPrivacyIdent((
int) $this->_moduleProperties[
'PrivacyIdent']);
   211         $this->_cmixObj->setPrivacyName((
int) $this->_moduleProperties[
'PrivacyName']);
   212         $this->_cmixObj->setUserPrivacyComment((
string) $this->_moduleProperties[
'UsrPrivacyComment']);
   213         $this->_cmixObj->setStatementsReportEnabled((
bool) $this->_moduleProperties[
'ShowStatements']);
   214         $this->_cmixObj->setXmlManifest((
string) $this->_moduleProperties[
'XmlManifest']);
   215         $this->_cmixObj->setVersion((
int) $this->_moduleProperties[
'Version']);
   216         $this->_cmixObj->setHighscoreEnabled((
bool) $this->_moduleProperties[
'HighscoreEnabled']);
   217         $this->_cmixObj->setHighscoreAchievedTS((
bool) $this->_moduleProperties[
'HighscoreAchievedTs']);
   218         $this->_cmixObj->setHighscorePercentage((
bool) $this->_moduleProperties[
'HighscorePercentage']);
   219         $this->_cmixObj->setHighscoreWtime((
bool) $this->_moduleProperties[
'HighscoreWtime']);
   220         $this->_cmixObj->setHighscoreOwnTable((
bool) $this->_moduleProperties[
'HighscoreOwnTable']);
   221         $this->_cmixObj->setHighscoreTopTable((
bool) $this->_moduleProperties[
'HighscoreTopTable']);
   222         $this->_cmixObj->setHighscoreTopNum((
int) $this->_moduleProperties[
'HighscoreTopNum']);
   223         $this->_cmixObj->setBypassProxyEnabled((
bool) $this->_moduleProperties[
'BypassProxy']);
   224         $this->_cmixObj->setOnlyMoveon((
bool) $this->_moduleProperties[
'OnlyMoveon']);
   225         $this->_cmixObj->setAchieved((
bool) $this->_moduleProperties[
'Achieved']);
   226         $this->_cmixObj->setAnswered((
bool) $this->_moduleProperties[
'Answered']);
   227         $this->_cmixObj->setCompleted((
bool) $this->_moduleProperties[
'Completed']);
   228         $this->_cmixObj->setFailed((
bool) $this->_moduleProperties[
'Failed']);
   229         $this->_cmixObj->setInitialized((
bool) $this->_moduleProperties[
'Initialized']);
   230         $this->_cmixObj->setPassed((
bool) $this->_moduleProperties[
'Passed']);
   231         $this->_cmixObj->setProgressed((
bool) $this->_moduleProperties[
'Progressed']);
   232         $this->_cmixObj->setSatisfied((
bool) $this->_moduleProperties[
'Satisfied']);
   233         $this->_cmixObj->setTerminated((
bool) $this->_moduleProperties[
'Terminated']);
   234         $this->_cmixObj->setHideData((
bool) $this->_moduleProperties[
'HideData']);
   235         $this->_cmixObj->setTimestamp((
bool) $this->_moduleProperties[
'Timestamp']);
   236         $this->_cmixObj->setDuration((
bool) $this->_moduleProperties[
'Duration']);
   237         $this->_cmixObj->setNoSubstatements((
bool) $this->_moduleProperties[
'NoSubstatements']);
   238         $this->_cmixObj->setPublisherId((
string) $this->_moduleProperties[
'PublisherId']);
   240         $this->_cmixObj->setMoveOn((
string) $this->_moduleProperties[
'MoveOn']);
   241         $this->_cmixObj->setLaunchParameters((
string) $this->_moduleProperties[
'LaunchParameters']);
   242         $this->_cmixObj->setEntitlementKey((
string) $this->_moduleProperties[
'EntitlementKey']);
   243         $this->_cmixObj->setSwitchToReviewEnabled((
bool) $this->_moduleProperties[
'SwitchToReview']);
   244         if (isset($this->_moduleProperties[
'DeleteData'])) {
   245             $this->_cmixObj->setDeleteData((
int) $this->_moduleProperties[
'DeleteData']);
   247         $this->_cmixObj->save();
   248         $this->_cmixObj->updateMetaData();
   259         $this->filesystemTemp->delete($this->_relImportDir);
   270         $dirArr = array_reverse(explode(
'/', $importTempDir));
   271         $this->_relImportDir = $dirArr[1] . 
'/' . $dirArr[0];
   282         $dirArr = array_reverse(explode(
'/', $importTempDir));
   283         $this->_relImportDir = $dirArr[3] . 
'/' . $dirArr[2] . 
'/' . $dirArr[1] . 
'/' . $dirArr[0];
   298         if ($this->_isSingleImport) {
 static getWebspaceDir(string $mode="filesystem")
get webspace directory 
 
__destruct()
if single import then deleteImportDirectiry 
 
getImportDirectoryContainer()
Gets the relative path to the Filesystem::temp Folder. 
 
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
 
deleteImportDirectiry()
Delete the import directory. 
 
prepareSingleObject()
Builds the CmiXapi Object. 
 
ILIAS Filesystem Filesystem $filesystemTemp
 
prepareLocalSourceStorage()
Creates a folder in the data directory of the document root. 
 
ILIAS Filesystem Util Archive LegacyArchives $archives
 
ilCmiXapiDataSet $_dataset
 
getMapping(string $a_comp, string $a_entity, string $a_old_id)
 
getImportDirectorySingle()
Gets the relative path to the Filesystem::temp Folder. 
 
__construct()
ilCmiXapiImporter constructor. 
 
importXmlRepresentation(string $a_entity, string $a_id, string $a_xml, ilImportMapping $a_mapping)
Init the object creation from import. 
 
ilImportMapping $_mapping
 
parseXmlFileProperties()
Parse xml file and set properties. 
 
static getInstanceByObjId(?int $obj_id, bool $stop_on_error=true)
get an instance of an Ilias object by object id 
 
ILIAS Filesystem Filesystem $filesystemWeb
 
updateNewObj()
Finalize the new CmiXapi Object. 
 
__construct(Container $dic, ilPlugin $plugin)
 
prepareContainerObject()
Builds the CmiXapi Object. 
 
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...