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

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


        editQuestion = item.getQuestion().getQuestion();
        displayMaterialFormController(ureq, editQuestion, restrictedEdit);
       
      } else if (cmd.equals("editr")) {
        editResponse = ((Response) item.getQuestion().getResponses().get(posid));
        Material responseMat = editResponse.getContent();
        displayMaterialFormController(ureq, responseMat, restrictedEdit);

      } else if (cmd.equals("addchoice")) {
        ChoiceQuestion question = (ChoiceQuestion) item.getQuestion();
        List choices = question.getResponses();
View Full Code Here


    fibquestion.setSingleCorrect(true);
    fibquestion.setSingleCorrectScore(1);

    FIBResponse response = new FIBResponse();
    response.setType(FIBResponse.TYPE_CONTENT);
    Material mat = new Material();
    mat.add(new Mattext(trans.translate("editor.newtextelement")));
    response.setContent(mat);
    fibquestion.getResponses().add(response);
    newItem.setQuestion(fibquestion);

    return newItem;
View Full Code Here

    essayquestion.getQuestion().getElements().add(new Mattext(trans.translate("editor.newquestiontext")));
    essayquestion.setSingleCorrect(true);
    essayquestion.setSingleCorrectScore(1);

    EssayResponse response = new EssayResponse();
    Material mat = new Material();
    mat.add(new Mattext(trans.translate("editor.newtextelement")));
    response.setContent(mat);
    essayquestion.getResponses().add(response);
    newItem.setQuestion(essayquestion);

    return newItem;
View Full Code Here

      ChoiceResponse choice = new ChoiceResponse();
      Element response_label = (Element) i.next();
      choice.setIdent(response_label.attributeValue("ident"));

      List materials = response_label.selectNodes(".//material");
      Material content = new Material();
      for (Iterator iter = materials.iterator(); iter.hasNext();) {
        Element el_material = (Element) iter.next();
        Material mat = (Material) parserManager.parse(el_material);
        content.getElements().addAll(mat.getElements());
      }
      // assure material always has some content
      if (content.getElements().size() == 0) content.getElements().add(new Mattext("[blank]"));
      choice.setContent(content);
      choices.add(choice);
View Full Code Here

   * @return feedback
   */
  public static String getFeedbackText(QTIObject object, String sIdent) {
    Feedback feedback = getFeedback(object, sIdent);
    try {
      Material mat = (Material) feedback.getMaterials().get(0);
      return mat.renderAsText();
    } catch (Exception e) {
      // 
    }
    return "";
  }
View Full Code Here

   * @param sIdent
   * @return
   */
  public static Material getFeedbackMaterial(QTIObject object, String sIdent) {
    Feedback feedback = getFeedback(object, sIdent);
    Material mat = null;
    try {
      mat = (Material) feedback.getMaterials().get(0);
    } catch (NullPointerException e) {
      // feedback is null
    }
View Full Code Here

    if (feedback != null) {
      feedbackString = feedbackString.trim();
      List matList = feedback.getMaterials();
      if (matList.size() > 0) {
        Material mat = (Material) feedback.getMaterials().get(0);
        if (mat == null) {
          mat = new Material();
          mat.getElements().add(new Mattext(feedbackString));
          feedback.getMaterials().add(mat);
        } else if (mat.getElements().size() > 0) {
          mat.getElements().set(0, new Mattext(feedbackString));
        } else {
          mat.getElements().add(new Mattext(feedbackString));
        }
      } else {
        Material mat = new Material();
        mat.getElements().add(new Mattext(feedbackString));
        feedback.getMaterials().add(mat);
      }
    } else {
      Feedback newFeedback = new Feedback();
      newFeedback.setIdent(sIdent);
      newFeedback.setView("All");
      Mattext newMattext = new Mattext(feedbackString);

      ArrayList newMattextL = new ArrayList();
      newMattextL.add(newMattext);

      Material material = new Material();
      material.setElements(newMattextL);

      ArrayList newMaterialL = new ArrayList();
      newMaterialL.add(material);
      newFeedback.setMaterials(newMaterialL);
      feedbacks.add(newFeedback);
View Full Code Here

        Item item = (Item)listIterator.next();       
        if((filterOut && thisItem.getIdent().equals(item.getIdent())) || (!filterOut && !thisItem.getIdent().equals(item.getIdent()))) {
          continue;
        }
        //question       
        Material material = item.getQuestion().getQuestion();
        if(material!=null) {
          String htmlContent = material.renderAsHtmlForEditor();
          //parse filenames
          returnSet.addAll(getMediaFileNames(htmlContent));
        }     
        //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
        Material masteryMat = QTIEditHelper.getFeedbackMasteryMaterial(item);
        if(masteryMat!=null) {
          returnSet.addAll(getMediaFileNames(masteryMat.renderAsHtmlForEditor()));
        }
        Material failureMat = QTIEditHelper.getFeedbackFailMaterial(item);
        if(failureMat!=null) {
          returnSet.addAll(getMediaFileNames(failureMat.renderAsHtmlForEditor()));
        }
      }
    }   
    return returnSet;
  }
View Full Code Here

        nce.setItemIdent(item.getIdent());
        nce.setQuestionIdent(item.getQuestion().getQuestion().getId());
        fireEvent(ureq, nce);
      } else if (event == Event.DONE_EVENT || event == Event.CANCELLED_EVENT) {
        if (event == Event.DONE_EVENT) {
          Material mat = materialCtr.getMaterial();
          String html = mat.renderAsHtmlForEditor();
          if (mat == masteryMat) {
            QTIEditHelper.setFeedbackMastery(item, html);
          } else if (mat == failureMat) {
            QTIEditHelper.setFeedbackFail(item, html);
          } else {
            QTIEditHelper.setFeedbackOlatResp(item, html, identities.get(mat));
          }

          // update view
          RichTextElement text = textElements.get(mat);
          //the html code is embbeded in the panel and as not a proper baseurl
          text.setValue(mat.renderAsHtml(mediaBaseUrl));
          // serialize document
          qtiPackage.serializeQTIDocument();
        }
        // dispose controllers
        dialogCtr.deactivate();
View Full Code Here

    qtiState.put("TITLE", item.getTitle());
    qtiState.put("OBJECTIVES", item.getObjectives());
    // question and responses
    qtiState.put("QUESTION.ID", question.getIdent());
    qtiState.put("QUESTION.HINTTEXT", question.getHintText());
    Material questMaterial = question.getQuestion();
    qtiState.put("QUESTION.MATERIAL.ASTEXT", questMaterial.renderAsText());
    List ids = new ArrayList();
    List asTexts = new ArrayList();
    List feedbacks = new ArrayList();
    List responses = question.getResponses();
    for (Iterator iter = responses.iterator(); iter.hasNext();) {
View Full Code Here

TOP

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

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.