private void updateStatisticUpdateOngoingFlag() {
   final StatisticUpdateService statisticUpdateManager = getStatisticUpdateManager();
   if (statisticUpdateManager == null) {
     log.info("event: UpdateStatisticsJob configured, but no StatisticManager available");
     content.contextPut("statisticUpdateOngoing", Boolean.TRUE);
   } else {
     content.contextPut("statisticUpdateOngoing", statisticUpdateManager.updateOngoing());
   }
 }
Example #2
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);
  }
  private void refreshUIState() {
    boolean enabled = false;
    String cronExpression = "";
    if (CoreSpringFactory.containsBean("schedulerFactoryBean")) {
      log.info("refreshUIState: schedulerFactoryBean found");
      final Object schedulerFactoryBean = CoreSpringFactory.getBean("schedulerFactoryBean");
      if (schedulerFactoryBean != null && schedulerFactoryBean instanceof Scheduler) {
        final Scheduler schedulerBean = (Scheduler) schedulerFactoryBean;
        int triggerState;
        try {
          triggerState =
              schedulerBean.getTriggerState("updateStatisticsTrigger", null /* trigger group */);
          enabled = (triggerState != Trigger.STATE_NONE) && (triggerState != Trigger.STATE_ERROR);
          log.info(
              "refreshUIState: updateStatisticsTrigger state was "
                  + triggerState
                  + ", enabled now: "
                  + enabled);
        } catch (final SchedulerException e) {
          log.warn(
              "refreshUIState: Got a SchedulerException while asking for the updateStatisticsTrigger's state",
              e);
        }
      }
      final CronTriggerBean triggerBean =
          (CronTriggerBean) CoreSpringFactory.getBean("updateStatisticsTrigger");
      final JobDetail jobDetail = triggerBean.getJobDetail();
      enabled &= jobDetail.getName().equals("statistics.job.enabled");
      log.info("refreshUIState: statistics.job.enabled check, enabled now: " + enabled);
      cronExpression = triggerBean.getCronExpression();
      final StatisticUpdateService statisticUpdateManager = getStatisticUpdateManager();
      if (statisticUpdateManager == null) {
        log.info("refreshUIState: statisticUpdateManager not configured");
        enabled = false;
      } else {
        enabled &= statisticUpdateManager.isEnabled();
        log.info("refreshUIState: statisticUpdateManager configured, enabled now: " + enabled);
      }
    } else {
      log.info("refreshUIState: schedulerFactoryBean not found");
    }
    if (enabled) {
      content.contextPut(
          "status",
          getTranslator().translate("statistics.status.enabled", new String[] {cronExpression}));
    } else {
      content.contextPut("status", getTranslator().translate("statistics.status.disabled"));
    }
    content.contextPut("statisticEnabled", enabled);

    recalcLastUpdated();

    updateStatisticUpdateOngoingFlag();
  }
Example #4
0
 private void checkChats(final UserRequest ureq) {
   if (ureq != null) {
     allChats = (List) ureq.getUserSession().getEntry("chats");
   }
   if (allChats == null || allChats.size() == 0) {
     startButton.setEnabled(true);
     myContent.contextPut("hasChatWindowOpen", false);
   } else {
     startButton.setEnabled(false);
     myContent.contextPut("hasChatWindowOpen", true);
   }
 }
