Search in sources :

Example 71 with Condition

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

the class BCCourseNodeEditController method event.

/**
 * @see org.olat.core.gui.control.DefaultController#event(org.olat.core.gui.UserRequest,
 *      org.olat.core.gui.control.Controller, org.olat.core.gui.control.Event)
 */
@Override
public void event(UserRequest urequest, Controller source, Event event) {
    if (source == uploaderCondContr) {
        if (event == Event.CHANGED_EVENT) {
            Condition cond = uploaderCondContr.getCondition();
            bcNode.setPreConditionUploaders(cond);
            fireEvent(urequest, NodeEditController.NODECONFIG_CHANGED_EVENT);
        }
    } else if (source == downloaderCondContr) {
        if (event == Event.CHANGED_EVENT) {
            Condition cond = downloaderCondContr.getCondition();
            bcNode.setPreConditionDownloaders(cond);
            fireEvent(urequest, NodeEditController.NODECONFIG_CHANGED_EVENT);
        }
    } else if (source == folderPathChoose) {
        if (bcNode.getModuleConfiguration().getStringValue(CONFIG_SUBPATH, "").startsWith("/_sharedfolder")) {
            accessabiliryContent.contextPut("uploadable", false);
        } else {
            accessabiliryContent.contextPut("uploadable", true);
        }
        fireEvent(urequest, event);
    } else if (cmc == source) {
        cleanUp();
    }
}
Also used : Condition(org.olat.course.condition.Condition)

Example 72 with Condition

use of org.olat.course.condition.Condition in project openolat by klemens.

the class AbstractCourseNodeWebService method createExpertCondition.

protected Condition createExpertCondition(String conditionId, String expertRules) {
    Condition cond = new Condition();
    cond.setConditionExpression(expertRules);
    cond.setExpertMode(true);
    cond.setConditionId(conditionId);
    return cond;
}
Also used : Condition(org.olat.course.condition.Condition)

Example 73 with Condition

use of org.olat.course.condition.Condition in project openolat by klemens.

the class ChecklistCourseNode method isConfigValid.

public StatusDescription isConfigValid() {
    if (oneClickStatusCache != null) {
        return oneClickStatusCache[0];
    }
    StatusDescription sd = StatusDescription.NOERROR;
    String transPackage = ChecklistEditController.class.getPackage().getName();
    // no configuration available hence there is no checklist with checkpoints
    if (getModuleConfiguration().get(ChecklistCourseNode.CONF_CHECKLIST) == null) {
        sd = new StatusDescription(ValidationStatus.ERROR, "config.nocheckpoints.short", "config.nocheckpoints.long", null, transPackage);
        sd.setDescriptionForUnit(getIdent());
        sd.setActivateableViewIdentifier(ChecklistEditController.PANE_TAB_CLCONFIG);
        return sd;
    }
    Checklist checklist = (Checklist) getModuleConfiguration().get(ChecklistCourseNode.CONF_CHECKLIST);
    // checklist without any checkpoints makes no sense
    if (!checklist.hasCheckpoints()) {
        sd = new StatusDescription(ValidationStatus.ERROR, "config.nocheckpoints.short", "config.nocheckpoints.long", null, transPackage);
        sd.setDescriptionForUnit(getIdent());
        sd.setActivateableViewIdentifier(ChecklistEditController.PANE_TAB_CLCONFIG);
        return sd;
    }
    // information, if all checkpoints are invisible
    boolean allUnvisible = true;
    boolean noLearners = false;
    if (checklist.hasCheckpoints()) {
        List<Checkpoint> checkpoints = ((Checklist) getModuleConfiguration().get(ChecklistCourseNode.CONF_CHECKLIST)).getCheckpoints();
        for (Checkpoint checkpoint : checkpoints) {
            if (!checkpoint.getMode().equals(CheckpointMode.MODE_HIDDEN))
                allUnvisible = false;
        }
        if (allUnvisible) {
            Condition cond = getPreConditionVisibility();
            if (cond.isEasyModeCoachesAndAdmins())
                noLearners = true;
            if (!noLearners) {
                sd = new StatusDescription(ValidationStatus.WARNING, "config.allhidden.short", "config.allhidden.long", null, transPackage);
                sd.setDescriptionForUnit(getIdent());
                sd.setActivateableViewIdentifier(ChecklistEditController.PANE_TAB_CLCONFIG);
            }
        }
    }
    return sd;
}
Also used : Condition(org.olat.course.condition.Condition) Checkpoint(de.bps.olat.modules.cl.Checkpoint) StatusDescription(org.olat.course.editor.StatusDescription) Checklist(de.bps.olat.modules.cl.Checklist) ChecklistEditController(de.bps.course.nodes.cl.ChecklistEditController)

Example 74 with Condition

use of org.olat.course.condition.Condition in project openolat by klemens.

the class LLEditController method event.

/**
 * {@inheritDoc}
 */
@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 == llFormContr) {
        moduleConfiguration = llFormContr.getModuleConfiguration();
        fireEvent(ureq, NodeEditController.NODECONFIG_CHANGED_EVENT);
    }
}
Also used : Condition(org.olat.course.condition.Condition)

Example 75 with Condition

use of org.olat.course.condition.Condition in project openolat by klemens.

the class CalCourseNode 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);
    }
    return conditions;
}
Also used : Condition(org.olat.course.condition.Condition) ConditionExpression(org.olat.course.condition.interpreter.ConditionExpression) ArrayList(java.util.ArrayList)

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