public function render(array &$a_html, $a_parent_gui) { global $lng; $all_tags = $this->getSubTreeTags(); if ($all_tags) { // see ilPDTaggingBlockGUI::getTagCloud(); $map = array("personal" => $lng->txt("tagging_my_tags"), "other" => $lng->txt("tagging_other_users")); foreach ($map as $type => $title) { $tags = $all_tags[$type]; if ($tags) { $max = 1; foreach ($tags as $tag => $counter) { $max = max($counter, $max); } reset($tags); $tpl = new ilTemplate("tpl.tag_cloud_block.html", true, true, "Services/Tagging"); $tpl->setCurrentBlock("tag_bl"); foreach ($tags as $tag => $counter) { $tpl->setVariable("TAG_TYPE", $type); $tpl->setVariable("TAG_TITLE", $tag); $tpl->setVariable("TAG_CODE", md5($tag)); $tpl->setVariable("REL_CLASS", ilTagging::getRelevanceClass($counter, $max)); if (is_array($this->selection[$type]) && in_array($tag, $this->selection[$type])) { $tpl->setVariable("HIGHL_CLASS", ' ilHighlighted'); } $tpl->parseCurrentBlock(); } $a_html[] = array("title" => $title, "html" => $tpl->get()); } } /* if($this->selection) { $a_html[] = array( "title" => "Related Tags", "html" => ":TODO:" ); } */ } }
/** * get tree bookmark list for personal desktop */ function getTagCloud() { global $ilCtrl, $ilUser; $showdetails = $this->getCurrentDetailLevel() > 2; $tpl = new ilTemplate("tpl.tag_cloud.html", true, true, "Services/Tagging"); $max = 1; foreach ($this->tags as $tag) { $max = max($tag["cnt"], $max); } reset($this->tags); foreach ($this->tags as $tag) { $tpl->setCurrentBlock("linked_tag"); $ilCtrl->setParameter($this, "tag", rawurlencode($tag["tag"])); $tpl->setVariable("HREF_TAG", $ilCtrl->getLinkTarget($this, "showResourcesForTag")); $tpl->setVariable("TAG_TITLE", $tag["tag"]); $tpl->setVariable("REL_CLASS", ilTagging::getRelevanceClass($tag["cnt"], $max)); $tpl->parseCurrentBlock(); } return $tpl->get(); }
/** * Build navigation by keywords block * * @param string $a_list_cmd * @param bool $a_show_inactive * @return string */ protected function renderNavigationByKeywords($a_list_cmd = "render", $a_show_inactive = false) { global $ilCtrl; $keywords = $this->getKeywords($a_show_inactive, $_GET["blpg"]); if ($keywords) { $wtpl = new ilTemplate("tpl.blog_list_navigation_keywords.html", true, true, "Modules/Blog"); $max = max($keywords); include_once "Services/Tagging/classes/class.ilTagging.php"; $wtpl->setCurrentBlock("keyword"); foreach ($keywords as $keyword => $counter) { $ilCtrl->setParameter($this, "kwd", urlencode($keyword)); // #15885 $url = $ilCtrl->getLinkTarget($this, $a_list_cmd); $ilCtrl->setParameter($this, "kwd", ""); $wtpl->setVariable("TXT_KEYWORD", $keyword); $wtpl->setVariable("CLASS_KEYWORD", ilTagging::getRelevanceClass($counter, $max)); $wtpl->setVariable("URL_KEYWORD", $url); $wtpl->parseCurrentBlock(); } return $wtpl->get(); } }
/** * Get Input HTML for Tagging of an object (and a user) */ function getAllUserTagsForObjectHTML() { global $lng, $ilCtrl; $ttpl = new ilTemplate("tpl.tag_cloud.html", true, true, "Services/Tagging"); $tags = ilTagging::getTagsForObject($this->obj_id, $this->obj_type, $this->sub_obj_id, $this->sub_obj_type); $max = 1; foreach ($tags as $tag) { $max = max($max, $tag["cnt"]); } reset($tags); foreach ($tags as $tag) { if (!$this->isForbidden($tag["tag"])) { $ttpl->setCurrentBlock("unlinked_tag"); $ttpl->setVariable("REL_CLASS", ilTagging::getRelevanceClass($tag["cnt"], $max)); $ttpl->setVariable("TAG_TITLE", $tag["tag"]); $ttpl->parseCurrentBlock(); } } return $ttpl->get(); }