Search in sources :

Example 46 with ModuleConfiguration

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

the class TACourseNode method updateModuleConfigDefaults.

/**
 * Init config parameter with default values for a new course node.
 */
@Override
public void updateModuleConfigDefaults(boolean isNewNode) {
    ModuleConfiguration config = getModuleConfiguration();
    if (isNewNode) {
        // use defaults for new course building blocks
        // task defaults
        config.set(CONF_TASK_ENABLED, Boolean.TRUE);
        config.set(CONF_TASK_TYPE, TaskController.TYPE_MANUAL);
        config.set(CONF_TASK_TEXT, "");
        config.set(CONF_TASK_SAMPLING_WITH_REPLACEMENT, Boolean.TRUE);
        // dropbox defaults
        config.set(CONF_DROPBOX_ENABLED, Boolean.TRUE);
        config.set(CONF_RETURNBOX_ENABLED, Boolean.TRUE);
        config.set(CONF_DROPBOX_ENABLEMAIL, Boolean.FALSE);
        config.set(CONF_DROPBOX_CONFIRMATION, "");
        // scoring defaults
        config.set(CONF_SCORING_ENABLED, Boolean.TRUE);
        // New config parameter version 2
        config.setBooleanEntry(CONF_TASK_PREVIEW, false);
        // solution defaults
        config.set(CONF_SOLUTION_ENABLED, Boolean.TRUE);
        MSCourseNode.initDefaultConfig(config);
        config.setConfigurationVersion(CURRENT_CONFIG_VERSION);
    } else {
        int version = config.getConfigurationVersion();
        if (version < CURRENT_CONFIG_VERSION) {
            // Loaded config is older than current config version => migrate
            if (version == 1) {
                // migrate V1 => V2
                config.setBooleanEntry(CONF_TASK_PREVIEW, false);
                // solution defaults
                config.set(CONF_SOLUTION_ENABLED, Boolean.FALSE);
                MSCourseNode.initDefaultConfig(config);
                version = 2;
            }
            config.setConfigurationVersion(CURRENT_CONFIG_VERSION);
        }
    }
}
Also used : ModuleConfiguration(org.olat.modules.ModuleConfiguration)

Example 47 with ModuleConfiguration

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

the class TACourseNode method hasScoreConfigured.

/**
 * @see org.olat.course.nodes.AssessableCourseNode#hasScoreConfigured()
 */
@Override
public boolean hasScoreConfigured() {
    Boolean hasScoring = (Boolean) getModuleConfiguration().get(CONF_SCORING_ENABLED);
    if (hasScoring) {
        ModuleConfiguration config = getModuleConfiguration();
        Boolean score = (Boolean) config.get(MSCourseNode.CONFIG_KEY_HAS_SCORE_FIELD);
        if (score != null) {
            return score.booleanValue();
        }
    }
    return false;
}
Also used : ModuleConfiguration(org.olat.modules.ModuleConfiguration)

Example 48 with ModuleConfiguration

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

the class TACourseNode method getMaxScoreConfiguration.

/**
 * @see org.olat.course.nodes.AssessableCourseNode#getMaxScoreConfiguration()
 */
@Override
public Float getMaxScoreConfiguration() {
    if (!hasScoreConfigured()) {
        throw new OLATRuntimeException(TACourseNode.class, "getMaxScore not defined when hasScore set to false", null);
    }
    ModuleConfiguration config = getModuleConfiguration();
    Float max = (Float) config.get(MSCourseNode.CONFIG_KEY_SCORE_MAX);
    return max;
}
Also used : ModuleConfiguration(org.olat.modules.ModuleConfiguration) OLATRuntimeException(org.olat.core.logging.OLATRuntimeException)

Example 49 with ModuleConfiguration

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

the class BasicLTICourseNode method isGuestAllowed.

public boolean isGuestAllowed() {
    ModuleConfiguration config = getModuleConfiguration();
    boolean assessable = config.getBooleanSafe(BasicLTICourseNode.CONFIG_KEY_HAS_SCORE_FIELD, false);
    boolean sendName = config.getBooleanSafe(LTIConfigForm.CONFIG_KEY_SENDNAME, false);
    boolean sendEmail = config.getBooleanSafe(LTIConfigForm.CONFIG_KEY_SENDEMAIL, false);
    boolean customValues = StringHelper.containsNonWhitespace(config.getStringValue(LTIConfigForm.CONFIG_KEY_CUSTOM));
    return !assessable && !sendName && !sendEmail && !customValues;
}
Also used : ModuleConfiguration(org.olat.modules.ModuleConfiguration)

Example 50 with ModuleConfiguration

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

the class BasicLTICourseNode method hasPassedConfigured.

@Override
public boolean hasPassedConfigured() {
    ModuleConfiguration config = getModuleConfiguration();
    Boolean passed = config.getBooleanEntry(CONFIG_KEY_HAS_PASSED_FIELD);
    return (passed == null) ? false : passed.booleanValue();
}
Also used : 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