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"])
283 public function importRecord($a_entity, $a_types, $a_rec, $a_mapping, $a_schema_version)
294 include_once(
"./Modules/MediaPool/classes/class.ilObjMediaPool.php");
296 if ($new_id = $a_mapping->getMapping(
'Services/Container',
'objs', $a_rec[
'Id'])) {
300 $newObj->setType(
"mep");
301 $newObj->create(
true);
304 $newObj->setTitle($a_rec[
"Title"]);
305 $newObj->setDescription($a_rec[
"Description"]);
306 $newObj->setDefaultWidth($a_rec[
"DefaultWidth"]);
307 $newObj->setDefaultHeight($a_rec[
"DefaultHeight"]);
308 $newObj->setForTranslation($a_rec[
"ForTranslation"]);
311 $this->current_obj = $newObj;
312 $a_mapping->addMapping(
"Modules/MediaPool",
"mep", $a_rec[
"Id"], $newObj->getId());
313 $a_mapping->addMapping(
"Services/Object",
"obj", $a_rec[
"Id"], $newObj->getId());
318 switch ($a_rec[
"Type"]) {
320 $parent = (int) $a_mapping->getMapping(
"Modules/MediaPool",
"mep_tree", $a_rec[
"Parent"]);
322 $this->current_obj->createFolder($a_rec[
"Title"], $parent);
323 $a_mapping->addMapping(
332 $parent = (int) $a_mapping->getMapping(
"Modules/MediaPool",
"mep_tree", $a_rec[
"Parent"]);
333 $mob_id = (int) $a_mapping->getMapping(
"Services/MediaObjects",
"mob", $a_rec[
"ForeignId"]);
335 $item->setType(
"mob");
336 $item->setForeignId($mob_id);
337 $item->setImportId($a_rec[
"ImportId"]);
338 $item->setTitle($a_rec[
"Title"]);
340 if ($item->getId() > 0) {
341 $this->current_obj->insertInTree($item->getId(), $parent);
346 $parent = (int) $a_mapping->getMapping(
"Modules/MediaPool",
"mep_tree", $a_rec[
"Parent"]);
349 $item->setType(
"pg");
350 $item->setTitle($a_rec[
"Title"]);
351 $item->setImportId($a_rec[
"ImportId"]);
353 $a_mapping->addMapping(
"Modules/MediaPool",
"pg", $a_rec[
"Child"], $item->getId());
354 $a_mapping->addMapping(
357 "mep:" . $a_rec[
"Child"],
358 "mep:" . $item->getId()
360 if ($item->getId() > 0) {
361 $this->current_obj->insertInTree($item->getId(), $parent);
367 if ($a_rec[
"Type"] ==
"pg") {
368 $imp_id = explode(
"_", $a_rec[
"ImportId"]);
369 if ($imp_id[0] ==
"il" &&
374 include_once(
"./Modules/MediaPool/classes/class.ilMediaPoolItem.php");
376 $pool = current($pool);
378 $a_mapping->addMapping(
"Modules/MediaPool",
"pg", $a_rec[
"Child"], $pg_id);
379 $a_mapping->addMapping(
382 "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
stripTags(array $rec, array $omit_keys=[])
A dataset contains in data in a common structure that can be shared and transformed for different pur...