ILIAS  release_4-4 Revision
ilCourseImporter Class Reference

folder xml importer More...

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

Public Member Functions

 init ()
 
 importXmlRepresentation ($a_entity, $a_id, $a_xml, $a_mapping)
 Import XML. More...
 
- Public Member Functions inherited from ilXmlImporter
 __construct ()
 Constructor. 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...
 
 importXmlRepresentation ($a_entity, $a_id, $a_xml, $a_mapping)
 Import xml representation. More...
 
 finalProcessing ($a_mapping)
 Final processing. More...
 

Private Attributes

 $course = null
 

Additional Inherited Members

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

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

◆ importXmlRepresentation()

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

Import XML.

Parameters

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

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

31  {
32  include_once './Modules/Course/classes/class.ilCourseXMLParser.php';
33  include_once './Modules/Course/classes/class.ilObjCourse.php';
34 
35 
36  if($new_id = $a_mapping->getMapping('Services/Container','objs',$a_id))
37  {
38  $refs = ilObject::_getAllReferences($new_id);
39  $this->course = ilObjectFactory::getInstanceByRefId(end($refs),false);
40  #$this->course = ilObjectFactory::getInstanceByObjId($new_id,false);
41  }
42  // Mapping for containers without subitems
43  elseif($new_id = $a_mapping->getMapping('Services/Container','refs',0))
44  {
45  $this->course = ilObjectFactory::getInstanceByRefId($new_id,false);
46  }
47  elseif(!$this->course instanceof ilObjCourse)
48  {
49  $this->course = new ilObjCourse();
50  $this->course->create(true);
51  }
52 
53  try
54  {
55  $parser = new ilCourseXMLParser($this->course);
56  $parser->setXMLContent($a_xml);
57  $parser->startParsing();
58  $a_mapping->addMapping('Modules/Course','crs',$a_id,$this->course->getId());
59  }
60  catch(ilSaxParserException $e)
61  {
62  $GLOBALS['ilLog']->write(__METHOD__.': Parsing failed with message, "'.$e->getMessage().'".');
63  }
64  catch(Exception $e)
65  {
66  $GLOBALS['ilLog']->write(__METHOD__.': Parsing failed with message, "'.$e->getMessage().'".');
67  }
68  }
getInstanceByRefId($a_ref_id, $stop_on_error=true)
get an instance of an Ilias object by reference id
SaxParserException thrown by ilSaxParser if property throwException is set.
static _getAllReferences($a_id)
get all reference ids of object
Class ilObjCourse.
$GLOBALS['ct_recipient']
+ Here is the call graph for this function:

◆ init()

ilCourseImporter::init ( )

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

21  {
22  }

Field Documentation

◆ $course

ilCourseImporter::$course = null
private

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


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