ILIAS  release_8 Revision v8.24
ilCourseExporter 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 ilCourseExporter:
+ Collaboration diagram for ilCourseExporter:

Public Member Functions

 __construct ()
 
 init ()
 
 getXmlExportHeadDependencies (string $a_entity, string $a_target_release, array $a_ids)
 Get head dependencies. More...
 
 getXmlExportTailDependencies (string $a_entity, string $a_target_release, array $a_ids)
 Get tail dependencies. More...
 
 getXmlRepresentation (string $a_entity, string $a_schema_version, string $a_id)
 
 getValidSchemaVersions (string $a_entity)
 Returns schema versions that the component can export to. More...
 
- Public Member Functions inherited from ilXmlExporter
 __construct ()
 
 setExport (ilExport $a_exp)
 
 getExport ()
 
 getXmlRepresentation (string $a_entity, string $a_schema_version, string $a_id)
 
 init ()
 
 setExportDirectories (string $a_dir_relative, string $a_dir_absolute)
 
 getRelativeExportDirectory ()
 
 getAbsoluteExportDirectory ()
 
 getXmlExportHeadDependencies (string $a_entity, string $a_target_release, array $a_ids)
 Get head dependencies. More...
 
 getXmlExportTailDependencies (string $a_entity, string $a_target_release, array $a_ids)
 Get tail dependencies. More...
 
 getValidSchemaVersions (string $a_entity)
 Returns schema versions that the component can export to. More...
 
 determineSchemaVersion (string $a_entity, string $a_target_release)
 

Data Fields

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

Protected Attributes

ilXmlWriter $writer
 
ilLogger $logger
 
- Protected Attributes inherited from ilXmlExporter
string $dir_relative = ""
 
string $dir_absolute = ""
 
ilExport $exp
 

Additional Inherited Members

- Static Public Member Functions inherited from ilXmlExporter
static lookupExportDirectory (string $a_obj_type, int $a_obj_id, string $a_export_type='xml', string $a_entity="")
 

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 Folder export

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

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

Constructor & Destructor Documentation

◆ __construct()

ilCourseExporter::__construct ( )

Reimplemented from ilXmlExporter.

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

34 {
35 global $DIC;
36 $this->logger = $DIC->logger()->crs();
37 }
global $DIC
Definition: feed.php:28

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

+ Here is the call graph for this function:

Member Function Documentation

◆ getValidSchemaVersions()

ilCourseExporter::getValidSchemaVersions ( string  $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. Example: return array ( "4.1.0" => array( "namespace" => "http://www.ilias.de/Services/MetaData/md/4_1", "xsd_file" => "ilias_md_4_1.xsd", "min" => "4.1.0", "max" => "") );

Reimplemented from ilXmlExporter.

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

126 : array
127 {
128 return array(
129 "4.1.0" => array(
130 "namespace" => "http://www.ilias.de/Modules/Course/crs/4_1",
131 "xsd_file" => "ilias_course_4_1.xsd",
132 "uses_dataset" => false,
133 "min" => "4.1.0",
134 "max" => "4.4.999"
135 ),
136 "5.0.0" => array(
137 "namespace" => "http://www.ilias.de/Modules/Course/crs/5_0",
138 "xsd_file" => "ilias_crs_5_0.xsd",
139 "uses_dataset" => false,
140 "min" => "5.0.0",
141 "max" => ""
142 )
143 );
144 }

◆ getXmlExportHeadDependencies()

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

Get head dependencies.

Reimplemented from ilXmlExporter.

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

46 : array
47 {
48 if ($a_entity != self::ENTITY_MAIN) {
49 return array();
50 }
51
52 // always trigger container because of co-page(s)
53 return array(
54 array(
55 'component' => 'Services/Container',
56 'entity' => 'struct',
57 'ids' => $a_ids
58 )
59 );
60 }

◆ getXmlExportTailDependencies()

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

Get tail dependencies.

Returns
array array of array with keys "component", entity", "ids"

Reimplemented from ilXmlExporter.

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

62 : array
63 {
64 $dependencies = array();
65 if ($a_entity == self::ENTITY_MAIN) {
66 $obj_id = 0;
67 foreach ($a_ids as $id) {
68 $obj_id = $id;
69 }
70
71 $dependencies[] = array(
72 'component' => 'Modules/Course',
73 'entity' => self::ENTITY_OBJECTIVE,
74 'ids' => $obj_id
75 );
76
77 $page_ids = array();
78 foreach (ilCourseObjective::_getObjectiveIds($obj_id) as $objective_id) {
79 foreach (ilLOPage::getAllPages('lobj', $objective_id) as $page_id) {
80 $page_ids[] = ('lobj:' . $page_id['id']);
81 }
82 }
83
84 if ($page_ids !== []) {
85 $dependencies[] = array(
86 'component' => 'Services/COPage',
87 'entity' => 'pg',
88 'ids' => $page_ids
89 );
90 }
91 }
92 return $dependencies;
93 }
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
static _getObjectiveIds(int $course_id, bool $a_activated_only=false)
static getAllPages(string $a_parent_type, int $a_parent_id, string $a_lang="-")
Get all pages for parent object.

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

+ Here is the call graph for this function:

◆ getXmlRepresentation()

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

Reimplemented from ilXmlExporter.

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

95 : string
96 {
97 $refs = ilObject::_getAllReferences((int) $a_id);
98 $course_ref_id = end($refs);
99 $course = ilObjectFactory::getInstanceByRefId($course_ref_id, false);
100
101 // begin-patch optes_lok_export
102 if ($a_entity == self::ENTITY_OBJECTIVE) {
103 try {
104 $writer = new ilLOXmlWriter($course_ref_id);
105 $writer->write();
106 return $writer->getXml();
107 } catch (Exception $ex) {
108 $this->logger->error('Export failed with message: ' . $ex->getMessage());
109 // and throw
110 throw $ex;
111 }
112 }
113 // end-patch optes_lok_export
114
115 if (!$course instanceof ilObjCourse) {
116 $this->logger->warning($a_id . ' is not id of course instance.');
117 return '';
118 }
119
120 $this->writer = new ilCourseXMLWriter($course);
121 $this->writer->setMode(ilCourseXMLWriter::MODE_EXPORT);
122 $this->writer->start();
123 return $this->writer->xmlDumpMem(false);
124 }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
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

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

+ Here is the call graph for this function:

◆ init()

ilCourseExporter::init ( )

Reimplemented from ilXmlExporter.

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

39 : void
40 {
41 }

Field Documentation

◆ $logger

ilLogger ilCourseExporter::$logger
protected

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

◆ $writer

ilXmlWriter ilCourseExporter::$writer
protected

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

Referenced by getXmlRepresentation().

◆ ENTITY_MAIN

const ilCourseExporter::ENTITY_MAIN = 'crs'

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

◆ ENTITY_OBJECTIVE

const ilCourseExporter::ENTITY_OBJECTIVE = 'objectives'

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


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