4 require_once
"classes/class.ilObject.php";
5 require_once
"./Services/MetaData/classes/class.ilMDLanguageItem.php";
6 require_once(
"./Modules/Folder/classes/class.ilObjFolder.php");
7 require_once(
"./Modules/MediaPool/classes/class.ilMediaPoolItem.php");
35 $this->
ilObject($a_id,$a_call_by_reference);
45 $this->default_width = $a_val;
55 return $this->default_width;
65 $this->default_height = $a_val;
75 return $this->default_height;
87 $set = $ilDB->query(
"SELECT * FROM mep_data ".
88 " WHERE id = ".$ilDB->quote($this->getId(),
"integer")
90 if ($rec = $ilDB->fetchAssoc($set))
109 $tree->setTreeTablePK(
"mep_id");
110 $tree->setTableNames(
"mep_tree",
"mep_item");
124 $ilDB->manipulate(
"INSERT INTO mep_data ".
126 $ilDB->quote($this->getId(),
"integer").
131 $this->tree->setTreeTablePK(
"mep_id");
132 $this->tree->setTableNames(
'mep_tree',
'mep_item');
133 $this->tree->addTree($this->
getId(), 1);
155 if (!parent::update())
161 $ilDB->manipulate(
"UPDATE mep_data SET ".
162 " default_width = ".$ilDB->quote($this->getDefaultWidth(),
"integer").
",".
163 " default_height = ".$ilDB->quote($this->getDefaultHeight(),
"integer").
164 " WHERE id = ".$ilDB->quote($this->getId(),
"integer")
184 if (!parent::delete())
190 $childs = $this->tree->getSubTree($this->tree->getNodeData($this->tree->readRootId()));
193 $this->tree->removeTree($this->tree->getTreeId());
196 foreach ($childs as $child)
199 switch ($child[
"type"])
204 include_once(
"./Services/MediaObjects/classes/class.ilObjMediaObject.php");
247 return $roles ? $roles : array();
263 function notify($a_event,$a_ref_id,$a_parent_non_rbac_id,$a_node_id,$a_params = 0)
303 if ($a_node_id==
$_GET[
"ref_id"])
305 $parent_obj =& $this->ilias->obj_factory->getInstanceByRefId($a_node_id);
306 $parent_type = $parent_obj->getType();
307 if($parent_type == $this->
getType())
309 $a_node_id = (int) $tree->getParentId($a_node_id);
313 parent::notify($a_event,$a_ref_id,$a_parent_non_rbac_id,$a_node_id,$a_params);
327 $obj_id = $this->tree->getRootId();
330 if ($a_type ==
"fold" || $a_type ==
"")
332 $objs = $this->tree->getChildsByType($obj_id,
"fold");
334 if ($a_type ==
"mob" || $a_type ==
"")
336 $mobs = $this->tree->getChildsByType($obj_id,
"mob");
342 if ($a_type ==
"pg" || $a_type ==
"")
344 $pgs = $this->tree->getChildsByType($obj_id,
"pg");
346 foreach($pgs as
$key => $pg)
363 $obj_id = $this->tree->getRootId();
366 $objs = $this->tree->getFilteredChilds(array(
"fold",
"dummy"), $obj_id);
377 $query =
"SELECT DISTINCT mep_tree.*, object_data.* ".
378 "FROM mep_tree JOIN mep_item ON (mep_tree.child = mep_item.obj_id) ".
379 " JOIN object_data ON (mep_item.foreign_id = object_data.obj_id) ";
381 if ($a_format_filter !=
"")
383 $query.=
" JOIN media_item ON (media_item.mob_id = object_data.obj_id) ";
387 " WHERE mep_tree.mep_id = ".$ilDB->quote($this->
getId(),
"integer").
388 " AND object_data.type = ".$ilDB->quote(
"mob",
"text");
391 if (trim($a_title_filter) !=
"")
393 $query.=
" AND ".$ilDB->like(
"object_data.title",
"text",
"%".trim($a_title_filter).
"%");
395 if ($a_format_filter !=
"")
397 $filter = ($a_format_filter ==
"unknown")
400 $query.=
" AND ".$ilDB->equals(
"media_item.format",
$filter,
"text",
true);
404 " ORDER BY object_data.title";
407 $set = $ilDB->query(
$query);
408 while ($rec = $ilDB->fetchAssoc($set))
410 $rec[
"foreign_id"] = $rec[
"obj_id"];
424 $query =
"SELECT DISTINCT media_item.format f FROM mep_tree ".
425 " JOIN mep_item ON (mep_item.obj_id = mep_tree.child) ".
426 " JOIN object_data ON (mep_item.foreign_id = object_data.obj_id) ".
427 " JOIN media_item ON (media_item.mob_id = object_data.obj_id) ".
428 " WHERE mep_tree.mep_id = ".$ilDB->quote($this->
getId(),
"integer").
429 " AND object_data.type = ".$ilDB->quote(
"mob",
"text").
432 $set = $ilDB->query(
$query);
433 while ($rec = $ilDB->fetchAssoc($set))
437 $formats[$rec[
"f"]] = $rec[
"f"];
441 $formats[
"unknown"] = $lng->txt(
"mep_unknown");
454 if ($obj_id == $this->tree->getRootId())
459 return $this->tree->getParentId($obj_id);
469 if (!$this->tree->isInTree($a_obj_id))
471 $parent = ($a_parent ==
"")
472 ? $this->tree->getRootId()
474 $this->tree->insertNode($a_obj_id, $parent);
494 $node_data = $this->tree->getNodeData($obj_id);
495 $subtree = $this->tree->getSubtree($node_data);
498 if($this->tree->isInTree($obj_id))
500 $this->tree->deleteTree($node_data);
504 foreach ($subtree as $node)
507 if ($node[
"type"] ==
"mob")
516 if ($node[
"type"] ==
"fold")
525 if ($node[
"type"] ==
"pg")
527 include_once(
"./Modules/MediaPool/classes/class.ilMediaPoolPage.php");
535 include_once(
"./Modules/MediaPool/classes/class.ilMediaPoolItem.php");
551 $set = $ilDB->query(
"SELECT * FROM mep_tree JOIN mep_item ON (child = obj_id) WHERE ".
552 " foreign_id = ".$ilDB->quote($a_foreign_id,
"integer").
553 " AND mep_id = ".$ilDB->quote($a_pool_id,
"integer")
555 if ($rec = $ilDB->fetchAssoc($set))
569 $set = $ilDB->query(
"SELECT * FROM mep_tree WHERE child = ".
570 $ilDB->quote($a_item_id,
"integer").
571 " AND mep_id = ".$ilDB->quote($a_pool_id,
"integer"));
572 if ($rec = $ilDB->fetchAssoc($set))