use of org.olat.ims.qti.container.Output in project openolat by klemens.
the class MenuItemNavigator method submitItems.
/**
* @see org.olat.qti.process.Navigator#submitItems(org.olat.qti.container.ItemsInput)
*/
public void submitItems(ItemsInput curitsinp) {
clearInfo();
int st = submitOneItem(curitsinp);
if (st != QTIConstants.ITEM_SUBMITTED) {
// time expired or too many attempts-> display a message above the next item or assessment-finished-text
getInfo().setError(st);
getInfo().setRenderItems(false);
} else {
// ok, eval the whole assessment here each time (so after a submitted item, one sees overall progress)
// getAssessmentContext().eval();
getInfo().setMessage(QTIConstants.MESSAGE_ITEM_SUBMITTED);
getInfo().setRenderItems(false);
ItemContext itc = getAssessmentContext().getCurrentSectionContext().getCurrentItemContext();
// check on section feedbacks
Output outp = itc.getOutput();
if (outp != null)
getInfo().setCurrentOutput(outp);
// check on item feedback
if (itc.isFeedback()) {
// feedback allowed
getInfo().setFeedback(itc.getOutput().hasItem_Responses());
}
if (itc.isHints()) {
// hints allowed
if (itc.getOutput().getHint() != null) {
// feedback existing on item
getInfo().setHint(true);
}
}
if (itc.isSolutions()) {
// solution allowed
if (itc.getOutput().getSolution() != null) {
// solution existing on item
getInfo().setSolution(true);
}
}
}
getAssessmentInstance().persist();
}
use of org.olat.ims.qti.container.Output in project openolat by klemens.
the class SequentialSectionNavigator method submitItems.
/**
* @see org.olat.qti.process.Navigator#submitItem(org.olat.qti.process.ItemsInput)
*/
public void submitItems(ItemsInput curitsinp) {
clearInfo();
int st = submitMultipleItems(curitsinp);
SectionContext sc = getAssessmentContext().getCurrentSectionContext();
if (st != QTIConstants.SECTION_SUBMITTED) {
// we could not submit the section (out of time is the only reason),
// display a error msg above the next section or assessment-finished-text
getInfo().setError(st);
getInfo().setRenderItems(true);
} else {
// section was successfully submitted
// increase times answered of section
sc.sectionWasSubmitted();
// calculate any section feedback
sc.eval();
if (sc.isFeedbackavailable()) {
Output outp = sc.getOutput();
getInfo().setCurrentOutput(outp);
getInfo().setFeedback(true);
}
getInfo().setMessage(QTIConstants.MESSAGE_SECTION_SUBMITTED);
getInfo().setRenderItems(true);
}
// find next section
AssessmentContext ac = getAssessmentContext();
int secPos = ac.getCurrentSectionContextPos();
int secPosMax = ac.getSectionContextCount() - 1;
if (!ac.isOpen()) {
getInfo().setError(QTIConstants.ERROR_ASSESSMENT_OUTOFTIME);
getInfo().setRenderItems(false);
submitAssessment();
} else if (secPos == secPosMax)
submitAssessment();
else {
while (secPos < secPosMax) {
// there are still further section(s)
secPos++;
if (ac.getSectionContext(secPos).getItemContextCount() != 0)
break;
}
if (secPos == secPosMax && ac.getSectionContext(secPos).getItemContextCount() == 0) {
// reached last section but section is empty -> finish assessment
submitAssessment();
} else {
ac.setCurrentSectionContextPos(secPos);
startSection(ac.getCurrentSectionContext());
}
}
getAssessmentInstance().persist();
}
Aggregations