diff --git a/src/main/java/org/olat/course/nodes/CourseNode.java b/src/main/java/org/olat/course/nodes/CourseNode.java index d34f4ddf4be0346cf11477c27102b16f9317a0f4..4bab12c90f91ee49cd78ad39e8bc16ae8aeeb02f 100644 --- a/src/main/java/org/olat/course/nodes/CourseNode.java +++ b/src/main/java/org/olat/course/nodes/CourseNode.java @@ -52,6 +52,7 @@ import org.olat.course.run.userview.TreeEvaluation; import org.olat.course.run.userview.UserCourseEnvironment; import org.olat.course.statistic.StatisticResourceOption; import org.olat.course.statistic.StatisticResourceResult; +import org.olat.ims.qti.statistics.QTIType; import org.olat.modules.ModuleConfiguration; import org.olat.repository.RepositoryEntry; @@ -261,9 +262,9 @@ public interface CourseNode extends INode, ShortName { * @return */ public StatisticResourceResult createStatisticNodeResult(UserRequest ureq, WindowControl wControl, - UserCourseEnvironment userCourseEnv, StatisticResourceOption options); + UserCourseEnvironment userCourseEnv, StatisticResourceOption options, QTIType... type); - public boolean isStatisticNodeResultAvailable(UserCourseEnvironment userCourseEnv); + public boolean isStatisticNodeResultAvailable(UserCourseEnvironment userCourseEnv, QTIType... type); /** * this method must generate a nodeevaluation and take care of (if any) child diff --git a/src/main/java/org/olat/course/nodes/GenericCourseNode.java b/src/main/java/org/olat/course/nodes/GenericCourseNode.java index 7bfc51f826d80fe483374ad00fee7237b302d61e..22dadc81c2dc2a1c1d259b242fe6be03c7953804 100644 --- a/src/main/java/org/olat/course/nodes/GenericCourseNode.java +++ b/src/main/java/org/olat/course/nodes/GenericCourseNode.java @@ -64,6 +64,7 @@ import org.olat.course.statistic.StatisticResourceOption; import org.olat.course.statistic.StatisticResourceResult; import org.olat.group.model.BGAreaReference; import org.olat.group.model.BusinessGroupReference; +import org.olat.ims.qti.statistics.QTIType; import org.olat.modules.ModuleConfiguration; /** @@ -151,12 +152,12 @@ public abstract class GenericCourseNode extends GenericNode implements CourseNod @Override public StatisticResourceResult createStatisticNodeResult(UserRequest ureq, WindowControl wControl, - UserCourseEnvironment userCourseEnv, StatisticResourceOption options) { + UserCourseEnvironment userCourseEnv, StatisticResourceOption options, QTIType... types) { return null; } @Override - public boolean isStatisticNodeResultAvailable(UserCourseEnvironment userCourseEnv) { + public boolean isStatisticNodeResultAvailable(UserCourseEnvironment userCourseEnv, QTIType... types) { return false; } diff --git a/src/main/java/org/olat/course/nodes/IQSURVCourseNode.java b/src/main/java/org/olat/course/nodes/IQSURVCourseNode.java index 4ed84e2d8882e12142d469af07b034454ae21d97..55fb165a2918f93e13b0cc4766acd7b4ec5cc876 100644 --- a/src/main/java/org/olat/course/nodes/IQSURVCourseNode.java +++ b/src/main/java/org/olat/course/nodes/IQSURVCourseNode.java @@ -68,6 +68,7 @@ import org.olat.ims.qti.export.QTIExportManager; import org.olat.ims.qti.process.AssessmentInstance; import org.olat.ims.qti.statistics.QTIStatisticResourceResult; import org.olat.ims.qti.statistics.QTIStatisticSearchParams; +import org.olat.ims.qti.statistics.QTIType; import org.olat.ims.qti.statistics.ui.QTI12StatisticsToolController; import org.olat.modules.ModuleConfiguration; import org.olat.repository.RepositoryEntry; @@ -130,7 +131,10 @@ public class IQSURVCourseNode extends AbstractAccessableCourseNode implements QT } @Override - public StatisticResourceResult createStatisticNodeResult(UserRequest ureq, WindowControl wControl, UserCourseEnvironment userCourseEnv, StatisticResourceOption options) { + public StatisticResourceResult createStatisticNodeResult(UserRequest ureq, WindowControl wControl, + UserCourseEnvironment userCourseEnv, StatisticResourceOption options, QTIType... types) { + if(!isQTITypeAllowed(types)) return null; + Long courseId = userCourseEnv.getCourseEnvironment().getCourseResourceableId(); OLATResourceable courseOres = OresHelper.createOLATResourceableInstance("CourseModule", courseId); QTIStatisticSearchParams searchParams = new QTIStatisticSearchParams(courseOres.getResourceableId(), getIdent()); @@ -141,8 +145,20 @@ public class IQSURVCourseNode extends AbstractAccessableCourseNode implements QT } @Override - public boolean isStatisticNodeResultAvailable(UserCourseEnvironment userCourseEnv) { - return true; + public boolean isStatisticNodeResultAvailable(UserCourseEnvironment userCourseEnv, QTIType... types) { + return isQTITypeAllowed(types); + } + + private boolean isQTITypeAllowed(QTIType... types) { + if(types == null) return true; + if(types.length == 0 || (types.length == 1 && types[0] == null)) return true; + + for(QTIType type:types) { + if(QTIType.survey.equals(type)) { + return true; + } + } + return false; } /** diff --git a/src/main/java/org/olat/course/nodes/IQTESTCourseNode.java b/src/main/java/org/olat/course/nodes/IQTESTCourseNode.java index 70bfb49bc3d89b537bbd4193976fe8fd32bc2262..07298807b7c063513317829f888ff8e552b1f374 100644 --- a/src/main/java/org/olat/course/nodes/IQTESTCourseNode.java +++ b/src/main/java/org/olat/course/nodes/IQTESTCourseNode.java @@ -73,6 +73,7 @@ import org.olat.ims.qti.export.QTIExportManager; import org.olat.ims.qti.process.AssessmentInstance; import org.olat.ims.qti.statistics.QTIStatisticResourceResult; import org.olat.ims.qti.statistics.QTIStatisticSearchParams; +import org.olat.ims.qti.statistics.QTIType; import org.olat.ims.qti.statistics.ui.QTI12StatisticsToolController; import org.olat.modules.ModuleConfiguration; import org.olat.repository.RepositoryEntry; @@ -144,7 +145,10 @@ public class IQTESTCourseNode extends AbstractAccessableCourseNode implements As } @Override - public StatisticResourceResult createStatisticNodeResult(UserRequest ureq, WindowControl wControl, UserCourseEnvironment userCourseEnv, StatisticResourceOption options) { + public StatisticResourceResult createStatisticNodeResult(UserRequest ureq, WindowControl wControl, + UserCourseEnvironment userCourseEnv, StatisticResourceOption options, QTIType... types) { + if(!isQTITypeAllowed(types)) return null; + Long courseId = userCourseEnv.getCourseEnvironment().getCourseResourceableId(); OLATResourceable courseOres = OresHelper.createOLATResourceableInstance("CourseModule", courseId); QTIStatisticSearchParams searchParams = new QTIStatisticSearchParams(courseOres.getResourceableId(), getIdent()); @@ -155,8 +159,20 @@ public class IQTESTCourseNode extends AbstractAccessableCourseNode implements As } @Override - public boolean isStatisticNodeResultAvailable(UserCourseEnvironment userCourseEnv) { - return true; + public boolean isStatisticNodeResultAvailable(UserCourseEnvironment userCourseEnv, QTIType... types) { + return isQTITypeAllowed(types); + } + + private boolean isQTITypeAllowed(QTIType... types) { + if(types == null) return true; + if(types.length == 0 || (types.length == 1 && types[0] == null)) return true; + + for(QTIType type:types) { + if(QTIType.test.equals(type) || QTIType.onyx.equals(type)) { + return true; + } + } + return false; } /** diff --git a/src/main/java/org/olat/course/nodes/scorm/ScormRunController.java b/src/main/java/org/olat/course/nodes/scorm/ScormRunController.java index 7867a40e6fe2364e4a20ccc219a52ea35bbf2197..29d840b3b035dcbc4d79afb89725777a6e78765b 100644 --- a/src/main/java/org/olat/course/nodes/scorm/ScormRunController.java +++ b/src/main/java/org/olat/course/nodes/scorm/ScormRunController.java @@ -359,7 +359,9 @@ public class ScormRunController extends BasicController implements ScormAPICallb @Override public void configurationChanged() { - scormDispC.configurationChanged(); + if(scormDispC != null) { + scormDispC.configurationChanged(); + } } /** diff --git a/src/main/java/org/olat/course/run/RunMainController.java b/src/main/java/org/olat/course/run/RunMainController.java index 0275f289972bbb11e0c25810be13bb2ab43757a4..de88dcf7535fa34e913717df93ff919886161b8d 100644 --- a/src/main/java/org/olat/course/run/RunMainController.java +++ b/src/main/java/org/olat/course/run/RunMainController.java @@ -121,6 +121,7 @@ import org.olat.course.statistic.StatisticMainController; import org.olat.group.BusinessGroup; import org.olat.group.BusinessGroupService; import org.olat.group.ui.edit.BusinessGroupModifiedEvent; +import org.olat.ims.qti.statistics.QTIType; import org.olat.instantMessaging.InstantMessagingModule; import org.olat.instantMessaging.InstantMessagingService; import org.olat.instantMessaging.OpenInstantMessageEvent; @@ -156,7 +157,8 @@ public class RunMainController extends MainLayoutBasicController implements Gene private MenuTree luTree; //tools - private Link editLink, userMgmtLink, archiverLink, assessmentLink, qtistatisticLink, statisticLink, dbLink; + private Link surveyStatisticLink, testStatisticLink; + private Link editLink, userMgmtLink, archiverLink, assessmentLink, statisticLink, dbLink; private Link efficiencyStatementsLink, bookmarkLink, calendarLink, detailsLink, noteLink, chatLink; private Panel contentP; @@ -476,9 +478,12 @@ public class RunMainController extends MainLayoutBasicController implements Gene } else if(assessmentLink == source) { all.popUpToRootController(ureq); launchAssessmentTool(ureq); - } else if(qtistatisticLink == source) { + } else if(testStatisticLink == source) { all.popUpToRootController(ureq); - launchAssessmentStatistics(ureq); + launchAssessmentStatistics(ureq, "command.openteststatistic", "TestStatistics", QTIType.test, QTIType.onyx); + } else if (surveyStatisticLink == source) { + all.popUpToRootController(ureq); + launchAssessmentStatistics(ureq, "command.opensurveystatistic", "SurveyStatistics", QTIType.survey); } else if(statisticLink == source) { all.popUpToRootController(ureq); launchStatistics(ureq); @@ -824,22 +829,15 @@ public class RunMainController extends MainLayoutBasicController implements Gene } else throw new OLATSecurityException("clicked groupmanagement, but no according right"); } - private Activateable2 launchAssessmentStatistics(UserRequest ureq) { - OLATResourceable ores = OresHelper.createOLATResourceableType("assessmentStatistics"); + private Activateable2 launchAssessmentStatistics(UserRequest ureq, String i18nCrumbKey, String typeName, QTIType... types) { + OLATResourceable ores = OresHelper.createOLATResourceableType(typeName); ThreadLocalUserActivityLogger.addLoggingResourceInfo(LoggingResourceable.wrapBusinessPath(ores)); WindowControl swControl = addToHistory(ureq, ores, null); - if (hasCourseRight(CourseRights.RIGHT_STATISTICS) || isCourseAdmin) { - StatisticCourseNodesController statsToolCtr = new StatisticCourseNodesController(ureq, swControl, uce); - currentToolCtr = statsToolCtr; - listenTo(statsToolCtr); - all.pushController(translate("command.openstatistic"), statsToolCtr); - return statsToolCtr; - } - if (isCourseCoach) { - StatisticCourseNodesController statsToolCtr = new StatisticCourseNodesController(ureq, swControl, uce); + if (hasCourseRight(CourseRights.RIGHT_STATISTICS) || isCourseAdmin || isCourseCoach) { + StatisticCourseNodesController statsToolCtr = new StatisticCourseNodesController(ureq, swControl, uce, types); currentToolCtr = statsToolCtr; listenTo(statsToolCtr); - all.pushController(translate("command.openstatistic"), statsToolCtr); + all.pushController(translate(i18nCrumbKey), statsToolCtr); return statsToolCtr; } return null; @@ -1052,18 +1050,26 @@ public class RunMainController extends MainLayoutBasicController implements Gene editTools.addComponent(assessmentLink); } if (hasCourseRight(CourseRights.RIGHT_STATISTICS) || isCourseAdmin || isCourseCoach) { - final AtomicInteger qtiNodes = new AtomicInteger(); + final AtomicInteger testNodes = new AtomicInteger(); + final AtomicInteger surveyNodes = new AtomicInteger(); new TreeVisitor(new Visitor() { @Override public void visit(INode node) { - if(((CourseNode)node).isStatisticNodeResultAvailable(uce)) { - qtiNodes.incrementAndGet(); + if(((CourseNode)node).isStatisticNodeResultAvailable(uce, QTIType.test, QTIType.onyx)) { + testNodes.incrementAndGet(); + } else if(((CourseNode)node).isStatisticNodeResultAvailable(uce, QTIType.survey)) { + surveyNodes.incrementAndGet(); } } }, course.getRunStructure().getRootNode(), true).visitAll(); - if(qtiNodes.intValue() > 0) { - qtistatisticLink = LinkFactory.createToolLink("qtistatistic", translate("command.openqtistatistic"), this); - editTools.addComponent(qtistatisticLink); + if(testNodes.intValue() > 0) { + testStatisticLink = LinkFactory.createToolLink("qtistatistic", translate("command.openqtistatistic"), this); + editTools.addComponent(testStatisticLink); + } + + if(surveyNodes.intValue() > 0) { + surveyStatisticLink = LinkFactory.createToolLink("qtistatistic", translate("command.openqtistatistic"), this); + editTools.addComponent(surveyStatisticLink); } } if (hasCourseRight(CourseRights.RIGHT_STATISTICS) || isCourseAdmin) { @@ -1309,11 +1315,16 @@ public class RunMainController extends MainLayoutBasicController implements Gene //the wrong link to the wrong person } } - } else if ("assessmentStatistics".equalsIgnoreCase(type)) { + } else if ("TestStatistics".equalsIgnoreCase(type) || "SurveyStatistics".equalsIgnoreCase(type)) { //check the security before, the link is perhaps in the wrong hands if(hasCourseRight(CourseRights.RIGHT_ASSESSMENT) || isCourseAdmin || isCourseCoach) { try { - Activateable2 assessmentCtrl = launchAssessmentStatistics(ureq); + Activateable2 assessmentCtrl; + if("TestStatistics".equalsIgnoreCase(type)) { + assessmentCtrl = launchAssessmentStatistics(ureq, "command.openteststatistic", "TestStatistics", QTIType.test, QTIType.onyx); + } else { + assessmentCtrl = launchAssessmentStatistics(ureq, "command.opensurveystatistic", "SurveyStatistics", QTIType.survey); + } List<ContextEntry> subEntries; if(entries.size() > 1 && entries.get(1).getOLATResourceable().getResourceableTypeName().equals(type)) { diff --git a/src/main/java/org/olat/course/run/_i18n/LocalStrings_de.properties b/src/main/java/org/olat/course/run/_i18n/LocalStrings_de.properties index 4ed0fc8a2429ce020498c23de9e5f728dcf832a3..16922303a9a35df3a47ea528da9c96fce454319c 100644 --- a/src/main/java/org/olat/course/run/_i18n/LocalStrings_de.properties +++ b/src/main/java/org/olat/course/run/_i18n/LocalStrings_de.properties @@ -20,7 +20,8 @@ command.opengroupmngt=Gruppenmanagement command.opensimplegroupmngt=Mitgliederverwaltung command.openrightmngt=Rechtemanagement command.openstatistic=Kurs Statistiken -command.openqtistatistic=QTI Test Statistiken +command.openteststatistic=Test Statistiken +command.opensurveystatistic=Fragebogen Statistiken command.personalnote=Notizen course.closed = Dieser Kurs wurde beendet und wird nicht l\u00e4nger bearbeitet oder aktualisiert. course.disposed.command.restart=Den Kurs beenden und neu starten diff --git a/src/main/java/org/olat/course/run/_i18n/LocalStrings_en.properties b/src/main/java/org/olat/course/run/_i18n/LocalStrings_en.properties index a70e5919008cafc9ee9855a434d7209c3dcf0884..b0e4818000fb633cf9f27aa9fed04c268e272049 100644 --- a/src/main/java/org/olat/course/run/_i18n/LocalStrings_en.properties +++ b/src/main/java/org/olat/course/run/_i18n/LocalStrings_en.properties @@ -17,7 +17,8 @@ command.openassessment=Assessment tool command.opendb=Course DB command.openeditor=Course editor command.opengroupmngt=Group management -command.openqtistatistic=QTI Test Statistics +command.openteststatistic=Test statistics +command.opensurveystatistic=Survey statistics command.openrightmngt=Rights management command.opensimplegroupmngt=Members management command.openstatistic=Course Statistics diff --git a/src/main/java/org/olat/course/run/_i18n/LocalStrings_fr.properties b/src/main/java/org/olat/course/run/_i18n/LocalStrings_fr.properties index 828ed415bab47723dbbdac9361baa270ddcf6268..3370624ccfa69f70c74d44c812f39bda041a7cda 100644 --- a/src/main/java/org/olat/course/run/_i18n/LocalStrings_fr.properties +++ b/src/main/java/org/olat/course/run/_i18n/LocalStrings_fr.properties @@ -17,7 +17,8 @@ command.openassessment=Outil d'\u00E9valuation command.opendb=Base de donn\u00E9es du cours command.openeditor=Editeur de cours command.opengroupmngt=Gestion des groupes -command.openqtistatistic=Statistique des tests QTI +command.openteststatistic=Statistique des tests +command.opensurveystatistic=Statistique des sondages command.openrightmngt=Gestion des droits command.opensimplegroupmngt=Administration des membres command.openstatistic=Statistique diff --git a/src/main/java/org/olat/course/run/_i18n/LocalStrings_pl.properties b/src/main/java/org/olat/course/run/_i18n/LocalStrings_pl.properties index 50022814151714bc04285f3527deb9fa45487f7a..74fd1f678dc97afceaf01856da79da1a2be55703 100644 --- a/src/main/java/org/olat/course/run/_i18n/LocalStrings_pl.properties +++ b/src/main/java/org/olat/course/run/_i18n/LocalStrings_pl.properties @@ -15,7 +15,7 @@ command.openarchiver=Archiwizacja command.openassessment=Ocenianie command.openeditor=Edytor command.opengroupmngt=Grupy -command.openqtistatistic=Statystyki QTI +command.openteststatistic=Statystyki QTI command.openrightmngt=Uprawnienia command.opensimplegroupmngt=Cz\u0142onkowie command.openstatistic=Statystyki diff --git a/src/main/java/org/olat/course/run/_i18n/LocalStrings_pt_BR.properties b/src/main/java/org/olat/course/run/_i18n/LocalStrings_pt_BR.properties index fcdd5f92a877331d014b1ad0ba5af8671357185b..faaa513c72e4d7f56787179ba8020a0ecacd3562 100644 --- a/src/main/java/org/olat/course/run/_i18n/LocalStrings_pt_BR.properties +++ b/src/main/java/org/olat/course/run/_i18n/LocalStrings_pt_BR.properties @@ -17,7 +17,7 @@ command.openassessment=Ferramenta de avalia\u00E7\u00E3o command.opendb=Banco de dados do Curso command.openeditor=Editor do curso command.opengroupmngt=Gerenciamento de grupo -command.openqtistatistic=Estat\u00EDsticas de Test QTI +command.openteststatistic=Estat\u00EDsticas de Test command.openrightmngt=Gerenciamento de direitos command.opensimplegroupmngt=Gest\u00E3o de membros command.openstatistic=Ajuda sobre as configura\u00E7\u00F5es das descri\u00E7\u00F5es diff --git a/src/main/java/org/olat/course/statistic/StatisticCourseNodesController.java b/src/main/java/org/olat/course/statistic/StatisticCourseNodesController.java index 465e90ae02adf7bbce1406500f80366a36e89223..52a7edcca7f7d0b9d0b8a6b466d3162c9af95322 100644 --- a/src/main/java/org/olat/course/statistic/StatisticCourseNodesController.java +++ b/src/main/java/org/olat/course/statistic/StatisticCourseNodesController.java @@ -49,6 +49,7 @@ import org.olat.course.ICourse; import org.olat.course.nodes.CourseNode; import org.olat.course.run.userview.UserCourseEnvironment; import org.olat.course.run.userview.UserCourseEnvironmentImpl; +import org.olat.ims.qti.statistics.QTIType; /** * @@ -60,11 +61,14 @@ public class StatisticCourseNodesController extends BasicController implements A private final LayoutMain3ColsController layoutCtr; private Controller currentCtrl; + private final QTIType[] types; private final StatisticResourceOption options; - public StatisticCourseNodesController(UserRequest ureq, WindowControl wControl, UserCourseEnvironment userCourseEnv) { + public StatisticCourseNodesController(UserRequest ureq, WindowControl wControl, + UserCourseEnvironment userCourseEnv, QTIType ... types) { super(ureq, wControl); + this.types = types; options = new StatisticResourceOption(); boolean admin = userCourseEnv.isAdmin(); @@ -106,7 +110,7 @@ public class StatisticCourseNodesController extends BasicController implements A @Override public void visit(INode node) { CourseNode courseNode = (CourseNode)node; - StatisticResourceResult result = courseNode.createStatisticNodeResult(ureq, getWindowControl(), userCourseEnv, options); + StatisticResourceResult result = courseNode.createStatisticNodeResult(ureq, getWindowControl(), userCourseEnv, options, types); if(result != null) { StatisticResourceNode courseNodeTreeNode = new StatisticResourceNode(courseNode, result); rootTreeNode.addChild(courseNodeTreeNode); diff --git a/src/main/java/org/olat/ims/qti/statistics/ui/_i18n/LocalStrings_de.properties b/src/main/java/org/olat/ims/qti/statistics/ui/_i18n/LocalStrings_de.properties index 71db5437f1f7dd6cde3f176e5ef3c42bdb258300..d327565a2895a04406d1412c524539b712c4e7fd 100644 --- a/src/main/java/org/olat/ims/qti/statistics/ui/_i18n/LocalStrings_de.properties +++ b/src/main/java/org/olat/ims/qti/statistics/ui/_i18n/LocalStrings_de.properties @@ -3,15 +3,14 @@ menu.title=Test Statistiken splash.choosetest=Wählen Sie einen Test aus splash.notenoughresults=Für diesen Test/Umfrage gibt es noch zu wenig Resultate ({0} Teilnehmer) - -chart.answer.averageScoreQuestions.y=Durschnittliche Punkte +chart.answer.averageScoreQuestions.y=Durchschnittliche Punkte chart.percent.participants=% Teilnehmer chart.percent.participants.num=Anzahl Teilnehmer chart.score.histogramm=Punkteverteilung chart.duration.histogramm=Bearbeitungsdauer chart.duration.histogramm.legend=Bearbeitungsdauer (Min.) -chart.averagescore.peritem=Durschnittliche Punkte pro Frage +chart.averagescore.peritem=Durchschnittliche Punkte pro Frage chart.rightanswers.peritem=Richtige Antworten pro Frage in Prozenten chart.responses=Antworten chart.survey.overview=Übersicht