Search in sources :

Example 56 with BusinessGroupQueryParams

use of org.olat.group.model.BusinessGroupQueryParams in project OpenOLAT by OpenOLAT.

the class SelectSearchBusinessGroupController method getSearchParams.

@Override
protected BusinessGroupQueryParams getSearchParams(SearchEvent event) {
    BusinessGroupQueryParams params = event.convertToBusinessGroupQueriesParams();
    // security
    if (restricted && !params.isAttendee() && !params.isOwner() && !params.isWaiting() && (params.getPublicGroups() == null || !params.getPublicGroups().booleanValue())) {
        params.setOwner(true);
        params.setAttendee(true);
        params.setWaiting(true);
    }
    return params;
}
Also used : BusinessGroupQueryParams(org.olat.group.model.BusinessGroupQueryParams)

Example 57 with BusinessGroupQueryParams

use of org.olat.group.model.BusinessGroupQueryParams in project OpenOLAT by OpenOLAT.

the class FavoritBusinessGroupListController method getSearchParams.

@Override
protected BusinessGroupQueryParams getSearchParams(SearchEvent event) {
    BusinessGroupQueryParams params = event.convertToBusinessGroupQueriesParams();
    // security
    if (!params.isAttendee() && !params.isOwner() && !params.isWaiting()) {
        params.setOwner(true);
        params.setAttendee(true);
        params.setWaiting(true);
    }
    params.setMarked(true);
    return params;
}
Also used : BusinessGroupQueryParams(org.olat.group.model.BusinessGroupQueryParams)

Example 58 with BusinessGroupQueryParams

use of org.olat.group.model.BusinessGroupQueryParams in project OpenOLAT by OpenOLAT.

the class AbstractBusinessGroupListController method doSearch.

protected void doSearch(FlexiTableSearchEvent event) {
    BusinessGroupQueryParams params = getDefaultSearchParams();
    params.setNameOrDesc(event.getSearch());
    loadModel(params);
}
Also used : BusinessGroupQueryParams(org.olat.group.model.BusinessGroupQueryParams)

Example 59 with BusinessGroupQueryParams

use of org.olat.group.model.BusinessGroupQueryParams in project OpenOLAT by OpenOLAT.

the class AbstractBusinessGroupListController method search.

private void search(SearchEvent event) {
    if (event == null) {
        loadModel(null);
    } else {
        BusinessGroupQueryParams params = getSearchParams(event);
        loadModel(params);
    }
}
Also used : BusinessGroupQueryParams(org.olat.group.model.BusinessGroupQueryParams)

Example 60 with BusinessGroupQueryParams

use of org.olat.group.model.BusinessGroupQueryParams in project OpenOLAT by OpenOLAT.

the class EditMembershipController method loadModel.

private void loadModel(Identity memberToLoad) {
    BusinessGroupQueryParams params = new BusinessGroupQueryParams();
    if (repoEntry == null) {
        params.setBusinessGroupKey(businessGroup.getKey());
    } else {
        params.setRepositoryEntry(repoEntry);
    }
    List<StatisticsBusinessGroupRow> groups = businessGroupService.findBusinessGroupsStatistics(params);
    if (groups.size() > 1) {
        Collections.sort(groups, new BusinessGroupRowComparator(getLocale()));
    }
    boolean defaultMembership = false;
    if (memberToLoad == null) {
        if (repoEntry != null && groups.isEmpty()) {
            boolean managed = RepositoryEntryManagedFlag.isManaged(repoEntry, RepositoryEntryManagedFlag.membersmanagement) && !overrideManaged;
            if (!managed) {
                repoRightsEl.select("participant", true);
            }
        } else if (repoEntry == null && groups.size() == 1) {
            boolean managed = BusinessGroupManagedFlag.isManaged(groups.get(0).getManagedFlags(), BusinessGroupManagedFlag.membersmanagement) && !overrideManaged;
            if (!managed) {
                defaultMembership = true;
            }
        }
    }
    List<Long> businessGroupKeys = new ArrayList<>(groups.size());
    groups.forEach(group -> businessGroupKeys.add(group.getKey()));
    groupMemberships = memberToLoad == null ? Collections.<BusinessGroupMembership>emptyList() : businessGroupService.getBusinessGroupMembership(businessGroupKeys, memberToLoad);
    List<MemberOption> options = new ArrayList<MemberOption>();
    for (StatisticsBusinessGroupRow group : groups) {
        boolean managed = BusinessGroupManagedFlag.isManaged(group.getManagedFlags(), BusinessGroupManagedFlag.membersmanagement) && !overrideManaged;
        MemberOption option = new MemberOption(group);
        BGPermission bgPermission = PermissionHelper.getPermission(group.getKey(), memberToLoad, groupMemberships);
        option.setTutor(createSelection(bgPermission.isTutor(), !managed, GroupRoles.coach.name()));
        option.setParticipant(createSelection(bgPermission.isParticipant() || defaultMembership, !managed, GroupRoles.participant.name()));
        boolean waitingListEnable = !managed && group.isWaitingListEnabled();
        option.setWaiting(createSelection(bgPermission.isWaitingList(), waitingListEnable, GroupRoles.waiting.name()));
        options.add(option);
    }
    tableDataModel.setObjects(options);
}
Also used : BusinessGroupQueryParams(org.olat.group.model.BusinessGroupQueryParams) StatisticsBusinessGroupRow(org.olat.group.model.StatisticsBusinessGroupRow) BusinessGroupMembership(org.olat.group.BusinessGroupMembership) BusinessGroupRowComparator(org.olat.group.model.comparator.BusinessGroupRowComparator) BGPermission(org.olat.course.member.PermissionHelper.BGPermission) ArrayList(java.util.ArrayList)

Aggregations

BusinessGroupQueryParams (org.olat.group.model.BusinessGroupQueryParams)82 Test (org.junit.Test)38 Identity (org.olat.core.id.Identity)38 BusinessGroup (org.olat.group.BusinessGroup)38 StatisticsBusinessGroupRow (org.olat.group.model.StatisticsBusinessGroupRow)38 OpenBusinessGroupRow (org.olat.group.model.OpenBusinessGroupRow)36 BusinessGroupRow (org.olat.group.model.BusinessGroupRow)34 SearchBusinessGroupParams (org.olat.group.model.SearchBusinessGroupParams)16 RepositoryEntry (org.olat.repository.RepositoryEntry)8 Offer (org.olat.resource.accesscontrol.Offer)4 OfferAccess (org.olat.resource.accesscontrol.OfferAccess)4 AccessMethod (org.olat.resource.accesscontrol.model.AccessMethod)4 TokenAccessMethod (org.olat.resource.accesscontrol.model.TokenAccessMethod)4 ArrayList (java.util.ArrayList)2 Calendar (java.util.Calendar)2 Date (java.util.Date)2 HashSet (java.util.HashSet)2 BGPermission (org.olat.course.member.PermissionHelper.BGPermission)2 BusinessGroupMembership (org.olat.group.BusinessGroupMembership)2 BusinessGroupRowComparator (org.olat.group.model.comparator.BusinessGroupRowComparator)2