use of org.olat.core.gui.components.velocity.VelocityContainer in project OpenOLAT by OpenOLAT.
the class QTI21OnyxAssessmentStatisticsController method initDurationHistogram.
private void initDurationHistogram(StatisticAssessment stats) {
if (!BarSeries.hasNotNullDatas(stats.getDurations()))
return;
VelocityContainer durationHistogramVC = createVelocityContainer("histogram_duration");
durationHistogramVC.contextPut("datas", BarSeries.datasToString(stats.getDurations()));
mainVC.put("durationHistogram", durationHistogramVC);
}
use of org.olat.core.gui.components.velocity.VelocityContainer in project OpenOLAT by OpenOLAT.
the class QTI12AssessmentStatisticsController method initItemsOverview.
private void initItemsOverview(List<Item> items) {
List<StatisticSurveyItem> surveyItems = qtiStatisticsManager.getStatisticAnswerOptions(resourceResult.getSearchParams(), items);
int count = 0;
List<String> overviewList = new ArrayList<>();
for (StatisticSurveyItem surveyItem : surveyItems) {
Item item = surveyItem.getItem();
Series series = seriesfactory.getSeries(item, null);
if (series != null) {
// essay hasn't a series
String name = "overview_" + count++;
VelocityContainer vc = createVelocityContainer(name, "hbar_item_overview");
vc.contextPut("series", series);
vc.contextPut("question", item.getQuestion().getQuestion().renderAsHtml(mediaBaseURL));
vc.contextPut("questionType", item.getQuestion().getType());
vc.contextPut("title", item.getTitle());
mainVC.put(vc.getDispatchID(), vc);
overviewList.add(vc.getDispatchID());
}
}
mainVC.contextPut("overviewList", overviewList);
}
use of org.olat.core.gui.components.velocity.VelocityContainer in project OpenOLAT by OpenOLAT.
the class QTI12AssessmentStatisticsController method initScoreStatisticPerItem.
private void initScoreStatisticPerItem(List<Item> items, double numOfParticipants) {
BarSeries d1 = new BarSeries();
BarSeries d2 = new BarSeries();
List<StatisticItem> statisticItems = qtiStatisticsManager.getStatisticPerItem(items, resourceResult.getSearchParams(), numOfParticipants);
int i = 0;
List<ItemInfos> itemInfos = new ArrayList<>(items.size());
for (StatisticItem statisticItem : statisticItems) {
Item item = statisticItem.getItem();
String label = Integer.toString(++i);
String text = item.getTitle();
d1.add(statisticItem.getAverageScore(), label);
double numOfRightAnswers = statisticItem.getNumOfCorrectAnswers();
double res = numOfRightAnswers;
d2.add(res, label);
itemInfos.add(new ItemInfos(label, text));
}
mainVC.contextPut("itemInfoList", itemInfos);
VelocityContainer averageScorePeritemVC = createVelocityContainer("hbar_average_score_per_item");
Stringuified data1 = BarSeries.getDatasAndColors(Collections.singletonList(d1), "bar_default");
averageScorePeritemVC.contextPut("datas", data1);
mainVC.put("averageScorePerItemChart", averageScorePeritemVC);
VelocityContainer percentRightAnswersPerItemVC = createVelocityContainer("hbar_right_answer_per_item");
Stringuified data2 = BarSeries.getDatasAndColors(Collections.singletonList(d2), "bar_green");
percentRightAnswersPerItemVC.contextPut("datas", data2);
percentRightAnswersPerItemVC.contextPut("numOfParticipants", Long.toString(Math.round(numOfParticipants)));
mainVC.put("percentRightAnswersPerItemChart", percentRightAnswersPerItemVC);
}
use of org.olat.core.gui.components.velocity.VelocityContainer in project OpenOLAT by OpenOLAT.
the class QTI12AssessmentStatisticsController method initScoreHistogram.
private void initScoreHistogram(StatisticAssessment stats) {
VelocityContainer scoreHistogramVC = createVelocityContainer("histogram_score");
scoreHistogramVC.contextPut("datas", BarSeries.datasToString(stats.getScores()));
scoreHistogramVC.contextPut("cutValue", cutValue);
mainVC.put("scoreHistogram", scoreHistogramVC);
}
use of org.olat.core.gui.components.velocity.VelocityContainer in project OpenOLAT by OpenOLAT.
the class BinderListController method initForm.
@Override
protected void initForm(FormItemContainer formLayout, Controller listener, UserRequest ureq) {
FlexiTableColumnModel columnsModel = FlexiTableDataModelFactory.createFlexiTableColumnModel();
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(false, PortfolioCols.key, "select"));
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(PortfolioCols.title, "select"));
model = new BindersDataModel(columnsModel);
tableEl = uifactory.addTableElement(getWindowControl(), "table", model, 20, false, getTranslator(), formLayout);
tableEl.setAvailableRendererTypes(FlexiTableRendererType.custom);
tableEl.setRendererType(FlexiTableRendererType.custom);
tableEl.setSearchEnabled(false);
tableEl.setCustomizeColumns(false);
tableEl.setElementCssClass("o_portfolio_listing");
tableEl.setEmtpyTableMessageKey("table.sEmptyTable");
tableEl.setNumOfRowsEnabled(false);
tableEl.setPageSize(24);
VelocityContainer row = createVelocityContainer("binder_row");
// sets its own DOM id in velocity container
row.setDomReplacementWrapperRequired(false);
tableEl.setRowRenderer(row, this);
tableEl.setCssDelegate(new BinderCssDelegate());
tableEl.setAndLoadPersistedPreferences(ureq, getTableId());
mapperThumbnailUrl = registerCacheableMapper(ureq, "binder-list", new ImageMapper(model));
row.contextPut("mapperThumbnailUrl", mapperThumbnailUrl);
if (!portfolioModule.isLearnerCanCreateBinders() && !portfolioModule.isCanCreateBindersFromTemplate() && portfolioModule.isCanCreateBindersFromCourse()) {
newBinderFromCourseButton = uifactory.addFormLink("create.binder.from.course", "create.empty.binder.from.course", null, formLayout, Link.BUTTON);
row.put("createBinderFromCourse", newBinderFromCourseButton.getComponent());
} else if (portfolioModule.isLearnerCanCreateBinders() || portfolioModule.isCanCreateBindersFromTemplate() || portfolioModule.isCanCreateBindersFromCourse()) {
newBinderDropdown = uifactory.addFormLink("create.binders", "create.new.binder", null, formLayout, Link.BUTTON);
int count = (portfolioModule.isLearnerCanCreateBinders() ? 1 : 0) + (portfolioModule.isCanCreateBindersFromTemplate() ? 1 : 0) + (portfolioModule.isCanCreateBindersFromCourse() ? 1 : 0);
if (count > 1) {
newBinderDropdown.setIconRightCSS("o_icon o_icon_caret");
}
row.put("createDropdown", newBinderDropdown.getComponent());
}
}
Aggregations