コード例 #1
0
  @Override
  @SuppressWarnings("unused")
  protected void event(final UserRequest ureq, final Component source, final Event event) {
    if (STATISTICS_FULL_RECALCULATION_TRIGGER_BUTTON.equals(event.getCommand())) {
      final StatisticUpdateService statisticUpdateManager = getStatisticUpdateManager();
      if (statisticUpdateManager == null) {
        log.info("event: UpdateStatisticsJob configured, but no StatisticManager available");
      } else {

        final String title = getTranslator().translate("statistics.fullrecalculation.really.title");
        final String text = getTranslator().translate("statistics.fullrecalculation.really.text");
        dialogCtr_ = DialogBoxUIFactory.createYesNoDialog(ureq, getWindowControl(), title, text);
        listenTo(dialogCtr_);
        dialogCtr_.activate();
      }
    } else if (STATISTICS_UPDATE_TRIGGER_BUTTON.equals(event.getCommand())) {
      final StatisticUpdateService statisticUpdateManager = getStatisticUpdateManager();
      if (statisticUpdateManager == null) {
        log.info("event: UpdateStatisticsJob configured, but no StatisticManager available");
      } else {
        statisticUpdateManager.updateStatistics(false, getUpdateFinishedCallback());
        refreshUIState();
        content.put(
            "updatecontrol",
            new JSAndCSSComponent("intervall", this.getClass(), null, null, false, null, 3000));
        getInitialComponent().setDirty(true);
      }
    }
  }
コード例 #2
0
ファイル: IQRunController.java プロジェクト: YaqubGhazi/olat
 @Override
 public void event(final Event event) {
   if (type == AssessmentInstance.QMD_ENTRY_TYPE_ASSESS) {
     if (event.getCommand().startsWith("ChatWindow")) {
       checkChats(null);
     }
   }
 }
コード例 #3
0
 @Override
 protected void event(final UserRequest ureq, final Component source, final Event event) {
   if (source == cpTree) {
     // FIXME:fj: cleanup between MenuTree.COMMAND_TREENODE_CLICKED and
     // TreeEvent.dito...
     if (event.getCommand().equals(MenuTree.COMMAND_TREENODE_CLICKED)) {
       final TreeEvent te = (TreeEvent) event;
       switchToPage(ureq, te);
     }
   } else if (source == cpComponent) {
     if (event instanceof NewInlineUriEvent) {
       final NewInlineUriEvent nue = (NewInlineUriEvent) event;
       // adjust the tree selection to the current choice if found
       selectTreeNode(ureq, nue.getNewUri());
     }
   }
 }
コード例 #4
0
 @Override
 protected void event(final UserRequest ureq, final Controller source, final Event event) {
   if (source == tableController) {
     if (event.getCommand().equals(Table.COMMANDLINK_ROWACTION_CLICKED)) {
       final TableEvent te = (TableEvent) event;
       final String actionid = te.getActionId();
       if (actionid.equals(CMD_LAUNCH)) {
         final int rowid = te.getRowId();
         final CalendarEntry calendarEntry =
             (CalendarEntry)
                 ((DefaultTableDataModel) tableController.getTableDataModel()).getObject(rowid);
         final Date startDate = calendarEntry.getBegin();
         final String activationCmd =
             "cal." + new SimpleDateFormat("yyyy.MM.dd").format(startDate);
         final DTabs dts = (DTabs) Windows.getWindows(ureq).getWindow(ureq).getAttribute("DTabs");
         // was brasato:: getWindowControl().getDTabs().activateStatic(ureq,
         // HomeSite.class.getName(), activationCmd);
         dts.activateStatic(ureq, HomeSite.class.getName(), activationCmd);
       }
     }
   }
 }
コード例 #5
0
ファイル: IQRunController.java プロジェクト: YaqubGhazi/olat
  @Override
  protected void event(final UserRequest urequest, final Controller source, final Event event) {
    if (source == displayController) {
      if (event instanceof IQSubmittedEvent) {
        final IQSubmittedEvent se = (IQSubmittedEvent) event;
        final AssessmentManager am = userCourseEnv.getCourseEnvironment().getAssessmentManager();

        // Save results in case of test
        if (type.equals(AssessmentInstance.QMD_ENTRY_TYPE_ASSESS)) {
          // update scoring overview for the user in the current course
          final Float score = new Float(se.getScore());
          final Boolean passed = new Boolean(se.isPassed());
          final ScoreEvaluation sceval =
              new ScoreEvaluation(score, passed, new Long(se.getAssessmentID()));
          final AssessableCourseNode acn =
              (AssessableCourseNode) courseNode; // assessment nodes are assesable
          final boolean incrementUserAttempts = true;
          acn.updateUserScoreEvaluation(
              sceval, userCourseEnv, urequest.getIdentity(), incrementUserAttempts);
          // userCourseEnv.getScoreAccounting().scoreInfoChanged(acn, sceval);
          exposeUserTestDataToVC(urequest);

          // Mark publisher for notifications
          final Long courseId = userCourseEnv.getCourseEnvironment().getCourseResourceableId();
          notificationHandler.markPublisherNews(urequest.getIdentity(), courseId);
          if (!assessmentStopped) {
            assessmentStopped = true;
            final AssessmentEvent assessmentStoppedEvent =
                new AssessmentEvent(AssessmentEvent.TYPE.STOPPED, userSession);
            singleUserEventCenter.deregisterFor(this, assessmentInstanceOres);
            singleUserEventCenter.fireEventToListenersOf(
                assessmentStoppedEvent, assessmentEventOres);
          }
        }
        // Save results in case of questionnaire
        else if (type.equals(AssessmentInstance.QMD_ENTRY_TYPE_SURVEY)) {
          // save number of attempts
          // although this is not an assessable node we still use the assessment
          // manager since this one uses caching
          am.incrementNodeAttempts(courseNode, urequest.getIdentity(), userCourseEnv);
          exposeUserQuestionnaireDataToVC();
          getWindowControl().pop();
        }
        // Don't save results in case of self-test
        // but do safe attempts !
        else if (type.equals(AssessmentInstance.QMD_ENTRY_TYPE_SELF)) {
          am.incrementNodeAttempts(courseNode, urequest.getIdentity(), userCourseEnv);
        }
      } else if (event.equals(Event.DONE_EVENT)) {
        getWindowControl().pop();
        if (type.equals(AssessmentInstance.QMD_ENTRY_TYPE_ASSESS) && !assessmentStopped) {
          assessmentStopped = true;
          final AssessmentEvent assessmentStoppedEvent =
              new AssessmentEvent(AssessmentEvent.TYPE.STOPPED, userSession);
          singleUserEventCenter.deregisterFor(this, assessmentInstanceOres);
          singleUserEventCenter.fireEventToListenersOf(assessmentStoppedEvent, assessmentEventOres);
        }
        fireEvent(urequest, Event.DONE_EVENT);
      }
    }
  }