ILIAS  trunk Revision v11.0_alpha-2638-g80c1d007f79
ilCOPageExporter 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 ilCOPageExporter:
+ Collaboration diagram for ilCOPageExporter:

Public Member Functions

 getXmlExportHeadDependencies (string $a_entity, string $a_target_release, array $a_ids)
 
 getXmlExportTailDependencies (string $a_entity, string $a_target_release, array $a_ids)
 
 getXmlRepresentation (string $a_entity, string $a_schema_version, string $a_id)
 
 getValidSchemaVersions (string $a_entity)
 
- 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)
 

Protected Attributes

ilCOPageExportConfig $config
 
array $plugin_dependencies = array()
 
- Protected Attributes inherited from ilXmlExporter
ilExport $exp
 

Private Attributes

ilCOPageDataSet $ds
 

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 Exporter class for meta data

Author
Alexander Killing killi.nosp@m.ng@l.nosp@m.eifos.nosp@m..de

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

Member Function Documentation

◆ getValidSchemaVersions()

ilCOPageExporter::getValidSchemaVersions ( string  $a_entity)

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

References $id, ilPageObject\buildDom(), ilPageObject\getDomDoc(), ilPageObject\getId(), ilPageObject\getLanguage(), ilPageObject\getParentType(), ilPageComponentPluginExporter\setPCProperties(), and ilPageComponentPluginExporter\setPCVersion().

200  : array {
201  if ($a_entity == "pg") {
202  return array(
203  "4.2.0" => array(
204  "namespace" => "https://www.ilias.de/Services/COPage/pg/4_2",
205  "xsd_file" => "ilias_pg_4_2.xsd",
206  "min" => "4.2.0",
207  "max" => ""),
208  "4.1.0" => array(
209  "namespace" => "https://www.ilias.de/Services/COPage/pg/4_1",
210  "xsd_file" => "ilias_pg_4_1.xsd",
211  "min" => "4.1.0",
212  "max" => "4.1.99")
213  );
214  }
215  if ($a_entity == "pgtp") {
216  return array(
217  "4.2.0" => array(
218  "namespace" => "https://www.ilias.de/Services/COPage/pgtp/4_1",
219  "xsd_file" => "ilias_pgtp_4_1.xsd",
220  "uses_dataset" => true,
221  "min" => "4.2.0",
222  "max" => "")
223  );
224  }
225  return [];
226  }
+ Here is the call graph for this function:

◆ getXmlExportHeadDependencies()

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

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

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

81  : array {
82  if ($a_entity == "pg") {
83  // get all media objects and files of the page
84  $mob_ids = array();
85  $file_ids = array();
86  foreach ($a_ids as $pg_id) {
87  $pg_id = explode(":", $pg_id);
88 
89  $lang = ($this->config->getMasterLanguageOnly())
90  ? "-"
91  : "";
92 
93  // get media objects
94  if ($this->config->getIncludeMedia()) {
95  $mids = ilObjMediaObject::_getMobsOfObject($pg_id[0] . ":pg", $pg_id[1], 0, $lang);
96  foreach ($mids as $mid) {
97  if (ilObject::_lookupType($mid) == "mob") {
98  $mob_ids[] = $mid;
99  }
100  }
101  }
102 
103  // get files
104  $files = ilObjFile::_getFilesOfObject($pg_id[0] . ":pg", $pg_id[1], 0, $lang);
105  foreach ($files as $file) {
106  if (ilObject::_lookupType($file) == "file") {
107  $file_ids[] = $file;
108  }
109  }
110  }
111 
112  return array(
113  array(
114  "component" => "components/ILIAS/MediaObjects",
115  "entity" => "mob",
116  "ids" => $mob_ids),
117  array(
118  "component" => "components/ILIAS/File",
119  "entity" => "file",
120  "ids" => $file_ids)
121  );
122  }
123 
124  return array();
125  }
static _getMobsOfObject(string $a_type, int $a_id, int $a_usage_hist_nr=0, string $a_lang="-")
$lang
Definition: xapiexit.php:25
static _lookupType(int $id, bool $reference=false)
+ Here is the call graph for this function:

◆ getXmlExportTailDependencies()

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

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

References $id.

131  : array {
132  if ($a_entity == "pgtp") {
133  $pg_ids = array();
134  foreach ($a_ids as $id) {
135  $pg_ids[] = "stys:" . $id;
136  }
137 
138  return array(
139  array(
140  "component" => "components/ILIAS/COPage",
141  "entity" => "pg",
142  "ids" => $pg_ids)
143  );
144  }
145 
146  if (!empty($this->plugin_dependencies)) {
147  // use numeric keys instead plugin names
148  return array_values($this->plugin_dependencies);
149  }
150 
151  return array();
152  }
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23

◆ getXmlRepresentation()

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

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

References $id, ilPageObjectFactory\getInstance(), IL_INST_ID, and ilPageObject\lookupTranslations().

158  : string {
159  if ($a_entity == "pg") {
160  $id = explode(":", $a_id);
161 
162  $langs = array("-");
163  if (!$this->config->getMasterLanguageOnly()) {
164  $trans = ilPageObject::lookupTranslations($id[0], $id[1]);
165  foreach ($trans as $t) {
166  if ($t != "-") {
167  $langs[] = $t;
168  }
169  }
170  }
171 
172  $xml = "";
173  foreach ($langs as $l) {
174  $page_object = ilPageObjectFactory::getInstance($id[0], $id[1], 0, $l);
175  $page_object->buildDom();
176  $page_object->insertInstIntoIDs(IL_INST_ID);
177  $this->extractPluginProperties($page_object);
178  $pxml = $page_object->getXMLFromDom(false, false, false, "", true);
179  $pxml = str_replace("&", "&", $pxml);
180  $a_media = ($this->config->getIncludeMedia())
181  ? ""
182  : 'WithoutMedia="1"';
183  $xml .= '<PageObject Language="' . $l . '" Active="' . $page_object->getActive() . '" ActivationStart="' . $page_object->getActivationStart() . '" ActivationEnd="' .
184  $page_object->getActivationEnd() . '" ShowActivationInfo="' . $page_object->getShowActivationInfo() . '" ' . $a_media . '>';
185  $xml .= $pxml;
186  $xml .= "</PageObject>";
187  $page_object->freeDom();
188  }
189 
190  return $xml;
191  }
192  if ($a_entity == "pgtp") {
193  return $this->ds->getXmlRepresentation($a_entity, $a_schema_version, [$a_id], "", true, true);
194  }
195  return "";
196  }
const IL_INST_ID
Definition: constants.php:40
static lookupTranslations(string $a_parent_type, int $a_id)
Lookup translations.
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
static getInstance(string $a_parent_type, int $a_id=0, int $a_old_nr=0, string $a_lang="-")
Get page object instance.
+ Here is the call graph for this function:

Field Documentation

◆ $config

ilCOPageExportConfig ilCOPageExporter::$config
protected

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

◆ $ds

ilCOPageDataSet ilCOPageExporter::$ds
private

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

◆ $plugin_dependencies

array ilCOPageExporter::$plugin_dependencies = array()
protected

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


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