/** * 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("FONT_SIZE", ilTagging::calculateFontSize($tag["cnt"], $max) . "%"); $ttpl->setVariable("TAG_TITLE", $tag["tag"]); $ttpl->parseCurrentBlock(); } } return $ttpl->get(); }
/** * Build navigation block * * @param array $items * @param string $a_list_cmd * @param string $a_posting_cmd * @param bool $a_link_template * @param bool $a_show_inactive * @return string */ function renderNavigation(array $items, $a_list_cmd = "render", $a_posting_cmd = "preview", $a_link_template = null, $a_show_inactive = false) { global $ilCtrl, $ilSetting; $max_detail_postings = 10; $wtpl = new ilTemplate("tpl.blog_list_navigation.html", true, true, "Modules/Blog"); $wtpl->setVariable("NAVIGATION_TITLE", $this->lng->txt("blog_navigation")); $ilCtrl->setParameter($this, "blpg", ""); include_once "Services/Calendar/classes/class.ilCalendarUtil.php"; $counter = 0; foreach ($items as $month => $postings) { $month_name = ilCalendarUtil::_numericMonthToString((int) substr($month, 5)) . " " . substr($month, 0, 4); if (!$a_link_template) { $ilCtrl->setParameter($this, "bmn", $month); $month_url = $ilCtrl->getLinkTarget($this, $a_list_cmd); } else { $month_url = $this->buildExportLink($a_link_template, "list", $month); } // list postings for month if ($counter < $max_detail_postings) { foreach ($postings as $id => $posting) { $is_active = ilBlogPosting::_lookupActive($id, "blp"); if (!$is_active && !$a_show_inactive) { continue; } $counter++; $caption = $posting["title"]; if (!$a_link_template) { $ilCtrl->setParameterByClass("ilblogpostinggui", "bmn", $month); $ilCtrl->setParameterByClass("ilblogpostinggui", "blpg", $id); $url = $ilCtrl->getLinkTargetByClass("ilblogpostinggui", $a_posting_cmd); } else { $url = $this->buildExportLink($a_link_template, "posting", $id); } if (!$is_active) { $wtpl->setVariable("NAV_ITEM_DRAFT", $this->lng->txt("blog_draft")); } else { if ($this->object->hasApproval() && !$posting["approved"]) { $wtpl->setVariable("NAV_ITEM_APPROVAL", $this->lng->txt("blog_needs_approval")); } } $wtpl->setCurrentBlock("navigation_item"); $wtpl->setVariable("NAV_ITEM_URL", $url); $wtpl->setVariable("NAV_ITEM_CAPTION", $caption); $wtpl->parseCurrentBlock(); } $wtpl->setCurrentBlock("navigation_month_details"); $wtpl->setVariable("NAV_MONTH", $month_name); $wtpl->setVariable("URL_MONTH", $month_url); $wtpl->parseCurrentBlock(); } else { $wtpl->setCurrentBlock("navigation_month"); $wtpl->setVariable("MONTH_NAME", $month_name); $wtpl->setVariable("URL_MONTH", $month_url); $wtpl->setVariable("MONTH_COUNT", sizeof($postings)); $wtpl->parseCurrentBlock(); } } $ilCtrl->setParameter($this, "bmn", $this->month); $ilCtrl->setParameterByClass("ilblogpostinggui", "bmn", ""); // authors if ($this->id_type == self::REPOSITORY_NODE_ID) { $authors = array(); foreach ($this->items as $month => $items) { foreach ($items as $item) { if (($a_show_inactive || ilBlogPosting::_lookupActive($item["id"], "blp")) && $item["author"]) { $authors[] = $item["author"]; } } } $authors = array_unique($authors); if (sizeof($authors) > 1) { include_once "Services/User/classes/class.ilUserUtil.php"; $list = array(); foreach ($authors as $user_id) { if ($user_id) { $ilCtrl->setParameter($this, "ath", $user_id); $url = $ilCtrl->getLinkTarget($this, $a_list_cmd); $ilCtrl->setParameter($this, "ath", ""); $name = ilUserUtil::getNamePresentation($user_id, true); $idx = trim(strip_tags($name)) . "///" . $user_id; // #10934 $list[$idx] = array($name, $url); } } ksort($list); $wtpl->setVariable("AUTHORS_TITLE", $this->lng->txt("blog_authors")); $wtpl->setCurrentBlock("author"); foreach ($list as $author) { $wtpl->setVariable("TXT_AUTHOR", $author[0]); $wtpl->setVariable("URL_AUTHOR", $author[1]); $wtpl->parseCurrentBlock(); } } } if (!$a_link_template) { // keywords $may_edit_keywords = $_GET["blpg"] && $this->mayContribute($_GET["blpg"]) && !$a_link_template && $a_list_cmd != "preview" && $a_list_cmd != "gethtml"; $keywords = $this->getKeywords($a_show_inactive, $_GET["blpg"]); if ($keywords || $may_edit_keywords) { $wtpl->setVariable("KEYWORDS_TITLE", $this->lng->txt("blog_keywords")); if ($keywords) { $max = max($keywords); include_once "Services/Tagging/classes/class.ilTagging.php"; $wtpl->setCurrentBlock("keyword"); foreach ($keywords as $keyword => $counter) { $ilCtrl->setParameter($this, "kwd", $keyword); $url = $ilCtrl->getLinkTarget($this, $a_list_cmd); $ilCtrl->setParameter($this, "kwd", ""); $wtpl->setVariable("TXT_KEYWORD", $keyword); $wtpl->setVariable("SIZE_KEYWORD", ilTagging::calculateFontSize($counter, $max)); $wtpl->setVariable("URL_KEYWORD", $url); $wtpl->parseCurrentBlock(); } } else { $wtpl->setVariable("TXT_NO_KEYWORDS", $this->lng->txt("blog_no_keywords")); } if ($may_edit_keywords) { $ilCtrl->setParameterByClass("ilblogpostinggui", "blpg", $_GET["blpg"]); $wtpl->setVariable("URL_EDIT_KEYWORDS", $ilCtrl->getLinkTargetByClass("ilblogpostinggui", "editKeywords")); $ilCtrl->setParameterByClass("ilblogpostinggui", "blpg", ""); $wtpl->setVariable("TXT_EDIT_KEYWORDS", $this->lng->txt("blog_edit_keywords")); } } // rss if ($this->object->hasRSS() && $ilSetting->get('enable_global_profiles') && $a_list_cmd == "preview") { // #10827 $blog_id = $this->node_id; if ($this->id_type != self::WORKSPACE_NODE_ID) { $blog_id .= "_cll"; } $url = ILIAS_HTTP_PATH . "/feed.php?blog_id=" . $blog_id . "&client_id=" . rawurlencode(CLIENT_ID); $wtpl->setCurrentBlock("rss"); $wtpl->setVariable("URL_RSS", $url); $wtpl->setVariable("IMG_RSS", ilUtil::getImagePath("rss.png")); $wtpl->parseCurrentBlock(); } } return $wtpl->get(); }
/** * 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("FONT_SIZE", ilTagging::calculateFontSize($tag["cnt"], $max) . "%"); $tpl->parseCurrentBlock(); } $tpl->setVariable("CLOUD_STYLE", ' class="small" '); return $tpl->get(); }