use of org.olat.modules.ModuleConfiguration in project OpenOLAT by OpenOLAT.
the class GTAIdentityListCourseNodeController method initStatusColumns.
@Override
protected void initStatusColumns(FlexiTableColumnModel columnsModel) {
ModuleConfiguration config = courseNode.getModuleConfiguration();
if (GTAType.individual.name().equals(config.getStringValue(GTACourseNode.GTASK_TYPE)) && config.getBooleanSafe(GTACourseNode.GTASK_ASSIGNMENT)) {
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel("table.header.details.gta", IdentityCourseElementCols.details.ordinal()));
}
super.initStatusColumns(columnsModel);
}
use of org.olat.modules.ModuleConfiguration in project OpenOLAT by OpenOLAT.
the class GTAIdentityListCourseNodeController method loadModel.
@Override
protected void loadModel(UserRequest ureq) {
super.loadModel(ureq);
ModuleConfiguration config = courseNode.getModuleConfiguration();
if (GTAType.individual.name().equals(config.getStringValue(GTACourseNode.GTASK_TYPE)) && config.getBooleanSafe(GTACourseNode.GTASK_ASSIGNMENT)) {
TaskList taskList = gtaManager.getTaskList(getCourseRepositoryEntry(), (GTACourseNode) courseNode);
if (taskList != null) {
loadTasksInModel(taskList);
}
}
}
use of org.olat.modules.ModuleConfiguration in project OpenOLAT by OpenOLAT.
the class ConvertToGTACourseNode method convertConfiguration.
private void convertConfiguration(TACourseNode sourceNode, GTACourseNode gtaNode) {
ModuleConfiguration gtaConfig = gtaNode.getModuleConfiguration();
ModuleConfiguration modConfig = sourceNode.getModuleConfiguration();
gtaConfig.setStringValue(GTACourseNode.GTASK_TYPE, GTAType.individual.name());
gtaConfig.setBooleanEntry(GTACourseNode.GTASK_ASSIGNMENT, modConfig.getBooleanSafe(TACourseNode.CONF_TASK_ENABLED));
if (TaskController.TYPE_AUTO.equals(modConfig.get(TACourseNode.CONF_TASK_TYPE))) {
gtaConfig.setStringValue(GTACourseNode.GTASK_ASSIGNEMENT_TYPE, GTACourseNode.GTASK_ASSIGNEMENT_TYPE_AUTO);
} else if (TaskController.TYPE_MANUAL.equals(modConfig.get(TACourseNode.CONF_TASK_TYPE))) {
gtaConfig.setStringValue(GTACourseNode.GTASK_ASSIGNEMENT_TYPE, GTACourseNode.GTASK_ASSIGNEMENT_TYPE_MANUAL);
} else {
gtaConfig.setStringValue(GTACourseNode.GTASK_ASSIGNEMENT_TYPE, GTACourseNode.GTASK_ASSIGNEMENT_TYPE_MANUAL);
}
gtaConfig.setBooleanEntry(GTACourseNode.GTASK_PREVIEW, modConfig.getBooleanSafe(TACourseNode.CONF_TASK_PREVIEW));
if (modConfig.getBooleanSafe(TACourseNode.CONF_TASK_SAMPLING_WITH_REPLACEMENT)) {
gtaConfig.setStringValue(GTACourseNode.GTASK_SAMPLING, GTACourseNode.GTASK_SAMPLING_REUSE);
} else {
gtaConfig.setStringValue(GTACourseNode.GTASK_SAMPLING, GTACourseNode.GTASK_SAMPLING_UNIQUE);
}
if (modConfig.get(TACourseNode.CONF_TASK_TEXT) != null) {
gtaConfig.setStringValue(GTACourseNode.GTASK_USERS_TEXT, modConfig.get(TACourseNode.CONF_TASK_TEXT).toString());
}
gtaConfig.setBooleanEntry(GTACourseNode.GTASK_SUBMIT, modConfig.getBooleanSafe(TACourseNode.CONF_DROPBOX_ENABLED));
// drop box options
String confirmation = modConfig.getStringValue(TACourseNode.CONF_DROPBOX_CONFIRMATION);
if (StringHelper.containsNonWhitespace(confirmation)) {
gtaConfig.setStringValue(GTACourseNode.GTASK_SUBMISSION_TEXT, confirmation);
gtaConfig.setBooleanEntry(GTACourseNode.GTASK_SUBMISSION_MAIL_CONFIRMATION, modConfig.getBooleanSafe(TACourseNode.CONF_DROPBOX_ENABLEMAIL));
}
gtaConfig.setBooleanEntry(GTACourseNode.GTASK_REVIEW_AND_CORRECTION, modConfig.getBooleanSafe(TACourseNode.CONF_RETURNBOX_ENABLED));
// passed
gtaConfig.setBooleanEntry(GTACourseNode.GTASK_GRADING, modConfig.getBooleanSafe(TACourseNode.CONF_SCORING_ENABLED));
// grading options
gtaConfig.set(MSCourseNode.CONFIG_KEY_HAS_SCORE_FIELD, modConfig.getBooleanEntry(MSCourseNode.CONFIG_KEY_HAS_SCORE_FIELD));
gtaConfig.set(MSCourseNode.CONFIG_KEY_SCORE_MIN, modConfig.get(MSCourseNode.CONFIG_KEY_SCORE_MIN));
gtaConfig.set(MSCourseNode.CONFIG_KEY_SCORE_MAX, modConfig.get(MSCourseNode.CONFIG_KEY_SCORE_MAX));
gtaConfig.set(MSCourseNode.CONFIG_KEY_HAS_PASSED_FIELD, modConfig.getBooleanEntry(MSCourseNode.CONFIG_KEY_HAS_PASSED_FIELD));
if (modConfig.get(MSCourseNode.CONFIG_KEY_PASSED_CUT_VALUE) != null) {
gtaConfig.set(MSCourseNode.CONFIG_KEY_PASSED_CUT_VALUE, modConfig.get(MSCourseNode.CONFIG_KEY_PASSED_CUT_VALUE));
}
gtaConfig.set(MSCourseNode.CONFIG_KEY_HAS_COMMENT_FIELD, modConfig.getBooleanEntry(MSCourseNode.CONFIG_KEY_HAS_COMMENT_FIELD));
gtaConfig.set(MSCourseNode.CONFIG_KEY_INFOTEXT_USER, modConfig.get(MSCourseNode.CONFIG_KEY_INFOTEXT_USER));
gtaConfig.set(MSCourseNode.CONFIG_KEY_INFOTEXT_COACH, modConfig.get(MSCourseNode.CONFIG_KEY_INFOTEXT_COACH));
gtaConfig.setBooleanEntry(GTACourseNode.GTASK_SAMPLE_SOLUTION, modConfig.getBooleanSafe(TACourseNode.CONF_SOLUTION_ENABLED));
}
use of org.olat.modules.ModuleConfiguration in project OpenOLAT by OpenOLAT.
the class QTI12PullTestsToolController method retrieveTest.
private void retrieveTest(Identity assessedIdentity, ICourse course) {
ModuleConfiguration modConfig = courseNode.getModuleConfiguration();
String resourcePathInfo = courseEnv.getCourseResourceableId() + File.separator + courseNode.getIdent();
AssessmentInstance ai = AssessmentFactory.createAssessmentInstance(assessedIdentity, "", modConfig, false, courseEnv.getCourseResourceableId(), courseNode.getIdent(), resourcePathInfo, null);
// close the test
ai.stop();
// persist the results
iqm.persistResults(ai);
// reporting
Document docResReporting = iqm.getResultsReporting(ai, assessedIdentity, I18nModule.getDefaultLocale());
FilePersister.createResultsReporting(docResReporting, assessedIdentity, ai.getFormattedType(), ai.getAssessID());
// olat results
AssessmentContext ac = ai.getAssessmentContext();
Float score = new Float(ac.getScore());
Boolean passed = new Boolean(ac.isPassed());
ScoreEvaluation sceval = new ScoreEvaluation(score, passed, Boolean.FALSE, new Long(ai.getAssessID()));
UserCourseEnvironment userCourseEnv = AssessmentHelper.createAndInitUserCourseEnvironment(assessedIdentity, course);
courseNode.updateUserScoreEvaluation(sceval, userCourseEnv, assessedIdentity, true, Role.coach);
// cleanup
ai.cleanUp();
}
use of org.olat.modules.ModuleConfiguration in project OpenOLAT by OpenOLAT.
the class HighScoreRunController method setupContent.
private void setupContent(UserRequest ureq, UserCourseEnvironment userCourseEnv, CourseNode courseNode) {
// initialize ModuleConfiguration
ModuleConfiguration config = courseNode.getModuleConfiguration();
viewHighscore = config.getBooleanSafe(HighScoreEditController.CONFIG_KEY_HIGHSCORE);
// do not build form if high-score is not set
if (!viewHighscore) {
return;
}
Date start = config.getBooleanEntry(HighScoreEditController.CONFIG_KEY_DATESTART) != null ? (Date) config.get(HighScoreEditController.CONFIG_KEY_DATESTART) : null;
// display only if start time has been met
if (start != null && start.after(new Date())) {
viewHighscore = false;
return;
}
// guests will never see the highscore
if (ureq != null && ureq.getUserSession().getRoles().isGuestOnly()) {
viewHighscore = false;
return;
}
ownIdentity = userCourseEnv.getIdentityEnvironment().getIdentity();
AssessmentManager assessmentManager = userCourseEnv.getCourseEnvironment().getAssessmentManager();
AssessmentEntry ownEntry = assessmentManager.getAssessmentEntry(courseNode, ownIdentity);
// check user visibility
if (ownEntry != null && ownEntry.getUserVisibility() != null && !ownEntry.getUserVisibility().booleanValue()) {
viewHighscore = false;
return;
}
boolean adminORcoach = userCourseEnv.isAdmin() || userCourseEnv.isCoach();
// coaches or admin may see highscore, user only if already scored
if (!adminORcoach && (ownEntry == null || (ownEntry != null && ownEntry.getScore() == null))) {
viewHighscore = false;
return;
}
// ban zero scorer from viewing the highscore on STCourseNode
if (!adminORcoach && isSTCourseNode && ownEntry != null && ownEntry.getScore().equals(new BigDecimal(0))) {
viewHighscore = false;
return;
}
List<AssessmentEntry> assessEntries = assessmentManager.getAssessmentEntriesWithStatus(courseNode, null, isSTCourseNode);
// display only if has content
if (assessEntries == null || assessEntries.isEmpty()) {
viewHighscore = false;
return;
}
viewTable = config.getBooleanSafe(HighScoreEditController.CONFIG_KEY_LISTING);
viewHistogram = config.getBooleanSafe(HighScoreEditController.CONFIG_KEY_HISTOGRAM);
viewPosition = config.getBooleanSafe(HighScoreEditController.CONFIG_KEY_POSITION);
viewPodium = config.getBooleanSafe(HighScoreEditController.CONFIG_KEY_PODIUM);
anonymous = config.getBooleanSafe(HighScoreEditController.CONFIG_KEY_ANONYMIZE);
int bestOnly = config.getBooleanEntry(HighScoreEditController.CONFIG_KEY_BESTONLY) != null ? (int) config.get(HighScoreEditController.CONFIG_KEY_BESTONLY) : 0;
tableSize = bestOnly != 0 ? (int) config.get(HighScoreEditController.CONFIG_KEY_NUMUSER) : assessEntries.size();
initLists();
// get borders
lowerBorder = (Float) config.get(MSCourseNode.CONFIG_KEY_SCORE_MIN);
upperBorder = (Float) config.get(MSCourseNode.CONFIG_KEY_SCORE_MAX);
// compute ranking and order
highscoreDataModel = highScoreManager.sortRankByScore(assessEntries, allMembers, ownIdMembers, allPodium, ownIdIndices, tableSize, ownIdentity);
allScores = highscoreDataModel.getScores();
// init showConfig from user Prefs
doLoadShowConfig(ureq);
initForm(ureq);
}
Aggregations