META-INF.resources.view.jsp Maven / Gradle / Ivy
The newest version!
<%--
/**
* Copyright (c) 2000-present Liferay, Inc. All rights reserved.
*
* This library is free software; you can redistribute it and/or modify it under
* the terms of the GNU Lesser General Public License as published by the Free
* Software Foundation; either version 2.1 of the License, or (at your option)
* any later version.
*
* This library is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
* details.
*/
--%>
<%@ include file="/init.jsp" %>
<%
String[] displayActivityCounterNames = socialGroupStatisticsPortletInstanceConfiguration.displayActivityCounterName();
for (int displayActivityCounterNameIndex = 0; displayActivityCounterNameIndex < displayActivityCounterNames.length; displayActivityCounterNameIndex++) {
String displayActivityCounterName = displayActivityCounterNames[displayActivityCounterNameIndex];
if (Validator.isNull(displayActivityCounterName)) {
continue;
}
String[] chartTypes = socialGroupStatisticsPortletInstanceConfiguration.chartType();
String chartType = GetterUtil.getString(chartTypes[displayActivityCounterNameIndex], "area");
String[] chartWidths = socialGroupStatisticsPortletInstanceConfiguration.chartWidth();
int chartWidth = GetterUtil.getInteger(chartWidths[displayActivityCounterNameIndex], 35);
String[] dataRanges = socialGroupStatisticsPortletInstanceConfiguration.dataRange();
String dataRange = GetterUtil.getString(dataRanges[displayActivityCounterNameIndex], "year");
List assetTags = null;
List activityCounters = null;
String title = LanguageUtil.get(request, "site-statistics") + StringPool.SPACE;
int dataSize = 0;
int displayHeight = 80;
if (chartType.equals("tag-cloud")) {
if (dataRange.equals("year")) {
assetTags = AssetTagLocalServiceUtil.getSocialActivityCounterPeriodTags(scopeGroupId, displayActivityCounterName, SocialCounterPeriodUtil.getFirstActivityDayOfYear(), SocialCounterPeriodUtil.getEndPeriod());
}
else {
assetTags = AssetTagLocalServiceUtil.getSocialActivityCounterOffsetTags(scopeGroupId, displayActivityCounterName, -12, 0);
}
title = title + LanguageUtil.format(request, "tag-cloud-for-x", LanguageUtil.get(request, "group.statistics.title." + displayActivityCounterName), false);
dataSize = assetTags.size();
}
else {
if (chartType.equals("pie")) {
if (dataRange.equals("year")) {
activityCounters = SocialActivityCounterLocalServiceUtil.getPeriodDistributionActivityCounters(scopeGroupId, displayActivityCounterName, SocialCounterPeriodUtil.getFirstActivityDayOfYear(), SocialCounterPeriodUtil.getEndPeriod());
}
else {
activityCounters = SocialActivityCounterLocalServiceUtil.getOffsetDistributionActivityCounters(scopeGroupId, displayActivityCounterName, -12, 0);
}
displayHeight = Math.max((activityCounters.size() + 1) * 18, displayHeight);
}
else {
if (dataRange.equals("year")) {
activityCounters = SocialActivityCounterLocalServiceUtil.getPeriodActivityCounters(scopeGroupId, displayActivityCounterName, SocialCounterPeriodUtil.getFirstActivityDayOfYear(), SocialCounterPeriodUtil.getEndPeriod());
}
else {
activityCounters = SocialActivityCounterLocalServiceUtil.getOffsetActivityCounters(scopeGroupId, displayActivityCounterName, -12, 0);
}
}
dataSize = activityCounters.size();
title = title + LanguageUtil.get(request, "group.statistics.title." + displayActivityCounterName);
}
if (dataSize == 0) {
displayHeight = 40;
}
%>
<%@ include file="/chart/pie.jspf" %>
<%@ include file="/chart/tag_cloud.jspf" %>
<%@ include file="/chart/other.jspf" %>
<%
}
%>