ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
ilCOPageExporter Class Reference

Exporter class for meta data. More...

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

Public Member Functions

 init ()
 Initialisation. 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...
 
 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
 
- 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 186 of file class.ilCOPageExporter.php.

References array.

187  {
188  if ($a_entity == "pg")
189  {
190  return array (
191  "4.2.0" => array(
192  "namespace" => "http://www.ilias.de/Services/COPage/pg/4_2",
193  "xsd_file" => "ilias_pg_4_2.xsd",
194  "min" => "4.2.0",
195  "max" => ""),
196  "4.1.0" => array(
197  "namespace" => "http://www.ilias.de/Services/COPage/pg/4_1",
198  "xsd_file" => "ilias_pg_4_1.xsd",
199  "min" => "4.1.0",
200  "max" => "4.1.99")
201  );
202  }
203  if ($a_entity == "pgtp")
204  {
205  return array (
206  "4.2.0" => array(
207  "namespace" => "http://www.ilias.de/Services/COPage/pgtp/4_1",
208  "xsd_file" => "ilias_pgtp_4_1.xsd",
209  "uses_dataset" => true,
210  "min" => "4.2.0",
211  "max" => "")
212  );
213  }
214  }
Create styles array
The data for the language used.

◆ 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 43 of file class.ilCOPageExporter.php.

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

44  {
45  if ($a_entity == "pg")
46  {
47  // get all media objects and files of the page
48  include_once("./Services/MediaObjects/classes/class.ilObjMediaObject.php");
49  include_once("./Modules/File/classes/class.ilObjFile.php");
50  $mob_ids = array();
51  $file_ids = array();
52  foreach ($a_ids as $pg_id)
53  {
54  $pg_id = explode(":", $pg_id);
55 
56  $lang = ($this->config->getMasterLanguageOnly())
57  ? "-"
58  : "";
59 
60  // get media objects
61  $mids = ilObjMediaObject::_getMobsOfObject($pg_id[0].":pg", $pg_id[1], 0, $lang);
62  foreach ($mids as $mid)
63  {
64  if (ilObject::_lookupType($mid) == "mob")
65  {
66  $mob_ids[] = $mid;
67  }
68  }
69 
70  // get files
71  $files = ilObjFile::_getFilesOfObject($pg_id[0].":pg", $pg_id[1], 0, $lang);
72  foreach ($files as $file)
73  {
74  if (ilObject::_lookupType($file) == "file")
75  {
76  $file_ids[] = $file;
77  }
78  }
79  }
80 
81  return array (
82  array(
83  "component" => "Services/MediaObjects",
84  "entity" => "mob",
85  "ids" => $mob_ids),
86  array(
87  "component" => "Modules/File",
88  "entity" => "file",
89  "ids" => $file_ids)
90  );
91  }
92 
93  return array();
94  }
$files
Definition: add-vimline.php:18
static _getMobsOfObject($a_type, $a_id, $a_usage_hist_nr=0, $a_lang="-")
get mobs of object
static _getFilesOfObject($a_type, $a_id, $a_usage_hist_nr=0, $a_usage_lang="-")
get all files of an object
Create styles array
The data for the language used.
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
if(!file_exists("$old.txt")) if($old===$new) if(file_exists("$new.txt")) $file
+ 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 104 of file class.ilCOPageExporter.php.

References array.

105  {
106  if ($a_entity == "pgtp")
107  {
108  $pg_ids = array();
109  foreach ($a_ids as $id)
110  {
111  $pg_ids[] = "stys:".$id;
112  }
113 
114  return array(
115  array(
116  "component" => "Services/COPage",
117  "entity" => "pg",
118  "ids" => $pg_ids)
119  );
120  }
121 
122  return array();
123  }
Create styles array
The data for the language used.

◆ getXmlRepresentation()

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

Get xml representation.

Parameters
stringentity
stringschema version
arrayids
Returns
string xml

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

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

135  {
136  if ($a_entity == "pg")
137  {
138  include_once("./Services/COPage/classes/class.ilPageObject.php");
139 
140  $id = explode(":", $a_id);
141 
142  $langs = array("-");
143  if (!$this->config->getMasterLanguageOnly())
144  {
145  $trans = ilPageObject::lookupTranslations($id[0], $id[1]);
146  foreach ($trans as $t)
147  {
148  if ($t != "-")
149  {
150  $langs[] = $t;
151  }
152  }
153  }
154 
155  include_once("./Services/COPage/classes/class.ilPageObjectFactory.php");
156  $xml = "";
157  foreach ($langs as $l)
158  {
159  $page_object = ilPageObjectFactory::getInstance($id[0], $id[1], 0, $l);
160  $page_object->buildDom();
161  $page_object->insertInstIntoIDs(IL_INST_ID);
162  $pxml = $page_object->getXMLFromDom(false, false, false, "", true);
163  $pxml = str_replace("&","&amp;", $pxml);
164  $xml.= '<PageObject Language="'.$l.'" Active="'.$page_object->getActive().'" ActivationStart="'.$page_object->getActivationStart().'" ActivationEnd="'.
165  $page_object->getActivationEnd().'" ShowActivationInfo="'.$page_object->getShowActivationInfo().'">';
166  $xml.= $pxml;
167  $xml.= "</PageObject>";
168  $page_object->freeDom();
169  }
170 
171  return $xml;
172  }
173  if ($a_entity == "pgtp")
174  {
175  return $this->ds->getXmlRepresentation($a_entity, $a_schema_version, $a_id, "", true, true);
176  }
177  }
Create styles array
The data for the language used.
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:

◆ init()

ilCOPageExporter::init ( )

Initialisation.

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

References ilXmlExporter\getExport().

22  {
23  include_once("./Services/COPage/classes/class.ilCOPageDataSet.php");
24  $this->ds = new ilCOPageDataSet();
25  $this->ds->setExportDirectories($this->dir_relative, $this->dir_absolute);
26  $this->ds->setDSPrefix("ds");
27  $this->config = $this->getExport()->getConfig("Services/COPage");
28  if ($this->config->getMasterLanguageOnly())
29  {
30  $this->ds->setMasterLanguageOnly(true);
31  }
32  }
COPage Data set class.
getExport()
Get export.
+ Here is the call graph for this function:

Field Documentation

◆ $config

ilCOPageExporter::$config
protected

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

◆ $ds

ilCOPageExporter::$ds
private

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


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