Пример #1
0
  private void exposeUserTestDataToVC(final UserRequest ureq) {
    // config : show score info
    final Object enableScoreInfoObject = modConfig.get(IQEditController.CONFIG_KEY_ENABLESCOREINFO);
    if (enableScoreInfoObject != null) {
      myContent.contextPut("enableScoreInfo", enableScoreInfoObject);
    } else {
      myContent.contextPut("enableScoreInfo", Boolean.TRUE);
    }

    // configuration data
    myContent.contextPut("attemptsConfig", modConfig.get(IQEditController.CONFIG_KEY_ATTEMPTS));
    // user data
    if (!(courseNode instanceof AssessableCourseNode)) {
      throw new AssertException(
          "exposeUserTestDataToVC can only be called for test nodes, not for selftest or questionnaire");
    }
    final AssessableCourseNode acn =
        (AssessableCourseNode) courseNode; // assessment nodes are assesable
    final ScoreEvaluation scoreEval = acn.getUserScoreEvaluation(userCourseEnv);

    final Identity identity = userCourseEnv.getIdentityEnvironment().getIdentity();
    myContent.contextPut("score", AssessmentHelper.getRoundedScore(scoreEval.getScore()));
    myContent.contextPut(
        "hasPassedValue", (scoreEval.getPassed() == null ? Boolean.FALSE : Boolean.TRUE));
    myContent.contextPut("passed", scoreEval.getPassed());
    myContent.contextPut("comment", acn.getUserUserComment(userCourseEnv));
    myContent.contextPut("attempts", acn.getUserAttempts(userCourseEnv));

    final UserNodeAuditManager am = userCourseEnv.getCourseEnvironment().getAuditManager();
    myContent.contextPut("log", am.getUserNodeLog(courseNode, identity));

    exposeResults(ureq);
  }
Пример #2
0
  /**
   * Provides the self test score and results, if any, to the velocity container.
   *
   * @param ureq
   */
  private void exposeUserSelfTestDataToVC(final UserRequest ureq) {
    // config : show score info
    final Object enableScoreInfoObject = modConfig.get(IQEditController.CONFIG_KEY_ENABLESCOREINFO);
    if (enableScoreInfoObject != null) {
      myContent.contextPut("enableScoreInfo", enableScoreInfoObject);
    } else {
      myContent.contextPut("enableScoreInfo", Boolean.TRUE);
    }

    if (!(courseNode instanceof SelfAssessableCourseNode)) {
      throw new AssertException(
          "exposeUserSelfTestDataToVC can only be called for selftest nodes, not for test or questionnaire");
    }
    final SelfAssessableCourseNode acn = (SelfAssessableCourseNode) courseNode;
    final ScoreEvaluation scoreEval = acn.getUserScoreEvaluation(userCourseEnv);
    if (scoreEval != null) {
      myContent.contextPut("hasResults", Boolean.TRUE);
      myContent.contextPut("score", AssessmentHelper.getRoundedScore(scoreEval.getScore()));
      myContent.contextPut(
          "hasPassedValue", (scoreEval.getPassed() == null ? Boolean.FALSE : Boolean.TRUE));
      myContent.contextPut("passed", scoreEval.getPassed());
      myContent.contextPut("attempts", new Integer(1)); // at least one attempt

      exposeResults(ureq);
    }
  }
  public PortfolioCourseNodeEditController(
      final UserRequest ureq,
      final WindowControl wControl,
      final ICourse course,
      final PortfolioCourseNode node,
      final ModuleConfiguration config,
      final UserCourseEnvironment euce) {
    super(ureq, wControl);
    this.config = config;
    this.courseNode = node;

    configForm = new PortfolioConfigForm(ureq, wControl, course, node);
    listenTo(configForm);
    scoringController = new MSEditFormController(ureq, wControl, config);
    scoringContent = scoringController.getInitialComponent();
    listenTo(scoringController);
    textForm = new PortfolioTextForm(ureq, wControl, course, node);
    listenTo(textForm);

    configContent = createVelocityContainer("edit");
    configContent.put("configForm", configForm.getInitialComponent());
    configContent.put("textForm", textForm.getInitialComponent());

    // Accessibility precondition
    final CourseGroupManager groupMgr = course.getCourseEnvironment().getCourseGroupManager();
    final CourseEditorTreeModel editorModel = course.getEditorTreeModel();
    final Condition accessCondition = node.getPreConditionAccess();
    accessibilityCondContr =
        new ConditionEditController(
            ureq,
            getWindowControl(),
            groupMgr,
            accessCondition,
            "accessabilityConditionForm",
            AssessmentHelper.getAssessableNodes(editorModel, node),
            euce);
    listenTo(accessibilityCondContr);

    // if there is already user data available, make for read only
    final UserNodeAuditManager am = course.getCourseEnvironment().getAuditManager();
    hasLogEntries = am.hasUserNodeLogs(node);
    configContent.contextPut("hasLogEntries", new Boolean(hasLogEntries));
    if (hasLogEntries) {
      scoringController.setDisplayOnly(true);
    }
    // Initialstate
    configContent.contextPut("isOverwriting", new Boolean(false));
  }
Пример #4
0
 /**
  * Provides the show results button if results available or a message with the visibility period.
  *
  * @param ureq
  */
 private void exposeResults(final UserRequest ureq) {
   // migration: check if old tests have no summary configured
   final String configuredSummary = (String) modConfig.get(IQEditController.CONFIG_KEY_SUMMARY);
   final boolean noSummary =
       configuredSummary == null
           || (configuredSummary != null
               && configuredSummary.equals(AssessmentInstance.QMD_ENTRY_SUMMARY_NONE));
   if (!noSummary) {
     final Boolean showResultsObj =
         (Boolean) modConfig.get(IQEditController.CONFIG_KEY_RESULT_ON_HOME_PAGE);
     final boolean showResultsOnHomePage =
         (showResultsObj != null && showResultsObj.booleanValue());
     myContent.contextPut("showResultsOnHomePage", new Boolean(showResultsOnHomePage));
     final boolean dateRelatedVisibility = AssessmentHelper.isResultVisible(modConfig);
     if (showResultsOnHomePage && dateRelatedVisibility) {
       myContent.contextPut("showResultsVisible", Boolean.TRUE);
       showResultsButton = LinkFactory.createButton("command.showResults", myContent, this);
       hideResultsButton = LinkFactory.createButton("command.hideResults", myContent, this);
     } else if (showResultsOnHomePage) {
       final Date startDate = (Date) modConfig.get(IQEditController.CONFIG_KEY_RESULTS_START_DATE);
       final Date endDate = (Date) modConfig.get(IQEditController.CONFIG_KEY_RESULTS_END_DATE);
       final String visibilityStartDate =
           DateFormat.getDateTimeInstance(DateFormat.SHORT, DateFormat.SHORT, ureq.getLocale())
               .format(startDate);
       String visibilityEndDate = "-";
       if (endDate != null) {
         visibilityEndDate =
             DateFormat.getDateTimeInstance(DateFormat.SHORT, DateFormat.SHORT, ureq.getLocale())
                 .format(endDate);
       }
       final String visibilityPeriod =
           getTranslator()
               .translate(
                   "showResults.visibility",
                   new String[] {visibilityStartDate, visibilityEndDate});
       myContent.contextPut("visibilityPeriod", visibilityPeriod);
       myContent.contextPut("showResultsVisible", Boolean.FALSE);
     }
   }
 }