ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
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'
 

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...
 
- Protected Attributes inherited from ilXmlExporter
 $dir_relative
 
 $dir_absolute
 
 $exp
 

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 27 of file class.ilCourseExporter.php.

28  {
29  }

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 157 of file class.ilCourseExporter.php.

158  {
159  return array (
160  "4.1.0" => array(
161  "namespace" => "http://www.ilias.de/Modules/Course/crs/4_1",
162  "xsd_file" => "ilias_course_4_1.xsd",
163  "uses_dataset" => false,
164  "min" => "4.1.0",
165  "max" => "4.4.999"),
166  "5.0.0" => array(
167  "namespace" => "http://www.ilias.de/Modules/Course/crs/5_0",
168  "xsd_file" => "ilias_crs_5_0.xsd",
169  "uses_dataset" => false,
170  "min" => "5.0.0",
171  "max" => "")
172  );
173  }

◆ 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 48 of file class.ilCourseExporter.php.

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

◆ getXmlExportTailDependencies()

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

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

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

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

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

119  {
120  $course_ref_id = end(ilObject::_getAllReferences($a_id));
121  $course = ilObjectFactory::getInstanceByRefId($course_ref_id,false);
122 
123  // begin-patch optes_lok_export
124  if($a_entity == self::ENTITY_OBJECTIVE)
125  {
126  try {
127  include_once './Modules/Course/classes/Objectives/class.ilLOXmlWriter.php';
128  $writer = new ilLOXmlWriter($course_ref_id);
129  $writer->write();
130  return $writer->getXml();
131  }
132  catch (Exception $ex) {
133  return '';
134  }
135  }
136  // end-patch optes_lok_export
137 
138  if(!$course instanceof ilObjCourse)
139  {
140  $GLOBALS['ilLog']->write(__METHOD__. $a_id . ' is not instance of type course');
141  return '';
142  }
143 
144  $this->writer = new ilCourseXMLWriter($course);
145  $this->writer->setMode(ilCourseXMLWriter::MODE_EXPORT);
146  $this->writer->start();
147  return $this->writer->xmlDumpMem(false);
148  }
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
Class ilLOXmlWriter.
Class ilObjCourse.
$GLOBALS['PHPCAS_CLIENT']
This global variable is used by the interface class phpCAS.
Definition: CAS.php:276
+ Here is the call graph for this function:

◆ init()

ilCourseExporter::init ( )

Init export.

Returns

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

36  {
37 
38  }

Field Documentation

◆ $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: