Search in sources :

Example 66 with Condition

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

the class STCourseNode method getScoreCalculator.

/**
 * @return Returns the scoreCalculator.
 */
@Override
public ScoreCalculator getScoreCalculator() {
    if (scoreCalculator == null) {
        scoreCalculator = new ScoreCalculator();
        scoreCalculator.setFailedType(FailedEvaluationType.failedAsNotPassedAfterEndDate);
    }
    passedExpression = new Condition();
    passedExpression.setConditionId("passed");
    if (scoreCalculator.getPassedExpression() != null) {
        passedExpression.setConditionExpression(scoreCalculator.getPassedExpression());
        passedExpression.setExpertMode(true);
    }
    scoreExpression = new Condition();
    scoreExpression.setConditionId("score");
    if (scoreCalculator.getScoreExpression() != null) {
        scoreExpression.setConditionExpression(scoreCalculator.getScoreExpression());
        scoreExpression.setExpertMode(true);
    }
    failedExpression = new Condition();
    failedExpression.setConditionId("failed");
    if (scoreCalculator.getFailedExpression() != null) {
        failedExpression.setConditionExpression(scoreCalculator.getFailedExpression());
        failedExpression.setExpertMode(true);
    }
    return scoreCalculator;
}
Also used : Condition(org.olat.course.condition.Condition) ScoreCalculator(org.olat.course.run.scoring.ScoreCalculator)

Example 67 with Condition

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

the class InfoCourseNode method getPreConditionEdit.

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

Example 68 with Condition

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

the class CalCourseNode method updateModuleConfigDefaults.

@Override
public void updateModuleConfigDefaults(boolean isNewNode) {
    ModuleConfiguration config = getModuleConfiguration();
    if (isNewNode) {
        // use defaults for new course building blocks
        config.setBooleanEntry(NodeEditController.CONFIG_STARTPAGE, false);
        config.setConfigurationVersion(1);
    } else {
        if (config.getConfigurationVersion() < 2) {
            Condition cond = getPreConditionEdit();
            if (!cond.isExpertMode() && cond.isEasyModeCoachesAndAdmins() && cond.getConditionExpression() == null) {
                // ensure that the default config has a condition expression
                cond.setConditionExpression(cond.getConditionFromEasyModeConfiguration());
            }
            config.setConfigurationVersion(2);
        }
    }
}
Also used : Condition(org.olat.course.condition.Condition) ModuleConfiguration(org.olat.modules.ModuleConfiguration)

Example 69 with Condition

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

the class CalCourseNode method getPreConditionEdit.

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

Example 70 with Condition

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

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