Package org.olat.ims.qti.container

Examples of org.olat.ims.qti.container.Output


        }
      }
      // set displayfeedback
      //<displayfeedback feedbacktype = "Response" linkrefid = "Correct"/>
      //<!ATTLIST displayfeedback  feedbacktype  (Response | Solution | Hint )  'Response' %I_LinkRefId; >
      Output output = itc.getOutput();
      List fbs = el_respcond.selectNodes("displayfeedback");
      for (Iterator it_fbs = fbs.iterator(); it_fbs.hasNext();) {
        Element el_dispfb = (Element) it_fbs.next();
        String linkRefId = el_dispfb.attributeValue("linkrefid"); // must exist (dtd)
        String feedbacktype = el_dispfb.attributeValue("feedbacktype"); // must exist (dtd)
        Element el_resolved =
          (Element) itc.getEl_item().selectSingleNode(".//itemfeedback[@ident='" + linkRefId + "']");
        if (el_resolved == null) continue;
        if (feedbacktype.equals("Response")) {
          // additional (olat) rule:
          // we want to render the original answer again in the simple case where the respcondition was generated
          // by the olat export and contains only one varequal.
          /*
           
              <response_label ident = "2">
                 <flow_mat>
                <material>
                    <mattext texttype="text/html">...</mattext>
                </material>
                        </flow_mat>
                    </response_label>
            ...
         
             <respcondition title="_olat_resp_feedback" continue="Yes">
              <conditionvar>
                <varequal respident="Frage6549" case="Yes">2</varequal>
              </conditionvar>
                    <displayfeedback linkrefid="2"/>
            </respcondition>
           
            In this case, it is possible (and wished) to trace the feedback back to the answer which triggered this feedback.
            Such a respcondition is identified by the title which is exactly "_olat_resp_feedback".
           
           
           */
          Element el_chosenanswer = null;
          if (respcondtitle != null && respcondtitle.equals("_olat_resp_feedback")) {
            Element el_vareq = (Element) el_respcond.selectSingleNode(".//varequal");
            String answerident = el_vareq.getText();
            el_chosenanswer = (Element) itc.getEl_item().selectSingleNode(".//response_label[@ident='" + answerident + "']//material");
          }
          output.addItem_El_response(el_chosenanswer,el_resolved); // give the whole itemfeedback to render
        } else if (feedbacktype.equals("Solution")) {
          Element el_solution = (Element) el_resolved.selectSingleNode(".//solution");
          if (el_solution != null) output.setSolution(new Solution(el_solution));
        } else if (feedbacktype.equals("Hint")) {
          //<!ENTITY % I_FeedbackStyle " feedbackstyle  (Complete | Incremental | Multilevel | Proprietary )  'Complete'">
          Element el_hint = (Element) el_resolved.selectSingleNode(".//hint");
          output.setHint(new Hint(el_hint));
        }
      }
    }
    return fulfilled;

