ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
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)
 
 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.

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

References $GLOBALS.

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

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

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

References array.

153  {
154  return array(
155  "4.1.0" => array(
156  "namespace" => "http://www.ilias.de/Modules/Course/crs/4_1",
157  "xsd_file" => "ilias_course_4_1.xsd",
158  "uses_dataset" => false,
159  "min" => "4.1.0",
160  "max" => "4.4.999"),
161  "5.0.0" => array(
162  "namespace" => "http://www.ilias.de/Modules/Course/crs/5_0",
163  "xsd_file" => "ilias_crs_5_0.xsd",
164  "uses_dataset" => false,
165  "min" => "5.0.0",
166  "max" => "")
167  );
168  }
Create styles array
The data for the language used.

◆ 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"

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

References array.

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

◆ getXmlExportTailDependencies()

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

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

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

71  {
72  $dependencies = array();
73  if ($a_entity == self::ENTITY_MAIN) {
74  $obj_id = 0;
75  foreach ($a_ids as $id) {
76  $obj_id = $id;
77  }
78 
79  $dependencies[] = array(
80  'component' => 'Modules/Course',
81  'entity' => self::ENTITY_OBJECTIVE,
82  'ids' => $obj_id
83  );
84 
85  include_once './Modules/Course/classes/Objectives/class.ilLOPage.php';
86  include_once './Modules/Course/classes/class.ilCourseObjective.php';
87  $page_ids = array();
88  foreach (ilCourseObjective::_getObjectiveIds($obj_id) as $objective_id) {
89  foreach (ilLOPage::getAllPages('lobj', $objective_id) as $page_id) {
90  $page_ids[] = ('lobj:' . $page_id['id']);
91  }
92  }
93 
94  if ($page_ids) {
95  $dependencies[] = array(
96  'component' => 'Services/COPage',
97  'entity' => 'pg',
98  'ids' => $page_ids
99  );
100  }
101  }
102  return $dependencies;
103  }
if(!array_key_exists('StateId', $_REQUEST)) $id
static _getObjectiveIds($course_id, $a_activated_only=false)
static getAllPages($a_parent_type, $a_parent_id, $a_lang="-")
Get all pages for parent object.
Create styles array
The data for the language used.
+ 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

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

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

115  {
116  $course_ref_id = end(ilObject::_getAllReferences($a_id));
117  $course = ilObjectFactory::getInstanceByRefId($course_ref_id, false);
118 
119  // begin-patch optes_lok_export
120  if ($a_entity == self::ENTITY_OBJECTIVE) {
121  try {
122  include_once './Modules/Course/classes/Objectives/class.ilLOXmlWriter.php';
123  $writer = new ilLOXmlWriter($course_ref_id);
124  $writer->write();
125  return $writer->getXml();
126  } catch (Exception $ex) {
127  $this->logger->error('Export failed with message: ' . $ex->getMessage());
128  // and throw
129  throw $ex;
130  }
131  }
132  // end-patch optes_lok_export
133 
134  if (!$course instanceof ilObjCourse) {
135  $this->logger->warning($a_id . ' is not id of course instance.');
136  return '';
137  }
138 
139  $this->writer = new ilCourseXMLWriter($course);
140  $this->writer->setMode(ilCourseXMLWriter::MODE_EXPORT);
141  $this->writer->start();
142  return $this->writer->xmlDumpMem(false);
143  }
static _getAllReferences($a_id)
get all reference ids of object
Class ilLOXmlWriter.
Class ilObjCourse.
static getInstanceByRefId($a_ref_id, $stop_on_error=true)
get an instance of an Ilias object by reference id
+ Here is the call graph for this function:

◆ init()

ilCourseExporter::init ( )

Init export.

Returns

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

42  {
43  }

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: