protected void init() { graderIdToNameMap = new HashMap(); defaultSearchString = getLocalizedString("search_default_student_search_string"); if (searchString == null) { searchString = defaultSearchString; } // Section filtering. availableSections = getViewableSections(); sectionFilterSelectItems = new ArrayList(); // The first choice is always "All available enrollments" sectionFilterSelectItems.add( new SelectItem( new Integer(ALL_SECTIONS_SELECT_VALUE), FacesUtil.getLocalizedString("search_sections_all"))); // TODO If there are unassigned students and the current user is allowed to see them, add them // next. // Add the available sections. for (int i = 0; i < availableSections.size(); i++) { CourseSection section = (CourseSection) availableSections.get(i); sectionFilterSelectItems.add(new SelectItem(new Integer(i), section.getTitle())); } // If the selected value now falls out of legal range due to sections // being deleted, throw it back to the default value (meaning everyone). int selectedSectionVal = selectedSectionFilterValue.intValue(); if ((selectedSectionVal >= 0) && (selectedSectionVal >= availableSections.size())) { if (log.isInfoEnabled()) log.info( "selectedSectionFilterValue=" + selectedSectionFilterValue.intValue() + " but available sections=" + availableSections.size()); selectedSectionFilterValue = new Integer(ALL_SECTIONS_SELECT_VALUE); } // Category filtering availableCategories = getViewableCategories(); categoryFilterSelectItems = new ArrayList(); // The first choice is always "All Categories" categoryFilterSelectItems.add( new SelectItem( new Integer(ALL_CATEGORIES_SELECT_VALUE), FacesUtil.getLocalizedString("search_categories_all"))); // Add available categories for (int i = 0; i < availableCategories.size(); i++) { Category cat = (Category) availableCategories.get(i); categoryFilterSelectItems.add( new SelectItem(new Integer(cat.getId().intValue()), cat.getName())); } // If the selected value now falls out of legal range due to categories // being deleted, throw it back to the default value (meaning all categories) int selectedCategoryVal = selectedCategoryFilterValue.intValue(); }
/** @inheritDoc */ public String getSectionName(final String sectionUuid) { CourseSection section = getSection(sectionUuid); return section.getTitle(); }