Search in sources :

Example 26 with ModuleConfiguration

use of org.olat.modules.ModuleConfiguration in project OpenOLAT by OpenOLAT.

the class GTAManagerImpl method filterBusinessGroups.

@Override
public List<BusinessGroup> filterBusinessGroups(List<BusinessGroup> groups, GTACourseNode cNode) {
    if (groups == null || groups.isEmpty())
        return new ArrayList<>(1);
    List<BusinessGroup> filteredGroups = new ArrayList<>();
    ModuleConfiguration config = cNode.getModuleConfiguration();
    List<Long> groupKeys = config.getList(GTACourseNode.GTASK_GROUPS, Long.class);
    for (BusinessGroup group : groups) {
        if (groupKeys.contains(group.getKey())) {
            filteredGroups.add(group);
        }
    }
    if (filteredGroups.size() < groups.size()) {
        List<Long> areaKeys = config.getList(GTACourseNode.GTASK_AREAS, Long.class);
        List<Long> groupKeysOfAreas = areaManager.findBusinessGroupKeysOfAreaKeys(areaKeys);
        for (BusinessGroup group : groups) {
            // don't add 2x
            if (!groupKeys.contains(group.getKey()) && groupKeysOfAreas.contains(group.getKey())) {
                filteredGroups.add(group);
            }
        }
    }
    return filteredGroups;
}
Also used : ModuleConfiguration(org.olat.modules.ModuleConfiguration) BusinessGroup(org.olat.group.BusinessGroup) ArrayList(java.util.ArrayList)

Example 27 with ModuleConfiguration

use of org.olat.modules.ModuleConfiguration in project OpenOLAT by OpenOLAT.

the class GTAManagerImpl method getCoachedBusinessGroups.

@Override
public List<BusinessGroup> getCoachedBusinessGroups(IdentityRef identity, GTACourseNode cNode) {
    ModuleConfiguration config = cNode.getModuleConfiguration();
    List<Long> groupKeys = config.getList(GTACourseNode.GTASK_GROUPS, Long.class);
    List<Long> areaKeys = config.getList(GTACourseNode.GTASK_AREAS, Long.class);
    return getBusinessGroups(identity, groupKeys, areaKeys, GroupRoles.coach);
}
Also used : ModuleConfiguration(org.olat.modules.ModuleConfiguration)

Example 28 with ModuleConfiguration

use of org.olat.modules.ModuleConfiguration in project OpenOLAT by OpenOLAT.

the class GTAManagerImpl method getMembership.

@Override
public Membership getMembership(IdentityRef identity, RepositoryEntryRef entry, GTACourseNode cNode) {
    List<String> roles;
    ModuleConfiguration config = cNode.getModuleConfiguration();
    if (GTAType.group.name().equals(config.getStringValue(GTACourseNode.GTASK_TYPE))) {
        List<Long> groupKeys = config.getList(GTACourseNode.GTASK_GROUPS, Long.class);
        List<Long> areaKeys = config.getList(GTACourseNode.GTASK_AREAS, Long.class);
        List<Long> consolidatedGroupKeys = new ArrayList<>();
        if (groupKeys != null && groupKeys.size() > 0) {
            consolidatedGroupKeys.addAll(groupKeys);
        }
        consolidatedGroupKeys.addAll(areaManager.findBusinessGroupKeysOfAreaKeys(areaKeys));
        List<BusinessGroupRef> businessGroups = BusinessGroupRefImpl.toRefs(consolidatedGroupKeys);
        roles = businessGroupRelationDao.getRoles(identity, businessGroups);
    } else {
        roles = repositoryEntryRelationDao.getRoles(identity, entry);
    }
    boolean coach = roles.contains(GroupRoles.coach.name()) || roles.contains(GroupRoles.owner.name());
    boolean participant = roles.contains(GroupRoles.participant.name());
    return new Membership(coach, participant);
}
Also used : BusinessGroupRef(org.olat.group.BusinessGroupRef) ModuleConfiguration(org.olat.modules.ModuleConfiguration) ArrayList(java.util.ArrayList) Membership(org.olat.course.nodes.gta.model.Membership)

Example 29 with ModuleConfiguration

use of org.olat.modules.ModuleConfiguration in project OpenOLAT by OpenOLAT.

the class OpenMeetingsEditController method event.

