/** * @see EventListener::execute() */ public function execute($eventObj, $className, $eventName) { if (MODULE_TAGGING == 1 && SEARCH_ENABLE_TAGS == 1) { // include files require_once WCF_DIR . 'lib/data/tag/TagCloud.class.php'; // get tags $tagCloud = new TagCloud(WCF::getSession()->getVisibleLanguageIDArray()); $tags = $tagCloud->getTags(); if (count($tags)) { WCF::getTPL()->assign('tags', $tags); WCF::getTPL()->append('additionalBoxes1', WCF::getTPL()->fetch('searchFormTagCloud')); } } }
/** * Prints tag cloud for attribute <code>attribute</code> to <code>$wgOut</code> * * @param $attribute String: attribute */ private function printTagCloud($attribute) { global $wgOut; try { $tagCloud = new TagCloud($attribute); // Context menu $wgOut->addHTML('<ul id="fptc_contextMenu" class="contextMenu"> <li class="browse"> <a href="#browse">' . wfMsg('fptc-context-menu-browse') . '</a> </li> <li class="fptc_suggestions separator"> ' . wfMsg('fptc-context-menu-similar-tags') . ' </li> </ul>'); // Print tags foreach ($tagCloud->getTags() as $tag) { $this->printTag($tag, $attribute); } $wgOut->addHTML('<div style="clear:both"></div>'); } catch (InvalidAttributeException $e) { if ($attribute) { // Attribute not found -> show error $wgOut->addHTML('<span style="color:red; font-weight:bold;">' . wfMsg('fptc-invalid-attribute') . '</span>'); } } }
/** * @see Page::readData(); */ public function readData() { parent::readData(); if ($this->tagObj) { // get tagged objects if ($this->taggableID == 0) { // get objects for overview $this->taggedObjects = TagEngine::getInstance()->getGroupedTaggedObjectsByTagID($this->tagObj->getID()); } else { $this->taggedObjects = $this->taggable->getObjectsByTagID($this->tagObj->getID(), $this->itemsPerPage, ($this->pageNo - 1) * $this->itemsPerPage); } } // get tags $tagCloud = new TagCloud(WCF::getSession()->getVisibleLanguageIDArray()); $this->tags = $tagCloud->getTags($this->tagObj !== null ? 50 : 500); }
/** * Reads the tags of this board. */ protected function readTags() { // include files require_once WCF_DIR . 'lib/data/tag/TagCloud.class.php'; // get tags $tagCloud = new TagCloud(WCF::getSession()->getVisibleLanguageIDArray()); $this->tags = $tagCloud->getTags(); }