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;
75 $this->transl_into =
true;
76 $this->transl_into_lm = $a_lm;
77 $this->transl_lang = $a_lang;
79 $this->transl_into =
false;
122 if ($a_entity ==
"mep") {
123 switch ($a_version) {
128 "Description" =>
"text",
129 "DefaultWidth" =>
"integer",
130 "DefaultHeight" =>
"integer");
136 "Description" =>
"text",
137 "DefaultWidth" =>
"integer",
138 "DefaultHeight" =>
"integer",
139 "ForTranslation" =>
"integer" 145 if ($a_entity ==
"mep_tree") {
146 switch ($a_version) {
150 "MepId" =>
"integer",
151 "Child" =>
"integer",
152 "Parent" =>
"integer",
153 "Depth" =>
"integer",
156 "ForeignId" =>
"integer",
169 public function readData($a_entity, $a_version, $a_ids, $a_field =
"")
173 if (!is_array($a_ids)) {
174 $a_ids = array($a_ids);
178 if ($a_entity ==
"mep") {
179 switch ($a_version) {
182 " default_width, default_height" .
183 " FROM mep_data JOIN object_data ON (mep_data.id = object_data.obj_id) " .
185 $ilDB->in(
"id", $a_ids,
false,
"integer"));
189 $q =
"SELECT id, title, description, " .
190 " default_width, default_height" .
191 " FROM mep_data JOIN object_data ON (mep_data.id = object_data.obj_id) " .
193 $ilDB->in(
"id", $a_ids,
false,
"integer");
195 $set =
$ilDB->query($q);
196 $this->
data = array();
197 while ($rec =
$ilDB->fetchAssoc($set)) {
199 $rec[
"for_translation"] = 1;
202 foreach ($rec as $k => $v) {
208 $this->
data[] = $rec;
216 if ($a_entity ==
"mep_tree") {
217 switch ($a_version) {
220 " ,parent,depth,type,title,foreign_id " .
221 " FROM mep_tree JOIN mep_item ON (child = obj_id) " .
223 $ilDB->in(
"mep_id", $a_ids,
false,
"integer") .
230 $type =
" AND type <> " .
$ilDB->quote(
"mob",
"text");
233 $q =
"SELECT mep_id, child " .
234 " ,parent,depth,type,title,foreign_id, import_id " .
235 " FROM mep_tree JOIN mep_item ON (child = obj_id) " .
237 $ilDB->in(
"mep_id", $a_ids,
false,
"integer") .
241 $set =
$ilDB->query($q);
242 $this->
data = array();
243 while ($rec =
$ilDB->fetchAssoc($set)) {
244 $set2 =
$ilDB->query(
"SELECT for_translation FROM mep_data WHERE id = " .
$ilDB->quote($rec[
"mep_id"],
true));
245 $rec2 =
$ilDB->fetchAssoc($set2);
246 if (!$rec2[
"for_translation"]) {
247 $rec[
"import_id"] =
"il_" . IL_INST_ID .
"_" . $rec[
"type"] .
"_" . $rec[
"child"];
250 foreach ($rec as $k => $v) {
256 $this->
data[] = $rec;
272 "mep_tree" => array(
"ids" => $a_rec[
"Id"])
289 public function importRecord($a_entity, $a_types, $a_rec, $a_mapping, $a_schema_version)
301 include_once(
"./Modules/MediaPool/classes/class.ilObjMediaPool.php");
303 if ($new_id = $a_mapping->getMapping(
'Services/Container',
'objs', $a_rec[
'Id'])) {
307 $newObj->setType(
"mep");
308 $newObj->create(
true);
311 $newObj->setTitle($a_rec[
"Title"]);
312 $newObj->setDescription($a_rec[
"Description"]);
313 $newObj->setDefaultWidth($a_rec[
"DefaultWidth"]);
314 $newObj->setDefaultHeight($a_rec[
"DefaultHeight"]);
315 $newObj->setForTranslation($a_rec[
"ForTranslation"]);
318 $this->current_obj = $newObj;
319 $a_mapping->addMapping(
"Modules/MediaPool",
"mep", $a_rec[
"Id"], $newObj->getId());
320 $a_mapping->addMapping(
"Services/Object",
"obj", $a_rec[
"Id"], $newObj->getId());
325 switch ($a_rec[
"Type"]) {
327 $parent = (int) $a_mapping->getMapping(
"Modules/MediaPool",
"mep_tree", $a_rec[
"Parent"]);
329 $this->current_obj->createFolder($a_rec[
"Title"], $parent);
330 $a_mapping->addMapping(
339 $parent = (int) $a_mapping->getMapping(
"Modules/MediaPool",
"mep_tree", $a_rec[
"Parent"]);
340 $mob_id = (int) $a_mapping->getMapping(
"Services/MediaObjects",
"mob", $a_rec[
"ForeignId"]);
342 $item->setType(
"mob");
343 $item->setForeignId($mob_id);
344 $item->setImportId($a_rec[
"ImportId"]);
345 $item->setTitle($a_rec[
"Title"]);
347 if ($item->getId() > 0) {
348 $this->current_obj->insertInTree($item->getId(), $parent);
353 $parent = (int) $a_mapping->getMapping(
"Modules/MediaPool",
"mep_tree", $a_rec[
"Parent"]);
356 $item->setType(
"pg");
357 $item->setTitle($a_rec[
"Title"]);
358 $item->setImportId($a_rec[
"ImportId"]);
360 $a_mapping->addMapping(
"Modules/MediaPool",
"pg", $a_rec[
"Child"], $item->getId());
361 $a_mapping->addMapping(
364 "mep:" . $a_rec[
"Child"],
365 "mep:" . $item->getId()
367 if ($item->getId() > 0) {
368 $this->current_obj->insertInTree($item->getId(), $parent);
374 if ($a_rec[
"Type"] ==
"pg") {
375 $imp_id = explode(
"_", $a_rec[
"ImportId"]);
376 if ($imp_id[0] ==
"il" &&
377 (
int) $imp_id[1] == (
int) IL_INST_ID &&
381 include_once(
"./Modules/MediaPool/classes/class.ilMediaPoolItem.php");
383 $pool = current($pool);
385 $a_mapping->addMapping(
"Modules/MediaPool",
"pg", $a_rec[
"Child"], $pg_id);
386 $a_mapping->addMapping(
389 "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
A dataset contains in data in a common structure that can be shared and transformed for different pur...