Package org.olat.ims.qti.editor.beecom.objects

Examples of org.olat.ims.qti.editor.beecom.objects.Response


   */
  public static float calculateMaxScore(Question question) {
    float tmpScore = 0;
    if (question.isSingleCorrect()) return question.getSingleCorrectScore();
    for (Iterator iter = question.getResponses().iterator(); iter.hasNext();) {
      Response resp = (Response) iter.next();
      float points = resp.getPoints();
      if (points > 0) tmpScore = tmpScore + points;
    }
    return tmpScore;
  }
View Full Code Here


        }     
        //responses
        List responseList = item.getQuestion().getResponses();
        Iterator responseIterator = responseList.iterator();
        while(responseIterator.hasNext()) {
          Response response = (Response)responseIterator.next();
          Material responseMat = response.getContent();
          //parse filenames
          if(responseMat!=null) {
            returnSet.addAll(getMediaFileNames(responseMat.renderAsHtmlForEditor()));
          }
          // response-level feedback
          Material responseFeedbackMat = QTIEditHelper.getFeedbackOlatRespMaterial(item, response.getIdent());
          if(responseFeedbackMat!=null) {
            returnSet.addAll(getMediaFileNames(responseFeedbackMat.renderAsHtmlForEditor()));
          }
        } 
        //feedback
View Full Code Here

    List ids = new ArrayList();
    List asTexts = new ArrayList();
    List feedbacks = new ArrayList();
    List responses = question.getResponses();
    for (Iterator iter = responses.iterator(); iter.hasNext();) {
      Response resp = (Response) iter.next();
      if (isFIB) {
        if (FIBResponse.TYPE_BLANK.equals(((FIBResponse) resp).getType())) {
          asTexts.add(formatFIBResponseAsText((FIBResponse) resp));
          ids.add(resp.getIdent());
          feedbacks.add(QTIEditHelper.getFeedbackOlatRespText(item, resp.getIdent()));
        }
      } else if (isESSAY) {
        asTexts.add(formatESSAYResponseAsText((EssayResponse) resp));
        ids.add(resp.getIdent());
        feedbacks.add(QTIEditHelper.getFeedbackOlatRespText(item, resp.getIdent()));
      } else {
        // not a FIB or ESSAY response
        asTexts.add(resp.getContent().renderAsText());
        ids.add(resp.getIdent());
        feedbacks.add(QTIEditHelper.getFeedbackOlatRespText(item, resp.getIdent()));
      }
    }
    qtiState.put("QUESTION.RESPONSES.IDS", ids);
    qtiState.put("QUESTION.RESPONSES.ASTEXT", asTexts);
    qtiState.put("QUESTION.RESPONSES.FEEDBACK", feedbacks);
View Full Code Here

      List responses = question.getResponses();
      int i = 0;
      boolean nothingToDo = false;
      for (Iterator iter = responses.iterator(); iter.hasNext();) {
        nothingToDo = false;
        Response resp = (Response) iter.next();
        if (isFIB) {
          if (FIBResponse.TYPE_BLANK.equals(((FIBResponse) resp).getType())) {
            newResp = formatFIBResponseAsText((FIBResponse) resp);
          } else {
            // skip
            nothingToDo = true;
          }
        } else if (isESSAY) {
          newResp = formatESSAYResponseAsText((EssayResponse) resp);
        } else {
          newResp = resp.getContent().renderAsText();
        }
        // if NOT nothingToDO
        if (!nothingToDo) {
          oldResp = (String) asTexts.get(i);
          if ((oldResp != null && !oldResp.equals(newResp)) || (newResp != null && !newResp.equals(oldResp))) {
            if (isFIB) {
              responsesChanges += "\nBlank changed:";
              responsesChanges += "\nold blank: \n\t" + formatVariable(oldResp) + "\n\nnew blank: \n\t" + formatVariable(newResp);
            } else {
              responsesChanges += "\nResponse changed:";
              responsesChanges += "\nold response: \n\t" + formatVariable(oldResp) + "\n\nnew response: \n\t" + formatVariable(newResp);
            }
          }
          // feedback to response changed?
          newFeedback = QTIEditHelper.getFeedbackOlatRespText(item, resp.getIdent());
          oldFeedback = (String) feedbacks.get(i);
          if ((oldFeedback != null && !oldFeedback.equals(newFeedback)) || (newFeedback != null && !newFeedback.equals(oldFeedback))) {
            feedbackChanges += "\nFeedback changed:";
            feedbackChanges += "\nold feedback: \n\t" + formatVariable(oldFeedback) + "\n\nnew feedback: \n\t"
                + formatVariable(newFeedback);
View Full Code Here

              // list contains org.olat.ims.qti.editor.beecom.objects.Response
              List responses = question != null ? question.getResponses() : null;
              if (responses != null && responses.size() > 0) {
                // check for changes in each response
                for (Iterator iter = responses.iterator(); iter.hasNext();) {
                  Response resp = (Response) iter.next();
                  if (history.containsKey(prefixKey + resp.getIdent())) {
                    // this response changed!
                    Memento tmpMem = (Memento) history.get(prefixKey + resp.getIdent());
                    if (respMem != null) {
                      respMem = respMem.getTimestamp() > tmpMem.getTimestamp() ? tmpMem : respMem;
                    } else {
                      hasChanges = true;
                      respMem = tmpMem;
View Full Code Here

TOP

Related Classes of org.olat.ims.qti.editor.beecom.objects.Response

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.