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;
}
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;
}
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;
}
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");
}
}
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();
}
Aggregations