use of org.olat.group.BusinessGroupMembership in project openolat by klemens.
the class OpenBusinessGroupListController method addAccessLink.
protected void addAccessLink(BGTableItem item) {
String action;
BusinessGroupMembership membership = item.getMembership();
if (membership != null && membership.isOwner()) {
return;
} else if (membership != null && (membership.isParticipant() || membership.isWaiting())) {
action = TABLE_ACTION_LEAVE;
} else if (item.isFull() && !item.isWaitingListEnabled()) {
action = null;
} else {
action = TABLE_ACTION_ACCESS;
}
String i18nKey;
if (membership != null && membership.isParticipant()) {
i18nKey = "table.header.leave";
} else if (membership != null && membership.isWaiting()) {
i18nKey = "table.header.leave.waiting";
} else if (item.isFull()) {
if (item.isWaitingListEnabled()) {
i18nKey = "table.access.waitingList";
} else {
i18nKey = "table.header.group.full";
}
} else if (item.isWaitingListEnabled()) {
if (item.isFull()) {
i18nKey = "table.access.waitingList";
} else {
i18nKey = "table.access";
}
} else {
i18nKey = "table.access";
}
FormLink accessLink = uifactory.addFormLink("open_" + item.getBusinessGroupKey(), action, i18nKey, null, null, Link.LINK);
if (action == null) {
accessLink.setEnabled(false);
}
accessLink.setUserObject(item);
item.setAccessLink(accessLink);
}
use of org.olat.group.BusinessGroupMembership in project openolat by klemens.
the class OpenBusinessGroupListController method searchTableItems.
@Override
protected List<BGTableItem> searchTableItems(BusinessGroupQueryParams params) {
List<OpenBusinessGroupRow> rows = businessGroupService.findPublishedBusinessGroups(params, getIdentity());
List<BGTableItem> items = new ArrayList<>(rows.size());
for (OpenBusinessGroupRow row : rows) {
BusinessGroupMembership membership = row.getMember();
Boolean allowLeave = membership != null;
BGTableItem item = new BGTableItem(row, null, allowLeave, Boolean.FALSE);
addAccessLink(item);
items.add(item);
}
return items;
}
use of org.olat.group.BusinessGroupMembership in project openolat by klemens.
the class SearchBusinessGroupListController method searchTableItems.
@Override
protected List<BGTableItem> searchTableItems(BusinessGroupQueryParams params) {
List<BusinessGroupRow> rows = businessGroupService.findBusinessGroupsWithMemberships(params, getIdentity());
List<BGTableItem> items = new ArrayList<>(rows.size());
for (BusinessGroupRow row : rows) {
BusinessGroupMembership membership = row.getMember();
Boolean allowLeave = membership != null;
Boolean allowDelete = isAdmin() ? Boolean.TRUE : (membership == null ? null : new Boolean(membership.isOwner()));
FormLink markLink = uifactory.addFormLink("mark_" + row.getKey(), "mark", "", null, null, Link.NONTRANSLATED);
markLink.setIconLeftCSS(row.isMarked() ? Mark.MARK_CSS_LARGE : Mark.MARK_ADD_CSS_LARGE);
BGTableItem item = new BGTableItem(row, markLink, allowLeave, allowDelete);
items.add(item);
}
return items;
}
use of org.olat.group.BusinessGroupMembership in project openolat by klemens.
the class BusinessGroupListController method searchTableItems.
@Override
protected List<BGTableItem> searchTableItems(BusinessGroupQueryParams params) {
List<BusinessGroupRow> rows = businessGroupService.findBusinessGroupsWithMemberships(params, getIdentity());
List<BGTableItem> items = new ArrayList<>(rows.size());
for (BusinessGroupRow row : rows) {
BusinessGroupMembership membership = row.getMember();
Boolean allowLeave = membership != null;
Boolean allowDelete = isAdmin() ? Boolean.TRUE : (membership == null ? null : new Boolean(membership.isOwner()));
FormLink markLink = uifactory.addFormLink("mark_" + row.getKey(), "mark", "", null, null, Link.NONTRANSLATED);
markLink.setIconLeftCSS(row.isMarked() ? Mark.MARK_CSS_LARGE : Mark.MARK_ADD_CSS_LARGE);
BGTableItem item = new BGTableItem(row, markLink, allowLeave, allowDelete);
items.add(item);
}
return items;
}
Aggregations