33 bool $a_call_by_reference =
true 37 $this->db = $DIC->database();
38 $this->
lng = $DIC->language();
49 $this->default_width = $a_val;
62 $this->default_height = $a_val;
75 $this->for_translation = $a_val;
83 public function read(): void
90 "SELECT * FROM mep_data " .
91 " WHERE id = " .
$ilDB->quote($this->getId(),
"integer")
93 if ($rec =
$ilDB->fetchAssoc($set)) {
98 $this->mep_tree = self::_getPoolTree($this->
getId());
116 return self::_getPoolTree($this->
getId());
123 $id = parent::create();
125 $ilDB->manipulate(
"INSERT INTO mep_data " .
126 "(id, default_width, default_height, for_translation) VALUES (" .
127 $ilDB->quote($this->getId(),
"integer") .
", " .
128 $ilDB->quote($this->getDefaultWidth(),
"integer") .
", " .
129 $ilDB->quote($this->getDefaultHeight(),
"integer") .
", " .
130 $ilDB->quote($this->getForTranslation(),
"integer") .
141 $this->mep_tree->setTreeTablePK(
"mep_id");
142 $this->mep_tree->setTableNames(
'mep_tree',
'mep_item');
143 $this->mep_tree->addTree($this->
getId(), 1);
155 if (!parent::update()) {
161 "UPDATE mep_data SET " .
162 " default_width = " .
$ilDB->quote($this->getDefaultWidth(),
"integer") .
"," .
163 " default_height = " .
$ilDB->quote($this->getDefaultHeight(),
"integer") .
"," .
164 " for_translation = " .
$ilDB->quote($this->getForTranslation(),
"integer") .
" " .
165 " WHERE id = " .
$ilDB->quote($this->getId(),
"integer")
172 public function delete():
bool 175 if (!parent::delete()) {
180 $childs = $this->mep_tree->getSubTree($this->mep_tree->getNodeData($this->mep_tree->readRootId()));
183 $this->mep_tree->removeTree($this->mep_tree->getTreeId());
186 foreach ($childs as $child) {
188 switch ($child[
"type"]) {
212 $obj_id = $this->mep_tree->getRootId();
215 if ($a_type ===
"fold" || $a_type ===
"") {
216 $objs = $this->mep_tree->getChildsByType($obj_id,
"fold");
218 if ($a_type ===
"mob" || $a_type ===
"") {
219 $mobs = $this->mep_tree->getChildsByType($obj_id,
"mob");
224 if ($a_type ===
"pg" || $a_type ===
"") {
225 $pgs = $this->mep_tree->getChildsByType($obj_id,
"pg");
227 foreach ($pgs as
$key => $pg) {
238 $obj_id = $this->mep_tree->getRootId();
241 return $this->mep_tree->getFilteredChilds(array(
"fold",
"dummy"), $obj_id);
252 $ilDB = $DIC->database();
254 $query =
"SELECT foreign_id as id FROM " .
255 " mep_tree JOIN mep_item ON (mep_tree.child = mep_item.obj_id) " .
256 " JOIN object_data ON (mep_item.foreign_id = object_data.obj_id) " .
257 " WHERE mep_tree.mep_id = " .
$ilDB->quote($a_id,
"integer") .
258 " AND mep_item.type = " .
$ilDB->quote(
"mob",
"text") .
259 " AND object_data.type = " .
$ilDB->quote(
"mob",
"text");
262 while ($rec =
$ilDB->fetchAssoc($set)) {
263 $ids[] = (
int) $rec[
"id"];
276 $query =
"SELECT DISTINCT media_item.format f FROM mep_tree " .
277 " JOIN mep_item ON (mep_item.obj_id = mep_tree.child) " .
278 " JOIN object_data ON (mep_item.foreign_id = object_data.obj_id) " .
279 " JOIN media_item ON (media_item.mob_id = object_data.obj_id) " .
280 " WHERE mep_tree.mep_id = " .
$ilDB->quote($this->
getId(),
"integer") .
281 " AND object_data.type = " .
$ilDB->quote(
"mob",
"text") .
285 while ($rec =
$ilDB->fetchAssoc($set)) {
286 if ($rec[
"f"] !=
"") {
301 if ($obj_id === $this->mep_tree->getRootId()) {
305 return (
int) $this->mep_tree->getParentId($obj_id);
313 ?
int $a_parent = null
315 if (!$this->mep_tree->isInTree($a_obj_id)) {
316 $parent = (is_null($a_parent))
317 ? $this->mep_tree->getRootId()
319 $this->mep_tree->insertNode($a_obj_id, $parent);
332 $node_data = $this->mep_tree->getNodeData($obj_id);
333 $subtree = $this->mep_tree->getSubTree($node_data);
336 if ($this->mep_tree->isInTree($obj_id)) {
337 $this->mep_tree->deleteTree($node_data);
341 foreach ($subtree as $node) {
372 $ilDB = $DIC->database();
375 "SELECT * FROM mep_tree JOIN mep_item ON (child = obj_id) WHERE " .
376 " foreign_id = " .
$ilDB->quote($a_foreign_id,
"integer") .
377 " AND mep_id = " .
$ilDB->quote($a_pool_id,
"integer")
379 if ($rec =
$ilDB->fetchAssoc($set)) {
394 $ilDB = $DIC->database();
396 $set =
$ilDB->query(
"SELECT * FROM mep_tree WHERE child = " .
397 $ilDB->quote($a_item_id,
"integer") .
398 " AND mep_id = " .
$ilDB->quote($a_pool_id,
"integer"));
399 if ($rec =
$ilDB->fetchAssoc($set)) {
411 $mep_item->setTitle($a_title);
412 $mep_item->setType(
"fold");
414 if ($mep_item->getId() > 0) {
416 $parent = $a_parent > 0
420 return $mep_item->getId();
431 public function cloneObject(
int $target_id,
int $copy_id = 0,
bool $omit_tree =
false): ?
ilObject 434 $new_obj = parent::cloneObject($target_id, $copy_id, $omit_tree);
436 $new_obj->setTitle($this->
getTitle());
445 $new_obj->getTree()->readRootId(),
454 int $a_target_parent,
458 $nodes = $this->
getTree()->getChilds($a_source_parent);
459 foreach ($nodes as $node) {
461 $item->setType($node[
"type"]);
462 switch ($node[
"type"]) {
466 $new_mob = $mob->duplicate();
467 $item->setForeignId($new_mob->getId());
468 $item->setTitle($new_mob->getTitle());
473 $item->setTitle($node[
"title"]);
477 $new_page->setParentId($a_new_obj->
getId());
478 $new_page->setId($item->getId());
479 $new_page->create(
false);
482 $page->copy($new_page->getId(), $new_page->getParentType(), $new_page->getParentId(),
true);
486 $item->setTitle($node[
"title"]);
492 $a_new_obj->
insertInTree($item->getId(), $a_target_parent);
504 if (in_array($a_mode, array(
"master",
"masternomedia"))) {
506 $conf = $exp->getConfig(
"Modules/MediaPool");
507 $conf->setMasterLanguageOnly(
true, ($a_mode ===
"master"));
508 $exp->exportObject($this->
getType(), $this->
getId(),
"4.4.0");
515 $snippets = $repo->getItems((
int) $a_obj_id);
516 foreach ($snippets as $snippet) {
517 if ((
int) $snippet[
'obj_id'] === (
int) $a_sub_id) {
518 return $snippet[
'title'];
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
txt(string $a_topic, string $a_default_lang_fallback_mod="")
gets the text for a given topic if the topic is not in the list, the topic itself with "-" will be re...
setTreeTablePK(string $a_column_name)
set column containing primary key in tree table
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
setTableNames(string $a_table_tree, string $a_table_obj_data, string $a_table_obj_reference="")
set table names The primary key of the table containing your object_data must be 'obj_id' You may use...
static _exists(string $a_parent_type, int $a_id, string $a_lang="", bool $a_no_cache=false)
Checks whether page exists.
__construct(Container $dic, ilPlugin $plugin)
static _lookupType(int $id, bool $reference=false)