Search in sources :

Example 86 with ModuleConfiguration

use of org.olat.modules.ModuleConfiguration in project openolat by klemens.

the class IQTESTCourseNode method getQTI21TimeLimitMaxInSeconds.

/**
 * If the course element override the test configuration, the value is from
 * the course element's configuration. Else, the value is from the assessment
 * test.
 *
 * @param testEntry The test repository entry
 * @return the maximum time limit in seconds or -1 if no time limit is configured
 */
public int getQTI21TimeLimitMaxInSeconds(RepositoryEntry testEntry) {
    int timeLimit = -1;
    if (ImsQTI21Resource.TYPE_NAME.equals(testEntry.getOlatResource().getResourceableTypeName())) {
        ModuleConfiguration config = getModuleConfiguration();
        boolean configRef = config.getBooleanSafe(IQEditController.CONFIG_KEY_CONFIG_REF, false);
        if (!configRef && config.getIntegerSafe(IQEditController.CONFIG_KEY_TIME_LIMIT, -1) > 0) {
            timeLimit = config.getIntegerSafe(IQEditController.CONFIG_KEY_TIME_LIMIT, -1);
        } else {
            File unzippedDirRoot = FileResourceManager.getInstance().unzipFileResource(testEntry.getOlatResource());
            ResolvedAssessmentTest resolvedAssessmentTest = CoreSpringFactory.getImpl(QTI21Service.class).loadAndResolveAssessmentTest(unzippedDirRoot, false, false);
            AssessmentTest assessmentTest = resolvedAssessmentTest.getRootNodeLookup().extractIfSuccessful();
            if (assessmentTest.getTimeLimits() != null && assessmentTest.getTimeLimits().getMaximum() != null) {
                timeLimit = assessmentTest.getTimeLimits().getMaximum().intValue();
            }
        }
    }
    return timeLimit;
}
Also used : AssessmentTest(uk.ac.ed.ph.jqtiplus.node.test.AssessmentTest) ResolvedAssessmentTest(uk.ac.ed.ph.jqtiplus.resolution.ResolvedAssessmentTest) ModuleConfiguration(org.olat.modules.ModuleConfiguration) QTI21Service(org.olat.ims.qti21.QTI21Service) ResolvedAssessmentTest(uk.ac.ed.ph.jqtiplus.resolution.ResolvedAssessmentTest) File(java.io.File)

Example 87 with ModuleConfiguration

use of org.olat.modules.ModuleConfiguration in project openolat by klemens.

the class IQTESTCourseNode method createPreviewController.

/**
 * @see org.olat.course.nodes.CourseNode#createPreviewController(org.olat.core.gui.UserRequest,
 *      org.olat.core.gui.control.WindowControl,
 *      org.olat.course.run.userview.UserCourseEnvironment,
 *      org.olat.course.run.userview.NodeEvaluation)
 */
@Override
public Controller createPreviewController(UserRequest ureq, WindowControl wControl, UserCourseEnvironment userCourseEnv, NodeEvaluation ne) {
    Controller controller;
    ModuleConfiguration config = getModuleConfiguration();
    boolean onyx = IQEditController.CONFIG_VALUE_QTI2.equals(config.get(IQEditController.CONFIG_KEY_TYPE_QTI));
    if (onyx) {
        Translator trans = Util.createPackageTranslator(IQEditController.class, ureq.getLocale());
        controller = MessageUIFactory.createInfoMessage(ureq, wControl, "", trans.translate("error.onyx"));
    } else {
        controller = new IQPreviewController(ureq, wControl, userCourseEnv, this);
    }
    return controller;
}
Also used : ModuleConfiguration(org.olat.modules.ModuleConfiguration) Translator(org.olat.core.gui.translator.Translator) IQPreviewController(org.olat.course.nodes.iq.IQPreviewController) QTI21AssessmentRunController(org.olat.course.nodes.iq.QTI21AssessmentRunController) IQIdentityListCourseNodeController(org.olat.course.nodes.iq.IQIdentityListCourseNodeController) IQRunController(org.olat.course.nodes.iq.IQRunController) QTI21AssessmentDetailsController(org.olat.ims.qti21.ui.QTI21AssessmentDetailsController) IQPreviewController(org.olat.course.nodes.iq.IQPreviewController) IQEditController(org.olat.course.nodes.iq.IQEditController) NodeEditController(org.olat.course.editor.NodeEditController) QTI12ResultDetailsController(org.olat.ims.qti.QTI12ResultDetailsController) TabbableController(org.olat.core.gui.control.generic.tabbable.TabbableController) AssessmentCourseNodeController(org.olat.course.assessment.ui.tool.AssessmentCourseNodeController) Controller(org.olat.core.gui.control.Controller)

Example 88 with ModuleConfiguration

use of org.olat.modules.ModuleConfiguration in project openolat by klemens.

the class IQTESTCourseNode method hasQTI21TimeLimit.

/**
 * @param testEntry The test repository entry
 * @return true if the course node or the test has a time limit set.
 */
public boolean hasQTI21TimeLimit(RepositoryEntry testEntry) {
    boolean timeLimit = false;
    if (ImsQTI21Resource.TYPE_NAME.equals(testEntry.getOlatResource().getResourceableTypeName())) {
        ModuleConfiguration config = getModuleConfiguration();
        boolean configRef = config.getBooleanSafe(IQEditController.CONFIG_KEY_CONFIG_REF, false);
        if (!configRef && config.getIntegerSafe(IQEditController.CONFIG_KEY_TIME_LIMIT, -1) > 0) {
            timeLimit = true;
        } else {
            File unzippedDirRoot = FileResourceManager.getInstance().unzipFileResource(testEntry.getOlatResource());
            ResolvedAssessmentTest resolvedAssessmentTest = CoreSpringFactory.getImpl(QTI21Service.class).loadAndResolveAssessmentTest(unzippedDirRoot, false, false);
            AssessmentTest assessmentTest = resolvedAssessmentTest.getRootNodeLookup().extractIfSuccessful();
            if (assessmentTest.getTimeLimits() != null && assessmentTest.getTimeLimits().getMaximum() != null) {
                timeLimit = true;
            }
        }
    }
    return timeLimit;
}
Also used : AssessmentTest(uk.ac.ed.ph.jqtiplus.node.test.AssessmentTest) ResolvedAssessmentTest(uk.ac.ed.ph.jqtiplus.resolution.ResolvedAssessmentTest) ModuleConfiguration(org.olat.modules.ModuleConfiguration) QTI21Service(org.olat.ims.qti21.QTI21Service) ResolvedAssessmentTest(uk.ac.ed.ph.jqtiplus.resolution.ResolvedAssessmentTest) File(java.io.File)

Example 89 with ModuleConfiguration

use of org.olat.modules.ModuleConfiguration in project openolat by klemens.

the class InfoCourseNode method updateModuleConfigDefaults.

@Override
public void updateModuleConfigDefaults(boolean isNewNode) {
    ModuleConfiguration config = getModuleConfiguration();
    if (isNewNode) {
        // use defaults for new course building blocks
        config.set(InfoCourseNodeConfiguration.CONFIG_AUTOSUBSCRIBE, "on");
        config.set(InfoCourseNodeConfiguration.CONFIG_DURATION, "90");
        config.set(InfoCourseNodeConfiguration.CONFIG_LENGTH, "10");
    }
}
Also used : ModuleConfiguration(org.olat.modules.ModuleConfiguration)

Example 90 with ModuleConfiguration

use of org.olat.modules.ModuleConfiguration in project openolat by klemens.

the class MSCourseNode method hasPassedConfigured.

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