@Override
protected void event(UserRequest ureq, Controller source, Event event) {
    if (source == accessibilityCondContr) {
        if (event == Event.CHANGED_EVENT) {
            Condition cond = accessibilityCondContr.getCondition();
            courseNode.setPreConditionAccess(cond);
            fireEvent(ureq, NodeEditController.NODECONFIG_CHANGED_EVENT);
        }
    } else if (source == editForm) {
        // config form action
        if (event == Event.DONE_EVENT || event == Event.CHANGED_EVENT) {
            OpenMeetingsRoom room = editForm.getRoom();
            if (room != null) {
                ModuleConfiguration moduleConfiguration = courseNode.getModuleConfiguration();
                moduleConfiguration.set(CONFIG_ROOM_NAME, room.getName());
                moduleConfiguration.set(CONFIG_ROOM_SIZE, new Long(room.getSize()));
                moduleConfiguration.set(CONFIG_ROOM_MODERATION, new Boolean(room.isModerated()));
                moduleConfiguration.set(CONFIG_ROOM_AUDIO_ONLY, new Boolean(room.isAudioOnly()));
                moduleConfiguration.set(CONFIG_ROOM_COMMENT, room.getComment());
                moduleConfiguration.set(CONFIG_ROOM_TYPE, new Long(room.getType()));
            }
        }
        if (event == Event.DONE_EVENT) {
            fireEvent(ureq, NodeEditController.NODECONFIG_CHANGED_EVENT);
        }
    }
}
Also used : Condition(org.olat.course.condition.Condition) OpenMeetingsRoom(org.olat.modules.openmeetings.model.OpenMeetingsRoom) ModuleConfiguration(org.olat.modules.ModuleConfiguration)

Example 30 with ModuleConfiguration

use of org.olat.modules.ModuleConfiguration in project OpenOLAT by OpenOLAT.

the class OpenMeetingsEditController method getDefaultValues.

private OpenMeetingsRoom getDefaultValues() {
    OpenMeetingsRoom room = new OpenMeetingsRoom();
    ModuleConfiguration moduleConfiguration = courseNode.getModuleConfiguration();
    Object name = moduleConfiguration.get(CONFIG_ROOM_NAME);
    if (name instanceof String) {
        room.setName((String) name);
    }
    Object size = moduleConfiguration.get(CONFIG_ROOM_SIZE);
    if (size instanceof Long) {
        room.setSize(((Long) size).longValue());
    }
    Object moderated = moduleConfiguration.get(CONFIG_ROOM_MODERATION);
    if (moderated instanceof Boolean) {
        room.setModerated(((Boolean) moderated).booleanValue());
    } else if (moderated == null) {
        room.setModerated(true);
    }
    Object comment = moduleConfiguration.get(CONFIG_ROOM_COMMENT);
    if (comment instanceof String) {
        room.setComment((String) comment);
    }
    Object type = moduleConfiguration.get(CONFIG_ROOM_TYPE);
    if (type instanceof Long) {
        room.setType(((Long) type).longValue());
    } else if (type == null) {
        room.setType(3);
    }
    Object isAudioOnly = moduleConfiguration.get(CONFIG_ROOM_AUDIO_ONLY);
    if (isAudioOnly instanceof Boolean) {
        room.setAudioOnly(((Boolean) isAudioOnly).booleanValue());
    } else if (isAudioOnly == null) {
        room.setAudioOnly(true);
    }
    return room;
}
Also used : OpenMeetingsRoom(org.olat.modules.openmeetings.model.OpenMeetingsRoom) ModuleConfiguration(org.olat.modules.ModuleConfiguration)

Aggregations

ModuleConfiguration (org.olat.modules.ModuleConfiguration)296 ArrayList (java.util.ArrayList)34 OLATRuntimeException (org.olat.core.logging.OLATRuntimeException)28 ICourse (org.olat.course.ICourse)26 CourseNode (org.olat.course.nodes.CourseNode)26 Date (java.util.Date)22 RepositoryEntry (org.olat.repository.RepositoryEntry)22 File (java.io.File)20 CheckboxList (org.olat.course.nodes.cl.model.CheckboxList)18 List (java.util.List)16 Identity (org.olat.core.id.Identity)16 CheckboxManager (org.olat.course.nodes.cl.CheckboxManager)16 UserCourseEnvironment (org.olat.course.run.userview.UserCourseEnvironment)16 Translator (org.olat.core.gui.translator.Translator)14 AssessmentManager (org.olat.course.assessment.AssessmentManager)14 CourseEnvironment (org.olat.course.run.environment.CourseEnvironment)14 ScoreEvaluation (org.olat.course.run.scoring.ScoreEvaluation)14 VFSItem (org.olat.core.util.vfs.VFSItem)12 BusinessGroup (org.olat.group.BusinessGroup)12 Checkbox (org.olat.course.nodes.cl.model.Checkbox)11