Search in sources :

Example 11 with ModuleConfiguration

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

the class PortfolioCourseNode method getMinScoreConfiguration.

@Override
public Float getMinScoreConfiguration() {
    if (!hasScoreConfigured()) {
        throw new OLATRuntimeException(PortfolioCourseNode.class, "getMinScore not defined when hasScore set to false", null);
    }
    ModuleConfiguration config = getModuleConfiguration();
    Float min = (Float) config.get(MSCourseNode.CONFIG_KEY_SCORE_MIN);
    return min;
}
Also used : ModuleConfiguration(org.olat.modules.ModuleConfiguration) OLATRuntimeException(org.olat.core.logging.OLATRuntimeException)

Example 12 with ModuleConfiguration

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

the class PortfolioCourseNode method updateModuleConfigDefaults.

@Override
public void updateModuleConfigDefaults(boolean isNewNode) {
    ModuleConfiguration config = getModuleConfiguration();
    if (isNewNode) {
        MSCourseNode.initDefaultConfig(config);
        config.setConfigurationVersion(CURRENT_CONFIG_VERSION);
    }
    if (config.getConfigurationVersion() < 2) {
        if (config.get(PortfolioCourseNodeConfiguration.REPO_SOFT_KEY) == null) {
            Object mapKey = config.get(PortfolioCourseNodeConfiguration.MAP_KEY);
            if (mapKey instanceof Long) {
                EPStructureManager eSTMgr = (EPStructureManager) CoreSpringFactory.getBean("epStructureManager");
                RepositoryEntry re = eSTMgr.loadPortfolioRepositoryEntryByMapKey((Long) mapKey);
                config.set(PortfolioCourseNodeConfiguration.REPO_SOFT_KEY, re.getSoftkey());
            }
        }
        config.setConfigurationVersion(2);
    }
}
Also used : ModuleConfiguration(org.olat.modules.ModuleConfiguration) RepositoryEntry(org.olat.repository.RepositoryEntry) EPStructureManager(org.olat.portfolio.manager.EPStructureManager)

Example 13 with ModuleConfiguration

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

the class PortfolioCourseNode method hasPassedConfigured.

@Override
public boolean hasPassedConfigured() {
    ModuleConfiguration config = getModuleConfiguration();
    Boolean passed = (Boolean) config.get(MSCourseNode.CONFIG_KEY_HAS_PASSED_FIELD);
    return (passed == null) ? false : passed.booleanValue();
}
Also used : ModuleConfiguration(org.olat.modules.ModuleConfiguration)

Example 14 with ModuleConfiguration

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

the class STCourseNode method updateModuleConfigDefaults.

/**
 * Update the module configuration to have all mandatory configuration flags
 * set to usefull default values
 *
 * @param isNewNode true: an initial configuration is set; false: upgrading
 *          from previous node configuration version, set default to maintain
 *          previous behaviour
 */
@Override
public void updateModuleConfigDefaults(boolean isNewNode) {
    ModuleConfiguration config = getModuleConfiguration();
    if (isNewNode) {
        // use defaults for new course building blocks
        config.setBooleanEntry(STCourseNodeEditController.CONFIG_KEY_ALLOW_RELATIVE_LINKS, Boolean.FALSE.booleanValue());
        // set the default display to peekview in two columns
        config.setStringValue(STCourseNodeEditController.CONFIG_KEY_DISPLAY_TYPE, STCourseNodeEditController.CONFIG_VALUE_DISPLAY_PEEKVIEW);
        config.setIntValue(STCourseNodeEditController.CONFIG_KEY_COLUMNS, 2);
        DeliveryOptions defaultOptions = DeliveryOptions.defaultWithGlossary();
        config.set(SPEditController.CONFIG_KEY_DELIVERYOPTIONS, defaultOptions);
        config.setConfigurationVersion(3);
        scoreCalculator = new ScoreCalculator();
        scoreCalculator.setFailedType(FailedEvaluationType.failedAsNotPassedAfterEndDate);
    } else {
        // update to version 2
        if (config.getConfigurationVersion() < 2) {
            // use values accoring to previous functionality
            config.setBooleanEntry(STCourseNodeEditController.CONFIG_KEY_ALLOW_RELATIVE_LINKS, Boolean.FALSE.booleanValue());
            // calculator, se to expert mode
            if (getScoreCalculator() != null) {
                getScoreCalculator().setExpertMode(true);
            }
            config.setConfigurationVersion(2);
        }
        // update to version 3
        if (config.getConfigurationVersion() < 3) {
            String fileName = (String) config.get(STCourseNodeEditController.CONFIG_KEY_FILE);
            if (fileName != null) {
                // set to custom file display config
                config.setStringValue(STCourseNodeEditController.CONFIG_KEY_DISPLAY_TYPE, STCourseNodeEditController.CONFIG_VALUE_DISPLAY_FILE);
            } else {
                // set the default display to plain vanilla TOC view in one column
                config.setStringValue(STCourseNodeEditController.CONFIG_KEY_DISPLAY_TYPE, STCourseNodeEditController.CONFIG_VALUE_DISPLAY_TOC);
                config.setIntValue(STCourseNodeEditController.CONFIG_KEY_COLUMNS, 1);
            }
            config.setConfigurationVersion(3);
        }
        if (config.getConfigurationVersion() < 4) {
            if (config.get(SPEditController.CONFIG_KEY_DELIVERYOPTIONS) == null) {
                DeliveryOptions defaultOptions = DeliveryOptions.defaultWithGlossary();
                config.set(SPEditController.CONFIG_KEY_DELIVERYOPTIONS, defaultOptions);
            }
            config.setConfigurationVersion(4);
        }
    }
}
Also used : ModuleConfiguration(org.olat.modules.ModuleConfiguration) ScoreCalculator(org.olat.course.run.scoring.ScoreCalculator) DeliveryOptions(org.olat.core.gui.control.generic.iframe.DeliveryOptions)

Example 15 with ModuleConfiguration

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

the class MSCourseNode method hasScoreConfigured.

/**
 * @see org.olat.course.nodes.AssessableCourseNode#hasScoreConfigured()
 */
@Override
public boolean hasScoreConfigured() {
    ModuleConfiguration config = getModuleConfiguration();
    Boolean score = (Boolean) config.get(CONFIG_KEY_HAS_SCORE_FIELD);
    if (score == null)
        return false;
    return score.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