39 bool $a_call_by_reference =
true
43 $this->export_factory =
new ExportFactory();
44 $this->data_factory =
new DataFactory();
45 $this->db =
$DIC->database();
46 $this->
lng = $DIC->language();
57 $this->default_width = $a_val;
70 $this->default_height = $a_val;
83 $this->for_translation = $a_val;
91 public function read(): void
98 "SELECT * FROM mep_data " .
99 " WHERE id = " .
$ilDB->quote($this->getId(),
"integer")
101 if ($rec =
$ilDB->fetchAssoc($set)) {
131 $id = parent::create();
135 $ilDB->manipulate(
"INSERT INTO mep_data " .
136 "(id, default_width, default_height, for_translation) VALUES (" .
137 $ilDB->quote($this->getId(),
"integer") .
", " .
138 $ilDB->quote($this->getDefaultWidth(),
"integer") .
", " .
139 $ilDB->quote($this->getDefaultHeight(),
"integer") .
", " .
140 $ilDB->quote($this->getForTranslation(),
"integer") .
151 $this->mep_tree->setTreeTablePK(
"mep_id");
152 $this->mep_tree->setTableNames(
'mep_tree',
'mep_item');
153 $this->mep_tree->addTree($this->
getId(), 1);
165 if (!parent::update()) {
173 "UPDATE mep_data SET " .
174 " default_width = " .
$ilDB->quote($this->getDefaultWidth(),
"integer") .
"," .
175 " default_height = " .
$ilDB->quote($this->getDefaultHeight(),
"integer") .
"," .
176 " for_translation = " .
$ilDB->quote($this->getForTranslation(),
"integer") .
" " .
177 " WHERE id = " .
$ilDB->quote($this->getId(),
"integer")
184 public function delete():
bool
187 if (!parent::delete()) {
194 $childs = $this->mep_tree->getSubTree($this->mep_tree->getNodeData($this->mep_tree->readRootId()));
197 $this->mep_tree->removeTree($this->mep_tree->getTreeId());
200 foreach ($childs as $child) {
202 switch ($child[
"type"]) {
226 $obj_id = $this->mep_tree->getRootId();
229 if ($a_type ===
"fold" || $a_type ===
"") {
230 $objs = $this->mep_tree->getChildsByType($obj_id,
"fold");
232 if ($a_type ===
"mob" || $a_type ===
"") {
233 $mobs = $this->mep_tree->getChildsByType($obj_id,
"mob");
235 foreach ($mobs as $key => $mob) {
238 if ($a_type ===
"pg" || $a_type ===
"") {
239 $pgs = $this->mep_tree->getChildsByType($obj_id,
"pg");
241 foreach ($pgs as $key => $pg) {
252 $obj_id = $this->mep_tree->getRootId();
255 return $this->mep_tree->getFilteredChilds(array(
"fold",
"dummy"), $obj_id);
268 $query =
"SELECT foreign_id as id FROM " .
269 " mep_tree JOIN mep_item ON (mep_tree.child = mep_item.obj_id) " .
270 " JOIN object_data ON (mep_item.foreign_id = object_data.obj_id) " .
271 " WHERE mep_tree.mep_id = " .
$ilDB->quote($a_id,
"integer") .
272 " AND mep_item.type = " .
$ilDB->quote(
"mob",
"text") .
273 " AND object_data.type = " .
$ilDB->quote(
"mob",
"text");
274 $set =
$ilDB->query($query);
276 while ($rec =
$ilDB->fetchAssoc($set)) {
277 $ids[] = (
int) $rec[
"id"];
290 $query =
"SELECT DISTINCT media_item.format f FROM mep_tree " .
291 " JOIN mep_item ON (mep_item.obj_id = mep_tree.child) " .
292 " JOIN object_data ON (mep_item.foreign_id = object_data.obj_id) " .
293 " JOIN media_item ON (media_item.mob_id = object_data.obj_id) " .
294 " WHERE mep_tree.mep_id = " .
$ilDB->quote($this->
getId(),
"integer") .
295 " AND object_data.type = " .
$ilDB->quote(
"mob",
"text") .
298 $set =
$ilDB->query($query);
299 while ($rec =
$ilDB->fetchAssoc($set)) {
300 if ($rec[
"f"] !=
"") {
301 $formats[$rec[
"f"]] = $rec[
"f"];
303 $formats[
"unknown"] =
$lng->txt(
"mep_unknown");
315 if ($obj_id === $this->mep_tree->getRootId()) {
319 return (
int) $this->mep_tree->getParentId($obj_id);
327 ?
int $a_parent =
null
329 if (!$this->mep_tree->isInTree($a_obj_id)) {
330 $parent = (is_null($a_parent))
331 ? $this->mep_tree->getRootId()
333 $this->mep_tree->insertNode($a_obj_id, $parent);
346 $node_data = $this->mep_tree->getNodeData($obj_id);
347 $subtree = $this->mep_tree->getSubTree($node_data);
350 if ($this->mep_tree->isInTree($obj_id)) {
351 $this->mep_tree->deleteTree($node_data);
355 foreach ($subtree as $node) {
389 "SELECT * FROM mep_tree JOIN mep_item ON (child = obj_id) WHERE " .
390 " foreign_id = " .
$ilDB->quote($a_foreign_id,
"integer") .
391 " AND mep_id = " .
$ilDB->quote($a_pool_id,
"integer")
393 if ($rec =
$ilDB->fetchAssoc($set)) {
410 $set =
$ilDB->query(
"SELECT * FROM mep_tree WHERE child = " .
411 $ilDB->quote($a_item_id,
"integer") .
412 " AND mep_id = " .
$ilDB->quote($a_pool_id,
"integer"));
413 if ($rec =
$ilDB->fetchAssoc($set)) {
426 $mep_item->setType(
"fold");
428 if ($mep_item->getId() > 0) {
429 $tree = $this->getTree();
430 $parent = $a_parent > 0
432 : $tree->getRootId();
433 $this->insertInTree($mep_item->getId(), $parent);
434 return $mep_item->getId();
445 public function cloneObject(
int $target_id,
int $copy_id = 0,
bool $omit_tree =
false): ?
ilObject
448 $new_obj = parent::cloneObject($target_id, $copy_id, $omit_tree);
450 $new_obj->setDescription($this->getDescription());
451 $new_obj->setDefaultWidth($this->getDefaultWidth());
452 $new_obj->setDefaultHeight($this->getDefaultHeight());
456 $this->copyTreeContent(
458 $new_obj->getTree()->readRootId(),
459 $this->getTree()->readRootId()
462 $this->cloneMetaData($new_obj);
469 int $a_target_parent,
473 $nodes = $this->getTree()->getChilds($a_source_parent);
474 foreach ($nodes as $node) {
476 $item->setType($node[
"type"]);
477 switch ($node[
"type"]) {
481 $new_mob = $mob->duplicate();
482 $item->setForeignId($new_mob->getId());
483 $item->setTitle($new_mob->getTitle());
488 $item->setTitle($node[
"title"]);
492 $new_page->setParentId($a_new_obj->
getId());
493 $new_page->setId($item->getId());
494 $new_page->create(
false);
497 $page->copy($new_page->getId(), $new_page->getParentType(), $new_page->getParentId(),
true);
501 $item->setTitle($node[
"title"]);
507 $a_new_obj->
insertInTree($item->getId(), $a_target_parent);
510 $this->copyTreeContent($a_new_obj, $item->
getId(), $node[
"child"]);
517 public function exportXML(
string $a_mode =
""): void
519 if (in_array($a_mode, array(
"master",
"masternomedia"))) {
521 $configs = $this->export_factory->consumer()->exportConfig()->allExportConfigs();
522 $config = $configs->getElementByComponent(
'components/ILIAS/MediaPool');
523 $config->setMasterLanguageOnly(
true, ($a_mode ===
"master"));
524 $this->export_factory->consumer()->handler()->createStandardExport($this->
user->getId(), $this->data_factory->objId($this->getId()), $configs);
531 $snippets = $repo->getItems((
int) $a_obj_id);
532 foreach ($snippets as $snippet) {
533 if ((
int) $snippet[
'obj_id'] === (
int) $a_sub_id) {
534 return $snippet[
'title'];
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Class ilObject Basic functions for all objects.
static _lookupType(int $id, bool $reference=false)
static _exists(string $a_parent_type, int $a_id, string $a_lang="", bool $a_no_cache=false)
Checks whether page exists.
Tree class data representation in hierachical trees using the Nested Set Model with Gaps by Joe Celco...
setTreeTablePK(string $a_column_name)
set column containing primary key in tree table
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...
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
if(!file_exists('../ilias.ini.php'))