ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
ilCourseExporter Class Reference

Folder export. More...

+ Inheritance diagram for ilCourseExporter:
+ Collaboration diagram for ilCourseExporter:

Public Member Functions

 __construct ()
 Constructor. More...
 
 init ()
 Init export. More...
 
 getXmlExportHeadDependencies ($a_entity, $a_target_release, $a_ids)
 Get head dependencies. More...
 
 getXmlExportTailDependencies ($a_entity, $a_target_release, $a_ids)
 Get tail dependencies. More...
 
 getXmlRepresentation ($a_entity, $a_schema_version, $a_id)
 Get xml. More...
 
 getValidSchemaVersions ($a_entity)
 Returns schema versions that the component can export to. More...
 
- Public Member Functions inherited from ilXmlExporter
 __construct ()
 Constructor. More...
 
 setExport (ilExport $a_exp)
 Set export object. More...
 
 getExport ()
 Get export. More...
 
 getXmlRepresentation ($a_entity, $a_schema_version, $a_id)
 Get xml representation. More...
 
 init ()
 
 setExportDirectories ($a_dir_relative, $a_dir_absolute)
 Export directories. More...
 
 getRelativeExportDirectory ()
 Get relative export directory. More...
 
 getAbsoluteExportDirectory ()
 Get absolute export directory. More...
 
 getXmlExportHeadDependencies ($a_entity, $a_target_release, $a_ids)
 Get head dependencies. More...
 
 getXmlExportTailDependencies ($a_entity, $a_target_release, $a_ids)
 Get tail dependencies. More...
 
 getValidSchemaVersions ($a_entity)
 Returns schema versions that the component can export to. More...
 
 determineSchemaVersion ($a_entity, $a_target_release)
 Determine schema version. More...
 

Data Fields

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

Protected Attributes

 $logger = null
 
- Protected Attributes inherited from ilXmlExporter
 $dir_relative
 
 $dir_absolute
 
 $exp
 

Private Attributes

 $writer = null
 

Additional Inherited Members

- Static Public Member Functions inherited from ilXmlExporter
static lookupExportDirectory ($a_obj_type, $a_obj_id, $a_export_type='xml', $a_entity="")
 export directory lookup More...
 

Detailed Description

Folder export.

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

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

Constructor & Destructor Documentation

◆ __construct()

ilCourseExporter::__construct ( )

Constructor.

Reimplemented from ilXmlExporter.

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

33 {
34 $this->logger = $GLOBALS['DIC']->logger()->crs();
35 }
$GLOBALS['loaded']
Global hash that tracks already loaded includes.

References $GLOBALS.

Member Function Documentation

◆ getValidSchemaVersions()

ilCourseExporter::getValidSchemaVersions (   $a_entity)

Returns schema versions that the component can export to.

ILIAS chooses the first one, that has min/max constraints which fit to the target release. Please put the newest on top.

Returns

Reimplemented from ilXmlExporter.

Definition at line 165 of file class.ilCourseExporter.php.

166 {
167 return array (
168 "4.1.0" => array(
169 "namespace" => "http://www.ilias.de/Modules/Course/crs/4_1",
170 "xsd_file" => "ilias_course_4_1.xsd",
171 "uses_dataset" => false,
172 "min" => "4.1.0",
173 "max" => "4.4.999"),
174 "5.0.0" => array(
175 "namespace" => "http://www.ilias.de/Modules/Course/crs/5_0",
176 "xsd_file" => "ilias_crs_5_0.xsd",
177 "uses_dataset" => false,
178 "min" => "5.0.0",
179 "max" => "")
180 );
181 }

◆ getXmlExportHeadDependencies()

ilCourseExporter::getXmlExportHeadDependencies (   $a_entity,
  $a_target_release,
  $a_ids 
)

Get head dependencies.

Parameters
stringentity
stringtarget release
arrayids
Returns
array array of array with keys "component", entity", "ids"

Reimplemented from ilXmlExporter.

Definition at line 54 of file class.ilCourseExporter.php.

55 {
56 if($a_entity != self::ENTITY_MAIN)
57 {
58 return array();
59 }
60
61 // always trigger container because of co-page(s)
62 return array(
63 array(
64 'component' => 'Services/Container',
65 'entity' => 'struct',
66 'ids' => $a_ids
67 )
68 );
69 }

