Search in sources :

Example 1 with LectureBlockRollCallStatusCellRenderer

use of org.olat.modules.lecture.ui.component.LectureBlockRollCallStatusCellRenderer in project OpenOLAT by OpenOLAT.

the class ParticipantLectureBlocksController method initForm.

@Override
protected void initForm(FormItemContainer formLayout, Controller listener, UserRequest ureq) {
    if (formLayout instanceof FormLayoutContainer) {
        FormLayoutContainer layoutCont = (FormLayoutContainer) formLayout;
        if (withPrint) {
            layoutCont.contextPut("winid", "w" + layoutCont.getFormItemComponent().getDispatchID());
            layoutCont.getFormItemComponent().addListener(this);
            layoutCont.getFormItemComponent().contextPut("withPrint", Boolean.TRUE);
            layoutCont.contextPut("title", StringHelper.escapeHtml(entry.getDisplayname()));
            openCourseButton = uifactory.addFormLink("open.course", formLayout, Link.BUTTON);
            openCourseButton.setIconLeftCSS("o_icon o_CourseModule_icon");
        } else {
            layoutCont.contextPut("title", translate("lectures.repository.print.title", new String[] { StringHelper.escapeHtml(entry.getDisplayname()), StringHelper.escapeHtml(userManager.getUserDisplayName(assessedIdentity)) }));
        }
        layoutCont.contextPut("authorizedAbsenceEnabled", authorizedAbsenceEnabled);
    }
    FlexiTableColumnModel columnsModel = FlexiTableDataModelFactory.createFlexiTableColumnModel();
    columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(ParticipantCols.date, new DateFlexiCellRenderer(getLocale())));
    columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(ParticipantCols.entry));
    columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(ParticipantCols.lectureBlock));
    columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(ParticipantCols.coach));
    columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(ParticipantCols.plannedLectures, new LecturesCompulsoryRenderer()));
    columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(ParticipantCols.attendedLectures));
    if (authorizedAbsenceEnabled) {
        columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(ParticipantCols.unauthorizedAbsentLectures));
        columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(ParticipantCols.authorizedAbsentLectures));
    } else {
        columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(ParticipantCols.absentLectures));
    }
    columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(ParticipantCols.status, new LectureBlockRollCallStatusCellRenderer(authorizedAbsenceEnabled, absenceDefaultAuthorized, getTranslator())));
    if (appealEnabled && withAppeal && assessedIdentity.equals(getIdentity())) {
        columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel("appeal", ParticipantCols.appeal.ordinal(), "appeal", new BooleanCellRenderer(new StaticFlexiCellRenderer(translate("appeal"), "appeal"), null)));
    }
    tableModel = new ParticipantLectureBlocksDataModel(columnsModel, authorizedAbsenceEnabled, absenceDefaultAuthorized, getLocale());
    int paging = withPrint ? 20 : -1;
    tableEl = uifactory.addTableElement(getWindowControl(), "table", tableModel, paging, false, getTranslator(), formLayout);
    FlexiTableSortOptions options = new FlexiTableSortOptions();
    options.setDefaultOrderBy(new SortKey(ParticipantCols.date.name(), true));
    tableEl.setSortSettings(options);
    tableEl.setCustomizeColumns(withPrint);
    tableEl.setAndLoadPersistedPreferences(ureq, "participant-roll-call-appeal");
    tableEl.setEmtpyTableMessageKey("empty.repository.entry.lectures");
    List<FlexiTableFilter> filters = new ArrayList<>();
    filters.add(new FlexiTableFilter(translate("filter.showAll"), "showAll", true));
    filters.add(new FlexiTableFilter(translate("filter.mandatory"), "mandatory"));
    tableEl.setFilters("", filters, false);
}
Also used : DateFlexiCellRenderer(org.olat.core.gui.components.form.flexible.impl.elements.table.DateFlexiCellRenderer) FlexiTableSortOptions(org.olat.core.gui.components.form.flexible.elements.FlexiTableSortOptions) ArrayList(java.util.ArrayList) FormLayoutContainer(org.olat.core.gui.components.form.flexible.impl.FormLayoutContainer) SortKey(org.olat.core.commons.persistence.SortKey) StaticFlexiCellRenderer(org.olat.core.gui.components.form.flexible.impl.elements.table.StaticFlexiCellRenderer) BooleanCellRenderer(org.olat.core.gui.components.form.flexible.impl.elements.table.BooleanCellRenderer) FlexiTableFilter(org.olat.core.gui.components.form.flexible.elements.FlexiTableFilter) FlexiTableColumnModel(org.olat.core.gui.components.form.flexible.impl.elements.table.FlexiTableColumnModel) LecturesCompulsoryRenderer(org.olat.modules.lecture.ui.component.LecturesCompulsoryRenderer) LectureBlockRollCallStatusCellRenderer(org.olat.modules.lecture.ui.component.LectureBlockRollCallStatusCellRenderer) DefaultFlexiColumnModel(org.olat.core.gui.components.form.flexible.impl.elements.table.DefaultFlexiColumnModel)

Example 2 with LectureBlockRollCallStatusCellRenderer

use of org.olat.modules.lecture.ui.component.LectureBlockRollCallStatusCellRenderer in project openolat by klemens.

the class ParticipantLectureBlocksController method initForm.

