/** * Fill data section */ function fillDataSection() { global $ilCtrl, $lng, $ilAccess; $tpl = new ilTemplate("tpl.wiki_side_block_content.html", true, true, "Modules/Wiki"); $wp = $this->getPageObject(); // info $actions[] = array("txt" => $lng->txt("info_short"), "href" => $ilCtrl->getLinkTargetByClass("ilobjwikigui", "infoScreen")); // recent changes $actions[] = array("txt" => $lng->txt("wiki_recent_changes"), "href" => $ilCtrl->getLinkTargetByClass("ilobjwikigui", "recentChanges")); foreach ($actions as $a) { $tpl->setCurrentBlock("action"); $tpl->setVariable("HREF", $a["href"]); $tpl->setVariable("TXT", $a["txt"]); $tpl->parseCurrentBlock(); $tpl->touchBlock("item"); } $actions = array(); // all pages $actions[] = array("txt" => $lng->txt("wiki_all_pages"), "href" => $ilCtrl->getLinkTargetByClass("ilobjwikigui", "allPages")); // new pages $actions[] = array("txt" => $lng->txt("wiki_new_pages"), "href" => $ilCtrl->getLinkTargetByClass("ilobjwikigui", "newPages")); // popular pages $actions[] = array("txt" => $lng->txt("wiki_popular_pages"), "href" => $ilCtrl->getLinkTargetByClass("ilobjwikigui", "popularPages")); // orphaned pages $actions[] = array("txt" => $lng->txt("wiki_orphaned_pages"), "href" => $ilCtrl->getLinkTargetByClass("ilobjwikigui", "orphanedPages")); // page lists include_once "./Services/UIComponent/AdvancedSelectionList/classes/class.ilAdvancedSelectionListGUI.php"; $list = new ilAdvancedSelectionListGUI(); $list->setListTitle($lng->txt("wiki_page_lists")); $list->setStyle(ilAdvancedSelectionListGUI::STYLE_LINK); $list->setId("wiki_pglists"); foreach ($actions as $a) { $list->addItem($a["txt"], "", $a["href"]); } $tpl->setCurrentBlock("plain"); $tpl->setVariable("PLAIN", $list->getHTML()); $tpl->parseCurrentBlock(); $tpl->touchBlock("item"); // page actions $list = new ilAdvancedSelectionListGUI(); $list->setStyle(ilAdvancedSelectionListGUI::STYLE_LINK); $list->setListTitle($lng->txt("wiki_page_actions")); $list->setId("wiki_pgactions"); if ($ilAccess->checkAccess("write", "", $_GET["ref_id"])) { // rating if (ilObjWiki::_lookupRating($this->getPageObject()->getWikiId())) { if (!$this->getPageObject()->getRating()) { $list->addItem($lng->txt("wiki_activate_page_rating"), "", $ilCtrl->getLinkTargetByClass("ilwikipagegui", "activateWikiPageRating")); } else { $list->addItem($lng->txt("wiki_deactivate_page_rating"), "", $ilCtrl->getLinkTargetByClass("ilwikipagegui", "deactivateWikiPageRating")); } } // unhide advmd? include_once "./Modules/Wiki/classes/class.ilWikiAdvMetaDataBlockGUI.php"; if (ilWikiAdvMetaDataBlockGUI::isActive($this->getPageObject()->getWikiId()) && ilWikiPage::lookupAdvancedMetadataHidden($this->getPageObject()->getId())) { $list->addItem($lng->txt("wiki_unhide_meta_adv_records"), "", $ilCtrl->getLinkTargetByClass("ilwikipagegui", "unhideAdvancedMetaData")); } } if ($ilAccess->checkAccess("edit_content", "", $_GET["ref_id"]) && !$this->getPageObject()->getBlocked() || $ilAccess->checkAccess("write", "", $_GET["ref_id"])) { // rename $list->addItem($lng->txt("wiki_rename_page"), "", $ilCtrl->getLinkTargetByClass("ilwikipagegui", "renameWikiPage")); } if ($ilAccess->checkAccess("write", "", $_GET["ref_id"])) { // block/unblock if ($this->getPageObject()->getBlocked()) { $list->addItem($lng->txt("wiki_unblock_page"), "", $ilCtrl->getLinkTargetByClass("ilwikipagegui", "unblockWikiPage")); } else { $list->addItem($lng->txt("wiki_block_page"), "", $ilCtrl->getLinkTargetByClass("ilwikipagegui", "blockWikiPage")); } // delete page $st_page = ilObjWiki::_lookupStartPage($this->getPageObject()->getParentId()); if ($st_page != $this->getPageObject()->getTitle()) { $list->addItem($lng->txt("wiki_delete_page"), "", $ilCtrl->getLinkTargetByClass("ilwikipagegui", "deleteWikiPageConfirmationScreen")); } include_once "Modules/Wiki/classes/class.ilWikiPageTemplate.php"; $wpt = new ilWikiPageTemplate($this->getPageObject()->getParentId()); if (!$wpt->isPageTemplate($this->getPageObject()->getId())) { $list->addItem($lng->txt("wiki_add_template"), "", $ilCtrl->getLinkTargetByClass("ilwikipagetemplategui", "addPageTemplateFromPageAction")); } else { $list->addItem($lng->txt("wiki_remove_template_status"), "", $ilCtrl->getLinkTargetByClass("ilwikipagetemplategui", "removePageTemplateFromPageAction")); } } if ($ilAccess->checkAccess("write", "", $_GET["ref_id"]) || $ilAccess->checkAccess("read", "", $_GET["ref_id"])) { $tpl->setCurrentBlock("plain"); $tpl->setVariable("PLAIN", $list->getHTML()); $tpl->parseCurrentBlock(); $tpl->touchBlock("item"); } // permissions // if ($ilAccess->checkAccess('edit_permission', "", $_GET["ref_id"])) // { // $actions[] = array( // "txt" => $lng->txt("perm_settings"), // "href" => $ilCtrl->getLinkTargetByClass(array("ilobjwikigui", "ilpermissiongui"), "perm") // ); // } $actions = array(); // settings if ($ilAccess->checkAccess('write', "", $_GET["ref_id"])) { // $actions[] = array( // "txt" => $lng->txt("settings"), // "href" => $ilCtrl->getLinkTargetByClass("ilobjwikigui", "editSettings") // ); $actions[] = array("txt" => $lng->txt("wiki_contributors"), "href" => $ilCtrl->getLinkTargetByClass("ilobjwikigui", "listContributors")); } // manage if ($ilAccess->checkAccess('write', "", $_GET["ref_id"])) { $actions[] = array("txt" => $lng->txt("settings"), "href" => $ilCtrl->getLinkTargetByClass("ilobjwikigui", "editSettings")); } else { if ($ilAccess->checkAccess('statistics_read', "", $_GET["ref_id"])) { $actions[] = array("txt" => $lng->txt("statistics"), "href" => $ilCtrl->getLinkTargetByClass(array("ilobjwikigui", "ilwikistatgui"), "initial")); } } foreach ($actions as $a) { $tpl->setCurrentBlock("action"); $tpl->setVariable("HREF", $a["href"]); $tpl->setVariable("TXT", $a["txt"]); $tpl->parseCurrentBlock(); $tpl->touchBlock("item"); } $this->setDataSection($tpl->get()); }
/** * Add new item selection to current page incl. toolbar (trigger) and overlay */ public function render() { global $ilToolbar, $tpl, $lng; if ($this->mode == ilObjectDefinition::MODE_WORKSPACE) { if (!$this->parsePersonalWorkspace()) { return; } } else { if (!$this->parseRepository()) { return; } } $ov_id = "il_add_new_item_ov"; $ov_trigger_id = $ov_id . "_tr"; include_once "./Services/UIComponent/AdvancedSelectionList/classes/class.ilAdvancedSelectionListGUI.php"; $adv = new ilAdvancedSelectionListGUI(); $adv->setListTitle($lng->txt("cntr_add_new_item")); $this->getHTML(); $adv->setGroupedList($this->gl); $adv->setStyle(ilAdvancedSelectionListGUI::STYLE_EMPH); $tpl->setVariable("SELECT_OBJTYPE_REPOS", $adv->getHTML()); //$ilToolbar->addDropDown($lng->txt("cntr_add_new_item"), $this->getHTML()); return; // toolbar include_once "Services/UIComponent/Button/classes/class.ilLinkButton.php"; $button = ilLinkButton::getInstance(); $button->setId($ov_trigger_id); $button->setCaption("cntr_add_new_item"); $button->setPrimary(true); $ilToolbar->addButtonInstance($button); // css? $tpl->setVariable("SELECT_OBJTYPE_REPOS", '<div id="' . $ov_id . '" style="display:none;" class="ilOverlay">' . $this->getHTML() . '</div>'); }
/** * Fill footer row */ function fillFooter() { global $lng, $ilCtrl, $ilUser; $footer = false; // select all checkbox if (strlen($this->getFormName()) && strlen($this->getSelectAllCheckbox()) && $this->dataExists()) { $this->tpl->setCurrentBlock("select_all_checkbox"); $this->tpl->setVariable("SELECT_ALL_TXT_SELECT_ALL", $lng->txt("select_all")); $this->tpl->setVariable("SELECT_ALL_CHECKBOX_NAME", $this->getSelectAllCheckbox()); $this->tpl->setVariable("SELECT_ALL_FORM_NAME", $this->getFormName()); $this->tpl->setVariable("CHECKBOXNAME", "chb_select_all_" . $this->unique_id); $this->tpl->parseCurrentBlock(); } // table footer numinfo if ($this->enabled["numinfo"] && $this->enabled["footer"]) { $start = $this->offset + 1; // compute num info if (!$this->dataExists()) { $start = 0; } $end = $this->offset + $this->limit; if ($end > $this->max_count or $this->limit == 0) { $end = $this->max_count; } if ($this->max_count > 0) { if ($this->lang_support) { $numinfo = "(" . $start . " - " . $end . " " . strtolower($this->lng->txt("of")) . " " . $this->max_count . ")"; } else { $numinfo = "(" . $start . " - " . $end . " of " . $this->max_count . ")"; } } if ($this->max_count > 0) { if ($this->getEnableNumInfo()) { $this->tpl->setCurrentBlock("tbl_footer_numinfo"); $this->tpl->setVariable("NUMINFO", $numinfo); $this->tpl->parseCurrentBlock(); } } $footer = true; } // table footer linkbar if ($this->enabled["linkbar"] && $this->enabled["footer"] && $this->limit != 0 && $this->max_count > 0) { $layout = array("link" => $this->footer_style, "prev" => $this->footer_previous, "next" => $this->footer_next); //if (!$this->getDisplayAsBlock()) //{ $linkbar = $this->getLinkbar("1"); $this->tpl->setCurrentBlock("tbl_footer_linkbar"); $this->tpl->setVariable("LINKBAR", $linkbar); $this->tpl->parseCurrentBlock(); $linkbar = true; //} $footer = true; } // column selector if (count($this->getSelectableColumns()) > 0) { $items = array(); foreach ($this->getSelectableColumns() as $k => $c) { $items[$k] = array("txt" => $c["txt"], "selected" => $this->isColumnSelected($k)); } include_once "./Services/UIComponent/CheckboxListOverlay/classes/class.ilCheckboxListOverlayGUI.php"; $cb_over = new ilCheckboxListOverlayGUI("tbl_" . $this->getId()); $cb_over->setLinkTitle($lng->txt("columns")); $cb_over->setItems($items); //$cb_over->setUrl("./ilias.php?baseClass=ilTablePropertiesStorage&table_id=". // $this->getId()."&cmd=saveSelectedFields&user_id=".$ilUser->getId()); $cb_over->setFormCmd($this->getParentCmd()); $cb_over->setFieldVar("tblfs" . $this->getId()); $cb_over->setHiddenVar("tblfsh" . $this->getId()); $cb_over->setSelectionHeaderClass("ilTableMenuItem"); $column_selector = $cb_over->getHTML(); $footer = true; } if ($this->getShowTemplates() && is_object($ilUser)) { // template handling if (isset($_REQUEST["tbltplcrt"]) && $_REQUEST["tbltplcrt"]) { if ($this->saveTemplate($_REQUEST["tbltplcrt"])) { ilUtil::sendSuccess($lng->txt("tbl_template_created")); } } else { if (isset($_REQUEST["tbltpldel"]) && $_REQUEST["tbltpldel"]) { if ($this->deleteTemplate($_REQUEST["tbltpldel"])) { ilUtil::sendSuccess($lng->txt("tbl_template_deleted")); } } } $create_id = "template_create_overlay_" . $this->getId(); $delete_id = "template_delete_overlay_" . $this->getId(); $list_id = "template_stg_" . $this->getId(); include_once "./Services/Table/classes/class.ilTableTemplatesStorage.php"; $storage = new ilTableTemplatesStorage(); $templates = $storage->getNames($this->getContext(), $ilUser->getId()); include_once "./Services/UIComponent/Overlay/classes/class.ilOverlayGUI.php"; // form to delete template if (sizeof($templates)) { $overlay = new ilOverlayGUI($delete_id); $overlay->setTrigger($list_id . "_delete"); $overlay->setAnchor("ilAdvSelListAnchorElement_" . $list_id); $overlay->setAutoHide(false); $overlay->add(); $lng->loadLanguageModule("form"); $this->tpl->setCurrentBlock("template_editor_delete_item"); $this->tpl->setVariable("TEMPLATE_DELETE_OPTION_VALUE", ""); $this->tpl->setVariable("TEMPLATE_DELETE_OPTION", "- " . $lng->txt("form_please_select") . " -"); $this->tpl->parseCurrentBlock(); foreach ($templates as $name) { $this->tpl->setVariable("TEMPLATE_DELETE_OPTION_VALUE", $name); $this->tpl->setVariable("TEMPLATE_DELETE_OPTION", $name); $this->tpl->parseCurrentBlock(); } $this->tpl->setCurrentBlock("template_editor_delete"); $this->tpl->setVariable("TEMPLATE_DELETE_ID", $delete_id); $this->tpl->setVariable("TXT_TEMPLATE_DELETE", $lng->txt("tbl_template_delete")); $this->tpl->setVariable("TXT_TEMPLATE_DELETE_SUBMIT", $lng->txt("delete")); $this->tpl->setVariable("TEMPLATE_DELETE_CMD", $this->parent_cmd); $this->tpl->parseCurrentBlock(); } // form to save new template $overlay = new ilOverlayGUI($create_id); $overlay->setTrigger($list_id . "_create"); $overlay->setAnchor("ilAdvSelListAnchorElement_" . $list_id); $overlay->setAutoHide(false); $overlay->add(); $this->tpl->setCurrentBlock("template_editor"); $this->tpl->setVariable("TEMPLATE_CREATE_ID", $create_id); $this->tpl->setVariable("TXT_TEMPLATE_CREATE", $lng->txt("tbl_template_create")); $this->tpl->setVariable("TXT_TEMPLATE_CREATE_SUBMIT", $lng->txt("save")); $this->tpl->setVariable("TEMPLATE_CREATE_CMD", $this->parent_cmd); $this->tpl->parseCurrentBlock(); // load saved template include_once "./Services/UIComponent/AdvancedSelectionList/classes/class.ilAdvancedSelectionListGUI.php"; $alist = new ilAdvancedSelectionListGUI(); $alist->setId($list_id); $alist->addItem($lng->txt("tbl_template_create"), "create", "#"); if (sizeof($templates)) { $alist->addItem($lng->txt("tbl_template_delete"), "delete", "#"); foreach ($templates as $name) { $ilCtrl->setParameter($this->parent_obj, $this->prefix . "_tpl", urlencode($name)); $alist->addItem($name, $name, $ilCtrl->getLinkTarget($this->parent_obj, $this->parent_cmd)); $ilCtrl->setParameter($this->parent_obj, $this->prefix . "_tpl", ""); } } $alist->setListTitle($lng->txt("tbl_templates")); $alist->setStyle(ilAdvancedSelectionListGUI::STYLE_LINK_BUTTON); $this->tpl->setVariable("TEMPLATE_SELECTOR", " " . $alist->getHTML()); } if ($footer) { $this->tpl->setCurrentBlock("tbl_footer"); $this->tpl->setVariable("COLUMN_COUNT", $this->getColumnCount()); if ($this->getDisplayAsBlock()) { $this->tpl->setVariable("BLK_CLASS", "Block"); } $this->tpl->parseCurrentBlock(); // top navigation, if number info or linkbar given if ($numinfo != "" || $linkbar != "" || $column_selector != "" || count($this->filters) > 0 || count($this->optional_filters) > 0) { if (is_object($ilUser) && (count($this->filters) || count($this->optional_filters))) { $this->tpl->setCurrentBlock("filter_activation"); $this->tpl->setVariable("TXT_ACTIVATE_FILTER", $lng->txt("show_filter")); $this->tpl->setVariable("FILA_ID", $this->getId()); if ($this->getId() != "") { $this->tpl->setVariable("SAVE_URLA", "./ilias.php?baseClass=ilTablePropertiesStorage&table_id=" . $this->getId() . "&cmd=showFilter&user_id=" . $ilUser->getId()); } $this->tpl->parseCurrentBlock(); if (!$this->getDisableFilterHiding()) { $this->tpl->setCurrentBlock("filter_deactivation"); $this->tpl->setVariable("TXT_HIDE", $lng->txt("hide_filter")); if ($this->getId() != "") { $this->tpl->setVariable("SAVE_URL", "./ilias.php?baseClass=ilTablePropertiesStorage&table_id=" . $this->getId() . "&cmd=hideFilter&user_id=" . $ilUser->getId()); $this->tpl->setVariable("FILD_ID", $this->getId()); } $this->tpl->parseCurrentBlock(); } } if ($numinfo != "" && $this->getEnableNumInfo()) { $this->tpl->setCurrentBlock("top_numinfo"); $this->tpl->setVariable("NUMINFO", $numinfo); $this->tpl->parseCurrentBlock(); } if ($linkbar != "" && !$this->getDisplayAsBlock()) { $linkbar = $this->getLinkbar("2"); $this->tpl->setCurrentBlock("top_linkbar"); $this->tpl->setVariable("LINKBAR", $linkbar); $this->tpl->parseCurrentBlock(); } // column selector $this->tpl->setVariable("COLUMN_SELECTOR", $column_selector); // row selector if ($this->getShowRowsSelector() && is_object($ilUser) && $this->getId() && $this->getLimit() < 9999) { include_once "./Services/UIComponent/AdvancedSelectionList/classes/class.ilAdvancedSelectionListGUI.php"; $alist = new ilAdvancedSelectionListGUI(); $alist->setStyle(ilAdvancedSelectionListGUI::STYLE_LINK_BUTTON); $alist->setId("sellst_rows_" . $this->getId()); $hpp = $ilUser->getPref("hits_per_page") != 9999 ? $ilUser->getPref("hits_per_page") : $lng->txt("unlimited"); $options = array(0 => $lng->txt("default") . " (" . $hpp . ")", 5 => 5, 10 => 10, 15 => 15, 20 => 20, 30 => 30, 40 => 40, 50 => 50, 100 => 100, 200 => 200, 400 => 400, 800 => 800); foreach ($options as $k => $v) { $ilCtrl->setParameter($this->parent_obj, $this->prefix . "_trows", $k); $alist->addItem($v, $k, $ilCtrl->getLinkTarget($this->parent_obj, $this->parent_cmd)); $ilCtrl->setParameter($this->parent_obj, $this->prefix . "_trows", ""); } $alist->setListTitle($this->getRowSelectorLabel() ? $this->getRowSelectorLabel() : $lng->txt("rows")); $this->tpl->setVariable("ROW_SELECTOR", $alist->getHTML()); } // export if (sizeof($this->export_formats) && $this->dataExists()) { include_once "./Services/UIComponent/AdvancedSelectionList/classes/class.ilAdvancedSelectionListGUI.php"; $alist = new ilAdvancedSelectionListGUI(); $alist->setStyle(ilAdvancedSelectionListGUI::STYLE_LINK_BUTTON); $alist->setId("sellst_xpt"); foreach ($this->export_formats as $format => $caption_lng_id) { $ilCtrl->setParameter($this->parent_obj, $this->prefix . "_xpt", $format); $url = $ilCtrl->getLinkTarget($this->parent_obj, $this->parent_cmd); $ilCtrl->setParameter($this->parent_obj, $this->prefix . "_xpt", ""); $alist->addItem($lng->txt($caption_lng_id), $format, $url); } $alist->setListTitle($lng->txt("export")); $this->tpl->setVariable("EXPORT_SELECTOR", " " . $alist->getHTML()); } $this->tpl->setCurrentBlock("top_navigation"); $this->tpl->setVariable("COLUMN_COUNT", $this->getColumnCount()); if ($this->getDisplayAsBlock()) { $this->tpl->setVariable("BLK_CLASS", "Block"); } $this->tpl->parseCurrentBlock(); } } }
/** * @param $root_node */ public function addToolbar($root_node) { global $lng, $ilToolbar, $ilLog; $create_list_gui = ilCloudConnector::getItemCreationListGUIClass($this->getService()); $list_gui_html = $create_list_gui->getGroupedListItemsHTML($this->getPermUploadItems(), $this->getPermCreateFolders()); if ($list_gui_html) { //toolbar $toolbar_locator = new ilLocatorGUI(); $toolbar_locator->addItem($this->getGuiClass()->object->getTitle(), ilCloudPluginFileTreeGUI::getLinkToFolder($root_node)); $ilToolbar->setId('xcld_toolbar'); $ilToolbar->addText("<div class='xcld_locator'>" . $toolbar_locator->getHtml() . "</div>"); $ilToolbar->addSeparator(); include_once "./Services/UIComponent/AdvancedSelectionList/classes/class.ilAdvancedSelectionListGUI.php"; $adv = new ilAdvancedSelectionListGUI(); $adv->setListTitle($lng->txt("cld_add_new_item")); $ilCloudGroupedListGUI = $create_list_gui->getGroupedListItems($this->getPermUploadItems(), $this->getPermCreateFolders()); if ($ilCloudGroupedListGUI->hasItems()) { $adv->setGroupedList($ilCloudGroupedListGUI); } $adv->setStyle(ilAdvancedSelectionListGUI::STYLE_EMPH); $ilToolbar->addText($adv->getHTML()); } }
/** * Fill header commands block */ function fillHeaderCommands() { global $lng, $ilCtrl; // header commands if (count($this->getHeaderCommands()) > 0 || $this->detail_max > $this->detail_min && $this->detail_min == 0 || $this->close_command != "") { foreach ($this->getHeaderCommands() as $command) { $this->tpl->setCurrentBlock("header_command"); $this->tpl->setVariable("HREF_HCOMM", $command["href"]); $this->tpl->setVariable("TXT_HCOMM", $command["text"]); $this->tpl->parseCurrentBlock(); } // close button if ($this->detail_max > $this->detail_min && $this->detail_min == 0 && !$this->getRepositoryMode() || $this->close_command != "") { $alt = $lng->txt("hide"); if ($this->close_command != "") { $url = $this->close_command; } else { $ilCtrl->setParameterByClass("ilcolumngui", $this->getDetailParameter(), "0"); $url = $ilCtrl->getLinkTargetByClass("ilcolumngui", ""); $ilCtrl->setParameterByClass("ilcolumngui", $this->getDetailParameter(), ""); } $this->dropdown[] = array("text" => $alt, "image" => $img, "href" => $url); } $this->tpl->setCurrentBlock("header_commands"); $this->tpl->parseCurrentBlock(); } // adv selection gui include_once "Services/UIComponent/AdvancedSelectionList/classes/class.ilAdvancedSelectionListGUI.php"; $dropdown = new ilAdvancedSelectionListGUI(); $dropdown->setUseImages(true); $dropdown->setStyle(ilAdvancedSelectionListGUI::STYLE_LINK_BUTTON); $dropdown->setHeaderIcon(ilAdvancedSelectionListGUI::ICON_CONFIG); $dropdown->setId("block_dd_" . $this->getBlockType() . "_" . $this->block_id); foreach ($this->dropdown as $item) { if ($item["href"] || $item["onclick"]) { if ($item["checked"]) { $item["image"] = ilUtil::getImagePath("icon_checked.svg"); } $dropdown->addItem($item["text"], "", $item["href"], $item["image"], $item["text"], "", "", false, $item["onclick"]); } } $dropdown = $dropdown->getHTML(); $this->tpl->setCurrentBlock("header_dropdown"); $this->tpl->setVariable("ADV_DROPDOWN", $dropdown); $this->tpl->parseCurrentBlock(); $this->tpl->setCurrentBlock("hitem"); $this->tpl->parseCurrentBlock(); }