From: Marcel Werk Date: Fri, 15 Apr 2016 13:11:59 +0000 (+0200) Subject: Added default tag cloud box controller X-Git-Tag: 3.0.0_Beta_1~1899 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=b78ec74e522150c80c2d96493b7c106ae89dac57;p=GitHub%2FWoltLab%2FWCF.git Added default tag cloud box controller --- diff --git a/wcfsetup/install/files/lib/system/box/TagCloudBoxController.class.php b/wcfsetup/install/files/lib/system/box/TagCloudBoxController.class.php new file mode 100644 index 0000000000..7067889547 --- /dev/null +++ b/wcfsetup/install/files/lib/system/box/TagCloudBoxController.class.php @@ -0,0 +1,71 @@ + + * @package com.woltlab.wcf + * @subpackage system.box + * @category Community Framework + */ +class TagCloudBoxController extends AbstractBoxController { + /** + * @inheritDoc + */ + protected $supportedPositions = ['footerBoxes', 'sidebarLeft', 'sidebarRight']; + + /** + * taggable object type + * @var string + */ + protected $objectType = ''; + + /** + * needed permission to view this box + * @var string + */ + protected $neededPermission = ''; + + /** + * @inheritDoc + */ + public function getTitle() { + return WCF::getLanguage()->get('wcf.tagging.tags'); + } + + /** + * @inheritDoc + */ + protected function loadContent() { + if (MODULE_TAGGING && WCF::getSession()->getPermission('user.tag.canViewTag') && (!$this->neededPermission || WCF::getSession()->getPermission($this->neededPermission))) { + $languageIDs = []; + if (LanguageFactory::getInstance()->multilingualismEnabled()) { + $languageIDs = WCF::getUser()->getLanguageIDs(); + } + + if ($this->objectType) { + $tagCloud = new TypedTagCloud($this->objectType, $languageIDs); + } + else { + $tagCloud = new TagCloud($languageIDs); + } + $tags = $tagCloud->getTags(); + + if (!empty($tags)) { + WCF::getTPL()->assign([ + 'tags' => $tags, + 'taggableObjectType' => $this->objectType + ]); + + $this->content = WCF::getTPL()->fetch('tagCloudBox'); + } + } + } +}