use of org.olat.core.gui.components.rating.RatingFormItem in project OpenOLAT by OpenOLAT.
the class RepositoryEntryListController method forgeRatings.
@Override
public void forgeRatings(RepositoryEntryRow row) {
if (repositoryModule.isRatingEnabled()) {
if (guestOnly) {
Double averageRating = row.getAverageRating();
float averageRatingValue = averageRating == null ? 0f : averageRating.floatValue();
RatingFormItem ratingCmp = uifactory.addRatingItem("rat_" + row.getKey(), null, averageRatingValue, 5, false, null);
row.setRatingFormItem(ratingCmp);
ratingCmp.setUserObject(row);
} else {
Integer myRating = row.getMyRating();
Double averageRating = row.getAverageRating();
long numOfRatings = row.getNumOfRatings();
float ratingValue = myRating == null ? 0f : myRating.floatValue();
float averageRatingValue = averageRating == null ? 0f : averageRating.floatValue();
RatingWithAverageFormItem ratingCmp = new RatingWithAverageFormItem("rat_" + row.getKey(), ratingValue, averageRatingValue, 5, numOfRatings);
row.setRatingFormItem(ratingCmp);
ratingCmp.setUserObject(row);
}
}
}
use of org.olat.core.gui.components.rating.RatingFormItem in project openolat by klemens.
the class FormUIFactory method addRatingItem.
public RatingFormItem addRatingItem(String name, String i18nLabel, float initialRating, int maxRating, boolean allowUserInput, FormItemContainer formLayout) {
RatingFormItem ratingCmp = new RatingFormItem(name, initialRating, maxRating, allowUserInput);
setLabelIfNotNull(i18nLabel, ratingCmp);
if (i18nLabel != null) {
ratingCmp.showLabel(true);
}
if (formLayout != null) {
formLayout.add(ratingCmp);
}
return ratingCmp;
}
use of org.olat.core.gui.components.rating.RatingFormItem in project OpenOLAT by OpenOLAT.
the class FormUIFactory method addRatingItem.
public RatingFormItem addRatingItem(String name, String i18nLabel, float initialRating, int maxRating, boolean allowUserInput, FormItemContainer formLayout) {
RatingFormItem ratingCmp = new RatingFormItem(name, initialRating, maxRating, allowUserInput);
setLabelIfNotNull(i18nLabel, ratingCmp);
if (i18nLabel != null) {
ratingCmp.showLabel(true);
}
if (formLayout != null) {
formLayout.add(ratingCmp);
}
return ratingCmp;
}
use of org.olat.core.gui.components.rating.RatingFormItem in project openolat by klemens.
the class RepositoryEntryListController method forgeRatings.
@Override
public void forgeRatings(RepositoryEntryRow row) {
if (repositoryModule.isRatingEnabled()) {
if (guestOnly) {
Double averageRating = row.getAverageRating();
float averageRatingValue = averageRating == null ? 0f : averageRating.floatValue();
RatingFormItem ratingCmp = uifactory.addRatingItem("rat_" + row.getKey(), null, averageRatingValue, 5, false, null);
row.setRatingFormItem(ratingCmp);
ratingCmp.setUserObject(row);
} else {
Integer myRating = row.getMyRating();
Double averageRating = row.getAverageRating();
long numOfRatings = row.getNumOfRatings();
float ratingValue = myRating == null ? 0f : myRating.floatValue();
float averageRatingValue = averageRating == null ? 0f : averageRating.floatValue();
RatingWithAverageFormItem ratingCmp = new RatingWithAverageFormItem("rat_" + row.getKey(), ratingValue, averageRatingValue, 5, numOfRatings);
row.setRatingFormItem(ratingCmp);
ratingCmp.setUserObject(row);
}
}
}
Aggregations