use of org.olat.course.highscore.ui.HighScoreRunController in project openolat by klemens.
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 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);
}
}
Aggregations