Beispiel #1
0
 public void eval() {
   if (assessInstance.isSurvey()) return;
   int sccnt = getSectionContextCount();
   for (int i = 0; i < sccnt; i++) {
     SectionContext sc = getSectionContext(i);
     sc.eval();
   }
   if (feedbacktesting) calcFeedBack();
 }
Beispiel #2
0
  @Override
  protected void event(final UserRequest ureq, final Component source, final Event event) {
    if (source == startButton && startButton.isEnabled()) {
      final long callingResId =
          userCourseEnv.getCourseEnvironment().getCourseResourceableId().longValue();
      final String callingResDetail = courseNode.getIdent();
      removeAsListenerAndDispose(displayController);
      final Controller returnController =
          IQManager.getInstance()
              .createIQDisplayController(
                  modConfig, secCallback, ureq, getWindowControl(), callingResId, callingResDetail);
      /*
       * either returnController is a MessageController or it is a IQDisplayController this should not serve as pattern to be copy&pasted. FIXME:2008-11-21:pb
       * INTRODUCED because of read/write QTI Lock solution for scalability II, 6.1.x Release
       */
      if (returnController instanceof IQDisplayController) {
        displayController = (IQDisplayController) returnController;
        listenTo(displayController);
        if (displayController.isReady()) {
          // in case displayController was unable to initialize, a message was set by
          // displayController
          // this is the case if no more attempts or security check was unsuccessfull
          final LayoutMain3ColsController layoutCtr =
              new LayoutMain3ColsController(
                  ureq,
                  getWindowControl(),
                  null,
                  null,
                  displayController.getInitialComponent(),
                  null);
          listenTo(layoutCtr); // autodispose

          // need to wrap a course restart controller again, because IQDisplay
          // runs on top of GUIStack
          final ICourse course = CourseFactory.loadCourse(callingResId);
          final RepositoryEntry courseRepositoryEntry =
              RepositoryServiceImpl.getInstance().lookupRepositoryEntry(course, true);
          final Panel empty = new Panel("empty"); // empty panel set as "menu" and "tool"
          final Controller courseCloser =
              CourseFactory.createDisposedCourseRestartController(
                  ureq, getWindowControl(), courseRepositoryEntry.getResourceableId());
          final Controller disposedRestartController =
              new LayoutMain3ColsController(
                  ureq,
                  getWindowControl(),
                  empty,
                  empty,
                  courseCloser.getInitialComponent(),
                  "disposed course whily in iqRun" + callingResId);
          layoutCtr.setDisposedMessageController(disposedRestartController);

          getWindowControl().pushToMainArea(layoutCtr.getInitialComponent());
          if (modConfig
              .get(IQEditController.CONFIG_KEY_TYPE)
              .equals(AssessmentInstance.QMD_ENTRY_TYPE_ASSESS)) {
            assessmentStopped = false;
            singleUserEventCenter.registerFor(this, getIdentity(), assessmentInstanceOres);
            singleUserEventCenter.fireEventToListenersOf(
                new AssessmentEvent(AssessmentEvent.TYPE.STARTED, ureq.getUserSession()),
                assessmentEventOres);
          }
        } // endif isReady
      } else {
        // -> qti file was locked -> show info message
        // user must click again on course node to activate
        mainPanel.pushContent(returnController.getInitialComponent());
      }
    } else if (source == showResultsButton) {
      final AssessmentManager am = userCourseEnv.getCourseEnvironment().getAssessmentManager();
      Long assessmentID = am.getAssessmentID(courseNode, ureq.getIdentity());
      if (assessmentID == null) {
        // fallback solution: if the assessmentID is not available via AssessmentManager than try to
        // get it via IQManager
        final long callingResId =
            userCourseEnv.getCourseEnvironment().getCourseResourceableId().longValue();
        final String callingResDetail = courseNode.getIdent();
        assessmentID =
            IQManager.getInstance()
                .getLastAssessmentID(ureq.getIdentity(), callingResId, callingResDetail);
      }
      if (assessmentID != null && !assessmentID.equals("")) {
        final Document doc =
            IQManager.getInstance()
                .getResultsReportingFromFile(ureq.getIdentity(), type, assessmentID);
        // StringBuilder resultsHTML =
        // LocalizedXSLTransformer.getInstance(ureq.getLocale()).renderResults(doc);
        final String summaryConfig = (String) modConfig.get(IQEditController.CONFIG_KEY_SUMMARY);
        final int summaryType = AssessmentInstance.getSummaryType(summaryConfig);
        final String resultsHTML =
            IQManager.getInstance().transformResultsReporting(doc, ureq.getLocale(), summaryType);
        myContent.contextPut("displayreporting", resultsHTML);
        myContent.contextPut("resreporting", resultsHTML);
        myContent.contextPut("showResults", Boolean.TRUE);
      }
    } else if (source == hideResultsButton) {
      myContent.contextPut("showResults", Boolean.FALSE);
    }
  }
