Search in sources :

Example 11 with Condition

use of org.olat.course.condition.Condition 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 12 with Condition

use of org.olat.course.condition.Condition in project OpenOLAT by OpenOLAT.

the class GoToMeetingEditController 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);
        }
    }
}
Also used : Condition(org.olat.course.condition.Condition)

Example 13 with Condition

use of org.olat.course.condition.Condition in project OpenOLAT by OpenOLAT.

the class DialogCourseNode method getPreConditionModerator.

/**
 * @return Returns the preConditionModerator.
 */
public Condition getPreConditionModerator() {
    if (this.preConditionModerator == null) {
        this.preConditionModerator = new Condition();
        // learner should not be able to delete files by default
        this.preConditionModerator.setEasyModeCoachesAndAdmins(true);
        this.preConditionModerator.setEasyModeAlwaysAllowCoachesAndAdmins(true);
        this.preConditionModerator.setConditionExpression("(  ( isCourseCoach(0) | isCourseAdministrator(0) ) )");
    }
    this.preConditionModerator.setConditionId("moderator");
    return this.preConditionModerator;
}
Also used : Condition(org.olat.course.condition.Condition)

Example 14 with Condition

use of org.olat.course.condition.Condition in project OpenOLAT by OpenOLAT.

the class InfoCourseNode method getConditionExpressions.

@Override
public List<ConditionExpression> getConditionExpressions() {
    List<ConditionExpression> parentConditions = super.getConditionExpressions();
    List<ConditionExpression> conditions = new ArrayList<>();
    if (parentConditions != null && parentConditions.size() > 0) {
        conditions.addAll(parentConditions);
    }
    Condition editCondition = getPreConditionEdit();
    if (editCondition != null && StringHelper.containsNonWhitespace(editCondition.getConditionExpression())) {
        ConditionExpression ce = new ConditionExpression(editCondition.getConditionId());
        ce.setExpressionString(editCondition.getConditionExpression());
        conditions.add(ce);
    }
    Condition adminCondition = getPreConditionAdmin();
    if (adminCondition != null && StringHelper.containsNonWhitespace(adminCondition.getConditionExpression())) {
        ConditionExpression ce = new ConditionExpression(adminCondition.getConditionId());
        ce.setExpressionString(adminCondition.getConditionExpression());
        conditions.add(ce);
    }
    return conditions;
}
Also used : Condition(org.olat.course.condition.Condition) ConditionExpression(org.olat.course.condition.interpreter.ConditionExpression) ArrayList(java.util.ArrayList)

Example 15 with Condition

use of org.olat.course.condition.Condition in project OpenOLAT by OpenOLAT.

the class InfoCourseNode method getPreConditionAdmin.

/**
 * Default set the write privileges to coaches and admin only
 * @return
 */
public Condition getPreConditionAdmin() {
    if (preConditionAdmin == null) {
        preConditionAdmin = new Condition();
        preConditionAdmin.setEasyModeCoachesAndAdmins(true);
        preConditionAdmin.setConditionExpression(preConditionAdmin.getConditionFromEasyModeConfiguration());
        preConditionAdmin.setExpertMode(false);
    }
    preConditionAdmin.setConditionId(ADMIN_CONDITION_ID);
    return preConditionAdmin;
}
Also used : Condition(org.olat.course.condition.Condition)

Aggregations

Condition (org.olat.course.condition.Condition)94 ModuleConfiguration (org.olat.modules.ModuleConfiguration)10 ArrayList (java.util.ArrayList)8 CourseNode (org.olat.course.nodes.CourseNode)8 RepositoryEntry (org.olat.repository.RepositoryEntry)8 ConditionExpression (org.olat.course.condition.interpreter.ConditionExpression)6 Checklist (de.bps.olat.modules.cl.Checklist)4 DeliveryOptions (org.olat.core.gui.control.generic.iframe.DeliveryOptions)4 ICourse (org.olat.course.ICourse)4 ConditionEditController (org.olat.course.condition.ConditionEditController)4 NodeEditController (org.olat.course.editor.NodeEditController)4 StatusDescription (org.olat.course.editor.StatusDescription)4 AbstractAccessableCourseNode (org.olat.course.nodes.AbstractAccessableCourseNode)4 ScoreCalculator (org.olat.course.run.scoring.ScoreCalculator)4 CourseEditorTreeNode (org.olat.course.tree.CourseEditorTreeNode)4 CourseNodeVO (org.olat.restapi.support.vo.CourseNodeVO)4 ChecklistEditController (de.bps.course.nodes.cl.ChecklistEditController)2 Checkpoint (de.bps.olat.modules.cl.Checkpoint)2 Date (java.util.Date)2 List (java.util.List)2