ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
ilCourseImporter Class Reference
+ Inheritance diagram for ilCourseImporter:
+ Collaboration diagram for ilCourseImporter:

Public Member Functions

 __construct ()
 
 init ()
 
 importXmlRepresentation (string $a_entity, string $a_id, string $a_xml, ilImportMapping $a_mapping)
 @noinspection PhpFieldAssignmentTypeMismatchInspection More...
 
 afterContainerImportProcessing (\ilImportMapping $mapping)
 
- Public Member Functions inherited from ilXmlImporter
 __construct ()
 
 setImport (ilImport $a_val)
 
 getImport ()
 
 init ()
 
 setInstallId (string $a_val)
 
 getInstallId ()
 
 setInstallUrl (string $a_val)
 
 getInstallUrl ()
 
 setSchemaVersion (string $a_val)
 
 getSchemaVersion ()
 
 setImportDirectory (string $a_val)
 
 getImportDirectory ()
 
 setSkipEntities (array $a_val)
 
 getSkipEntities ()
 
 exportedFromSameInstallation ()
 
 importXmlRepresentation (string $a_entity, string $a_id, string $a_xml, ilImportMapping $a_mapping)
 
 finalProcessing (ilImportMapping $a_mapping)
 
 afterContainerImportProcessing (ilImportMapping $mapping)
 

Data Fields

const ENTITY_MAIN = 'crs'
 
const ENTITY_OBJECTIVE = 'objectives'
 

Protected Member Functions

 addFinalProcessingInfo ($a_course, $a_entity, $a_xml)
 

Protected Attributes

ilLogger $logger
 
- Protected Attributes inherited from ilXmlImporter
array $skip_entities = array()
 
ilImport $imp
 
string $install_id
 
string $install_url
 
string $schema_version
 
string $import_directory
 

Private Attributes

ilObjCourse $course = null
 
array $final_processing_info = []
 

Detailed Description

Author
Stefan Meyer meyer.nosp@m.@lei.nosp@m.fos.c.nosp@m.om \

Definition at line 24 of file class.ilCourseImporter.php.

Constructor & Destructor Documentation

◆ __construct()

ilCourseImporter::__construct ( )

Reimplemented from ilXmlImporter.

Definition at line 34 of file class.ilCourseImporter.php.

35 {
36 global $DIC;
37
38 $this->logger = $DIC->logger()->crs();
39 }
global $DIC
Definition: shib_login.php:26

References $DIC, and ILIAS\Repository\logger().

+ Here is the call graph for this function:

Member Function Documentation

◆ addFinalProcessingInfo()

ilCourseImporter::addFinalProcessingInfo (   $a_course,
  $a_entity,
  $a_xml 
)
protected

Definition at line 110 of file class.ilCourseImporter.php.

110 : void
111 {
112 $this->final_processing_info[] = array(
113 'course' => $a_course,
114 'entity' => $a_entity,
115 'xml' => $a_xml
116 );
117 }

◆ afterContainerImportProcessing()

ilCourseImporter::afterContainerImportProcessing ( \ilImportMapping  $mapping)

Definition at line 99 of file class.ilCourseImporter.php.

99 : void
100 {
101 foreach ($this->final_processing_info as $info) {
102 // import learning objectives
103 $parser = new ilLOXmlParser($info['course'], $info['xml']);
104 $parser->setMapping($mapping);
105 $parser->parseObjectDependencies();
106 return;
107 }
108 }
Class ilLOXmlWriter.
$info
Definition: entry_point.php:21

References $info.

◆ importXmlRepresentation()

ilCourseImporter::importXmlRepresentation ( string  $a_entity,
string  $a_id,
string  $a_xml,
ilImportMapping  $a_mapping 
)

@noinspection PhpFieldAssignmentTypeMismatchInspection

Reimplemented from ilXmlImporter.

Definition at line 46 of file class.ilCourseImporter.php.

51 : void {
52 if ($new_id = $a_mapping->getMapping('components/ILIAS/Container', 'objs', $a_id)) {
53 $refs = ilObject::_getAllReferences((int) $new_id);
54 $this->course = ilObjectFactory::getInstanceByRefId((int) end($refs), false);
55 } // Mapping for containers without subitems
56 elseif ($new_id = $a_mapping->getMapping('components/ILIAS/Container', 'refs', '0')) {
57 $this->course = ilObjectFactory::getInstanceByRefId((int) $new_id, false);
58 } elseif (!$this->course instanceof ilObjCourse) {
59 $this->course = new ilObjCourse();
60 $this->course->create();
61 }
62
63 if ($a_entity == self::ENTITY_OBJECTIVE) {
64 $this->addFinalProcessingInfo($this->course, $a_entity, $a_xml);
65
66 // import learning objectives => without materials and fixed questions.
67 // These are handled in afterContainerImportProcessing
68 $parser = new ilLOXmlParser($this->course, $a_xml);
69 $parser->setMapping($a_mapping);
70 $parser->parse();
71 return;
72 }
73
74 try {
75 $parser = new ilCourseXMLParser($this->course);
76 $parser->setXMLContent($a_xml);
77 $parser->startParsing();
78
79 // set course offline
80 $this->course->setOfflineStatus(true);
81 $this->course->update();
82
83 $a_mapping->addMapping('components/ILIAS/Course', 'crs', $a_id, (string) $this->course->getId());
84 $a_mapping->addMapping('components/ILIAS/AdvancedMetaData', 'parent', $a_id, (string) $this->course->getId());
85
86 // workaround for ilImportContainer::createDummy which creates Metadata via create(true)
87 $this->course->deleteMetaData();
88 $a_mapping->addMapping(
89 'components/ILIAS/MetaData',
90 'md',
91 $a_id . ':0:crs',
92 $this->course->getId() . ':0:crs'
93 );
94 } catch (ilSaxParserException|Exception $e) {
95 $this->logger->error('Parsing failed with message, "' . $e->getMessage() . '".');
96 }
97 }
addFinalProcessingInfo($a_course, $a_entity, $a_xml)
addMapping(string $a_comp, string $a_entity, string $a_old_id, string $a_new_id)
getMapping(string $a_comp, string $a_entity, string $a_old_id)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static getInstanceByRefId(int $ref_id, bool $stop_on_error=true)
get an instance of an Ilias object by reference id
static _getAllReferences(int $id)
get all reference ids for object ID
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...

References ilObject\_getAllReferences(), and ilObjectFactory\getInstanceByRefId().

+ Here is the call graph for this function:

◆ init()

ilCourseImporter::init ( )

Reimplemented from ilXmlImporter.

Definition at line 41 of file class.ilCourseImporter.php.

41 : void
42 {
43 }

Field Documentation

◆ $course

ilObjCourse ilCourseImporter::$course = null
private

Definition at line 29 of file class.ilCourseImporter.php.

◆ $final_processing_info

array ilCourseImporter::$final_processing_info = []
private

Definition at line 30 of file class.ilCourseImporter.php.

◆ $logger

ilLogger ilCourseImporter::$logger
protected

Definition at line 32 of file class.ilCourseImporter.php.

◆ ENTITY_MAIN

const ilCourseImporter::ENTITY_MAIN = 'crs'

Definition at line 26 of file class.ilCourseImporter.php.

◆ ENTITY_OBJECTIVE

const ilCourseImporter::ENTITY_OBJECTIVE = 'objectives'

Definition at line 27 of file class.ilCourseImporter.php.


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