ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
ilCourseImporter Class Reference

folder xml importer More...

+ Inheritance diagram for ilCourseImporter:
+ Collaboration diagram for ilCourseImporter:

Public Member Functions

 init ()
 Init. More...
 
 importXmlRepresentation ($a_entity, $a_id, $a_xml, $a_mapping)
 Import XML. More...
 
 afterContainerImportProcessing (\ilImportMapping $mapping)
 
- Public Member Functions inherited from ilXmlImporter
 __construct ()
 Constructor. More...
 
 setImport ($a_val)
 Set import. More...
 
 getImport ()
 Get import. More...
 
 init ()
 Init. More...
 
 setInstallId ($a_val)
 Set installation id. More...
 
 getInstallId ()
 Get installation id. More...
 
 setInstallUrl ($a_val)
 Set installation url. More...
 
 getInstallUrl ()
 Get installation url. More...
 
 setSchemaVersion ($a_val)
 Set schema version. More...
 
 getSchemaVersion ()
 Get schema version. More...
 
 setImportDirectory ($a_val)
 Set import directory. More...
 
 getImportDirectory ()
 Get import directory. More...
 
 setSkipEntities ($a_val)
 Set skip entities. More...
 
 getSkipEntities ()
 Get skip entities. More...
 
 exportedFromSameInstallation ()
 Is exporting and importing installation identical? More...
 
 importXmlRepresentation ($a_entity, $a_id, $a_xml, $a_mapping)
 Import xml representation. More...
 
 finalProcessing ($a_mapping)
 Final processing. More...
 
 afterContainerImportProcessing (ilImportMapping $mapping)
 Called after all container objects have been implemented. More...
 

Data Fields

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

Protected Member Functions

 addFinalProcessingInfo ($a_course, $a_entity, $a_xml)
 Add information for final processing. More...
 

Private Attributes

 $course = null
 
 $final_processing_info = array()
 

Additional Inherited Members

- Protected Attributes inherited from ilXmlImporter
 $skip_entities = array()
 
 $imp
 

Detailed Description

folder xml importer

Author
Stefan Meyer meyer.nosp@m.@lei.nosp@m.fos.c.nosp@m.om
Version
$Id$

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

Member Function Documentation

◆ addFinalProcessingInfo()

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

Add information for final processing.

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

105 {
106 $this->final_processing_info[] = array(
107 'course' => $a_course,
108 'entity' => $a_entity,
109 'xml' => $a_xml
110 );
111 }

Referenced by importXmlRepresentation().

+ Here is the caller graph for this function:

◆ afterContainerImportProcessing()

ilCourseImporter::afterContainerImportProcessing ( \ilImportMapping  $mapping)
Parameters
\ilImportMapping$mapping

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

90 {
91 foreach ($this->final_processing_info as $info) {
92 // import learning objectives
93 include_once './Modules/Course/classes/Objectives/class.ilLOXmlParser.php';
94 $parser = new ilLOXmlParser($info['course'], $info['xml']);
95 $parser->setMapping($mapping);
96 $parser->parseObjectDependencies();
97 return;
98 }
99 }
$parser
Definition: BPMN2Parser.php:23
Class ilLOXmlWriter.
$info
Definition: index.php:5

References $info, and $parser.

◆ importXmlRepresentation()

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

Import XML.

Parameters

return

Reimplemented from ilXmlImporter.

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

36 {
37 include_once './Modules/Course/classes/class.ilCourseXMLParser.php';
38 include_once './Modules/Course/classes/class.ilObjCourse.php';
39
40
41 if ($new_id = $a_mapping->getMapping('Services/Container', 'objs', $a_id)) {
42 $refs = ilObject::_getAllReferences($new_id);
43 $this->course = ilObjectFactory::getInstanceByRefId(end($refs), false);
44 #$this->course = ilObjectFactory::getInstanceByObjId($new_id,false);
45 }
46 // Mapping for containers without subitems
47 elseif ($new_id = $a_mapping->getMapping('Services/Container', 'refs', 0)) {
48 $this->course = ilObjectFactory::getInstanceByRefId($new_id, false);
49 } elseif (!$this->course instanceof ilObjCourse) {
50 $this->course = new ilObjCourse();
51 $this->course->create(true);
52 }
53
54 if ($a_entity == self::ENTITY_OBJECTIVE) {
55 $this->addFinalProcessingInfo($this->course, $a_entity, $a_xml);
56
57 // import learning objectives => without materials and fixed questions.
58 // These are handled in afterContainerImportProcessing
59 include_once './Modules/Course/classes/Objectives/class.ilLOXmlParser.php';
60 $parser = new ilLOXmlParser($this->course, $a_xml);
61 $parser->setMapping($a_mapping);
62 $parser->parse();
63 return;
64 }
65
66 try {
67 $parser = new ilCourseXMLParser($this->course);
68 $parser->setXMLContent($a_xml);
69 $parser->startParsing();
70
71 // set course offline
72 $this->course->setOfflineStatus(true);
73 $this->course->update();
74
75 $a_mapping->addMapping('Modules/Course', 'crs', $a_id, $this->course->getId());
76 } catch (ilSaxParserException $e) {
77 $GLOBALS['DIC']['ilLog']->write(__METHOD__ . ': Parsing failed with message, "' . $e->getMessage() . '".');
78 } catch (Exception $e) {
79 $GLOBALS['DIC']['ilLog']->write(__METHOD__ . ': Parsing failed with message, "' . $e->getMessage() . '".');
80 }
81 }
addFinalProcessingInfo($a_course, $a_entity, $a_xml)
Add information for final processing.
Class ilObjCourse.
static getInstanceByRefId($a_ref_id, $stop_on_error=true)
get an instance of an Ilias object by reference id
static _getAllReferences($a_id)
get all reference ids of object
SaxParserException thrown by ilSaxParser if property throwException is set.
$GLOBALS['JPEG_Segment_Names']
Global Variable: XMP_tag_captions.

References $GLOBALS, $parser, ilObject\_getAllReferences(), addFinalProcessingInfo(), and ilObjectFactory\getInstanceByRefId().

+ Here is the call graph for this function:

◆ init()

ilCourseImporter::init ( )

Init.

Reimplemented from ilXmlImporter.

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

26 {
27 }

Field Documentation

◆ $course

ilCourseImporter::$course = null
private

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

◆ $final_processing_info

ilCourseImporter::$final_processing_info = array()
private

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

◆ ENTITY_MAIN

const ilCourseImporter::ENTITY_MAIN = 'crs'

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

◆ ENTITY_OBJECTIVE

const ilCourseImporter::ENTITY_OBJECTIVE = 'objectives'

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


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