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

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


        Material responseMat = ((Response) item.getQuestion().getResponses().get(posid)).getContent();
        displayMaterialFormController(ureq, responseMat, restrictedEdit);
       
      } else if (cmd.equals("addtext")) {
        FIBQuestion fib = (FIBQuestion) item.getQuestion();
        FIBResponse response = new FIBResponse();
        response.setType(FIBResponse.TYPE_CONTENT);
        Material mat = new Material();
        mat.add(new Mattext(trnsltr.translate("newtextelement")));
        response.setContent(mat);
        fib.getResponses().add(response);
      } else if (cmd.equals("addblank")) {
        FIBQuestion fib = (FIBQuestion) item.getQuestion();
        FIBResponse response = new FIBResponse();
        response.setType(FIBResponse.TYPE_BLANK);
        response.setCorrectBlank("");
        response.setPoints(1f); // default value
        fib.getResponses().add(response);
      } else if (cmd.equals("del")) {
        delYesNoCtrl = DialogController.createYesNoDialogController(ureq.getLocale(), trnsltr.translate("confirm.delete.element"), this,
            new Integer(posid));
        getWindowControl().pushAsModalDialog( delYesNoCtrl.getInitialComponent());
      } else if (cmd.equals("sfib")) { // submit fib
        FIBQuestion question = (FIBQuestion) item.getQuestion();
        // Survey specific variables
        if (surveyMode) {
          List responses = question.getResponses();
          for (int i = 0; i < responses.size(); i++) {
            FIBResponse response = (FIBResponse) responses.get(i);
            if (FIBResponse.TYPE_BLANK.equals(response.getType())) {
              // Set size of input field
              String size = ureq.getParameter("size_q" + i);
              if (size != null) response.setSizeFromString(size);
              String maxLength = ureq.getParameter("maxl_q" + i);
              if (maxLength != null) response.setMaxLengthFromString(maxLength);
            }
          }

        } else {
          // For all other cases, non-surveys
          // set min/max values before single_correct !!
          if (!restrictedEdit) {
            // only in full edit mode the following fields are available:
            // min_value, max_value, valuation_method
            question.setMinValue(ureq.getParameter("min_value"));
            question.setMaxValue(ureq.getParameter("max_value"));
            question.setSingleCorrect(ureq.getParameter("valuation_method").equals("single"));
            if (question.isSingleCorrect()) {
              question.setSingleCorrectScore(ureq.getParameter("single_score"));
            else {
              question.setSingleCorrectScore(0);
            }
          }

          NodeBeforeChangeEvent nce = new NodeBeforeChangeEvent();
          nce.setItemIdent(item.getIdent());

          List responses = question.getResponses();
          for (int i = 0; i < responses.size(); i++) {
            FIBResponse response = (FIBResponse) responses.get(i);
            nce.setResponseIdent(response.getIdent());
            fireEvent(ureq, nce);

            response.setPoints(ureq.getParameter("points_q" + i));
            if (FIBResponse.TYPE_BLANK.equals(response.getType())) {
              response.setCorrectBlank(ureq.getParameter("content_q" + i));
              // Set case sensitiveness
              String caseSensitive = ureq.getParameter("case_q" + i);
              if (caseSensitive == null) caseSensitive = "No";
              response.setCaseSensitive(caseSensitive);
              // Set size of input field
              String size = ureq.getParameter("size_q" + i);
              if (size != null) response.setSizeFromString(size);
              String maxLength = ureq.getParameter("maxl_q" + i);
              if (maxLength != null) response.setMaxLengthFromString(maxLength);
              if (response.getCorrectBlank().length() > response.getMaxLength()) response.setMaxLength(response.getCorrectBlank().length());
            }
          }
        }
      }
      qtiPackage.serializeQTIDocument();
View Full Code Here


    FIBQuestion fibquestion = new FIBQuestion();
    fibquestion.getQuestion().getElements().add(new Mattext(trans.translate("editor.newquestiontext")));
    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

TOP

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

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.