diff --git a/src/main/java/org/olat/modules/qpool/ui/AbstractItemListController.java b/src/main/java/org/olat/modules/qpool/ui/AbstractItemListController.java index 85ddd0a22fea4aed58414422591edecff091ba59..b2d3b988ed58b6c915466697a2193334575549c5 100644 --- a/src/main/java/org/olat/modules/qpool/ui/AbstractItemListController.java +++ b/src/main/java/org/olat/modules/qpool/ui/AbstractItemListController.java @@ -199,6 +199,7 @@ public abstract class AbstractItemListController extends FormBasicController columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(Cols.taxonomyLevel)); columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(Cols.taxonomyPath)); } + columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(false, Cols.educationalContext)); columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(false, Cols.difficulty)); columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(false, Cols.stdevDifficulty)); columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(false, Cols.differentiation)); @@ -206,6 +207,7 @@ public abstract class AbstractItemListController extends FormBasicController columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(false, Cols.usage)); columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(false, Cols.correctionTime)); columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(Cols.type)); + columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(false, Cols.learningTime, new LearningTimeRenderer())); columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(Cols.format)); columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(Cols.rating)); columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(Cols.numberOfRatings)); diff --git a/src/main/java/org/olat/modules/qpool/ui/LearningTimeRenderer.java b/src/main/java/org/olat/modules/qpool/ui/LearningTimeRenderer.java new file mode 100644 index 0000000000000000000000000000000000000000..aeb4b49e023724ed827dc39eff0d4528d7032d63 --- /dev/null +++ b/src/main/java/org/olat/modules/qpool/ui/LearningTimeRenderer.java @@ -0,0 +1,51 @@ +/** + * <a href="http://www.openolat.org"> + * OpenOLAT - Online Learning and Training</a><br> + * <p> + * Licensed under the Apache License, Version 2.0 (the "License"); <br> + * you may not use this file except in compliance with the License.<br> + * You may obtain a copy of the License at the + * <a href="http://www.apache.org/licenses/LICENSE-2.0">Apache homepage</a> + * <p> + * Unless required by applicable law or agreed to in writing,<br> + * software distributed under the License is distributed on an "AS IS" BASIS, <br> + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. <br> + * See the License for the specific language governing permissions and <br> + * limitations under the License. + * <p> + * Initial code contributed and copyrighted by<br> + * frentix GmbH, http://www.frentix.com + * <p> + */ +package org.olat.modules.qpool.ui; + +import org.olat.core.gui.components.form.flexible.impl.elements.table.FlexiCellRenderer; +import org.olat.core.gui.components.form.flexible.impl.elements.table.FlexiTableComponent; +import org.olat.core.gui.render.Renderer; +import org.olat.core.gui.render.StringOutput; +import org.olat.core.gui.render.URLBuilder; +import org.olat.core.gui.translator.Translator; +import org.olat.modules.qpool.manager.MetadataConverterHelper; +import org.olat.modules.qpool.model.LOMDuration; + +/** + * + * Initial date: 7 Sep 2020<br> + * @author uhensler, urs.hensler@frentix.com, http://www.frentix.com + * + */ +public class LearningTimeRenderer implements FlexiCellRenderer { + + @Override + public void render(Renderer renderer, StringOutput target, Object cellValue, int row, FlexiTableComponent source, + URLBuilder ubu, Translator translator) { + if (cellValue instanceof String) { + LOMDuration duration = MetadataConverterHelper.convertDuration((String)cellValue); + target.append(duration.getDay()).append(translator.translate("educational.learningTime.day")).append(" "); + target.append(duration.getHour()).append(translator.translate("educational.learningTime.hour")).append(" "); + target.append(duration.getMinute()).append(translator.translate("educational.learningTime.minute")).append(" "); + target.append(duration.getSeconds()).append(translator.translate("educational.learningTime.second")); + } + } + +} diff --git a/src/main/java/org/olat/modules/qpool/ui/QuestionItemDataModel.java b/src/main/java/org/olat/modules/qpool/ui/QuestionItemDataModel.java index a6517ec1580c41fd194f9b748da088d1d01449f0..ace2855ed4d2b81e7c77175284c848e1ac648803 100644 --- a/src/main/java/org/olat/modules/qpool/ui/QuestionItemDataModel.java +++ b/src/main/java/org/olat/modules/qpool/ui/QuestionItemDataModel.java @@ -90,6 +90,7 @@ public class QuestionItemDataModel extends DefaultFlexiTableDataSourceModel<Item case lastModified: return item.getLastModified(); case taxonomyLevel: return item.getTaxonomyLevelName(); case taxonomyPath: return item.getTaxonomicPath(); + case educationalContext: return item.getEducationalContextLevel(); case difficulty: return MetaUIFactory.bigDToString(item.getDifficulty()); case stdevDifficulty: return MetaUIFactory.bigDToString(item.getStdevDifficulty()); case differentiation: return MetaUIFactory.bigDToString(item.getDifferentiation()); @@ -105,6 +106,7 @@ public class QuestionItemDataModel extends DefaultFlexiTableDataSourceModel<Item } return type; } + case learningTime: return item.getEducationalLearningTime(); case rating: return round(item.getRating()); case numberOfRatings: return item.getNumberOfRatings(); case format: return item.getFormat(); @@ -136,11 +138,13 @@ public class QuestionItemDataModel extends DefaultFlexiTableDataSourceModel<Item lastModified("technical.lastModified"), taxonomyLevel("classification.taxonomy.level"), taxonomyPath("classification.taxonomic.path"), + educationalContext("educational.context"), difficulty("question.difficulty"), stdevDifficulty("question.stdevDifficulty"), differentiation("question.differentiation"), numOfAnswerAlternatives("question.numOfAnswerAlternatives"), usage("question.usage"), + learningTime("educational.learningTime"), type("question.type"), format("technical.format"), rating("rating"),