Search in sources :

Example 1 with AssessmentStatusCellRenderer

use of org.olat.course.assessment.ui.tool.AssessmentStatusCellRenderer in project OpenOLAT by OpenOLAT.

the class AssessedIdentityListController method initForm.

@Override
protected void initForm(FormItemContainer formLayout, Controller listener, UserRequest ureq) {
    if (formLayout instanceof FormLayoutContainer) {
        FormLayoutContainer layoutCont = (FormLayoutContainer) formLayout;
        layoutCont.contextPut("title", testEntry.getDisplayname());
        RepositoryHandler handler = repositoryHandlerFactory.getRepositoryHandler(testEntry);
        layoutCont.contextPut("cssClass", RepositoyUIFactory.getIconCssClass(handler.getSupportedType()));
    }
    // add the table
    FlexiTableColumnModel columnsModel = FlexiTableDataModelFactory.createFlexiTableColumnModel();
    if (isAdministrativeUser) {
        columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(IdentityCourseElementCols.username, "select"));
    }
    int colIndex = AssessmentToolConstants.USER_PROPS_OFFSET;
    for (int i = 0; i < userPropertyHandlers.size(); i++) {
        UserPropertyHandler userPropertyHandler = userPropertyHandlers.get(i);
        boolean visible = UserManager.getInstance().isMandatoryUserProperty(AssessmentToolConstants.usageIdentifyer, userPropertyHandler);
        columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(visible, userPropertyHandler.i18nColumnDescriptorLabelKey(), colIndex, "select", true, "userProp-" + colIndex));
        colIndex++;
    }
    if (element.hasAttemptsConfigured()) {
        columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(IdentityCourseElementCols.attempts, "select"));
    }
    if (element.hasScoreConfigured()) {
        columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(IdentityCourseElementCols.min, "select", new ScoreCellRenderer()));
        columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(IdentityCourseElementCols.max, "select", new ScoreCellRenderer()));
        columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(IdentityCourseElementCols.score, "select", new ScoreCellRenderer()));
    }
    if (element.hasPassedConfigured()) {
        columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(IdentityCourseElementCols.passed, new PassedCellRenderer()));
    }
    columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(IdentityCourseElementCols.assessmentStatus, new AssessmentStatusCellRenderer(getLocale())));
    columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(IdentityCourseElementCols.initialLaunchDate, "select"));
    columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(false, IdentityCourseElementCols.lastModified, "select"));
    columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(IdentityCourseElementCols.lastUserModified, "select"));
    columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(false, IdentityCourseElementCols.lastCoachModified, "select"));
    usersTableModel = new AssessedIdentityListTableModel(columnsModel, element);
    usersTableModel.setCertificateMap(new ConcurrentHashMap<>());
    tableEl = uifactory.addTableElement(getWindowControl(), "table", usersTableModel, 20, false, getTranslator(), formLayout);
    tableEl.setExportEnabled(true);
    tableEl.setSearchEnabled(new AssessedIdentityListProvider(getIdentity(), testEntry, testEntry, null, assessmentCallback), ureq.getUserSession());
    List<FlexiTableFilter> filters = new ArrayList<>();
    filters.add(new FlexiTableFilter(translate("filter.passed"), "passed"));
    filters.add(new FlexiTableFilter(translate("filter.failed"), "failed"));
    filters.add(new FlexiTableFilter(translate("filter.inProgress"), "inProgress"));
    filters.add(new FlexiTableFilter(translate("filter.inReview"), "inReview"));
    filters.add(new FlexiTableFilter(translate("filter.done"), "done"));
    tableEl.setFilters("", filters, false);
    if (assessmentCallback.canAssessBusinessGoupMembers()) {
        List<BusinessGroup> coachedGroups;
        if (assessmentCallback.isAdmin()) {
            SearchBusinessGroupParams params = new SearchBusinessGroupParams();
            coachedGroups = businessGroupService.findBusinessGroups(params, testEntry, 0, -1);
        } else {
            coachedGroups = assessmentCallback.getCoachedGroups();
        }
        if (coachedGroups.size() > 0) {
            List<FlexiTableFilter> groupFilters = new ArrayList<>();
            for (BusinessGroup coachedGroup : coachedGroups) {
                String groupName = StringHelper.escapeHtml(coachedGroup.getName());
                groupFilters.add(new FlexiTableFilter(groupName, coachedGroup.getKey().toString(), "o_icon o_icon_group"));
            }
            tableEl.setExtendedFilterButton(translate("filter.groups"), groupFilters);
        }
    }
}
Also used : BusinessGroup(org.olat.group.BusinessGroup) AssessedIdentityListProvider(org.olat.course.assessment.ui.tool.AssessedIdentityListProvider) ArrayList(java.util.ArrayList) FormLayoutContainer(org.olat.core.gui.components.form.flexible.impl.FormLayoutContainer) SearchBusinessGroupParams(org.olat.group.model.SearchBusinessGroupParams) AssessmentStatusCellRenderer(org.olat.course.assessment.ui.tool.AssessmentStatusCellRenderer) FlexiTableFilter(org.olat.core.gui.components.form.flexible.elements.FlexiTableFilter) FlexiTableColumnModel(org.olat.core.gui.components.form.flexible.impl.elements.table.FlexiTableColumnModel) RepositoryHandler(org.olat.repository.handlers.RepositoryHandler) PassedCellRenderer(org.olat.course.assessment.bulk.PassedCellRenderer) DefaultFlexiColumnModel(org.olat.core.gui.components.form.flexible.impl.elements.table.DefaultFlexiColumnModel) UserPropertyHandler(org.olat.user.propertyhandlers.UserPropertyHandler)