View Full Code Here


        case QTIConstants.MESSAGE_SECTION_SUBMITTED :
          //  provide section feedback if enabled and existing
          //SectionContext sc = act.getCurrentSectionContext();         
          if (info.isFeedback()) {
            Output outp = info.getCurrentOutput();
            GenericQTIElement el_feedback = outp.getEl_response();
            if (el_feedback != null) displayFeedback(sb, el_feedback, ai, translator.getLocale());
          }
          if(!comp.getMenuDisplayConf().isEnabledMenu() && !comp.getMenuDisplayConf().isItemPageSequence()) {
            SectionContext sc = ai.getAssessmentContext().getCurrentSectionContext();
            displaySectionInfo(sb, sc, ai, comp, ubu, translator);
          }
          break;

        case QTIConstants.MESSAGE_ASSESSMENT_SUBMITTED :
          //  provide assessment feedback if enabled and existing
          if (info.isFeedback()) {
            Output outp = info.getCurrentOutput();
            GenericQTIElement el_feedback = outp.getEl_response();
            if (el_feedback != null) displayFeedback(sb, el_feedback, ai, translator.getLocale());
          }
          break;

        case QTIConstants.MESSAGE_SECTION_INFODEMANDED : // for menu item navigator
          // provide some stats maybe
          SectionContext sc = ai.getAssessmentContext().getCurrentSectionContext();
          displaySectionInfo(sb, sc, ai, comp, ubu, translator);
          break;

        case QTIConstants.MESSAGE_ASSESSMENT_INFODEMANDED : // at the start of the test
          displayAssessmentInfo(sb, act, ai, comp, ubu, translator);
          break;
      }
    }

    if (renderItems) {
      boolean displayForm = true;
      // First check wether we need to render a form.
      // No form is needed if the current item has a matapplet object to be displayed.
      // Matapplets will send their response back directly.
      SectionContext sct = act.getCurrentSectionContext();
      ItemContext itc = null;
      if (sct != null && !ai.isSectionPage()) {
        itc = sct.getCurrentItemContext();
        if (itc != null) {
          Item item = itc.getQtiItem();
          if (item.getQTIIdent().startsWith("QTIEDIT:FLA:")) displayForm = false;
        }
      }
     
      sb.append("<form action=\"");
      ubu.buildURI(sb, new String[] { VelocityContainer.COMMAND_ID }, new String[] { "sitse" });
     
      sb.append("\" id=\"ofo_iq_item\" method=\"post\">");

      if (!ai.isSectionPage()) {
        if (itc != null) displayItem(sb, renderer, ubu, itc, ai);
      } else {
        if (sct != null && sct.getItemContextCount() != 0)
          displayItems(sb, renderer, ubu, sct, ai);
      }
     
      sb.append("<div class=\"b_button_group\"><input class=\"b_button\" type=\"submit\" name=\"olat_fosm\" value=\"");
      if (ai.isSectionPage())
        sb.append(StringEscapeUtils.escapeHtml(translator.translate("submitMultiAnswers")));
      else
        sb.append(StringEscapeUtils.escapeHtml(translator.translate("submitSingleAnswer")));
      sb.append("\"");
      if (!displayForm) sb.append(" style=\"display: none;\"");
      sb.append(" /></div></form>");
    }

    if (status == QTIConstants.ASSESSMENT_FINISHED) {
      if (info.isFeedback()) {
        Output outp = info.getCurrentOutput();
        GenericQTIElement el_feedback = outp.getEl_response();
        if (el_feedback != null) displayFeedback(sb, el_feedback, ai, null);
      }
    }
    return sb;
  }
View Full Code Here

   */
  public void submitAssessment() {
    getAssessmentInstance().close();
    AssessmentContext ac = getAssessmentContext();
    if (ac.isFeedbackavailable()) {
      Output outp = ac.getOutput();
      getInfo().setCurrentOutput(outp);
      getInfo().setFeedback(true);
    }
    info.clear();
    info.setMessage(QTIConstants.MESSAGE_ASSESSMENT_SUBMITTED);
View Full Code Here

      getInfo().setRenderItems(true);
    } else { // section was successfully submitted
      sc.sectionWasSubmitted(); // increase times answered of section
      sc.eval(); // calculate any section feedback
      if (sc.isFeedbackavailable()) {
        Output outp = sc.getOutput();
        getInfo().setCurrentOutput(outp);
        getInfo().setFeedback(true);
      }
      getInfo().setMessage(QTIConstants.MESSAGE_SECTION_SUBMITTED);
      getInfo().setRenderItems(true);
View Full Code Here

      //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
View Full Code Here

        getInfo().setError(st);
        getInfo().setRenderItems(true); // still continue to next item
      }
    } else { // ok, display feedback
      ItemContext itc = getAssessmentContext().getCurrentSectionContext().getCurrentItemContext();
      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());
      }
View Full Code Here

TOP

Related Classes of org.olat.ims.qti.container.Output

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.