◆ getXmlExportTailDependencies()

ilCourseExporter::getXmlExportTailDependencies (   $a_entity,
  $a_target_release,
  $a_ids 
)

Get tail dependencies.

Parameters
stringentity
stringtarget release
arrayids
Returns
array array of array with keys "component", entity", "ids"

Reimplemented from ilXmlExporter.

Definition at line 72 of file class.ilCourseExporter.php.

73 {
74 $dependencies = array();
75 if($a_entity == self::ENTITY_MAIN)
76 {
77 $obj_id = 0;
78 foreach($a_ids as $id)
79 {
80 $obj_id = $id;
81 }
82
83 $dependencies[] = array(
84 'component' => 'Modules/Course',
85 'entity' => self::ENTITY_OBJECTIVE,
86 'ids' => $obj_id
87 );
88
89 include_once './Modules/Course/classes/Objectives/class.ilLOPage.php';
90 include_once './Modules/Course/classes/class.ilCourseObjective.php';
91 $page_ids = array();
92 foreach(ilCourseObjective::_getObjectiveIds($obj_id) as $objective_id)
93 {
94 foreach(ilLOPage::getAllPages('lobj', $objective_id) as $page_id)
95 {
96 $page_ids[] = ('lobj:'.$page_id['id']);
97 }
98 }
99
100 if($page_ids)
101 {
102 $dependencies[] = array(
103 'component' => 'Services/COPage',
104 'entity' => 'pg',
105 'ids' => $page_ids
106 );
107 }
108
109
110
111 }
112 return $dependencies;
113 }
static _getObjectiveIds($course_id, $a_activated_only=false)
static getAllPages($a_parent_type, $a_parent_id, $a_lang="-")
Get all pages for parent object.

References ilCourseObjective\_getObjectiveIds(), and ilPageObject\getAllPages().

+ Here is the call graph for this function:

◆ getXmlRepresentation()

ilCourseExporter::getXmlRepresentation (   $a_entity,
  $a_schema_version,
  $a_id 
)

Get xml.

Parameters
object$a_entity
object$a_schema_version
object$a_id
Returns

Reimplemented from ilXmlExporter.

Definition at line 124 of file class.ilCourseExporter.php.

125 {
126 $course_ref_id = end(ilObject::_getAllReferences($a_id));
127 $course = ilObjectFactory::getInstanceByRefId($course_ref_id,false);
128
129 // begin-patch optes_lok_export
130 if($a_entity == self::ENTITY_OBJECTIVE)
131 {
132 try {
133 include_once './Modules/Course/classes/Objectives/class.ilLOXmlWriter.php';
134 $writer = new ilLOXmlWriter($course_ref_id);
135 $writer->write();
136 return $writer->getXml();
137 }
138 catch (Exception $ex) {
139 $this->logger->error('Export failed with message: ' . $ex->getMessage());
140 // and throw
141 throw $ex;
142 }
143 }
144 // end-patch optes_lok_export
145
146 if(!$course instanceof ilObjCourse)
147 {
148 $this->logger->warning($a_id .' is not id of course instance.');
149 return '';
150 }
151
152 $this->writer = new ilCourseXMLWriter($course);
153 $this->writer->setMode(ilCourseXMLWriter::MODE_EXPORT);
154 $this->writer->start();
155 return $this->writer->xmlDumpMem(false);
156 }
Class ilLOXmlWriter.
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

References $writer, ilObject\_getAllReferences(), ilObjectFactory\getInstanceByRefId(), and ilCourseXMLWriter\MODE_EXPORT.

+ Here is the call graph for this function:

◆ init()

ilCourseExporter::init ( )

Init export.

Returns

Reimplemented from ilXmlExporter.

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

42 {
43
44 }

Field Documentation

◆ $logger

ilCourseExporter::$logger = null
protected

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

◆ $writer

ilCourseExporter::$writer = null
private

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

Referenced by getXmlRepresentation().

◆ ENTITY_MAIN

const ilCourseExporter::ENTITY_MAIN = 'crs'

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

◆ ENTITY_OBJECTIVE

const ilCourseExporter::ENTITY_OBJECTIVE = 'objectives'

Definition at line 19 of file class.ilCourseExporter.php.


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