/** * Get class name */ function _getName($a_id) { $name = ilPlugin::lookupNameForId(IL_COMP_SERVICE, "Repository", "robj", $a_id); if ($name != "") { return $name; } }
/** * * @param object $a_parent_class * @param string $a_parent_cmd * @return */ public function __construct($a_parent_class, $a_parent_cmd, $a_type) { global $lng, $ilCtrl, $ilUser, $objDefinition; parent::__construct($a_parent_class, $a_parent_cmd); $this->type = $a_type; $this->lng = $lng; $this->ctrl = $ilCtrl; if (!$objDefinition->isPlugin($this->type)) { $title = $this->lng->txt('obj_' . $this->type . '_duplicate'); } else { include_once "Services/Component/classes/class.ilPlugin.php"; $plugin = ilPlugin::getPluginObject(IL_COMP_SERVICE, "Repository", "robj", ilPlugin::lookupNameForId(IL_COMP_SERVICE, "Repository", "robj", $this->type)); $title = $plugin->txt('obj_' . $this->type . '_duplicate'); } $this->setTitle($title); $ilUser->getPref('search_max_hits'); $this->addColumn($this->lng->txt('search_title_description'), 'title', '99%'); $this->setEnableHeader(true); $this->setFormAction($ilCtrl->getFormAction($this->getParentObject())); $this->setRowTemplate("tpl.obj_copy_search_result_row.html", "Services/Object"); $this->setEnableTitle(true); $this->setEnableNumInfo(true); $this->setDefaultOrderField('title'); if ($objDefinition->isContainer($this->type)) { $this->addCommandButton('saveSource', $this->lng->txt('btn_next')); } else { $this->addCommandButton('saveSource', $title); } $this->addCommandButton('cancel', $this->lng->txt('btn_back')); }
/** * Constructor. */ function __construct($a_ref_id = 0, $a_id_type = self::REPOSITORY_NODE_ID, $a_parent_node_id = 0) { parent::__construct($a_ref_id, $a_id_type, $a_parent_node_id); $this->plugin = ilPlugin::getPluginObject(IL_COMP_SERVICE, "Repository", "robj", ilPlugin::lookupNameForId(IL_COMP_SERVICE, "Repository", "robj", $this->getType())); if (!is_object($this->plugin)) { die("ilObjectPluginGUI: Could not instantiate plugin object for type " . $this->getType() . "."); } }
/** * Constructor. */ function __construct($a_ref_id = 0) { $this->initType(); parent::__construct($a_ref_id, true); $this->plugin = ilPlugin::getPluginObject(IL_COMP_SERVICE, "Repository", "robj", ilPlugin::lookupNameForId(IL_COMP_SERVICE, "Repository", "robj", $this->getType())); if (!is_object($this->plugin)) { die("ilObjectPluginGUI: Could not instantiate plugin object for type " . $this->getType() . "."); } }
/** * initialisation */ final function init() { $this->delete_enabled = true; $this->cut_enabled = true; $this->subscribe_enabled = true; $this->link_enabled = true; $this->payment_enabled = false; $this->info_screen_enabled = true; $this->initType(); $this->plugin = ilPlugin::getPluginObject(IL_COMP_SERVICE, "Repository", "robj", ilPlugin::lookupNameForId(IL_COMP_SERVICE, "Repository", "robj", $this->getType())); $this->gui_class_name = $this->getGuiClass(); $this->commands = $this->initCommands(); }
/** * Forward command to plugin */ function forward() { global $ilCtrl; $type = ilObject::_lookupType($_GET["ref_id"], true); if ($type != "") { include_once "./Services/Component/classes/class.ilPlugin.php"; $pl_name = ilPlugin::lookupNameForId(IL_COMP_SERVICE, "Repository", "robj", $type); if ($pl_name != "") { $gui_cn = "ilObj" . $pl_name . "GUI"; $ilCtrl->setParameterByClass($gui_cn, "ref_id", $_GET["ref_id"]); $ilCtrl->redirectByClass($gui_cn, $_GET["forwardCmd"]); } } }
/** * Check whether a repository type is a plugin which has active learning progress * * @param string $a_type * @param bool $a_active_status * @return boolean */ static function isTypePluginWithLP($a_type, $a_active_status = true) { global $ilPluginAdmin; include_once "./Services/Component/classes/class.ilPlugin.php"; $pname = ilPlugin::lookupNameForId(IL_COMP_SERVICE, "Repository", "robj", $a_type); if ($pname == "") { return false; } if ($ilPluginAdmin->exists(IL_COMP_SERVICE, "Repository", "robj", $pname)) { if (!$a_active_status || $ilPluginAdmin->isActive(IL_COMP_SERVICE, "Repository", "robj", $pname)) { if ($ilPluginAdmin->hasLearningProgress(IL_COMP_SERVICE, "Repository", "robj", $pname)) { return true; } } } return false; }
/** * @param $string a_type * @param $string $a_size * @return string */ public static function _getIcon($a_type, $a_size) { return ilPlugin::_getImagePath(IL_COMP_SERVICE, 'Repository', 'robj', ilPlugin::lookupNameForId(IL_COMP_SERVICE, 'Repository', 'robj', $a_type), 'icon_' . $a_type . '.svg'); }
/** * Get navigation item stack. */ public function getItems() { global $tree, $ilDB, $ilUser, $objDefinition, $ilPluginAdmin; $items = array(); foreach ($this->items as $it) { if ($tree->isInTree($it["ref_id"]) && (!$objDefinition->isPluginTypeName($it["type"]) || $ilPluginAdmin->isActive(IL_COMP_SERVICE, "Repository", "robj", ilPlugin::lookupNameForId(IL_COMP_SERVICE, "Repository", "robj", $it["type"])))) { $items[$it["ref_id"] . ":" . $it["sub_obj_id"]] = $it; } } // less than 10? -> get items from db if (count($items) < 10 && $ilUser->getId() != ANONYMOUS_USER_ID) { $set = $ilDB->query("SELECT last_visited FROM usr_data " . " WHERE usr_id = " . $ilDB->quote($ilUser->getId(), "integer")); $rec = $ilDB->fetchAssoc($set); $db_entries = unserialize($rec["last_visited"]); $cnt = count($items); if (is_array($db_entries)) { foreach ($db_entries as $rec) { include_once "./Services/Link/classes/class.ilLink.php"; if ($cnt <= 10 && !isset($items[$rec["ref_id"] . ":" . $rec["sub_obj_id"]])) { if ($tree->isInTree($rec["ref_id"]) && (!$objDefinition->isPluginTypeName($rec["type"]) || $ilPluginAdmin->isActive(IL_COMP_SERVICE, "Repository", "robj", ilPlugin::lookupNameForId(IL_COMP_SERVICE, "Repository", "robj", $rec["type"])))) { $link = $rec["goto_link"] != "" ? $rec["goto_link"] : ilLink::_getLink($rec["ref_id"]); if ($rec["sub_obj_id"] != "") { $title = $rec["title"]; } else { $title = ilObject::_lookupTitle(ilObject::_lookupObjId($rec["ref_id"])); } $items[$rec["ref_id"] . ":" . $rec["sub_obj_id"]] = array("id" => $rec["ref_id"] . ":" . $rec["sub_obj_id"], "ref_id" => $rec["ref_id"], "link" => $link, "title" => $title, "type" => $rec["type"], "sub_obj_id" => $rec["sub_obj_id"], "goto_link" => $rec["goto_link"]); $cnt++; } } } } } //var_dump($items); return $items; }
static function _getIcon($a_type, $a_size) { return ilPlugin::_getImagePath(IL_COMP_SERVICE, "Repository", "robj", ilPlugin::lookupNameForId(IL_COMP_SERVICE, "Repository", "robj", $a_type), "icon_" . $a_type . ".svg"); }
/** * Show target selection * @return */ public function showTargetSelectionTree() { global $ilTabs, $ilToolbar, $ilCtrl, $tree, $tpl, $objDefinition; $this->tpl = $tpl; $this->tpl->addBlockfile('ADM_CONTENT', 'adm_content', 'tpl.paste_into_multiple_objects.html', "Services/Object"); ilUtil::sendInfo($this->lng->txt('msg_copy_clipboard')); include_once './Services/Object/classes/class.ilPasteIntoMultipleItemsExplorer.php'; $exp = new ilPasteIntoMultipleItemsExplorer(ilPasteIntoMultipleItemsExplorer::SEL_TYPE_RADIO, 'ilias.php?baseClass=ilRepositoryGUI&cmd=goto', 'paste_copy_repexpand'); $exp->setExpandTarget($ilCtrl->getLinkTarget($this, 'showTargetSelectionTree')); $exp->setTargetGet('ref_id'); $exp->setPostVar('target'); $exp->setCheckedItems(array((int) $_POST['target'])); // Filter to container foreach (array('cat', 'root', 'crs', 'grp', 'fold') as $container) { /* if($this->getType() == 'crs' and $container == 'crs') { continue; } */ $sub = $objDefinition->getSubObjects($container); if (!isset($sub[$this->getType()])) { $exp->removeFormItemForType($container); } } if ($_GET['paste_copy_repexpand'] == '') { $expanded = $tree->readRootId(); } else { $expanded = $_GET['paste_copy_repexpand']; } $this->tpl->setVariable('FORM_TARGET', '_self'); $this->tpl->setVariable('FORM_ACTION', $ilCtrl->getFormAction($this, 'copySelection')); $exp->setExpand($expanded); // build html-output $exp->setOutput(0); $output = $exp->getOutput(); $this->tpl->setVariable('OBJECT_TREE', $output); $this->tpl->setVariable('CMD_SUBMIT', 'saveTarget'); if ($objDefinition->isContainer($this->getType())) { $this->tpl->setVariable('TXT_SUBMIT', $this->lng->txt('btn_next')); } else { if (!$objDefinition->isPlugin($this->getType())) { $submit = $this->lng->txt('obj_' . $this->getType() . '_duplicate'); } else { // get plugin instance include_once "Services/Component/classes/class.ilPlugin.php"; $plugin = ilPlugin::getPluginObject(IL_COMP_SERVICE, "Repository", "robj", ilPlugin::lookupNameForId(IL_COMP_SERVICE, "Repository", "robj", $this->getType())); $submit = $plugin->txt('obj_' . $this->getType() . '_duplicate'); } $this->tpl->setVariable('TXT_SUBMIT', $submit); } $ilToolbar->addButton($this->lng->txt('cancel'), $ilCtrl->getLinkTarget($this, 'cancel')); }
function lookupNameForId($a_ctype, $a_cname, $a_slot_id, $a_plugin_id) { return parent::lookupNameForId($a_ctype, $a_cname, $a_slot_id, $a_plugin_id); // TODO: Change the autogenerated stub }
/** * Show target selection */ public function showTargetSelectionTree() { global $ilTabs, $ilToolbar, $ilCtrl, $tree, $tpl, $objDefinition, $lng; $this->tpl = $tpl; if ($objDefinition->isContainer($this->getType())) { ilUtil::sendInfo($this->lng->txt('msg_copy_clipboard_container')); } else { ilUtil::sendInfo($this->lng->txt('msg_copy_clipboard')); } // include_once "./Services/Repository/classes/class.ilRepositorySelectorExplorerGUI.php"; $exp = new ilRepositorySelectorExplorerGUI($this, "showTargetSelectionTree"); $exp->setTypeWhiteList(array("root", "cat", "grp", "crs", "fold")); $exp->setSelectMode("target", false); if ($exp->handleCommand()) { return; } $output = $exp->getHTML(); // toolbars $t = new ilToolbarGUI(); $t->setFormAction($ilCtrl->getFormAction($this, "saveTarget")); if ($objDefinition->isContainer($this->getType())) { $t->addFormButton($lng->txt("btn_next"), "saveTarget"); } else { $t->addFormButton($lng->txt("paste"), "saveTarget"); } $t->addSeparator(); $t->addFormButton($lng->txt("obj_insert_into_clipboard"), "keepObjectsInClipboard"); $t->addFormButton($lng->txt("cancel"), "cancel"); $t->setCloseFormTag(false); $t->setLeadingImage(ilUtil::getImagePath("arrow_upright.svg"), " "); $output = $t->getHTML() . $output; $t->setLeadingImage(ilUtil::getImagePath("arrow_downright.svg"), " "); $t->setCloseFormTag(true); $t->setOpenFormTag(false); $output .= "<br />" . $t->getHTML(); $this->tpl->setContent($output); return; // old implementation $this->tpl->addBlockfile('ADM_CONTENT', 'adm_content', 'tpl.paste_into_multiple_objects.html', "Services/Object"); include_once './Services/Object/classes/class.ilPasteIntoMultipleItemsExplorer.php'; $exp = new ilPasteIntoMultipleItemsExplorer(ilPasteIntoMultipleItemsExplorer::SEL_TYPE_RADIO, 'ilias.php?baseClass=ilRepositoryGUI&cmd=goto', 'paste_copy_repexpand'); // Target selection should check for create permission $required_perm = 'visible'; $create_perm = 'create_' . ilObject::_lookupType($this->getSource(), true); if ($create_perm) { $required_perm .= ',' . $create_perm; } $exp->setRequiredFormItemPermission($required_perm); $exp->setExpandTarget($ilCtrl->getLinkTarget($this, 'showTargetSelectionTree')); $exp->setTargetGet('ref_id'); $exp->setPostVar('target'); $exp->highlightNode($_GET['ref_id']); $exp->setCheckedItems(array((int) $_POST['target'])); // Filter to container foreach (array('cat', 'root', 'crs', 'grp', 'fold') as $container) { /* if($this->getType() == 'crs' and $container == 'crs') { continue; } */ $sub = $objDefinition->getSubObjects($container); if (!isset($sub[$this->getType()])) { $exp->removeFormItemForType($container); } } if ($_GET['paste_copy_repexpand'] == '') { $expanded = $tree->readRootId(); } else { $expanded = $_GET['paste_copy_repexpand']; } $this->tpl->setVariable('FORM_TARGET', '_self'); $this->tpl->setVariable('FORM_ACTION', $ilCtrl->getFormAction($this, 'copySelection')); $exp->setExpand($expanded); // build html-output $exp->setOutput(0); $output = $exp->getOutput(); $this->tpl->setVariable('OBJECT_TREE', $output); $this->tpl->setVariable('CMD_SUBMIT', 'saveTarget'); if ($objDefinition->isContainer($this->getType())) { $this->tpl->setVariable('TXT_SUBMIT', $this->lng->txt('btn_next')); } else { if (!$objDefinition->isPlugin($this->getType())) { $submit = $this->lng->txt('obj_' . $this->getType() . '_duplicate'); } else { // get plugin instance include_once "Services/Component/classes/class.ilPlugin.php"; $plugin = ilPlugin::getPluginObject(IL_COMP_SERVICE, "Repository", "robj", ilPlugin::lookupNameForId(IL_COMP_SERVICE, "Repository", "robj", $this->getType())); $submit = $plugin->txt('obj_' . $this->getType() . '_duplicate'); } $this->tpl->setVariable('TXT_SUBMIT', $submit); } $ilToolbar->addButton($this->lng->txt('cancel'), $ilCtrl->getLinkTarget($this, 'cancel')); }