41 return array(
"5.1.0",
"4.1.0");
44 protected function getXmlNamespace(
string $a_entity,
string $a_schema_version): string
46 return "https://www.ilias.de/xml/Modules/MediaPool/" . $a_entity;
54 $this->master_lang_only = $a_val;
66 if ($a_mep !== null) {
67 $this->transl_into =
true;
68 $this->transl_into_mep = $a_mep;
69 $this->transl_lang = $a_lang;
71 $this->transl_into =
false;
93 protected function getTypes(
string $a_entity,
string $a_version): array
96 if ($a_entity ===
"mep") {
102 "Description" =>
"text",
103 "DefaultWidth" =>
"integer",
104 "DefaultHeight" =>
"integer");
110 "Description" =>
"text",
111 "DefaultWidth" =>
"integer",
112 "DefaultHeight" =>
"integer",
113 "ForTranslation" =>
"integer" 119 if ($a_entity ===
"mep_tree") {
120 switch ($a_version) {
124 "MepId" =>
"integer",
125 "Child" =>
"integer",
126 "Parent" =>
"integer",
127 "Depth" =>
"integer",
130 "ForeignId" =>
"integer",
138 public function readData(
string $a_entity,
string $a_version, array $a_ids): void
143 if ($a_entity ===
"mep") {
144 switch ($a_version) {
147 " default_width, default_height" .
148 " FROM mep_data JOIN object_data ON (mep_data.id = object_data.obj_id) " .
150 $ilDB->in(
"id", $a_ids,
false,
"integer"));
154 $q =
"SELECT id, title, description, " .
155 " default_width, default_height" .
156 " FROM mep_data JOIN object_data ON (mep_data.id = object_data.obj_id) " .
158 $ilDB->in(
"id", $a_ids,
false,
"integer");
160 $set =
$ilDB->query($q);
161 $this->data = array();
162 while ($rec =
$ilDB->fetchAssoc($set)) {
164 $rec[
"for_translation"] = 1;
167 foreach ($rec as $k => $v) {
173 $this->data[] = $rec;
181 if ($a_entity ===
"mep_tree") {
182 switch ($a_version) {
185 " ,parent,depth,type,title,foreign_id " .
186 " FROM mep_tree JOIN mep_item ON (child = obj_id) " .
188 $ilDB->in(
"mep_id", $a_ids,
false,
"integer") .
195 $type =
" AND type <> " .
$ilDB->quote(
"mob",
"text");
198 $q =
"SELECT mep_id, child " .
199 " ,parent,depth,type,title,foreign_id, import_id " .
200 " FROM mep_tree JOIN mep_item ON (child = obj_id) " .
202 $ilDB->in(
"mep_id", $a_ids,
false,
"integer") .
206 $set =
$ilDB->query($q);
207 $this->data = array();
208 while ($rec =
$ilDB->fetchAssoc($set)) {
209 $set2 =
$ilDB->query(
"SELECT for_translation FROM mep_data WHERE id = " .
$ilDB->quote($rec[
"mep_id"],
true));
210 $rec2 =
$ilDB->fetchAssoc($set2);
211 if (!$rec2[
"for_translation"]) {
212 $rec[
"import_id"] =
"il_" .
IL_INST_ID .
"_" . $rec[
"type"] .
"_" . $rec[
"child"];
215 foreach ($rec as $k => $v) {
221 $this->data[] = $rec;
232 ?array $a_rec = null,
238 "mep_tree" => array(
"ids" => $a_rec[
"Id"] ?? null)
249 string $a_schema_version
260 if ($new_id = $a_mapping->
getMapping(
'Services/Container',
'objs', $a_rec[
'Id'])) {
264 $newObj->setType(
"mep");
268 $newObj->setTitle($a_rec[
"Title"]);
269 $newObj->setDescription($a_rec[
"Description"]);
270 $newObj->setDefaultWidth((
int) $a_rec[
"DefaultWidth"]);
271 $newObj->setDefaultHeight((
int) $a_rec[
"DefaultHeight"]);
272 $newObj->setForTranslation((
bool) ($a_rec[
"ForTranslation"] ??
false));
275 $this->current_obj = $newObj;
276 $a_mapping->
addMapping(
"Modules/MediaPool",
"mep", $a_rec[
"Id"], $newObj->getId());
277 $a_mapping->
addMapping(
"Services/Object",
"obj", $a_rec[
"Id"], $newObj->getId());
282 switch ($a_rec[
"Type"]) {
284 $parent = (
int) $a_mapping->
getMapping(
"Modules/MediaPool",
"mep_tree", $a_rec[
"Parent"]);
286 $this->current_obj->createFolder($a_rec[
"Title"], $parent);
296 $parent = (
int) $a_mapping->
getMapping(
"Modules/MediaPool",
"mep_tree", $a_rec[
"Parent"]);
297 $mob_id = (
int) $a_mapping->
getMapping(
"Services/MediaObjects",
"mob", $a_rec[
"ForeignId"]);
299 $item->setType(
"mob");
300 $item->setForeignId($mob_id);
301 $item->setImportId($a_rec[
"ImportId"]);
302 $item->setTitle($a_rec[
"Title"]);
304 if ($item->getId() > 0) {
308 $this->current_obj->insertInTree($item->getId(), $parent);
313 $parent = (
int) $a_mapping->
getMapping(
"Modules/MediaPool",
"mep_tree", $a_rec[
"Parent"]);
316 $item->setType(
"pg");
317 $item->setTitle($a_rec[
"Title"]);
318 $item->setImportId($a_rec[
"ImportId"]);
320 $a_mapping->
addMapping(
"Modules/MediaPool",
"pg", $a_rec[
"Child"], $item->getId());
324 "mep:" . $a_rec[
"Child"],
325 "mep:" . $item->getId()
327 if ($item->getId() > 0) {
331 $this->current_obj->insertInTree($item->getId(), $parent);
336 } elseif ($a_rec[
"Type"] ===
"pg") {
337 $imp_id = explode(
"_", $a_rec[
"ImportId"]);
338 if ($imp_id[0] ===
"il" &&
344 $pool = current($pool);
346 $a_mapping->
addMapping(
"Modules/MediaPool",
"pg", $a_rec[
"Child"], $pg_id);
350 "mep:" . $a_rec[
"Child"],
convertToLeadingUpper(string $a_str)
Make xyz_abc a XyzAbc string.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
addMapping(string $a_comp, string $a_entity, string $a_old_id, string $a_new_id)
getMapping(string $a_comp, string $a_entity, string $a_old_id)
getDirectDataFromQuery(string $a_query, bool $a_convert_to_leading_upper=true, bool $a_set=true)
Get data from query.This is a standard procedure, all db field names are directly mapped to abstract ...
static getInstanceByObjId(?int $obj_id, bool $stop_on_error=true)
get an instance of an Ilias object by object id
stripTags(array $rec, array $omit_keys=[])
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...