Search in sources :

Example 36 with FlexiTableFilter

use of org.olat.core.gui.components.form.flexible.elements.FlexiTableFilter in project OpenOLAT by OpenOLAT.

the class FlexiTableElementImpl method setSelectedFilterKey.

@Override
public void setSelectedFilterKey(String key) {
    if (filters != null) {
        for (FlexiTableFilter filter : filters) {
            boolean selected = (key == null && filter.getFilter() == null) || (key != null && key.equals(filter.getFilter()));
            filter.setSelected(selected);
        }
    }
}
Also used : FlexiTableFilter(org.olat.core.gui.components.form.flexible.elements.FlexiTableFilter)

Example 37 with FlexiTableFilter

use of org.olat.core.gui.components.form.flexible.elements.FlexiTableFilter in project OpenOLAT by OpenOLAT.

the class IdentityAssessmentOverviewController method initForm.

@Override
protected void initForm(FormItemContainer formLayout, Controller listener, UserRequest ureq) {
    FlexiTableColumnModel columnsModel = FlexiTableDataModelFactory.createFlexiTableColumnModel();
    columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(NodeCols.node, new IndentedNodeRenderer() {

        @Override
        public boolean isIndentationEnabled() {
            return tableEl.getOrderBy() == null || tableEl.getOrderBy().length == 0;
        }
    }));
    columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(NodeCols.attempts));
    if (!followUserResultsVisibility) {
        columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(NodeCols.userVisibility, new UserVisibilityCellRenderer(getTranslator())));
    }
    columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(NodeCols.score, new ScoreCellRenderer()));
    columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(NodeCols.min, new ScoreCellRenderer()));
    columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(NodeCols.max, new ScoreCellRenderer()));
    columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(NodeCols.passed, new PassedCellRenderer()));
    columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(NodeCols.numOfAssessmentDocs));
    columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(NodeCols.status, new AssessmentStatusCellRenderer(getLocale())));
    columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(false, NodeCols.lastModified));
    columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(NodeCols.lastUserModified));
    columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(false, NodeCols.lastCoachModified));
    if (nodesSelectable) {
        DefaultFlexiColumnModel selectCol = new DefaultFlexiColumnModel("select", NodeCols.select.ordinal(), CMD_SELECT_NODE, new BooleanCellRenderer(new StaticFlexiCellRenderer(translate("select"), CMD_SELECT_NODE), null));
        selectCol.setExportable(false);
        columnsModel.addFlexiColumnModel(selectCol);
    }
    tableModel = new IdentityAssessmentOverviewTableModel(columnsModel);
    tableEl = uifactory.addTableElement(getWindowControl(), "table", tableModel, 250, false, getTranslator(), formLayout);
    tableEl.setExportEnabled(true);
    tableEl.setEmtpyTableMessageKey("nodesoverview.emptylist");
    tableEl.setBordered(true);
    tableEl.setNumOfRowsEnabled(false);
    if (allowTableFiltering) {
        List<FlexiTableFilter> filters = new ArrayList<>();
        filters.add(new FlexiTableFilter(translate("filter.showAll"), "showAll", true));
        filters.add(FlexiTableFilter.SPACER);
        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);
    }
}
Also used : ArrayList(java.util.ArrayList) IndentedNodeRenderer(org.olat.course.assessment.IndentedNodeRenderer) StaticFlexiCellRenderer(org.olat.core.gui.components.form.flexible.impl.elements.table.StaticFlexiCellRenderer) ScoreCellRenderer(org.olat.modules.assessment.ui.ScoreCellRenderer) 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) PassedCellRenderer(org.olat.course.assessment.bulk.PassedCellRenderer) DefaultFlexiColumnModel(org.olat.core.gui.components.form.flexible.impl.elements.table.DefaultFlexiColumnModel)

Example 38 with FlexiTableFilter

use of org.olat.core.gui.components.form.flexible.elements.FlexiTableFilter in project OpenOLAT by OpenOLAT.

the class IdentityListCourseNodeController method activate.

