Last active
July 18, 2016 14:09
-
-
Save farmerbradllc/fd3d658459482be7cf331bcc567e5648 to your computer and use it in GitHub Desktop.
ADT for Message Boards
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#set ($layoutLocalService = $serviceLocator.findService("com.liferay.portal.service.LayoutLocalService")) | |
#set ($assetTagLocalService = $serviceLocator.findService("com.liferay.portlet.asset.service.AssetTagLocalService")) | |
#set ($assetCategoryLocalService = $serviceLocator.findService("com.liferay.portlet.asset.service.AssetCategoryLocalService")) | |
#set ($currentPlid = $getterUtil.getLong($themeDisplay.get('plid'))) | |
#set ($pageName = $layoutLocalService.getLayout($currentPlid).name) | |
#set ($pageName = $themeDisplay.getLayout().getName($locale)) | |
#set ($MBCategoryLocalService = $serviceLocator.findService("com.liferay.portlet.messageboards.service.MBCategoryLocalService")) | |
#set ($MBThreadLocalService = $serviceLocator.findService("com.liferay.portlet.messageboards.service.MBThreadLocalService")) | |
#set ($MBMessageLocalService = $serviceLocator.findService("com.liferay.portlet.messageboards.service.MBMessageLocalService")) | |
#set ($MBStatsUserLocalService = $serviceLocator.findService("com.liferay.portlet.messageboards.service.MBStatsUserLocalService")) | |
#set ($userLocalService = $serviceLocator.findService("com.liferay.portal.service.UserLocalService")) | |
<div class="my-communication list forums"> | |
<div class="title"> | |
<h2>$languageUtil.get($locale, "my-forums")</h2> | |
</div> | |
#set ($categoryUrl= "") | |
#foreach ($MBcategory in $MBCategoryLocalService.getCategories($groupId)) | |
#set ($MBCategoryName = $MBcategory.name) | |
#set ($MBCategoryId = $MBcategory.categoryId) | |
#set ($ThreadCount = $MBThreadLocalService.getCategoryThreadsCount($groupId, $MBCategoryId, 0)) | |
#if ($ThreadCount > 0) | |
#set ($MBMessage = $MBMessageLocalService.getCategoryMessages($groupId, $MBCategoryId, 0, 0, 1).get(0)) | |
#end | |
#if ($MBCategoryName == "Business Operations") | |
#set ($categoryUrl = "business-operations-forums") | |
#elseif($MBCategoryName == "Product") | |
#set ($categoryUrl = "product-forums") | |
#elseif($MBCategoryName == "Foundation") | |
#set ($categoryUrl = "foundation-forums") | |
#elseif ($MBCategoryName == "Marketing") | |
#set ($categoryUrl = "marketing-forums") | |
#elseif ($MBCategoryName == "Training") | |
#set ($categoryUrl = "training-forums") | |
#else | |
#set ($categoryUrl = "") | |
#end | |
#if ($MBMessage) | |
#set ($MBMessageDate = $dateTool.format("MMM dd,yyy",$dateTool.toDate("EEE, dd MMM yyyy hh:mm:ss Z", $MBMessage.modifiedDate, $localeUtil.getDefault()))) | |
#set ($MBUserId = $MBMessage.userId) | |
#set ($screenName = $userLocalService.getUser($MBUserId).screenName) | |
#set ($MBMessageId = $MBMessage.messageId) | |
#set ($MBMessageSubject = $MBMessage.subject) | |
#set ($MBMessageBody = $MBMessage.body) | |
#if ($MBMessageId) | |
#set ($messageUrl = $categoryUrl + "/-/message_boards/message/" + $MBMessageId) | |
#end | |
#end | |
#set ($categoryUrl = $categoryUrl + "/-/message_boards/category/" + $MBCategoryId) | |
<div class="item"> | |
<div class="row-fluid"> | |
<div class="span3"> | |
$MBMessageDate | |
<p> | |
<a href="profile?profile=$screenName">$screenName</a> | |
</p> | |
</div> | |
<div class="span9"> | |
#if ($ThreadCount > 0) | |
<h3><a href="$categoryUrl">$stringUtil.shorten($MBCategoryName,50)</a></h3> | |
#if ($MBMessage) | |
<h4><a href="$messageUrl">$stringUtil.shorten($MBMessageSubject,50)</a></h4> | |
<p> | |
$MBMessageBody | |
</p> | |
<a class="read-more" href="$messageUrl">Read More »</a> | |
#end | |
#else | |
<h3><a href="$categoryUrl">$stringUtil.shorten($MBCategoryName,50)</a></h3> | |
<p>Currently there are no messages in this category.</p> | |
#end | |
</div> | |
</div> | |
</div> | |
#end | |
</div> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment