4 include_once(
"./Services/DataSet/classes/class.ilDataSet.php");
32 return array(
"5.1.0",
"4.1.0");
43 return "http://www.ilias.de/xml/Modules/MediaPool/".$a_entity;
53 $this->master_lang_only = $a_val;
76 $this->transl_into =
true;
77 $this->transl_into_lm = $a_lm;
78 $this->transl_lang = $a_lang;
82 $this->transl_into =
false;
125 if ($a_entity ==
"mep")
133 "Description" =>
"text",
134 "DefaultWidth" =>
"integer",
135 "DefaultHeight" =>
"integer");
141 "Description" =>
"text",
142 "DefaultWidth" =>
"integer",
143 "DefaultHeight" =>
"integer",
144 "ForTranslation" =>
"integer" 150 if ($a_entity ==
"mep_tree")
157 "MepId" =>
"integer",
158 "Child" =>
"integer",
159 "Parent" =>
"integer",
160 "Depth" =>
"integer",
163 "ForeignId" =>
"integer",
176 function readData($a_entity, $a_version, $a_ids, $a_field =
"")
180 if (!is_array($a_ids))
182 $a_ids =
array($a_ids);
186 if ($a_entity ==
"mep")
192 " default_width, default_height".
193 " FROM mep_data JOIN object_data ON (mep_data.id = object_data.obj_id) ".
195 $ilDB->in(
"id", $a_ids,
false,
"integer"));
199 $q =
"SELECT id, title, description, ".
200 " default_width, default_height".
201 " FROM mep_data JOIN object_data ON (mep_data.id = object_data.obj_id) ".
203 $ilDB->in(
"id", $a_ids,
false,
"integer");
205 $set = $ilDB->query($q);
207 while ($rec = $ilDB->fetchAssoc($set))
211 $rec[
"for_translation"] = 1;
214 foreach ($rec as $k => $v)
221 $this->
data[] = $rec;
229 if ($a_entity ==
"mep_tree")
235 " ,parent,depth,type,title,foreign_id ".
236 " FROM mep_tree JOIN mep_item ON (child = obj_id) ".
238 $ilDB->in(
"mep_id", $a_ids,
false,
"integer").
246 $type =
" AND type <> ".$ilDB->quote(
"mob",
"text");
249 $q =
"SELECT mep_id, child ".
250 " ,parent,depth,type,title,foreign_id, import_id ".
251 " FROM mep_tree JOIN mep_item ON (child = obj_id) ".
253 $ilDB->in(
"mep_id", $a_ids,
false,
"integer").
257 $set = $ilDB->query($q);
259 while ($rec = $ilDB->fetchAssoc($set))
261 $set2 = $ilDB->query(
"SELECT for_translation FROM mep_data WHERE id = ".$ilDB->quote($rec[
"mep_id"],
true));
262 $rec2 = $ilDB->fetchAssoc($set2);
263 if (!$rec2[
"for_translation"])
265 $rec[
"import_id"] =
"il_".IL_INST_ID.
"_".$rec[
"type"].
"_".$rec[
"child"];
268 foreach ($rec as $k => $v)
275 $this->
data[] = $rec;
292 "mep_tree" =>
array(
"ids" => $a_rec[
"Id"])
309 function importRecord($a_entity, $a_types, $a_rec, $a_mapping, $a_schema_version)
323 include_once(
"./Modules/MediaPool/classes/class.ilObjMediaPool.php");
325 if($new_id = $a_mapping->getMapping(
'Services/Container',
'objs',$a_rec[
'Id']))
332 $newObj->setType(
"mep");
333 $newObj->create(
true);
336 $newObj->setTitle($a_rec[
"Title"]);
337 $newObj->setDescription($a_rec[
"Description"]);
338 $newObj->setDefaultWidth($a_rec[
"DefaultWidth"]);
339 $newObj->setDefaultHeight($a_rec[
"DefaultHeight"]);
340 $newObj->setForTranslation($a_rec[
"ForTranslation"]);
343 $this->current_obj = $newObj;
344 $a_mapping->addMapping(
"Modules/MediaPool",
"mep", $a_rec[
"Id"], $newObj->getId());
345 $a_mapping->addMapping(
"Services/Object",
"obj", $a_rec[
"Id"], $newObj->getId());
351 switch ($a_rec[
"Type"])
354 $parent = (int) $a_mapping->getMapping(
"Modules/MediaPool",
"mep_tree", $a_rec[
"Parent"]);
356 $this->current_obj->createFolder($a_rec[
"Title"], $parent);
357 $a_mapping->addMapping(
"Modules/MediaPool",
"mep_tree", $a_rec[
"Child"],
362 $parent = (int) $a_mapping->getMapping(
"Modules/MediaPool",
"mep_tree", $a_rec[
"Parent"]);
363 $mob_id = (int) $a_mapping->getMapping(
"Services/MediaObjects",
"mob", $a_rec[
"ForeignId"]);
365 $item->setType(
"mob");
366 $item->setForeignId($mob_id);
367 $item->setImportId($a_rec[
"ImportId"]);
368 $item->setTitle($a_rec[
"Title"]);
370 if ($item->getId() > 0)
372 $this->current_obj->insertInTree($item->getId(), $parent);
377 $parent = (int) $a_mapping->getMapping(
"Modules/MediaPool",
"mep_tree", $a_rec[
"Parent"]);
380 $item->setType(
"pg");
381 $item->setTitle($a_rec[
"Title"]);
382 $item->setImportId($a_rec[
"ImportId"]);
384 $a_mapping->addMapping(
"Modules/MediaPool",
"pg", $a_rec[
"Child"], $item->getId());
385 $a_mapping->addMapping(
"Services/COPage",
"pg",
"mep:".$a_rec[
"Child"],
386 "mep:".$item->getId());
387 if ($item->getId() > 0)
389 $this->current_obj->insertInTree($item->getId(), $parent);
397 if ($a_rec[
"Type"] ==
"pg")
399 $imp_id = explode(
"_", $a_rec[
"ImportId"]);
400 if ($imp_id[0] ==
"il" &&
401 (
int) $imp_id[1] == (
int) IL_INST_ID &&
406 include_once(
"./Modules/MediaPool/classes/class.ilMediaPoolItem.php");
408 $pool = current($pool);
411 $a_mapping->addMapping(
"Modules/MediaPool",
"pg", $a_rec[
"Child"], $pg_id);
412 $a_mapping->addMapping(
"Services/COPage",
"pg",
"mep:".$a_rec[
"Child"],
getDirectDataFromQuery($a_query, $a_convert_to_leading_upper=true, $a_set=true)
Get data from query.This is a standard procedure, all db field names are directly mapped to abstract ...
convertToLeadingUpper($a_str)
Make xyz_abc a XyzAbc string.
static getInstanceByObjId($a_obj_id, $stop_on_error=true)
get an instance of an Ilias object by object id
Create styles array
The data for the language used.
A dataset contains in data in a common structure that can be shared and transformed for different pur...