Search in sources :

Example 11 with Output

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();
}
Also used : ItemContext(org.olat.ims.qti.container.ItemContext) Output(org.olat.ims.qti.container.Output)

Example 12 with Output

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();
}
Also used : SectionContext(org.olat.ims.qti.container.SectionContext) AssessmentContext(org.olat.ims.qti.container.AssessmentContext) Output(org.olat.ims.qti.container.Output)

Aggregations

Output (org.olat.ims.qti.container.Output)12 AssessmentContext (org.olat.ims.qti.container.AssessmentContext)8 ItemContext (org.olat.ims.qti.container.ItemContext)8 SectionContext (org.olat.ims.qti.container.SectionContext)6 Hint (org.olat.ims.qti.container.qtielements.Hint)4 Solution (org.olat.ims.qti.container.qtielements.Solution)4 Iterator (java.util.Iterator)2 List (java.util.List)2 Element (org.dom4j.Element)2 StringOutput (org.olat.core.gui.render.StringOutput)2 Variable (org.olat.ims.qti.container.Variable)2 Variables (org.olat.ims.qti.container.Variables)2 GenericQTIElement (org.olat.ims.qti.container.qtielements.GenericQTIElement)2 Item (org.olat.ims.qti.container.qtielements.Item)2 Info (org.olat.ims.qti.navigator.Info)2 AssessmentInstance (org.olat.ims.qti.process.AssessmentInstance)2 IQManager (org.olat.modules.iq.IQManager)2