Beispiel #3
0
  /**
   * Method setUp.
   *
   * @param assessInstance
   */
  public void setUp(AssessmentInstance assessInstance) {
    this.assessInstance = assessInstance;
    init();

    Document el_questestinterop = assessInstance.getResolver().getQTIDocument();
    el_assessment = (Element) el_questestinterop.selectSingleNode("questestinterop/assessment");

    ident = el_assessment.attributeValue("ident");
    title = el_assessment.attributeValue("title");
    Element dur = (Element) el_assessment.selectSingleNode("duration");

    if (dur == null) {
      durationLimit = -1; // no limit
    } else {
      String sdur = dur.getText();
      durationLimit = QTIHelper.parseISODuration(sdur);
      if (durationLimit == 0) durationLimit = -1; // Assesst Designer fix
    }

    // get objectives
    Element el_objectives = (Element) el_assessment.selectSingleNode("objectives");
    if (el_objectives != null) objectives = new Objectives(el_objectives);

    // set feedback, hint, and solutions switches
    // <!ENTITY % I_FeedbackSwitch " feedbackswitch (Yes | No ) 'Yes'">
    // <!ENTITY % I_HintSwitch " hintswitch (Yes | No ) 'Yes'">
    // <!ENTITY % I_SolutionSwitch " solutionswitch (Yes | No ) 'Yes'">

    // <!ELEMENT assessment (qticomment? , duration? , qtimetadata* ,
    // objectives* , assessmentcontrol* , rubric* , presentation_material? ,
    // outcomes_processing* , assessproc_extension? , assessfeedback* ,
    // selection_ordering? , reference? , (sectionref | section)+)>
    // <!ELEMENT assessmentcontrol (qticomment?)>
    Element el_control = (Element) el_assessment.selectSingleNode("assessmentcontrol");
    if (el_control != null) {
      String feedbackswitch = el_control.attributeValue("feedbackswitch");
      String hintswitch = el_control.attributeValue("hintswitch");
      String solutionswitch = el_control.attributeValue("solutionswitch");
      boolean feedback = (feedbackswitch == null) ? true : feedbackswitch.equals("Yes");
      boolean hints = (hintswitch == null) ? true : hintswitch.equals("Yes");
      boolean solutions = (solutionswitch == null) ? true : solutionswitch.equals("Yes");
      switches = new Switches(feedback, hints, solutions);
    }

    // scoring model and outcomes processing
    Element el_outpro = (Element) el_assessment.selectSingleNode("outcomes_processing");
    if (el_outpro != null) {
      // get the scoring model: we need it later for calculating the score
      // <!ENTITY % I_ScoreModel " scoremodel CDATA #IMPLIED">
      scoremodel = el_outpro.attributeValue("scoremodel");
      // may be null -> then assume SumOfScores

      // set the cutvalue if given (only variable score)
      cutvalue =
          QTIHelper.getFloatAttribute(el_outpro, "outcomes/decvar[@varname='SCORE']", "cutvalue");
      List<?> el_oft = el_outpro.selectNodes("outcomes_feedback_test");
      if (el_oft.size() != 0) {
        feedbacktesting = true;
      }
    }

    initSections(el_assessment, switches);
    init();
  }