Example 2 with AssessmentStatusCellRenderer

use of org.olat.course.assessment.ui.tool.AssessmentStatusCellRenderer in project openolat by klemens.

the class AssessedIdentityListController method initForm.

@Override
protected void initForm(FormItemContainer formLayout, Controller listener, UserRequest ureq) {
    if (formLayout instanceof FormLayoutContainer) {
        FormLayoutContainer layoutCont = (FormLayoutContainer) formLayout;
        layoutCont.contextPut("title", testEntry.getDisplayname());
        RepositoryHandler handler = repositoryHandlerFactory.getRepositoryHandler(testEntry);
        layoutCont.contextPut("cssClass", RepositoyUIFactory.getIconCssClass(handler.getSupportedType()));
    }
    // add the table
    FlexiTableColumnModel columnsModel = FlexiTableDataModelFactory.createFlexiTableColumnModel();
    if (isAdministrativeUser) {
        columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(IdentityCourseElementCols.username, "select"));
    }
    int colIndex = AssessmentToolConstants.USER_PROPS_OFFSET;
    for (int i = 0; i < userPropertyHandlers.size(); i++) {
        UserPropertyHandler userPropertyHandler = userPropertyHandlers.get(i);
        boolean visible = UserManager.getInstance().isMandatoryUserProperty(AssessmentToolConstants.usageIdentifyer, userPropertyHandler);
        columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(visible, userPropertyHandler.i18nColumnDescriptorLabelKey(), colIndex, "select", true, "userProp-" + colIndex));
        colIndex++;
    }
    if (element.hasAttemptsConfigured()) {
        columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(IdentityCourseElementCols.attempts, "select"));
    }
    if (element.hasScoreConfigured()) {
        columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(IdentityCourseElementCols.min, "select", new ScoreCellRenderer()));
        columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(IdentityCourseElementCols.max, "select", new ScoreCellRenderer()));
        columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(IdentityCourseElementCols.score, "select", new ScoreCellRenderer()));
    }
    if (element.hasPassedConfigured()) {
        columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(IdentityCourseElementCols.passed, new PassedCellRenderer()));
    }
    columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(IdentityCourseElementCols.assessmentStatus, new AssessmentStatusCellRenderer(getLocale())));
    columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(IdentityCourseElementCols.initialLaunchDate, "select"));
    columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(false, IdentityCourseElementCols.lastModified, "select"));
    columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(IdentityCourseElementCols.lastUserModified, "select"));
    columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(false, IdentityCourseElementCols.lastCoachModified, "select"));
    usersTableModel = new AssessedIdentityListTableModel(columnsModel, element);
    usersTableModel.setCertificateMap(new ConcurrentHashMap<>());
    tableEl = uifactory.addTableElement(getWindowControl(), "table", usersTableModel, 20, false, getTranslator(), formLayout);
    tableEl.setExportEnabled(true);
    tableEl.setSearchEnabled(new AssessedIdentityListProvider(getIdentity(), testEntry, testEntry, null, assessmentCallback), ureq.getUserSession());
    List<FlexiTableFilter> filters = new ArrayList<>();
    filters.add(new FlexiTableFilter(translate("filter.passed"), "passed"));
    filters.add(new FlexiTableFilter(translate("filter.failed"), "failed"));
    filters.add(new FlexiTableFilter(translate("filter.inProgress"), "inProgress"));
    filters.add(new FlexiTableFilter(translate("filter.inReview"), "inReview"));
    filters.add(new FlexiTableFilter(translate("filter.done"), "done"));
    tableEl.setFilters("", filters, false);
    if (assessmentCallback.canAssessBusinessGoupMembers()) {
        List<BusinessGroup> coachedGroups;
        if (assessmentCallback.isAdmin()) {
            SearchBusinessGroupParams params = new SearchBusinessGroupParams();
            coachedGroups = businessGroupService.findBusinessGroups(params, testEntry, 0, -1);
        } else {
            coachedGroups = assessmentCallback.getCoachedGroups();
        }
        if (coachedGroups.size() > 0) {
            List<FlexiTableFilter> groupFilters = new ArrayList<>();
            for (BusinessGroup coachedGroup : coachedGroups) {
                String groupName = StringHelper.escapeHtml(coachedGroup.getName());
                groupFilters.add(new FlexiTableFilter(groupName, coachedGroup.getKey().toString(), "o_icon o_icon_group"));
            }
            tableEl.setExtendedFilterButton(translate("filter.groups"), groupFilters);
        }
    }
}
Also used : BusinessGroup(org.olat.group.BusinessGroup) AssessedIdentityListProvider(org.olat.course.assessment.ui.tool.AssessedIdentityListProvider) ArrayList(java.util.ArrayList) FormLayoutContainer(org.olat.core.gui.components.form.flexible.impl.FormLayoutContainer) SearchBusinessGroupParams(org.olat.group.model.SearchBusinessGroupParams) AssessmentStatusCellRenderer(org.olat.course.assessment.ui.tool.AssessmentStatusCellRenderer) FlexiTableFilter(org.olat.core.gui.components.form.flexible.elements.FlexiTableFilter) FlexiTableColumnModel(org.olat.core.gui.components.form.flexible.impl.elements.table.FlexiTableColumnModel) RepositoryHandler(org.olat.repository.handlers.RepositoryHandler) PassedCellRenderer(org.olat.course.assessment.bulk.PassedCellRenderer) DefaultFlexiColumnModel(org.olat.core.gui.components.form.flexible.impl.elements.table.DefaultFlexiColumnModel) UserPropertyHandler(org.olat.user.propertyhandlers.UserPropertyHandler)

Aggregations

ArrayList (java.util.ArrayList)2 FlexiTableFilter (org.olat.core.gui.components.form.flexible.elements.FlexiTableFilter)2 FormLayoutContainer (org.olat.core.gui.components.form.flexible.impl.FormLayoutContainer)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 PassedCellRenderer (org.olat.course.assessment.bulk.PassedCellRenderer)2 AssessedIdentityListProvider (org.olat.course.assessment.ui.tool.AssessedIdentityListProvider)2 AssessmentStatusCellRenderer (org.olat.course.assessment.ui.tool.AssessmentStatusCellRenderer)2 BusinessGroup (org.olat.group.BusinessGroup)2 SearchBusinessGroupParams (org.olat.group.model.SearchBusinessGroupParams)2 RepositoryHandler (org.olat.repository.handlers.RepositoryHandler)2 UserPropertyHandler (org.olat.user.propertyhandlers.UserPropertyHandler)2