Example #5
0
  /**
   * Constructor for a test run controller
   *
   * @param userCourseEnv
   * @param moduleConfiguration
   * @param secCallback
   * @param ureq
   * @param wControl
   * @param testCourseNode
   */
  IQRunController(
      final UserCourseEnvironment userCourseEnv,
      final ModuleConfiguration moduleConfiguration,
      final IQSecurityCallback secCallback,
      final UserRequest ureq,
      final WindowControl wControl,
      final IQTESTCourseNode testCourseNode,
      final AssessmentNotificationsHandler notificationHandler) {
    super(ureq, wControl);

    this.modConfig = moduleConfiguration;
    this.secCallback = secCallback;
    this.userCourseEnv = userCourseEnv;
    this.courseNode = testCourseNode;
    this.type = AssessmentInstance.QMD_ENTRY_TYPE_ASSESS;
    this.singleUserEventCenter = ureq.getUserSession().getSingleUserEventCenter();
    this.assessmentEventOres = OresHelper.createOLATResourceableType(AssessmentEvent.class);
    this.assessmentInstanceOres = OresHelper.createOLATResourceableType(AssessmentInstance.class);
    this.chatEventOres = OresHelper.createOLATResourceableType(InstantMessaging.class);
    this.notificationHandler = notificationHandler;
    this.userSession = ureq.getUserSession();

    addLoggingResourceable(LoggingResourceable.wrap(courseNode));

    myContent = createVelocityContainer("testrun");

    mainPanel = putInitialPanel(myContent);

    if (!modConfig
        .get(IQEditController.CONFIG_KEY_TYPE)
        .equals(AssessmentInstance.QMD_ENTRY_TYPE_ASSESS)) {
      throw new OLATRuntimeException(
          "IQRunController launched with Test constructor but module configuration not configured as test",
          null);
    }
    init(ureq);
    exposeUserTestDataToVC(ureq);

    final StringBuilder qtiChangelog = createChangelogMsg(ureq);
    // decide about changelog in VC
    if (qtiChangelog.length() > 0) {
      // there is some message
      myContent.contextPut("changeLog", qtiChangelog);
    }

    // if show results on test home page configured - show log
    final Boolean showResultOnHomePage =
        (Boolean)
            testCourseNode
                .getModuleConfiguration()
                .get(IQEditController.CONFIG_KEY_RESULT_ON_HOME_PAGE);
    myContent.contextPut("showChangelog", showResultOnHomePage);
  }
Example #6
0
  private void init(final UserRequest ureq) {
    startButton = LinkFactory.createButton("start", myContent, this);
    // fetch disclaimer file
    String sDisclaimer = (String) modConfig.get(IQEditController.CONFIG_KEY_DISCLAIMER);
    if (sDisclaimer != null) {
      VFSContainer baseContainer = userCourseEnv.getCourseEnvironment().getCourseFolderContainer();
      final int lastSlash = sDisclaimer.lastIndexOf('/');
      if (lastSlash != -1) {
        baseContainer = (VFSContainer) baseContainer.resolve(sDisclaimer.substring(0, lastSlash));
        sDisclaimer = sDisclaimer.substring(lastSlash);
        // first check if disclaimer exists on filesystem
        if (baseContainer == null || baseContainer.resolve(sDisclaimer) == null) {
          showWarning("disclaimer.file.invalid", sDisclaimer);
        } else {
          // screenreader do not like iframes, display inline
          if (getWindowControl().getWindowBackOffice().getWindowManager().isForScreenReader()) {
            final HtmlStaticPageComponent disclaimerComp =
                new HtmlStaticPageComponent("disc", baseContainer);
            myContent.put("disc", disclaimerComp);
            disclaimerComp.setCurrentURI(sDisclaimer);
            myContent.contextPut("hasDisc", Boolean.TRUE);
          } else {
            iFrameCtr = new IFrameDisplayController(ureq, getWindowControl(), baseContainer);
            listenTo(iFrameCtr); // dispose automatically
            myContent.put("disc", iFrameCtr.getInitialComponent());
            iFrameCtr.setCurrentURI(sDisclaimer);
            myContent.contextPut("hasDisc", Boolean.TRUE);
          }
        }
      }
    }

    // push title and learning objectives, only visible on intro page
    myContent.contextPut("menuTitle", courseNode.getShortTitle());
    myContent.contextPut("displayTitle", courseNode.getLongTitle());

    // Adding learning objectives
    final String learningObj = courseNode.getLearningObjectives();
    if (learningObj != null) {
      final Component learningObjectives =
          ObjectivesHelper.createLearningObjectivesComponent(learningObj, ureq);
      myContent.put("learningObjectives", learningObjectives);
      myContent.contextPut("hasObjectives", learningObj); // dummy value, just an exists operator
    }

    if (type.equals(AssessmentInstance.QMD_ENTRY_TYPE_ASSESS)) {
      checkChats(ureq);
      singleUserEventCenter.registerFor(this, getIdentity(), chatEventOres);
    }
  }
  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));
  }
 @Override
 protected void event(final UserRequest ureq, final Controller source, final Event event) {
   if (source == accessibilityCondContr) {
     if (event == Event.CHANGED_EVENT) {
       final Condition cond = accessibilityCondContr.getCondition();
       courseNode.setPreConditionAccess(cond);
       fireEvent(ureq, NodeEditController.NODECONFIG_CHANGED_EVENT);
     }
   } else if (source == configForm) {
     if (event == Event.DONE_EVENT) {
       configForm.getUpdatedConfig();
       fireEvent(ureq, NodeEditController.NODECONFIG_CHANGED_EVENT);
     }
   } else if (source == textForm) {
     if (event == Event.DONE_EVENT) {
       textForm.getUpdatedConfig();
       configForm.setDirtyFromOtherForm(false);
       fireEvent(ureq, NodeEditController.NODECONFIG_CHANGED_EVENT);
     } else if (event == Event.CHANGED_EVENT) {
       // disable modification in other forms!
       configForm.setDirtyFromOtherForm(true);
     }
   } else if (source == scoringController) {
     if (event == Event.CANCELLED_EVENT) {
       if (hasLogEntries) {
         scoringController.setDisplayOnly(true);
       }
       configContent.contextPut("isOverwriting", new Boolean(false));
       return;
     } else if (event == Event.DONE_EVENT) {
       scoringController.updateModuleConfiguration(config);
       fireEvent(ureq, NodeEditController.NODECONFIG_CHANGED_EVENT);
     }
   }
 }