@Override
public void activate(UserRequest ureq, List<ContextEntry> entries, StateEntry state) {
    String filter = null;
    List<FlexiTableFilter> extendedFilters = null;
    if (state instanceof AssessedIdentityListState) {
        AssessedIdentityListState listState = (AssessedIdentityListState) state;
        if (StringHelper.containsNonWhitespace(listState.getFilter())) {
            filter = listState.getFilter();
        }
        extendedFilters = listState.getExtendedFilters();
    }
    tableEl.setSelectedFilterKey(filter);
    if (extendedFilters != null) {
        tableEl.setSelectedExtendedFilters(extendedFilters);
    }
    loadModel(ureq);
    if (entries != null && entries.size() > 0) {
        ContextEntry entry = entries.get(0);
        String resourceType = entry.getOLATResourceable().getResourceableTypeName();
        if ("Identity".equals(resourceType)) {
            Long identityKey = entries.get(0).getOLATResourceable().getResourceableId();
            for (int i = usersTableModel.getRowCount(); i-- > 0; ) {
                AssessedIdentityElementRow row = usersTableModel.getObject(i);
                if (row.getIdentityKey().equals(identityKey)) {
                    Controller ctrl = doSelect(ureq, row);
                    if (ctrl instanceof Activateable2) {
                        List<ContextEntry> subEntries = entries.subList(1, entries.size());
                        ((Activateable2) ctrl).activate(ureq, subEntries, entry.getTransientState());
                    }
                }
            }
        }
    }
}
Also used : Activateable2(org.olat.core.gui.control.generic.dtabs.Activateable2) AssessedIdentityElementRow(org.olat.modules.assessment.ui.AssessedIdentityElementRow) FlexiTableFilter(org.olat.core.gui.components.form.flexible.elements.FlexiTableFilter) AssessedIdentityListState(org.olat.modules.assessment.ui.AssessedIdentityListState) CloseableModalController(org.olat.core.gui.control.generic.closablewrapper.CloseableModalController) AssessedIdentityController(org.olat.modules.assessment.ui.AssessedIdentityController) CloseableCalloutWindowController(org.olat.core.gui.control.generic.closablewrapper.CloseableCalloutWindowController) FormBasicController(org.olat.core.gui.components.form.flexible.impl.FormBasicController) Controller(org.olat.core.gui.control.Controller) ContextEntry(org.olat.core.id.context.ContextEntry)

Example 39 with FlexiTableFilter

use of org.olat.core.gui.components.form.flexible.elements.FlexiTableFilter in project OpenOLAT by OpenOLAT.

the class IdentityListCourseNodeController method getSearchParameters.

protected SearchAssessedIdentityParams getSearchParameters() {
    SearchAssessedIdentityParams params = new SearchAssessedIdentityParams(courseEntry, courseNode.getIdent(), referenceEntry, assessmentCallback);
    List<FlexiTableFilter> filters = tableEl.getSelectedFilters();
    List<FlexiTableFilter> extendedFilters = tableEl.getSelectedExtendedFilters();
    List<AssessmentEntryStatus> assessmentStatus = null;
    if (filters != null && filters.size() > 0) {
        assessmentStatus = new ArrayList<>(filters.size());
        for (FlexiTableFilter filter : filters) {
            if ("passed".equals(filter.getFilter())) {
                params.setPassed(true);
            } else if ("failed".equals(filter.getFilter())) {
                params.setFailed(true);
            } else if (AssessmentEntryStatus.isValueOf(filter.getFilter())) {
                assessmentStatus.add(AssessmentEntryStatus.valueOf(filter.getFilter()));
            }
        }
    }
    params.setAssessmentStatus(assessmentStatus);
    List<Long> businessGroupKeys = null;
    if (group != null) {
        businessGroupKeys = Collections.singletonList(group.getKey());
    } else if (extendedFilters != null && extendedFilters.size() > 0) {
        businessGroupKeys = new ArrayList<>(extendedFilters.size());
        for (FlexiTableFilter extendedFilter : extendedFilters) {
            if (StringHelper.isLong(extendedFilter.getFilter())) {
                businessGroupKeys.add(Long.parseLong(extendedFilter.getFilter()));
            }
        }
    }
    params.setBusinessGroupKeys(businessGroupKeys);
    params.setSearchString(tableEl.getQuickSearchString());
    return params;
}
Also used : SearchAssessedIdentityParams(org.olat.course.assessment.model.SearchAssessedIdentityParams) FlexiTableFilter(org.olat.core.gui.components.form.flexible.elements.FlexiTableFilter) ArrayList(java.util.ArrayList) AssessmentEntryStatus(org.olat.modules.assessment.model.AssessmentEntryStatus)

Example 40 with FlexiTableFilter

use of org.olat.core.gui.components.form.flexible.elements.FlexiTableFilter in project OpenOLAT by OpenOLAT.

the class IdentityListCourseNodeController method initForm.