@Override
protected void initForm(FormItemContainer formLayout, Controller listener, UserRequest ureq) {
    if (formLayout instanceof FormLayoutContainer) {
        FormLayoutContainer layoutCont = (FormLayoutContainer) formLayout;
        if (withPrint) {
            layoutCont.contextPut("winid", "w" + layoutCont.getFormItemComponent().getDispatchID());
            layoutCont.getFormItemComponent().addListener(this);
            layoutCont.getFormItemComponent().contextPut("withPrint", Boolean.TRUE);
            layoutCont.contextPut("title", StringHelper.escapeHtml(entry.getDisplayname()));
            openCourseButton = uifactory.addFormLink("open.course", formLayout, Link.BUTTON);
            openCourseButton.setIconLeftCSS("o_icon o_CourseModule_icon");
        } else {
            layoutCont.contextPut("title", translate("lectures.repository.print.title", new String[] { StringHelper.escapeHtml(entry.getDisplayname()), StringHelper.escapeHtml(userManager.getUserDisplayName(assessedIdentity)) }));
        }
        layoutCont.contextPut("authorizedAbsenceEnabled", authorizedAbsenceEnabled);
    }
    FlexiTableColumnModel columnsModel = FlexiTableDataModelFactory.createFlexiTableColumnModel();
    columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(ParticipantCols.date, new DateFlexiCellRenderer(getLocale())));
    columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(ParticipantCols.entry));
    columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(ParticipantCols.lectureBlock));
    columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(ParticipantCols.coach));
    columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(ParticipantCols.plannedLectures, new LecturesCompulsoryRenderer()));
    columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(ParticipantCols.attendedLectures));
    if (authorizedAbsenceEnabled) {
        columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(ParticipantCols.unauthorizedAbsentLectures));
        columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(ParticipantCols.authorizedAbsentLectures));
    } else {
        columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(ParticipantCols.absentLectures));
    }
    columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(ParticipantCols.status, new LectureBlockRollCallStatusCellRenderer(authorizedAbsenceEnabled, absenceDefaultAuthorized, getTranslator())));
    if (appealEnabled && withAppeal && assessedIdentity.equals(getIdentity())) {
        columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel("appeal", ParticipantCols.appeal.ordinal(), "appeal", new BooleanCellRenderer(new StaticFlexiCellRenderer(translate("appeal"), "appeal"), null)));
    }
    tableModel = new ParticipantLectureBlocksDataModel(columnsModel, authorizedAbsenceEnabled, absenceDefaultAuthorized, getLocale());
    int paging = withPrint ? 20 : -1;
    tableEl = uifactory.addTableElement(getWindowControl(), "table", tableModel, paging, false, getTranslator(), formLayout);
    FlexiTableSortOptions options = new FlexiTableSortOptions();
    options.setDefaultOrderBy(new SortKey(ParticipantCols.date.name(), true));
    tableEl.setSortSettings(options);
    tableEl.setCustomizeColumns(withPrint);
    tableEl.setAndLoadPersistedPreferences(ureq, "participant-roll-call-appeal");
    tableEl.setEmtpyTableMessageKey("empty.repository.entry.lectures");
    List<FlexiTableFilter> filters = new ArrayList<>();
    filters.add(new FlexiTableFilter(translate("filter.showAll"), "showAll", true));
    filters.add(new FlexiTableFilter(translate("filter.mandatory"), "mandatory"));
    tableEl.setFilters("", filters, false);
}
Also used : DateFlexiCellRenderer(org.olat.core.gui.components.form.flexible.impl.elements.table.DateFlexiCellRenderer) FlexiTableSortOptions(org.olat.core.gui.components.form.flexible.elements.FlexiTableSortOptions) ArrayList(java.util.ArrayList) FormLayoutContainer(org.olat.core.gui.components.form.flexible.impl.FormLayoutContainer) SortKey(org.olat.core.commons.persistence.SortKey) StaticFlexiCellRenderer(org.olat.core.gui.components.form.flexible.impl.elements.table.StaticFlexiCellRenderer) BooleanCellRenderer(org.olat.core.gui.components.form.flexible.impl.elements.table.BooleanCellRenderer) FlexiTableFilter(org.olat.core.gui.components.form.flexible.elements.FlexiTableFilter) FlexiTableColumnModel(org.olat.core.gui.components.form.flexible.impl.elements.table.FlexiTableColumnModel) LecturesCompulsoryRenderer(org.olat.modules.lecture.ui.component.LecturesCompulsoryRenderer) LectureBlockRollCallStatusCellRenderer(org.olat.modules.lecture.ui.component.LectureBlockRollCallStatusCellRenderer) DefaultFlexiColumnModel(org.olat.core.gui.components.form.flexible.impl.elements.table.DefaultFlexiColumnModel)

Aggregations

ArrayList (java.util.ArrayList)2 SortKey (org.olat.core.commons.persistence.SortKey)2 FlexiTableFilter (org.olat.core.gui.components.form.flexible.elements.FlexiTableFilter)2 FlexiTableSortOptions (org.olat.core.gui.components.form.flexible.elements.FlexiTableSortOptions)2 FormLayoutContainer (org.olat.core.gui.components.form.flexible.impl.FormLayoutContainer)2 BooleanCellRenderer (org.olat.core.gui.components.form.flexible.impl.elements.table.BooleanCellRenderer)2 DateFlexiCellRenderer (org.olat.core.gui.components.form.flexible.impl.elements.table.DateFlexiCellRenderer)2 DefaultFlexiColumnModel (org.olat.core.gui.components.form.flexible.impl.elements.table.DefaultFlexiColumnModel)2 FlexiTableColumnModel (org.olat.core.gui.components.form.flexible.impl.elements.table.FlexiTableColumnModel)2 StaticFlexiCellRenderer (org.olat.core.gui.components.form.flexible.impl.elements.table.StaticFlexiCellRenderer)2 LectureBlockRollCallStatusCellRenderer (org.olat.modules.lecture.ui.component.LectureBlockRollCallStatusCellRenderer)2 LecturesCompulsoryRenderer (org.olat.modules.lecture.ui.component.LecturesCompulsoryRenderer)2