diff --git a/src/main/java/org/olat/course/nodes/CourseNode.java b/src/main/java/org/olat/course/nodes/CourseNode.java index a52001306e24db2caab20d0a91fe9680197cc745..200cf79d92b6881cf0e8c3ec9718ffd576c78057 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 c9d516c03d930e5f4080d41fccdb1ed18b398fa1..34bd7ea51b2ef45aac5a52dc91bcc473a32a1a5b 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 a0cfaaa48b4530ee23a20c51d16762c0a720803b..a1459dca3213e5617d087f19822ed88cda52aad8 100644 --- a/src/main/java/org/olat/course/nodes/IQSURVCourseNode.java +++ b/src/main/java/org/olat/course/nodes/IQSURVCourseNode.java @@ -70,6 +70,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; @@ -133,7 +134,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); @@ -155,8 +159,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 1a9cc2cc195fa1863374e9e16fb76c479a89415b..3cccc61dd960867a26c83b9921acdfffd2e30370 100644 --- a/src/main/java/org/olat/course/nodes/IQTESTCourseNode.java +++ b/src/main/java/org/olat/course/nodes/IQTESTCourseNode.java @@ -75,6 +75,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; @@ -147,7 +148,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); @@ -169,8 +173,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/run/RunMainController.java b/src/main/java/org/olat/course/run/RunMainController.java index 3971c8c1a2d39f01fe7f3eeaa2c8e5451eb18199..1f144807f55d4a64057a1d0915d786a06f77fef8 100644 --- a/src/main/java/org/olat/course/run/RunMainController.java +++ b/src/main/java/org/olat/course/run/RunMainController.java @@ -119,6 +119,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; @@ -694,8 +695,10 @@ public class RunMainController extends MainLayoutBasicController implements Gene boolean vip = isCourseCoach || isCourseAdmin; OpenInstantMessageEvent event = new OpenInstantMessageEvent(ureq, course, courseTitle, vip); ureq.getUserSession().getSingleUserEventCenter().fireEventToListenersOf(event, InstantMessagingService.TOWER_EVENT_ORES); - } else if (cmd.equals("qtistatistic")) { - launchAssessmentStatistics(ureq, null); + } else if (cmd.equals("teststatistic")) { + launchAssessmentStatistics(ureq, "command.openteststatistic", "TestStatistics", QTIType.test, QTIType.onyx); + } else if (cmd.equals("surveystatistic")) { + launchAssessmentStatistics(ureq, "command.opensurveystatistic", "SurveyStatistics", QTIType.survey); } else if (cmd.equals("customDb")) { if (hasCourseRight(CourseRights.RIGHT_DB) || isCourseAdmin) { currentToolCtr = new CustomDBMainController(ureq, getWindowControl(), course); @@ -855,22 +858,15 @@ public class RunMainController extends MainLayoutBasicController implements Gene } else throw new OLATSecurityException("clicked groupmanagement, but no according right"); } - private Activateable2 launchAssessmentStatistics(UserRequest ureq, List<ContextEntry> entries) { - 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, courseRepositoryEntry, uce); + if (hasCourseRight(CourseRights.RIGHT_STATISTICS) || isCourseAdmin || isCourseCoach) { + StatisticCourseNodesController statsToolCtr = new StatisticCourseNodesController(ureq, swControl, courseRepositoryEntry, uce, types); currentToolCtr = statsToolCtr; listenTo(statsToolCtr); - all.pushController(translate("command.openstatistic"), statsToolCtr); - return statsToolCtr; - } - if (isCourseCoach) { - StatisticCourseNodesController statsToolCtr = new StatisticCourseNodesController(ureq, swControl, courseRepositoryEntry, uce); - currentToolCtr = statsToolCtr; - listenTo(statsToolCtr); - all.pushController(translate("command.openstatistic"), statsToolCtr); + all.pushController(translate(i18nCrumbKey), statsToolCtr); return statsToolCtr; } return null; @@ -1063,17 +1059,23 @@ public class RunMainController extends MainLayoutBasicController implements Gene myTool.addLink("assessment", translate("command.openassessment")); } 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) { - myTool.addLink("qtistatistic", translate("command.openqtistatistic")); + if(testNodes.intValue() > 0) { + myTool.addLink("teststatistic", translate("command.openteststatistic")); + } + if(surveyNodes.intValue() > 0) { + myTool.addLink("surveystatistic", translate("command.opensurveystatistic")); } } if (hasCourseRight(CourseRights.RIGHT_STATISTICS) || isCourseAdmin) { @@ -1290,11 +1292,16 @@ public class RunMainController extends MainLayoutBasicController implements Gene //the wrong link to the wrong person } } - } else if ("assessmentStatistics".equals(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, null); + 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 819722f497f092432ca16f6d3e6eee92c0c50341..c980e306b2724338b75d5a125c36636d0ed2aa30 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.nodes.CourseNode; import org.olat.course.run.userview.UserCourseEnvironment; import org.olat.course.run.userview.UserCourseEnvironmentImpl; import org.olat.group.BusinessGroup; +import org.olat.ims.qti.statistics.QTIType; import org.olat.repository.RepositoryEntry; /** @@ -61,11 +62,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, RepositoryEntry courseRe, UserCourseEnvironment userCourseEnv) { + public StatisticCourseNodesController(UserRequest ureq, WindowControl wControl, + RepositoryEntry courseRe, UserCourseEnvironment userCourseEnv, QTIType ... types) { super(ureq, wControl); + this.types = types; options = new StatisticResourceOption(); boolean admin = userCourseEnv.isAdmin(); @@ -109,7 +113,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