/** * Read pool data */ function read() { global $ilDB; parent::read(); $set = $ilDB->query("SELECT * FROM mep_data " . " WHERE id = " . $ilDB->quote($this->getId(), "integer")); if ($rec = $ilDB->fetchAssoc($set)) { $this->setDefaultWidth($rec["default_width"]); $this->setDefaultHeight($rec["default_height"]); } $this->tree = ilObjMediaPool::getPoolTree($this->getId()); }
/** * Constructor */ function __construct($a_parent_obj, $a_parent_cmd, $a_media_pool, $a_folder_par = "obj_id", $a_mode = ilMediaPoolTableGUI::IL_MEP_EDIT, $a_all_objects = false, $a_parent_tpl = null) { global $ilCtrl, $lng, $ilAccess, $lng; if ($a_parent_tpl == null) { $a_parent_tpl = $GLOBALS["tpl"]; } $this->parent_tpl = $a_parent_tpl; if ($a_all_objects) { $this->setId("mepall" . $a_parent_obj->object->getId()); } else { if (is_object($a_parent_obj->object)) { $this->setId("mepfold" . $a_parent_obj->object->getId()); } } parent::__construct($a_parent_obj, $a_parent_cmd); $this->setMode($a_mode); $this->all_objects = $a_all_objects; $lng->loadLanguageModule("mep"); $this->media_pool = $a_media_pool; $this->tree = ilObjMediaPool::getPoolTree($this->media_pool->getId()); $this->folder_par = $a_folder_par; if ($this->all_objects) { $this->setExternalSorting(true); $this->initFilter(); } // folder determination if ($_GET[$this->folder_par] > 0) { $this->current_folder = $_GET[$this->folder_par]; } else { if ($_SESSION["mep_pool_folder"] > 0 && $this->tree->isInTree($_SESSION["mep_pool_folder"])) { $this->current_folder = $_SESSION["mep_pool_folder"]; } else { $this->current_folder = $this->tree->getRootId(); } } $_SESSION["mep_pool_folder"] = $this->current_folder; $this->addColumn("", "", "1"); // checkbox $this->addColumn($lng->txt("mep_thumbnail"), "", "1"); $this->addColumn($lng->txt("mep_title_and_description"), "", "100%"); $this->setEnableHeader(true); $this->setFormAction($ilCtrl->getFormAction($a_parent_obj)); $this->setRowTemplate("tpl.mep_list_row.html", "Modules/MediaPool"); $this->getItems(); // title if ($this->current_folder != $this->tree->getRootId() && !$this->all_objects) { $node = $this->tree->getNodeData($this->current_folder); $this->setTitle($lng->txt("mep_choose_from_folder") . ": " . $node["title"], "icon_fold.svg", $node["title"]); } else { $this->setTitle($lng->txt("mep_choose_from_mep") . ": " . ilObject::_lookupTitle($this->media_pool->getId()), "icon_mep.svg", ilObject::_lookupTitle($this->media_pool->getId())); } // action commands if ($ilAccess->checkAccess("write", "", $this->media_pool->getRefId()) && $this->getMode() == ilMediaPoolTableGUI::IL_MEP_EDIT) { $this->addMultiCommand("copyToClipboard", $lng->txt("cont_copy_to_clipboard")); $this->addMultiCommand("confirmRemove", $lng->txt("remove")); if (!$this->all_objects) { /* $this->addCommandButton("createFolderForm", $lng->txt("mep_create_folder")); $this->addCommandButton("createMediaObject", $lng->txt("mep_create_mob")); $mset = new ilSetting("mobs"); if ($mset->get("mep_activate_pages")) { $this->addCommandButton("createMediaPoolPage", $lng->txt("mep_create_content_snippet")); }*/ } } if ($this->getMode() == ilMediaPoolTableGUI::IL_MEP_SELECT_SINGLE) { // ... even more coupling with ilpcmediaobjectgui $this->addMultiCommand("selectObjectReference", $lng->txt("cont_select")); } if ($this->getMode() == ilMediaPoolTableGUI::IL_MEP_EDIT && $ilAccess->checkAccess("write", "", $this->media_pool->getRefId())) { $this->setSelectAllCheckbox("id"); } }