forked from fneumann/TestPageComponent
-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathclass.ilTestPageComponentExporter.php
More file actions
120 lines (109 loc) · 3.72 KB
/
class.ilTestPageComponentExporter.php
File metadata and controls
120 lines (109 loc) · 3.72 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
<?php
/**
* 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 the TestPageComponent Plugin
* @author Fred Neumann <fred.neumann@gmx.de>
* @author Alexander Killing <killing@leifos.de>
*/
class ilTestPageComponentExporter extends ilPageComponentPluginExporter
{
public function init() : void
{
}
/**
* Get head dependencies
* @param string entity
* @param string target release
* @param array ids
* @return array array of array with keys "component", entity", "ids"
*/
public function getXmlExportHeadDependencies(string $a_entity, string $a_target_release, array $a_ids) : array
{
// collect the files to export
$file_ids = array();
foreach ($a_ids as $id) {
$properties = self::getPCProperties($id);
if (isset($properties['page_file'])) {
$file_ids[] = $properties['page_file'];
}
}
// add the files as dependencies
if (!empty(($file_ids))) {
return array(
array(
"component" => "components/ILIAS/File",
"entity" => "file",
"ids" => $file_ids
)
);
}
return array();
}
/**
* Get xml representation
* @param string entity
* @param string schema version
* @param string id
* @return string xml string
*/
public function getXmlRepresentation(string $a_entity, string $a_schema_version, string $a_id) : string
{
global $DIC;
/** @var ilComponentFactory $component_factory */
$component_factory = $DIC["component.factory"];
/** @var ilTestPageComponentPlugin $plugin */
$plugin = $component_factory->getPlugin("pctpc");
$properties = self::getPCProperties($a_id);
$data = $plugin->getData($properties['additional_data_id']);
return '<data>' . htmlentities($data) . '</data>';
}
/**
* Get tail dependencies
* @param string entity
* @param string target release
* @param array ids
* @return array array of array with keys "component", entity", "ids"
*/
public function getXmlExportTailDependencies(string $a_entity, string $a_target_release, array $a_ids) : array
{
return array();
}
/**
* 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. Example:
* return array (
* "4.1.0" => array(
* "namespace" => "http://www.ilias.de/Services/MetaData/md/4_1",
* "xsd_file" => "ilias_md_4_1.xsd",
* "min" => "4.1.0",
* "max" => "")
* );
*/
public function getValidSchemaVersions(string $a_entity) : array
{
return array(
'5.3.0' => array(
'namespace' => 'http://www.ilias.de/',
//'xsd_file' => 'pctpc_5_3.xsd',
'uses_dataset' => false,
'min' => '5.3.0',
'max' => ''
)
);
}
}