use of org.olat.course.highscore.ui.HighScoreRunController in project OpenOLAT by OpenOLAT.
the class PortfolioCourseNodeRunController method initForm.
@Override
protected void initForm(FormItemContainer formLayout, Controller listener, UserRequest ureq) {
infosContainer = FormLayoutContainer.createDefaultFormLayout("infos", getTranslator());
formLayout.add(infosContainer);
String assessmentPage = velocity_root + "/assessment_infos.html";
assessmentInfosContainer = FormLayoutContainer.createCustomFormLayout("assessmentInfos", getTranslator(), assessmentPage);
assessmentInfosContainer.setVisible(false);
formLayout.add(assessmentInfosContainer);
VelocityContainer mainVC = ((FormLayoutContainer) formLayout).getFormItemComponent();
if (courseNode.getModuleConfiguration().getBooleanSafe(MSCourseNode.CONFIG_KEY_HAS_SCORE_FIELD, false)) {
HighScoreRunController highScoreCtr = new HighScoreRunController(ureq, getWindowControl(), userCourseEnv, courseNode, this.mainForm);
if (highScoreCtr.isViewHighscore()) {
Component highScoreComponent = highScoreCtr.getInitialComponent();
mainVC.put("highScore", highScoreComponent);
}
}
Object text = config.get(PortfolioCourseNodeConfiguration.NODE_TEXT);
String explanation = (text instanceof String) ? (String) text : "";
if (StringHelper.containsNonWhitespace(explanation)) {
uifactory.addStaticTextElement("explanation.text", explanation, infosContainer);
}
String deadlineconfig = (String) config.get(PortfolioCourseNodeConfiguration.DEADLINE_TYPE);
if (!DeadlineType.none.name().equals(deadlineconfig) && deadlineconfig != null) {
// show deadline-config
String deadLineLabel = "map.deadline." + deadlineconfig + ".label";
String deadLineInfo = "";
if (deadlineconfig.equals(DeadlineType.absolut.name())) {
Formatter f = Formatter.getInstance(getLocale());
deadLineInfo = f.formatDate((Date) config.get(PortfolioCourseNodeConfiguration.DEADLINE_DATE));
} else {
deadLineInfo = getDeadlineRelativeInfo();
}
deadlineDateText = uifactory.addStaticTextElement("deadline", deadLineLabel, deadLineInfo, infosContainer);
}
if (templateMap != null || templateBinder != null) {
updateUI(ureq);
}
}
use of org.olat.course.highscore.ui.HighScoreRunController in project OpenOLAT by OpenOLAT.
the class GTACoachedGroupGradingController method initForm.
@Override
protected void initForm(FormItemContainer formLayout, Controller listener, UserRequest ureq) {
assessmentFormButton = uifactory.addFormLink("coach.assessment", "coach.assessment", null, formLayout, Link.BUTTON);
assessmentFormButton.setCustomEnabledLinkCSS("btn btn-primary");
assessmentFormButton.setIconLeftCSS("o_icon o_icon o_icon_submit");
assessmentFormButton.setElementCssClass("o_sel_course_gta_assessment_button");
assessmentFormButton.setVisible(!coachCourseEnv.isCourseReadOnly() && (assignedTask == null || assignedTask.getTaskStatus() != TaskProcess.graded));
reopenButton = uifactory.addFormLink("coach.reopen", "coach.reopen", null, formLayout, Link.BUTTON);
reopenButton.setElementCssClass("o_sel_course_gta_reopen_button");
reopenButton.setVisible(!coachCourseEnv.isCourseReadOnly() && assignedTask != null && assignedTask.getTaskStatus() == TaskProcess.graded);
if (formLayout instanceof FormLayoutContainer) {
ModuleConfiguration config = gtaNode.getModuleConfiguration();
FormLayoutContainer layoutCont = (FormLayoutContainer) formLayout;
layoutCont.contextPut(MSCourseNode.CONFIG_KEY_HAS_SCORE_FIELD, config.get(MSCourseNode.CONFIG_KEY_HAS_SCORE_FIELD));
layoutCont.contextPut(MSCourseNode.CONFIG_KEY_HAS_PASSED_FIELD, config.get(MSCourseNode.CONFIG_KEY_HAS_PASSED_FIELD));
layoutCont.contextPut(MSCourseNode.CONFIG_KEY_PASSED_CUT_VALUE, AssessmentHelper.getRoundedScore(config.getFloatEntry(MSCourseNode.CONFIG_KEY_PASSED_CUT_VALUE)));
layoutCont.contextPut(MSCourseNode.CONFIG_KEY_SCORE_MIN, AssessmentHelper.getRoundedScore(config.getFloatEntry(MSCourseNode.CONFIG_KEY_SCORE_MIN)));
layoutCont.contextPut(MSCourseNode.CONFIG_KEY_SCORE_MAX, AssessmentHelper.getRoundedScore(config.getFloatEntry(MSCourseNode.CONFIG_KEY_SCORE_MAX)));
if (config.getBooleanSafe(MSCourseNode.CONFIG_KEY_HAS_SCORE_FIELD, false)) {
HighScoreRunController highScoreCtr = new HighScoreRunController(ureq, getWindowControl(), coachCourseEnv, gtaNode);
if (highScoreCtr.isViewHighscore()) {
Component highScoreComponent = highScoreCtr.getInitialComponent();
layoutCont.put("highScore", highScoreComponent);
}
}
}
FlexiTableColumnModel columnsModel = FlexiTableDataModelFactory.createFlexiTableColumnModel();
if (isAdministrativeUser) {
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(Cols.username.i18nKey(), Cols.username.ordinal()));
}
int i = 0;
for (UserPropertyHandler userPropertyHandler : userPropertyHandlers) {
int colIndex = GTACoachedGroupGradingController.USER_PROPS_OFFSET + i++;
if (userPropertyHandler == null)
continue;
String propName = userPropertyHandler.getName();
boolean visible = userManager.isMandatoryUserProperty(GTACoachedGroupGradingController.USER_PROPS_ID, userPropertyHandler);
if (visible) {
FlexiColumnModel col;
if (UserConstants.FIRSTNAME.equals(propName) || UserConstants.LASTNAME.equals(propName)) {
col = new DefaultFlexiColumnModel(userPropertyHandler.i18nColumnDescriptorLabelKey(), colIndex, userPropertyHandler.getName(), true, propName, new StaticFlexiCellRenderer(userPropertyHandler.getName(), new TextFlexiCellRenderer()));
} else {
col = new DefaultFlexiColumnModel(true, userPropertyHandler.i18nColumnDescriptorLabelKey(), colIndex, true, propName);
}
columnsModel.addFlexiColumnModel(col);
}
}
if (withPassed) {
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(Cols.passedVal.i18nKey(), Cols.passedVal.ordinal(), new PassedCellRenderer()));
}
if (withScore) {
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(Cols.scoreVal.i18nKey(), Cols.scoreVal.ordinal()));
}
if (withComment) {
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(Cols.commentVal.i18nKey(), Cols.commentVal.ordinal()));
}
model = new GroupAssessmentModel(gtaNode, userPropertyHandlers, getLocale(), columnsModel);
table = uifactory.addTableElement(getWindowControl(), "group-list", model, getTranslator(), formLayout);
table.setCustomizeColumns(true);
table.setAndLoadPersistedPreferences(ureq, "gtagroup-assessment");
}
use of org.olat.course.highscore.ui.HighScoreRunController in project OpenOLAT by OpenOLAT.
the class LTIRunController method doRun.
/**
* Helper to initialize the LTI run view after user has accepted data exchange.
* @param ureq
*/
private void doRun(UserRequest ureq) {
if (display == LTIDisplayOptions.window) {
// Use other container for popup opening. Rest of code is the same
run = createVelocityContainer("runPopup");
} else if (display == LTIDisplayOptions.fullscreen) {
run = createVelocityContainer("run");
back = LinkFactory.createLinkBack(run, this);
run.put("back", back);
} else {
run = createVelocityContainer("run");
}
// push title and learning objectives, only visible on intro page
run.contextPut("menuTitle", courseNode.getShortTitle());
run.contextPut("displayTitle", courseNode.getLongTitle());
startPage = createVelocityContainer("overview");
startPage.contextPut("menuTitle", courseNode.getShortTitle());
startPage.contextPut("displayTitle", courseNode.getLongTitle());
if (courseNode.getModuleConfiguration().getBooleanSafe(MSCourseNode.CONFIG_KEY_HAS_SCORE_FIELD, false)) {
HighScoreRunController highScoreCtr = new HighScoreRunController(ureq, getWindowControl(), userCourseEnv, courseNode);
if (highScoreCtr.isViewHighscore()) {
Component highScoreComponent = highScoreCtr.getInitialComponent();
startPage.put("highScore", highScoreComponent);
}
}
startButton = LinkFactory.createButton("start", startPage, this);
startButton.setPrimary(true);
Boolean assessable = config.getBooleanEntry(BasicLTICourseNode.CONFIG_KEY_HAS_SCORE_FIELD);
if (assessable != null && assessable.booleanValue()) {
startPage.contextPut("isassessable", assessable);
Integer attempts = courseNode.getUserAttempts(userCourseEnv);
startPage.contextPut("attempts", attempts);
ScoreEvaluation eval = courseNode.getUserScoreEvaluation(userCourseEnv);
Float cutValue = config.getFloatEntry(BasicLTICourseNode.CONFIG_KEY_PASSED_CUT_VALUE);
if (cutValue != null) {
startPage.contextPut("hasPassedValue", Boolean.TRUE);
startPage.contextPut("passed", eval.getPassed());
}
startPage.contextPut("score", eval.getScore());
startPage.contextPut("hasScore", Boolean.TRUE);
boolean resultsVisible = eval.getUserVisible() == null || eval.getUserVisible().booleanValue();
startPage.contextPut("resultsVisible", resultsVisible);
mainPanel.setContent(startPage);
}
// only run when user as already accepted to data exchange or no data
// has to be exchanged or when it is configured to not show the accept
// dialog,
createExchangeDataProperties();
String dataExchangeHash = createHashFromExchangeDataProperties();
Boolean skipAcceptLaunchPage = config.getBooleanEntry(BasicLTICourseNode.CONFIG_SKIP_ACCEPT_LAUNCH_PAGE);
if (dataExchangeHash == null || checkHasDataExchangeAccepted(dataExchangeHash) || (skipAcceptLaunchPage != null && skipAcceptLaunchPage.booleanValue())) {
Boolean skipLaunchPage = config.getBooleanEntry(BasicLTICourseNode.CONFIG_SKIP_LAUNCH_PAGE);
if (skipLaunchPage != null && skipLaunchPage.booleanValue()) {
// start the content immediately
openBasicLTIContent(ureq);
} else {
// or show the start button
mainPanel.setContent(startPage);
}
} else {
doAskDataExchange();
}
}
use of org.olat.course.highscore.ui.HighScoreRunController in project openolat by klemens.
the class QTI21AssessmentRunController method initAssessment.
private void initAssessment(UserRequest ureq) {
// config : show score info
boolean enableScoreInfo = config.getBooleanSafe(IQEditController.CONFIG_KEY_ENABLESCOREINFO);
mainVC.contextPut("enableScoreInfo", Boolean.valueOf(enableScoreInfo));
// configuration data
int maxAttempts = deliveryOptions.getMaxAttempts();
if (maxAttempts > 0) {
mainVC.contextPut("attemptsConfig", Integer.valueOf(maxAttempts));
} else {
mainVC.contextPut("attemptsConfig", Boolean.FALSE);
}
// configure date period
mainVC.contextPut("blockDate", Boolean.valueOf(blockedBasedOnDate()));
// time limit
Long timeLimit = getAssessmentTestMaxTimeLimit();
if (timeLimit != null) {
mainVC.contextPut("timeLimit", Formatter.formatHourAndSeconds(timeLimit.longValue() * 1000l));
}
if (courseNode instanceof AssessableCourseNode) {
AssessableCourseNode assessableCourseNode = (AssessableCourseNode) courseNode;
if (assessableCourseNode.hasScoreConfigured() || userCourseEnv.isCoach()) {
HighScoreRunController highScoreCtr = new HighScoreRunController(ureq, getWindowControl(), userCourseEnv, courseNode);
if (highScoreCtr.isViewHighscore()) {
Component highScoreComponent = highScoreCtr.getInitialComponent();
mainVC.put("highScore", highScoreComponent);
}
}
}
// user data
if (courseNode instanceof SelfAssessableCourseNode) {
SelfAssessableCourseNode acn = (SelfAssessableCourseNode) courseNode;
ScoreEvaluation scoreEval = acn.getUserScoreEvaluation(userCourseEnv);
Integer attempts = acn.getUserAttempts(userCourseEnv);
if (scoreEval != null) {
mainVC.contextPut("resultsVisible", Boolean.TRUE);
mainVC.contextPut("hasResults", Boolean.TRUE);
mainVC.contextPut("score", AssessmentHelper.getRoundedScore(scoreEval.getScore()));
mainVC.contextPut("hasPassedValue", (scoreEval.getPassed() == null ? Boolean.FALSE : Boolean.TRUE));
mainVC.contextPut("passed", scoreEval.getPassed());
// at least one attempt
mainVC.contextPut("attempts", attempts);
mainVC.contextPut("showChangeLog", Boolean.TRUE && enableScoreInfo);
exposeResults(ureq, true);
} else {
exposeResults(ureq, false);
}
} else if (courseNode instanceof IQTESTCourseNode) {
IQTESTCourseNode testCourseNode = (IQTESTCourseNode) courseNode;
AssessmentEntry assessmentEntry = testCourseNode.getUserAssessmentEntry(userCourseEnv);
if (assessmentEntry == null) {
mainVC.contextPut("blockAfterSuccess", Boolean.FALSE);
mainVC.contextPut("score", null);
mainVC.contextPut("hasPassedValue", Boolean.FALSE);
mainVC.contextPut("passed", Boolean.FALSE);
mainVC.contextPut("comment", null);
mainVC.contextPut("attempts", 0);
mainVC.contextPut("showChangeLog", Boolean.FALSE);
} else {
Boolean passed = assessmentEntry.getPassed();
// block if test passed (and config set to check it)
Boolean blocked = Boolean.FALSE;
boolean blockAfterSuccess = deliveryOptions.isBlockAfterSuccess();
if (blockAfterSuccess && passed != null && passed.booleanValue()) {
blocked = Boolean.TRUE;
}
mainVC.contextPut("blockAfterSuccess", blocked);
boolean resultsVisible = assessmentEntry.getUserVisibility() == null || assessmentEntry.getUserVisibility().booleanValue();
mainVC.contextPut("resultsVisible", resultsVisible);
mainVC.contextPut("score", AssessmentHelper.getRoundedScore(assessmentEntry.getScore()));
mainVC.contextPut("hasPassedValue", (passed == null ? Boolean.FALSE : Boolean.TRUE));
mainVC.contextPut("passed", passed);
if (resultsVisible) {
if (testCourseNode.hasCommentConfigured()) {
StringBuilder comment = Formatter.stripTabsAndReturns(testCourseNode.getUserUserComment(userCourseEnv));
if (comment != null && comment.length() > 0) {
mainVC.contextPut("comment", StringHelper.xssScan(comment));
mainVC.contextPut("in-comment", isPanelOpen(ureq, "comment", true));
}
}
if (testCourseNode.hasIndividualAsssessmentDocuments()) {
List<File> docs = testCourseNode.getIndividualAssessmentDocuments(userCourseEnv);
String mapperUri = registerCacheableMapper(ureq, null, new DocumentsMapper(docs));
mainVC.contextPut("docsMapperUri", mapperUri);
mainVC.contextPut("docs", docs);
mainVC.contextPut("in-assessmentDocuments", isPanelOpen(ureq, "assessmentDocuments", true));
}
}
Integer attempts = assessmentEntry.getAttempts();
mainVC.contextPut("attempts", attempts == null ? new Integer(0) : attempts);
boolean showChangelog = (!anonym && enableScoreInfo && resultsVisible && isResultVisible(config));
mainVC.contextPut("showChangeLog", showChangelog);
if (deliveryOptions.isDigitalSignature()) {
AssessmentTestSession session = qtiService.getAssessmentTestSession(assessmentEntry.getAssessmentId());
if (session != null) {
File signature = qtiService.getAssessmentResultSignature(session);
if (signature != null && signature.exists()) {
signatureDownloadLink = LinkFactory.createLink("digital.signature.download.link", mainVC, this);
signatureDownloadLink.setIconLeftCSS("o_icon o_icon-fw o_icon_download");
signatureDownloadLink.setTarget("_blank");
Date issueDate = qtiService.getAssessmentResultSignatureIssueDate(session);
if (issueDate != null) {
mainVC.contextPut("signatureIssueDate", Formatter.getInstance(getLocale()).formatDateAndTime(issueDate));
}
}
}
}
exposeResults(ureq, resultsVisible);
}
}
}
use of org.olat.course.highscore.ui.HighScoreRunController in project openolat by klemens.
the class GTACoachedGroupGradingController method initForm.
@Override
protected void initForm(FormItemContainer formLayout, Controller listener, UserRequest ureq) {
assessmentFormButton = uifactory.addFormLink("coach.assessment", "coach.assessment", null, formLayout, Link.BUTTON);
assessmentFormButton.setCustomEnabledLinkCSS("btn btn-primary");
assessmentFormButton.setIconLeftCSS("o_icon o_icon o_icon_submit");
assessmentFormButton.setElementCssClass("o_sel_course_gta_assessment_button");
assessmentFormButton.setVisible(!coachCourseEnv.isCourseReadOnly() && (assignedTask == null || assignedTask.getTaskStatus() != TaskProcess.graded));
reopenButton = uifactory.addFormLink("coach.reopen", "coach.reopen", null, formLayout, Link.BUTTON);
reopenButton.setElementCssClass("o_sel_course_gta_reopen_button");
reopenButton.setVisible(!coachCourseEnv.isCourseReadOnly() && assignedTask != null && assignedTask.getTaskStatus() == TaskProcess.graded);
if (formLayout instanceof FormLayoutContainer) {
ModuleConfiguration config = gtaNode.getModuleConfiguration();
FormLayoutContainer layoutCont = (FormLayoutContainer) formLayout;
layoutCont.contextPut(MSCourseNode.CONFIG_KEY_HAS_SCORE_FIELD, config.get(MSCourseNode.CONFIG_KEY_HAS_SCORE_FIELD));
layoutCont.contextPut(MSCourseNode.CONFIG_KEY_HAS_PASSED_FIELD, config.get(MSCourseNode.CONFIG_KEY_HAS_PASSED_FIELD));
layoutCont.contextPut(MSCourseNode.CONFIG_KEY_PASSED_CUT_VALUE, AssessmentHelper.getRoundedScore(config.getFloatEntry(MSCourseNode.CONFIG_KEY_PASSED_CUT_VALUE)));
layoutCont.contextPut(MSCourseNode.CONFIG_KEY_SCORE_MIN, AssessmentHelper.getRoundedScore(config.getFloatEntry(MSCourseNode.CONFIG_KEY_SCORE_MIN)));
layoutCont.contextPut(MSCourseNode.CONFIG_KEY_SCORE_MAX, AssessmentHelper.getRoundedScore(config.getFloatEntry(MSCourseNode.CONFIG_KEY_SCORE_MAX)));
if (config.getBooleanSafe(MSCourseNode.CONFIG_KEY_HAS_SCORE_FIELD, false)) {
HighScoreRunController highScoreCtr = new HighScoreRunController(ureq, getWindowControl(), coachCourseEnv, gtaNode);
if (highScoreCtr.isViewHighscore()) {
Component highScoreComponent = highScoreCtr.getInitialComponent();
layoutCont.put("highScore", highScoreComponent);
}
}
}
FlexiTableColumnModel columnsModel = FlexiTableDataModelFactory.createFlexiTableColumnModel();
if (isAdministrativeUser) {
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(Cols.username.i18nKey(), Cols.username.ordinal()));
}
int i = 0;
for (UserPropertyHandler userPropertyHandler : userPropertyHandlers) {
int colIndex = GTACoachedGroupGradingController.USER_PROPS_OFFSET + i++;
if (userPropertyHandler == null)
continue;
String propName = userPropertyHandler.getName();
boolean visible = userManager.isMandatoryUserProperty(GTACoachedGroupGradingController.USER_PROPS_ID, userPropertyHandler);
if (visible) {
FlexiColumnModel col;
if (UserConstants.FIRSTNAME.equals(propName) || UserConstants.LASTNAME.equals(propName)) {
col = new DefaultFlexiColumnModel(userPropertyHandler.i18nColumnDescriptorLabelKey(), colIndex, userPropertyHandler.getName(), true, propName, new StaticFlexiCellRenderer(userPropertyHandler.getName(), new TextFlexiCellRenderer()));
} else {
col = new DefaultFlexiColumnModel(true, userPropertyHandler.i18nColumnDescriptorLabelKey(), colIndex, true, propName);
}
columnsModel.addFlexiColumnModel(col);
}
}
if (withPassed) {
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(Cols.passedVal.i18nKey(), Cols.passedVal.ordinal(), new PassedCellRenderer()));
}
if (withScore) {
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(Cols.scoreVal.i18nKey(), Cols.scoreVal.ordinal()));
}
if (withComment) {
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(Cols.commentVal.i18nKey(), Cols.commentVal.ordinal()));
}
model = new GroupAssessmentModel(gtaNode, userPropertyHandlers, getLocale(), columnsModel);
table = uifactory.addTableElement(getWindowControl(), "group-list", model, getTranslator(), formLayout);
table.setCustomizeColumns(true);
table.setAndLoadPersistedPreferences(ureq, "gtagroup-assessment");
}
Aggregations