use of org.olat.user.propertyhandlers.UserPropertyHandler in project OpenOLAT by OpenOLAT.
the class QTIExportFormatterCSVType1 method createHeaderRow2Intro.
/**
* Creates header line for all types
*
* @param theType
* @return header line for download
*/
private String createHeaderRow2Intro() {
StringBuilder hr2Intro = new StringBuilder();
// header for personalized download (iqtest)
String sequentialNumber = translator.translate("column.header.seqnum");
hr2Intro.append(sequentialNumber);
hr2Intro.append(sep);
// add configured user properties
if (isAnonymous) {
String num = translator.translate("column.header.number");
hr2Intro.append(num);
hr2Intro.append(sep);
} else {
for (UserPropertyHandler userPropertyHandler : userPropertyHandlers) {
if (userPropertyHandler == null) {
continue;
}
String header = translator.translate(userPropertyHandler.i18nFormElementLabelKey());
hr2Intro.append(header);
hr2Intro.append(sep);
}
// add other user and session information
String homepage = translator.translate("column.header.homepage");
hr2Intro.append(homepage);
hr2Intro.append(sep);
}
String assessPoint = translator.translate("column.header.assesspoints");
hr2Intro.append(assessPoint);
hr2Intro.append(sep);
String passed = translator.translate("column.header.passed");
hr2Intro.append(passed);
hr2Intro.append(sep);
if (!isAnonymous) {
String ipAddress = translator.translate("column.header.ipaddress");
hr2Intro.append(ipAddress);
hr2Intro.append(sep);
String date = translator.translate("column.header.date");
hr2Intro.append(date);
hr2Intro.append(sep);
}
String duration = translator.translate("column.header.duration");
hr2Intro.append(duration);
hr2Intro.append(sep);
return hr2Intro.toString();
}
use of org.olat.user.propertyhandlers.UserPropertyHandler in project OpenOLAT by OpenOLAT.
the class UserListController method initForm.
@Override
protected void initForm(FormItemContainer formLayout, Controller listener, UserRequest ureq) {
// add the table
FlexiTableColumnModel columnsModel = FlexiTableDataModelFactory.createFlexiTableColumnModel();
if (isAdministrativeUser) {
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(Columns.name, "select"));
}
int colIndex = UserListController.USER_PROPS_OFFSET;
for (int i = 0; i < userPropertyHandlers.size(); i++) {
UserPropertyHandler userPropertyHandler = userPropertyHandlers.get(i);
boolean visible = userManager.isMandatoryUserProperty(UserListController.usageIdentifyer, userPropertyHandler);
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(visible, userPropertyHandler.i18nColumnDescriptorLabelKey(), colIndex++, "select", true, userPropertyHandler.i18nColumnDescriptorLabelKey()));
}
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(Columns.countCourse));
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(Columns.initialLaunch, new LightIconRenderer()));
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(Columns.countPassed, new ProgressRenderer(false, getTranslator())));
model = new StudentsTableDataModel(columnsModel);
tableEl = uifactory.addTableElement(getWindowControl(), "table", model, 20, false, getTranslator(), formLayout);
tableEl.setExportEnabled(true);
tableEl.setEmtpyTableMessageKey("error.no.found");
UserSession usess = ureq.getUserSession();
boolean autoCompleteAllowed = securityModule.isUserAllowedAutoComplete(usess.getRoles());
if (autoCompleteAllowed) {
tableEl.setSearchEnabled(new StudentListProvider(model, userManager), usess);
}
}
use of org.olat.user.propertyhandlers.UserPropertyHandler in project OpenOLAT by OpenOLAT.
the class UserSearchForm method validate.
private boolean validate() {
boolean atLeastOne = false;
if (login.isVisible()) {
atLeastOne = StringHelper.containsNonWhitespace(login.getValue());
}
for (UserPropertyHandler userPropertyHandler : userPropertyHandlers) {
if (userPropertyHandler != null) {
FormItem ui = propFormItems.get(userPropertyHandler.getName());
String uiValue = userPropertyHandler.getStringValue(ui);
if (StringHelper.containsNonWhitespace(uiValue) && !uiValue.equals("-")) {
atLeastOne = true;
}
}
}
if (!atLeastOne) {
showWarning("error.search.form.notempty");
}
return atLeastOne;
}
use of org.olat.user.propertyhandlers.UserPropertyHandler in project OpenOLAT by OpenOLAT.
the class CourseController method initForm.
@Override
protected void initForm(FormItemContainer formLayout, Controller listener, UserRequest ureq) {
openCourse = uifactory.addFormLink("open.course", formLayout, Link.BUTTON);
openCourse.setIconLeftCSS("o_icon o_CourseModule_icon");
if (formLayout instanceof FormLayoutContainer) {
FormLayoutContainer layoutCont = (FormLayoutContainer) formLayout;
layoutCont.contextPut("courseName", StringHelper.escapeHtml(course.getDisplayname()));
}
// add the table
FlexiTableColumnModel columnsModel = FlexiTableDataModelFactory.createFlexiTableColumnModel();
if (isAdministrativeUser) {
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(Columns.name, "select"));
}
int colIndex = UserListController.USER_PROPS_OFFSET;
for (int i = 0; i < userPropertyHandlers.size(); i++) {
UserPropertyHandler userPropertyHandler = userPropertyHandlers.get(i);
boolean visible = userManager.isMandatoryUserProperty(UserListController.usageIdentifyer, userPropertyHandler);
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(visible, userPropertyHandler.i18nColumnDescriptorLabelKey(), colIndex++, "select", true, userPropertyHandler.i18nColumnDescriptorLabelKey()));
}
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(Columns.repoName));
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(Columns.passed, new PassedCellRenderer()));
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(Columns.score, new ScoreCellRenderer()));
CourseConfig courseConfig = CourseFactory.loadCourse(course).getCourseConfig();
if (courseConfig.isCertificateEnabled()) {
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(Columns.certificate, new DownloadCertificateCellRenderer(getLocale())));
if (courseConfig.isRecertificationEnabled()) {
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(Columns.recertification, new DateFlexiCellRenderer(getLocale())));
}
}
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(false, Columns.lastModification));
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(Columns.lastUserModified));
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(false, Columns.lastCoachModified));
model = new EfficiencyStatementEntryTableDataModel(columnsModel);
tableEl = uifactory.addTableElement(getWindowControl(), "table", model, 20, false, getTranslator(), formLayout);
tableEl.setExportEnabled(true);
tableEl.setEmtpyTableMessageKey("error.no.found");
tableEl.setAndLoadPersistedPreferences(ureq, "fCourseController");
}
use of org.olat.user.propertyhandlers.UserPropertyHandler in project OpenOLAT by OpenOLAT.
the class SharedBindersController method initForm.
@Override
protected void initForm(FormItemContainer formLayout, Controller listener, UserRequest ureq) {
FlexiTableColumnModel columnsModel = FlexiTableDataModelFactory.createFlexiTableColumnModel();
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(false, ShareItemCols.binderKey, "select"));
SortKey defaultSortKey = null;
if (isAdministrativeUser) {
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(ShareItemCols.username));
defaultSortKey = new SortKey(Cols.username.name(), true);
}
// followed by the users fields
int colPos = USER_PROPS_OFFSET;
for (int i = 0; i < userPropertyHandlers.size(); i++) {
UserPropertyHandler userPropertyHandler = userPropertyHandlers.get(i);
String propName = userPropertyHandler.getName();
if (defaultSortKey == null && i == 0) {
defaultSortKey = new SortKey(propName, true);
} else if (UserConstants.LASTNAME.equals(propName) && !isAdministrativeUser) {
defaultSortKey = new SortKey(propName, true);
}
boolean visible = userManager.isMandatoryUserProperty(USER_PROPS_ID, userPropertyHandler);
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(visible, userPropertyHandler.i18nColumnDescriptorLabelKey(), colPos, true, propName));
colPos++;
}
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(ShareItemCols.binderName, "select"));
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(ShareItemCols.courseName, "select"));
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(ShareItemCols.lastModified));
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(ShareItemCols.recentLaunch));
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(ShareItemCols.openSections, "select"));
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(ShareItemCols.selectSections, new SelectSectionsCellRenderer()));
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(ShareItemCols.newlyPublishedPage));
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(false, ShareItemCols.draftPage));
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(false, ShareItemCols.inRevisionPage));
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(false, ShareItemCols.closedPage));
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(ShareItemCols.grading, new AssessmentEntryCellRenderer(getTranslator())));
StaticFlexiCellRenderer selectRenderer = new StaticFlexiCellRenderer(translate("select"), "select");
selectRenderer.setIconRightCSS("o_icon-sw o_icon_start");
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(true, true, "select", -1, "select", false, null, FlexiColumnModel.ALIGNMENT_LEFT, selectRenderer));
StaticFlexiCellRenderer leaveRenderer = new StaticFlexiCellRenderer(translate("leave"), "leave");
leaveRenderer.setIconRightCSS("o_icon-sw o_icon_delete");
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(false, false, "leave", -2, "leave", false, null, FlexiColumnModel.ALIGNMENT_LEFT, leaveRenderer));
model = new SharedBindersDataModel(columnsModel, getLocale());
tableEl = uifactory.addTableElement(getWindowControl(), "table", model, 20, false, getTranslator(), formLayout);
tableEl.setSearchEnabled(true);
tableEl.setCustomizeColumns(true);
tableEl.setElementCssClass("o_binder_shared_items_listing");
tableEl.setEmtpyTableMessageKey("table.sEmptyTable");
tableEl.setPageSize(24);
tableEl.setAndLoadPersistedPreferences(ureq, "shared-items");
FlexiTableSortOptions options = new FlexiTableSortOptions();
if (defaultSortKey != null) {
options.setDefaultOrderBy(defaultSortKey);
}
tableEl.setSortSettings(options);
List<FlexiTableFilter> tableFilters = new ArrayList<>();
tableFilters.add(new FlexiTableFilter(translate("filter.sections.empty"), SharedBindersDataModel.EMPTY_SECTIONS, true));
tableFilters.add(FlexiTableFilter.SPACER);
tableFilters.add(new FlexiTableFilter(translate("filter.show.all"), "all", true));
tableEl.setFilters("Filters", tableFilters, false);
tableEl.setSelectedFilterKey(SharedBindersDataModel.EMPTY_SECTIONS);
}
Aggregations