ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
ilCOPageExporter Class Reference

Exporter class for meta data. More...

+ Inheritance diagram for ilCOPageExporter:
+ Collaboration diagram for ilCOPageExporter:

Public Member Functions

 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 representation. 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...
 

Protected Attributes

 $config
 
 $plugin_dependencies = array()
 
- Protected Attributes inherited from ilXmlExporter
 $dir_relative
 
 $dir_absolute
 
 $exp
 

Private Attributes

 $ds
 

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

Exporter class for meta data.

Author
Alex Killing alex..nosp@m.kill.nosp@m.ing@g.nosp@m.mx.d.nosp@m.e
Version
Id

Definition at line 13 of file class.ilCOPageExporter.php.

Member Function Documentation

◆ getValidSchemaVersions()

ilCOPageExporter::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 221 of file class.ilCOPageExporter.php.

References $id, $nodes, ilPageComponentPluginExporter\setPCProperties(), and ilPageComponentPluginExporter\setPCVersion().

222  {
223  if ($a_entity == "pg") {
224  return array(
225  "4.2.0" => array(
226  "namespace" => "http://www.ilias.de/Services/COPage/pg/4_2",
227  "xsd_file" => "ilias_pg_4_2.xsd",
228  "min" => "4.2.0",
229  "max" => ""),
230  "4.1.0" => array(
231  "namespace" => "http://www.ilias.de/Services/COPage/pg/4_1",
232  "xsd_file" => "ilias_pg_4_1.xsd",
233  "min" => "4.1.0",
234  "max" => "4.1.99")
235  );
236  }
237  if ($a_entity == "pgtp") {
238  return array(
239  "4.2.0" => array(
240  "namespace" => "http://www.ilias.de/Services/COPage/pgtp/4_1",
241  "xsd_file" => "ilias_pgtp_4_1.xsd",
242  "uses_dataset" => true,
243  "min" => "4.2.0",
244  "max" => "")
245  );
246  }
247  }
+ Here is the call graph for this function:

◆ getXmlExportHeadDependencies()

ilCOPageExporter::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 81 of file class.ilCOPageExporter.php.

References $files, $lang, ilObjFile\_getFilesOfObject(), ilObjMediaObject\_getMobsOfObject(), and ilObject\_lookupType().

82  {
83  if ($a_entity == "pg") {
84  // get all media objects and files of the page
85  include_once("./Services/MediaObjects/classes/class.ilObjMediaObject.php");
86  include_once("./Modules/File/classes/class.ilObjFile.php");
87  $mob_ids = array();
88  $file_ids = array();
89  foreach ($a_ids as $pg_id) {
90  $pg_id = explode(":", $pg_id);
91 
92  $lang = ($this->config->getMasterLanguageOnly())
93  ? "-"
94  : "";
95 
96  // get media objects
97  if ($this->config->getIncludeMedia()) {
98  $mids = ilObjMediaObject::_getMobsOfObject($pg_id[0] . ":pg", $pg_id[1], 0, $lang);
99  foreach ($mids as $mid) {
100  if (ilObject::_lookupType($mid) == "mob") {
101  $mob_ids[] = $mid;
102  }
103  }
104  }
105 
106  // get files
107  $files = ilObjFile::_getFilesOfObject($pg_id[0] . ":pg", $pg_id[1], 0, $lang);
108  foreach ($files as $file) {
109  if (ilObject::_lookupType($file) == "file") {
110  $file_ids[] = $file;
111  }
112  }
113  }
114 
115  return array(
116  array(
117  "component" => "Services/MediaObjects",
118  "entity" => "mob",
119  "ids" => $mob_ids),
120  array(
121  "component" => "Modules/File",
122  "entity" => "file",
123  "ids" => $file_ids)
124  );
125  }
126 
127  return array();
128  }
static _getMobsOfObject($a_type, $a_id, $a_usage_hist_nr=0, $a_lang="-")
get mobs of object
$files
Definition: metarefresh.php:49
static _getFilesOfObject($a_type, $a_id, $a_usage_hist_nr=0, $a_usage_lang="-")
get all files of an object
static _lookupType($a_id, $a_reference=false)
lookup object type
for($i=1; $i<=count($kw_cases_sel); $i+=1) $lang
Definition: langwiz.php:349
+ Here is the call graph for this function:

◆ getXmlExportTailDependencies()

ilCOPageExporter::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"

Definition at line 138 of file class.ilCOPageExporter.php.

References $id.

139  {
140  if ($a_entity == "pgtp") {
141  $pg_ids = array();
142  foreach ($a_ids as $id) {
143  $pg_ids[] = "stys:" . $id;
144  }
145 
146  return array(
147  array(
148  "component" => "Services/COPage",
149  "entity" => "pg",
150  "ids" => $pg_ids)
151  );
152  }
153 
154  if (!empty($this->plugin_dependencies)) {
155  // use numeric keys instead plugin names
156  return array_values($this->plugin_dependencies);
157  }
158 
159  return array();
160  }
if(!array_key_exists('StateId', $_REQUEST)) $id

◆ getXmlRepresentation()

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

Get xml representation.

Parameters
stringentity
stringschema version
arrayids
Returns
string xml

Definition at line 171 of file class.ilCOPageExporter.php.

References $id, $l, $t, $xml, ilPageObjectFactory\getInstance(), and ilPageObject\lookupTranslations().

172  {
173  if ($a_entity == "pg") {
174  include_once("./Services/COPage/classes/class.ilPageObject.php");
175 
176  $id = explode(":", $a_id);
177 
178  $langs = array("-");
179  if (!$this->config->getMasterLanguageOnly()) {
180  $trans = ilPageObject::lookupTranslations($id[0], $id[1]);
181  foreach ($trans as $t) {
182  if ($t != "-") {
183  $langs[] = $t;
184  }
185  }
186  }
187 
188  include_once("./Services/COPage/classes/class.ilPageObjectFactory.php");
189  $xml = "";
190  foreach ($langs as $l) {
191  $page_object = ilPageObjectFactory::getInstance($id[0], $id[1], 0, $l);
192  $page_object->buildDom();
193  $page_object->insertInstIntoIDs(IL_INST_ID);
194  $this->extractPluginProperties($page_object);
195  $pxml = $page_object->getXMLFromDom(false, false, false, "", true);
196  $pxml = str_replace("&", "&amp;", $pxml);
197  $a_media = ($this->config->getIncludeMedia())
198  ? ""
199  : 'WithoutMedia="1"';
200  $xml .= '<PageObject Language="' . $l . '" Active="' . $page_object->getActive() . '" ActivationStart="' . $page_object->getActivationStart() . '" ActivationEnd="' .
201  $page_object->getActivationEnd() . '" ShowActivationInfo="' . $page_object->getShowActivationInfo() . '" ' . $a_media . '>';
202  $xml .= $pxml;
203  $xml .= "</PageObject>";
204  $page_object->freeDom();
205  }
206 
207  return $xml;
208  }
209  if ($a_entity == "pgtp") {
210  return $this->ds->getXmlRepresentation($a_entity, $a_schema_version, $a_id, "", true, true);
211  }
212  }
if(!array_key_exists('StateId', $_REQUEST)) $id
static getInstance($a_parent_type, $a_id=0, $a_old_nr=0, $a_lang="-")
Get page object instance.
global $l
Definition: afr.php:30
static lookupTranslations($a_parent_type, $a_id)
Lookup translations.
+ Here is the call graph for this function:

Field Documentation

◆ $config

ilCOPageExporter::$config
protected

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

◆ $ds

ilCOPageExporter::$ds
private

Definition at line 15 of file class.ilCOPageExporter.php.

◆ $plugin_dependencies

ilCOPageExporter::$plugin_dependencies = array()
protected

Definition at line 36 of file class.ilCOPageExporter.php.


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