Search in sources :

Example 16 with VelocityContainer

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);
}
Also used : VelocityContainer(org.olat.core.gui.components.velocity.VelocityContainer)

Example 17 with VelocityContainer

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);
}
Also used : StatisticSurveyItem(org.olat.ims.qti.statistics.model.StatisticSurveyItem) StatisticSurveyItem(org.olat.ims.qti.statistics.model.StatisticSurveyItem) Item(org.olat.ims.qti.editor.beecom.objects.Item) StatisticItem(org.olat.ims.qti.statistics.model.StatisticItem) BarSeries(org.olat.core.gui.components.chart.BarSeries) ArrayList(java.util.ArrayList) StatisticFormatter.getModeString(org.olat.ims.qti.statistics.ui.StatisticFormatter.getModeString) VelocityContainer(org.olat.core.gui.components.velocity.VelocityContainer)

Example 18 with VelocityContainer

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);
}
Also used : StatisticSurveyItem(org.olat.ims.qti.statistics.model.StatisticSurveyItem) Item(org.olat.ims.qti.editor.beecom.objects.Item) StatisticItem(org.olat.ims.qti.statistics.model.StatisticItem) StatisticItem(org.olat.ims.qti.statistics.model.StatisticItem) Stringuified(org.olat.core.gui.components.chart.BarSeries.Stringuified) ArrayList(java.util.ArrayList) BarSeries(org.olat.core.gui.components.chart.BarSeries) StatisticFormatter.getModeString(org.olat.ims.qti.statistics.ui.StatisticFormatter.getModeString) VelocityContainer(org.olat.core.gui.components.velocity.VelocityContainer)

Example 19 with VelocityContainer

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);
}
Also used : VelocityContainer(org.olat.core.gui.components.velocity.VelocityContainer)

Example 20 with VelocityContainer

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());
    }
}
Also used : FlexiTableColumnModel(org.olat.core.gui.components.form.flexible.impl.elements.table.FlexiTableColumnModel) DefaultFlexiColumnModel(org.olat.core.gui.components.form.flexible.impl.elements.table.DefaultFlexiColumnModel) VelocityContainer(org.olat.core.gui.components.velocity.VelocityContainer)

Aggregations

VelocityContainer (org.olat.core.gui.components.velocity.VelocityContainer)162 Component (org.olat.core.gui.components.Component)22 ArrayList (java.util.ArrayList)16 DefaultFlexiColumnModel (org.olat.core.gui.components.form.flexible.impl.elements.table.DefaultFlexiColumnModel)14 FlexiTableColumnModel (org.olat.core.gui.components.form.flexible.impl.elements.table.FlexiTableColumnModel)14 CloseableCalloutWindowController (org.olat.core.gui.control.generic.closablewrapper.CloseableCalloutWindowController)14 Link (org.olat.core.gui.components.link.Link)12 Panel (org.olat.core.gui.components.panel.Panel)12 UserRequest (org.olat.core.gui.UserRequest)10 JSAndCSSComponent (org.olat.core.gui.components.htmlheader.jscss.JSAndCSSComponent)10 List (java.util.List)8 LayoutMain3ColsController (org.olat.core.commons.fullWebApp.LayoutMain3ColsController)8 WindowControl (org.olat.core.gui.control.WindowControl)8 CloseableModalController (org.olat.core.gui.control.generic.closablewrapper.CloseableModalController)8 Translator (org.olat.core.gui.translator.Translator)8 OLATResourceable (org.olat.core.id.OLATResourceable)8 HashMap (java.util.HashMap)6 Collectors (java.util.stream.Collectors)6 Mapper (org.olat.core.dispatcher.mapper.Mapper)6 BarSeries (org.olat.core.gui.components.chart.BarSeries)6