@Override
protected void initForm(FormItemContainer formLayout, Controller listener, UserRequest ureq) {
    if (formLayout instanceof FormLayoutContainer) {
        FormLayoutContainer layoutCont = (FormLayoutContainer) formLayout;
        layoutCont.contextPut("courseNodeTitle", courseNode.getShortTitle());
        layoutCont.contextPut("courseNodeCssClass", CourseNodeFactory.getInstance().getCourseNodeConfigurationEvenForDisabledBB(courseNode.getType()).getIconCSSClass());
        if (group != null) {
            layoutCont.contextPut("businessGroupName", group.getName());
        }
    }
    ICourse course = CourseFactory.loadCourse(courseEntry);
    String select = isSelectable() ? "select" : null;
    // add the table
    FlexiTableSortOptions options = new FlexiTableSortOptions();
    FlexiTableColumnModel columnsModel = FlexiTableDataModelFactory.createFlexiTableColumnModel();
    if (isAdministrativeUser) {
        options.setDefaultOrderBy(new SortKey(IdentityCourseElementCols.username.sortKey(), true));
        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));
        if (!options.hasDefaultOrderBy()) {
            options.setDefaultOrderBy(new SortKey("userProp-" + colIndex, true));
        }
        colIndex++;
    }
    initAssessmentColumns(columnsModel);
    initStatusColumns(columnsModel);
    initModificationDatesColumns(columnsModel);
    initCalloutColumns(columnsModel);
    AssessableCourseNode assessableNode = courseNode instanceof AssessableCourseNode ? (AssessableCourseNode) courseNode : null;
    usersTableModel = new IdentityListCourseNodeTableModel(columnsModel, assessableNode, getLocale());
    tableEl = uifactory.addTableElement(getWindowControl(), "table", usersTableModel, 20, false, getTranslator(), formLayout);
    tableEl.setExportEnabled(true);
    tableEl.setSearchEnabled(new AssessedIdentityListProvider(getIdentity(), courseEntry, referenceEntry, courseNode.getIdent(), assessmentCallback), ureq.getUserSession());
    tableEl.setMultiSelect(!coachCourseEnv.isCourseReadOnly());
    tableEl.setSortSettings(options);
    tableEl.setSelectAllEnable(true);
    List<FlexiTableFilter> filters = new ArrayList<>();
    filters.add(new FlexiTableFilter(translate("filter.showAll"), "showAll", true));
    filters.add(FlexiTableFilter.SPACER);
    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() && group == null) {
        List<BusinessGroup> coachedGroups = null;
        if (assessmentCallback.isAdmin()) {
            coachedGroups = course.getCourseEnvironment().getCourseGroupManager().getAllBusinessGroups();
        } 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);
        }
    }
    tableEl.setAndLoadPersistedPreferences(ureq, getTableId());
}
Also used : FlexiTableSortOptions(org.olat.core.gui.components.form.flexible.elements.FlexiTableSortOptions) BusinessGroup(org.olat.group.BusinessGroup) ArrayList(java.util.ArrayList) FormLayoutContainer(org.olat.core.gui.components.form.flexible.impl.FormLayoutContainer) ICourse(org.olat.course.ICourse) SortKey(org.olat.core.commons.persistence.SortKey) CalculatedAssessableCourseNode(org.olat.course.nodes.CalculatedAssessableCourseNode) AssessableCourseNode(org.olat.course.nodes.AssessableCourseNode) FlexiTableFilter(org.olat.core.gui.components.form.flexible.elements.FlexiTableFilter) FlexiTableColumnModel(org.olat.core.gui.components.form.flexible.impl.elements.table.FlexiTableColumnModel) DefaultFlexiColumnModel(org.olat.core.gui.components.form.flexible.impl.elements.table.DefaultFlexiColumnModel) UserPropertyHandler(org.olat.user.propertyhandlers.UserPropertyHandler)

Aggregations

FlexiTableFilter (org.olat.core.gui.components.form.flexible.elements.FlexiTableFilter)52 ArrayList (java.util.ArrayList)40 DefaultFlexiColumnModel (org.olat.core.gui.components.form.flexible.impl.elements.table.DefaultFlexiColumnModel)24 FlexiTableColumnModel (org.olat.core.gui.components.form.flexible.impl.elements.table.FlexiTableColumnModel)24 FormLayoutContainer (org.olat.core.gui.components.form.flexible.impl.FormLayoutContainer)18 UserPropertyHandler (org.olat.user.propertyhandlers.UserPropertyHandler)16 SortKey (org.olat.core.commons.persistence.SortKey)14 FlexiTableSortOptions (org.olat.core.gui.components.form.flexible.elements.FlexiTableSortOptions)12 StaticFlexiCellRenderer (org.olat.core.gui.components.form.flexible.impl.elements.table.StaticFlexiCellRenderer)10 BusinessGroup (org.olat.group.BusinessGroup)10 PassedCellRenderer (org.olat.course.assessment.bulk.PassedCellRenderer)8 Component (org.olat.core.gui.components.Component)6 FormLink (org.olat.core.gui.components.form.flexible.elements.FormLink)6 FormBasicController (org.olat.core.gui.components.form.flexible.impl.FormBasicController)6 BooleanCellRenderer (org.olat.core.gui.components.form.flexible.impl.elements.table.BooleanCellRenderer)6 Controller (org.olat.core.gui.control.Controller)6 Activateable2 (org.olat.core.gui.control.generic.dtabs.Activateable2)6 SearchAssessedIdentityParams (org.olat.course.assessment.model.SearchAssessedIdentityParams)6 AssessmentEntryStatus (org.olat.modules.assessment.model.AssessmentEntryStatus)6 Collections (java.util.Collections)4