Example #9
0
 private void exposeUserQuestionnaireDataToVC() {
   final AssessmentManager am = userCourseEnv.getCourseEnvironment().getAssessmentManager();
   final Identity identity = userCourseEnv.getIdentityEnvironment().getIdentity();
   // although this is not an assessable node we still use the assessment
   // manager since this one uses caching
   myContent.contextPut("attempts", am.getNodeAttempts(courseNode, identity));
 }
Example #10
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);
    }
  }
 private void recalcLastUpdated() {
   try {
     final long lastUpdated = getStatisticUpdateManager().getLastUpdated();
     if (lastUpdated == -1) {
       content.contextPut(
           "lastupdated", getTranslator().translate("statistics.lastupdated.never", null));
     } else {
       final DateFormat df =
           DateFormat.getDateTimeInstance(DateFormat.LONG, DateFormat.LONG, getLocale());
       content.contextPut(
           "lastupdated",
           getTranslator()
               .translate(
                   "statistics.lastupdated", new String[] {df.format(new Date(lastUpdated))}));
     }
   } catch (final Exception e) {
     content.contextPut("lastupdated", getTranslator().translate("statistics.lastupdated", null));
   }
 }
Example #12
0
  /**
   * Constructor for a survey run controller
   *
   * @param userCourseEnv
   * @param moduleConfiguration
   * @param secCallback
   * @param ureq
   * @param wControl
   * @param surveyCourseNode
   */
  IQRunController(
      final UserCourseEnvironment userCourseEnv,
      final ModuleConfiguration moduleConfiguration,
      final IQSecurityCallback secCallback,
      final UserRequest ureq,
      final WindowControl wControl,
      final IQSURVCourseNode surveyCourseNode) {
    super(ureq, wControl);

    this.modConfig = moduleConfiguration;
    this.secCallback = secCallback;
    this.userCourseEnv = userCourseEnv;
    this.courseNode = surveyCourseNode;
    this.type = AssessmentInstance.QMD_ENTRY_TYPE_SURVEY;

    addLoggingResourceable(LoggingResourceable.wrap(courseNode));

    myContent = createVelocityContainer("surveyrun");

    mainPanel = putInitialPanel(myContent);

    if (!modConfig
        .get(IQEditController.CONFIG_KEY_TYPE)
        .equals(AssessmentInstance.QMD_ENTRY_TYPE_SURVEY)) {
      throw new OLATRuntimeException(
          "IQRunController launched with Survey constructor but module configuration not configured as survey",
          null);
    }
    init(ureq);
    exposeUserQuestionnaireDataToVC();

    final StringBuilder qtiChangelog = createChangelogMsg(ureq);
    // decide about changelog in VC
    if (qtiChangelog.length() > 0) {
      // there is some message
      myContent.contextPut("changeLog", qtiChangelog);
    }
    // per default change log is not open
    myContent.contextPut("showChangelog", Boolean.FALSE);
  }
