ILIAS  release_8 Revision v8.19
All Data Structures Namespaces Files Functions Variables Modules Pages
ilCourseImporter Class Reference

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V. More...

+ 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)
 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

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V.

ILIAS is licensed with the GPL-3.0, see https://www.gnu.org/licenses/gpl-3.0.en.html You should have received a copy of said license along with the source code, too.

If this is not the case or you just want to try ILIAS, you'll find us at: https://www.ilias.de https://github.com/ILIAS-eLearning

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 ( )

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

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

35  {
36  global $DIC;
37 
38  $this->logger = $DIC->logger()->crs();
39  }
global $DIC
Definition: feed.php:28
+ Here is the call graph for this function:

Member Function Documentation

◆ addFinalProcessingInfo()

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

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

Referenced by importXmlRepresentation().

100  : void
101  {
102  $this->final_processing_info[] = array(
103  'course' => $a_course,
104  'entity' => $a_entity,
105  'xml' => $a_xml
106  );
107  }
+ Here is the caller graph for this function:

◆ afterContainerImportProcessing()

ilCourseImporter::afterContainerImportProcessing ( \ilImportMapping  $mapping)

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

89  : void
90  {
91  foreach ($this->final_processing_info as $info) {
92  // import learning objectives
93  $parser = new ilLOXmlParser($info['course'], $info['xml']);
94  $parser->setMapping($mapping);
95  $parser->parseObjectDependencies();
96  return;
97  }
98  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...

◆ importXmlRepresentation()

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

PhpFieldAssignmentTypeMismatchInspection

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

References Vendor\Package\$e, ilObject\_getAllReferences(), addFinalProcessingInfo(), ilImportMapping\addMapping(), ilObjectFactory\getInstanceByRefId(), ilImportMapping\getMapping(), and ILIAS\Repository\logger().

51  : void {
52  if ($new_id = $a_mapping->getMapping('Services/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('Services/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(true);
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('Modules/Course', 'crs', $a_id, (string) $this->course->getId());
85  $this->logger->error('Parsing failed with message, "' . $e->getMessage() . '".');
86  }
87  }
static _getAllReferences(int $id)
get all reference ids for object ID
addFinalProcessingInfo($a_course, $a_entity, $a_xml)
SaxParserException thrown by ilSaxParser if property throwException is set.
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
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
+ Here is the call graph for this function:

◆ init()

ilCourseImporter::init ( )

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: