/** * Side column */ static function renderSideBlock($a_wpg_id, $a_wiki_ref_id, $a_wp = null) { global $tpl, $lng; if ($a_wpg_id > 0 && !$a_wp) { include_once "./Modules/Wiki/classes/class.ilWikiPage.php"; $a_wp = ilWikiPage($a_wpg_id); } // search block include_once "./Modules/Wiki/classes/class.ilWikiSearchBlockGUI.php"; $wiki_search_block = new ilWikiSearchBlockGUI(); $rcontent = $wiki_search_block->getHTML(); // quick navigation if ($a_wpg_id > 0) { // include_once("./Modules/Wiki/classes/class.ilWikiSideBlockGUI.php"); // $wiki_side_block = new ilWikiSideBlockGUI(); // $wiki_side_block->setPageObject($a_wp); // $rcontent.= $wiki_side_block->getHTML(); // rating $wiki_id = ilObject::_lookupObjId($a_wiki_ref_id); if (ilObjWiki::_lookupRating($wiki_id) && $a_wp->getRating()) { include_once "./Services/Rating/classes/class.ilRatingGUI.php"; $rgui = new ilRatingGUI(); $rgui->setObject($wiki_id, "wiki", $a_wpg_id, "wpg"); $rgui->enableCategories(ilObjWiki::_lookupRatingCategories($wiki_id)); $rgui->setYourRatingText("#"); $rcontent .= $rgui->getBlockHTML($lng->txt("wiki_rate_page")); } // advanced metadata include_once "./Modules/Wiki/classes/class.ilWikiAdvMetaDataBlockGUI.php"; if (ilWikiAdvMetaDataBlockGUI::isActive($wiki_id)) { $rec_ids = ilWikiAdvMetaDataBlockGUI::getRecords($wiki_id); foreach ($rec_ids as $record) { $advmd_pages_block = new ilWikiAdvMetaDataBlockGUI($record); $advmd_pages_block->setObject($a_wiki_ref_id, $wiki_id, $a_wpg_id); $rcontent .= $advmd_pages_block->getHTML(); } } } // important pages // if (ilObjWiki::_lookupImportantPages(ilObject::_lookupObjId($a_wiki_ref_id))) // { include_once "./Modules/Wiki/classes/class.ilWikiImportantPagesBlockGUI.php"; $imp_pages_block = new ilWikiImportantPagesBlockGUI(); $rcontent .= $imp_pages_block->getHTML(); // } // wiki functions block if ($a_wpg_id > 0) { include_once "./Modules/Wiki/classes/class.ilWikiFunctionsBlockGUI.php"; $wiki_functions_block = new ilWikiFunctionsBlockGUI(); $wiki_functions_block->setPageObject($a_wp); $rcontent .= $wiki_functions_block->getHTML(); } $tpl->setRightContent($rcontent); }
function addHeaderAction($a_redraw = false) { global $ilUser, $ilAccess; include_once "Services/Object/classes/class.ilCommonActionDispatcherGUI.php"; $dispatcher = new ilCommonActionDispatcherGUI(ilCommonActionDispatcherGUI::TYPE_REPOSITORY, $ilAccess, "wiki", $_GET["ref_id"], $this->getPageObject()->getParentId()); $dispatcher->setSubObject("wpg", $this->getPageObject()->getId()); include_once "Services/Object/classes/class.ilObjectListGUI.php"; ilObjectListGUI::prepareJSLinks($this->ctrl->getLinkTarget($this, "redrawHeaderAction", "", true), $this->ctrl->getLinkTargetByClass(array("ilcommonactiondispatchergui", "ilnotegui"), "", "", true, false), $this->ctrl->getLinkTargetByClass(array("ilcommonactiondispatchergui", "iltagginggui"), "", "", true, false)); $lg = $dispatcher->initHeaderAction(); $lg->enableNotes(true); $lg->enableComments(ilObjWiki::_lookupPublicNotes($this->getPageObject()->getParentId()), false); // notification if ($ilUser->getId() != ANONYMOUS_USER_ID) { include_once "./Services/Notification/classes/class.ilNotification.php"; if (ilNotification::hasNotification(ilNotification::TYPE_WIKI, $ilUser->getId(), $this->getPageObject()->getParentId())) { $this->ctrl->setParameter($this, "ntf", 1); $lg->addCustomCommand($this->ctrl->getLinkTarget($this), "wiki_notification_deactivate_wiki"); $lg->addHeaderIcon("not_icon", ilUtil::getImagePath("notification_on.png"), $this->lng->txt("wiki_notification_activated")); } else { $this->ctrl->setParameter($this, "ntf", 2); $lg->addCustomCommand($this->ctrl->getLinkTarget($this), "wiki_notification_activate_wiki"); if (ilNotification::hasNotification(ilNotification::TYPE_WIKI_PAGE, $ilUser->getId(), $this->getPageObject()->getId())) { $this->ctrl->setParameter($this, "ntf", 3); $lg->addCustomCommand($this->ctrl->getLinkTarget($this), "wiki_notification_deactivate_page"); $lg->addHeaderIcon("not_icon", ilUtil::getImagePath("notification_on.png"), $this->lng->txt("wiki_page_notification_activated")); } else { $this->ctrl->setParameter($this, "ntf", 4); $lg->addCustomCommand($this->ctrl->getLinkTarget($this), "wiki_notification_activate_page"); $lg->addHeaderIcon("not_icon", ilUtil::getImagePath("notification_off.png"), $this->lng->txt("wiki_notification_deactivated")); } } $this->ctrl->setParameter($this, "ntf", ""); } // rating $wiki_id = $this->getPageObject()->getParentId(); if (ilObjWiki::_lookupRating($wiki_id) && $this->getPageObject()->getRating() && $this->getPageObject()->old_nr == 0) { include_once "./Services/Rating/classes/class.ilRatingGUI.php"; $rating_gui = new ilRatingGUI(); $rating_gui->setObject($this->getPageObject()->getParentId(), "wiki", $this->getPageObject()->getId(), "wpg"); $rating_gui->setYourRatingText($this->lng->txt("wiki_rate_page")); $rating_gui->enableCategories(ilObjWiki::_lookupRatingCategories($wiki_id)); $lg->addHeaderIconHTML("rating", $this->ctrl->getHtml($rating_gui)); } if (!$a_redraw) { $this->tpl->setHeaderActionMenu($lg->getHeaderAction()); } else { return $lg->getHeaderAction(); } }
/** * Get header action * * @return string */ function getHeaderAction() { global $ilUser, $lng, $tpl; $htpl = new ilTemplate("tpl.header_action.html", true, true, "Services/Repository"); $redraw_js = "il.Object.redrawActionHeader();"; // tags if ($this->tags_enabled) { include_once "./Services/Tagging/classes/class.ilTagging.php"; $tags = ilTagging::getTagsForUserAndObject($this->obj_id, ilObject::_lookupType($this->obj_id), 0, "", $ilUser->getId()); if (count($tags) > 0) { include_once "./Services/Tagging/classes/class.ilTaggingGUI.php"; $lng->loadLanguageModule("tagging"); $this->addHeaderIcon("tags", ilUtil::getImagePath("icon_tag.svg"), $lng->txt("tagging_tags") . ": " . count($tags), ilTaggingGUI::getListTagsJSCall($this->ajax_hash, $redraw_js), count($tags)); } } // notes and comments $comments_enabled = $this->isCommentsActivated($this->type, $this->ref_id, $this->obj_id, true, false); if ($this->notes_enabled || $comments_enabled) { include_once "./Services/Notes/classes/class.ilNote.php"; include_once "./Services/Notes/classes/class.ilNoteGUI.php"; $cnt = ilNote::_countNotesAndComments($this->obj_id, $this->sub_obj_id); if ($this->notes_enabled && $cnt[$this->obj_id][IL_NOTE_PRIVATE] > 0) { $this->addHeaderIcon("notes", ilUtil::getImagePath("note_unlabeled.svg"), $lng->txt("private_notes") . ": " . $cnt[$this->obj_id][IL_NOTE_PRIVATE], ilNoteGUI::getListNotesJSCall($this->ajax_hash, $redraw_js), $cnt[$this->obj_id][IL_NOTE_PRIVATE]); } if ($comments_enabled && $cnt[$this->obj_id][IL_NOTE_PUBLIC] > 0) { $lng->loadLanguageModule("notes"); $this->addHeaderIcon("comments", ilUtil::getImagePath("comment_unlabeled.svg"), $lng->txt("notes_public_comments") . ": " . $cnt[$this->obj_id][IL_NOTE_PUBLIC], ilNoteGUI::getListCommentsJSCall($this->ajax_hash, $redraw_js), $cnt[$this->obj_id][IL_NOTE_PUBLIC]); } } // rating if ($this->rating_enabled) { include_once "./Services/Rating/classes/class.ilRatingGUI.php"; $rating_gui = new ilRatingGUI(); $rating_gui->enableCategories($this->rating_categories_enabled); // never rate sub objects from header action! $rating_gui->setObject($this->obj_id, $this->type); if ($this->rating_text) { $rating_gui->setYourRatingText($this->rating_text); } $this->ctrl->setParameterByClass("ilRatingGUI", "cadh", $this->ajax_hash); $this->ctrl->setParameterByClass("ilRatingGUI", "rnsb", true); if ($this->rating_ctrl_path) { $rating_gui->setCtrlPath($this->rating_ctrl_path); $ajax_url = $this->ctrl->getLinkTargetByClass($this->rating_ctrl_path, "saveRating", "", true, false); } else { // ??? $ajax_url = $this->ctrl->getLinkTargetByClass("ilRatingGUI", "saveRating", "", true, false); } $tpl->addOnLoadCode("il.Object.setRatingUrl('" . $ajax_url . "');"); $this->addHeaderIconHTML("rating", $rating_gui->getHtml(true, $this->checkCommandAccess("read", "", $this->ref_id, $this->type), "il.Object.saveRating(%rating%);")); } if ($this->header_icons) { include_once "./Services/UIComponent/Tooltip/classes/class.ilTooltipGUI.php"; $chunks = array(); foreach ($this->header_icons as $id => $attr) { $id = "headp_" . $id; if (is_array($attr)) { if ($attr["onclick"]) { $htpl->setCurrentBlock("onclick"); $htpl->setVariable("PROP_ONCLICK", $attr["onclick"]); $htpl->parseCurrentBlock(); } if ($attr["status_text"]) { $htpl->setCurrentBlock("status"); $htpl->setVariable("PROP_TXT", $attr["status_text"]); $htpl->parseCurrentBlock(); } if (!$attr["href"]) { $attr["href"] = "#"; } $htpl->setCurrentBlock("prop"); $htpl->setVariable("PROP_ID", $id); $htpl->setVariable("IMG", ilUtil::img($attr["img"])); $htpl->setVariable("PROP_HREF", $attr["href"]); $htpl->parseCurrentBlock(); if ($attr["tooltip"]) { ilTooltipGUI::addTooltip($id, $attr["tooltip"]); } } else { $chunks[] = $attr; } } if (sizeof($chunks)) { $htpl->setVariable("PROP_CHUNKS", implode(" ", $chunks) . " "); } } $htpl->setVariable("ACTION_DROP_DOWN", $this->insertCommands(false, false, "", true)); return $htpl->get(); }