Example #13
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);
     }
   }
 }
  /**
   * Constructor
   *
   * @param ureq
   * @param wControl
   */
  protected CalendarPortletRunController(final UserRequest ureq, final WindowControl wControl) {
    super(ureq, wControl);

    calendarVC = createVelocityContainer("calendarPortlet");
    showAllLink = LinkFactory.createLink("calendar.showAll", calendarVC, this);
    ComponentUtil.registerForValidateEvents(calendarVC, this);

    final Date date = new Date();
    final String today =
        DateFormat.getTimeInstance(DateFormat.MEDIUM, ureq.getLocale()).format(date);
    calendarVC.contextPut("today", today);

    final TableGuiConfiguration tableConfig = new TableGuiConfiguration();
    tableConfig.setTableEmptyMessage(translate("calendar.noEvents"));
    tableConfig.setDisplayTableHeader(false);
    tableConfig.setCustomCssClass("b_portlet_table");
    tableConfig.setDisplayRowCount(false);
    tableConfig.setPageingEnabled(false);
    tableConfig.setDownloadOffered(false);
    tableController = new TableController(tableConfig, ureq, getWindowControl(), getTranslator());
    // dummy header key, won't be used since setDisplayTableHeader is set to
    // false
    tableController.addColumnDescriptor(
        new PortletDateColumnDescriptor("calendar.date", 0, getTranslator()));
    tableController.addColumnDescriptor(
        new DefaultColumnDescriptor(
            "calendar.subject", 1, CMD_LAUNCH, ureq.getLocale(), ColumnDescriptor.ALIGNMENT_LEFT));

    final List events = getMatchingEvents(ureq, wControl);
    tableController.setTableDataModel(new EventsModel(events));
    listenTo(tableController);

    calendarVC.put("table", tableController.getInitialComponent());

    putInitialPanel(this.calendarVC);
  }
 private void updateUI() {
   myContent.contextPut("subscribed", (isSubscribed ? Boolean.TRUE : Boolean.FALSE));
 }
  @Override
  protected void event(final UserRequest ureq, final Controller source, final Event event) {
    if (source == usersForm) {
      if (event == Event.DONE_EVENT) {
        // calc stuff, preview

        final List existIdents = securityManager.getIdentitiesOfSecurityGroup(securityGroup);
        oks = new ArrayList<Identity>();
        final List<String> anonymous = new ArrayList<String>();
        final List<String> notFounds = new ArrayList<String>();
        final List<String> alreadyIn = new ArrayList<String>();

        // get the logins
        final String inp = usersForm.getLoginsString();
        final String[] lines = inp.split("\r?\n");
        for (int i = 0; i < lines.length; i++) {
          final String username = lines[i].trim();
          if (!username.equals("")) { // skip empty lines
            final Identity ident = securityManager.findIdentityByName(username);
            if (ident == null) { // not found, add to not-found-list
              notFounds.add(username);
            } else if (getBaseSecurityEBL().isAnonymous(ident)) {
              anonymous.add(username);
            } else {
              // check if already in group
              final boolean inGroup = containsIdentity(existIdents, ident);
              if (inGroup) {
                // added to warning: already in group
                alreadyIn.add(ident.getName());
              } else {
                // ok to add -> preview (but filter duplicate entries)
                if (!containsIdentity(oks, ident)) {
                  oks.add(ident);
                }
              }
            }
          }
        }
        // push table and other infos to velocity
        removeAsListenerAndDispose(newTableC);
        newTableC =
            UserControllerFactory.createTableControllerFor(
                null, oks, ureq, getWindowControl(), null);
        listenTo(newTableC);

        mainVc.put("table", newTableC.getInitialComponent());
        mainVc.contextPut("isanonymous", listNames(anonymous));
        mainVc.contextPut("notfound", listNames(notFounds));
        mainVc.contextPut("alreadyin", listNames(alreadyIn));
        mainVc.contextPut("usercount", new Integer(oks.size()));
        // set table page as next wizard step
        setNextWizardStep(translate("import.title.finish"), mainVc);
      }

    } else if (source == mailCtr) {
      if (event == Event.DONE_EVENT) {
        final MultiIdentityChosenEvent multiEvent = new MultiIdentityChosenEvent(this.oks);
        multiEvent.setMailTemplate(mailCtr.getMailTemplate());
        fireEvent(ureq, multiEvent);
      }
    }
  }
Example #17
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);
    }
  }