use of org.olat.user.propertyhandlers.UserPropertyHandler in project OpenOLAT by OpenOLAT.
the class StudentCoursesController method initForm.
@Override
protected void initForm(FormItemContainer formLayout, Controller listener, UserRequest ureq) {
if (formLayout instanceof FormLayoutContainer) {
FormLayoutContainer layoutCont = (FormLayoutContainer) formLayout;
String fullName = userManager.getUserDisplayName(student);
layoutCont.contextPut("studentName", StringHelper.escapeHtml(fullName));
}
// add the table
FlexiTableColumnModel columnsModel = FlexiTableDataModelFactory.createFlexiTableColumnModel();
if (isAdministrativeUser) {
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(false, Columns.name, "select"));
}
int colIndex = UserListController.USER_PROPS_OFFSET;
for (int i = 0; i < userPropertyHandlers.size(); i++) {
UserPropertyHandler userPropertyHandler = userPropertyHandlers.get(i);
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(false, userPropertyHandler.i18nColumnDescriptorLabelKey(), colIndex++, "select", true, userPropertyHandler.i18nColumnDescriptorLabelKey()));
}
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(Columns.repoName, "select"));
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(Columns.passed, new PassedCellRenderer()));
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(Columns.score, new ScoreCellRenderer()));
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(Columns.certificate, new DownloadCertificateCellRenderer(getLocale())));
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(Columns.recertification, new DateFlexiCellRenderer(getLocale())));
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(Columns.progress, new ProgressRenderer(true, getTranslator())));
if (lectureModule.isEnabled()) {
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(Columns.plannedLectures));
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(Columns.attendedLectures));
if (lectureModule.isAuthorizedAbsenceEnabled()) {
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(Columns.unauthorizedAbsenceLectures));
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(Columns.authorizedAbsenceLectures));
} else {
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(Columns.absentLectures));
}
}
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, "fStudentCourseListController");
}
use of org.olat.user.propertyhandlers.UserPropertyHandler in project OpenOLAT by OpenOLAT.
the class ParticipantListRepositoryController method initForm.
@Override
protected void initForm(FormItemContainer formLayout, Controller listener, UserRequest ureq) {
if (formLayout instanceof FormLayoutContainer && !printView) {
FormLayoutContainer layoutCont = (FormLayoutContainer) formLayout;
layoutCont.contextPut("winid", "w" + layoutCont.getFormItemComponent().getDispatchID());
layoutCont.getFormItemComponent().addListener(this);
layoutCont.getFormItemComponent().contextPut("withPrint", Boolean.TRUE);
}
FlexiTableSortOptions options = new FlexiTableSortOptions();
FlexiTableColumnModel columnsModel = FlexiTableDataModelFactory.createFlexiTableColumnModel();
if (isAdministrativeUser) {
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(ParticipantsCols.username));
options.setDefaultOrderBy(new SortKey(ParticipantsCols.username.sortKey(), true));
}
int colPos = USER_PROPS_OFFSET;
for (UserPropertyHandler userPropertyHandler : userPropertyHandlers) {
if (userPropertyHandler == null)
continue;
String propName = userPropertyHandler.getName();
boolean visible = userManager.isMandatoryUserProperty(USER_PROPS_ID, userPropertyHandler);
FlexiColumnModel col = new DefaultFlexiColumnModel(visible, userPropertyHandler.i18nColumnDescriptorLabelKey(), colPos, true, propName);
columnsModel.addFlexiColumnModel(col);
colPos++;
if (!options.hasDefaultOrderBy()) {
options.setDefaultOrderBy(new SortKey(propName, true));
} else if (UserConstants.LASTNAME.equals(propName)) {
options.setDefaultOrderBy(new SortKey(propName, true));
}
}
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(ParticipantsCols.plannedLectures));
if (rollCallEnabled) {
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(ParticipantsCols.attendedLectures));
if (authorizedAbsenceEnabled) {
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(ParticipantsCols.unauthorizedAbsenceLectures));
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(ParticipantsCols.authorizedAbsenceLectures));
} else {
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(ParticipantsCols.absentLectures, new LongCellRenderer("o_sel_absences")));
}
FlexiColumnModel progressCol = new DefaultFlexiColumnModel(ParticipantsCols.progress, new LectureStatisticsCellRenderer());
progressCol.setExportable(false);
columnsModel.addFlexiColumnModel(progressCol);
}
if (rateEnabled) {
FlexiColumnModel warningCol = new DefaultFlexiColumnModel(ParticipantsCols.rateWarning, new RateWarningCellRenderer(getTranslator()));
warningCol.setExportable(false);
columnsModel.addFlexiColumnModel(warningCol);
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(ParticipantsCols.rate, new PercentCellRenderer()));
}
FlexiColumnModel infoCol = new DefaultFlexiColumnModel(ParticipantsCols.infos, new ParticipantInfosRenderer(getTranslator(), defaultRate));
infoCol.setExportable(false);
columnsModel.addFlexiColumnModel(infoCol);
if (!printView) {
DefaultFlexiColumnModel editColumn = new DefaultFlexiColumnModel("table.header.edit", -1, "edit", new StaticFlexiCellRenderer("", "edit", "o_icon o_icon-lg o_icon_edit", translate("edit"), null));
editColumn.setExportable(false);
editColumn.setAlwaysVisible(true);
columnsModel.addFlexiColumnModel(editColumn);
}
tableModel = new ParticipantListDataModel(columnsModel, getTranslator(), getLocale());
tableEl = uifactory.addTableElement(getWindowControl(), "table", tableModel, 20, false, getTranslator(), formLayout);
tableEl.setExportEnabled(!printView);
tableEl.setEmtpyTableMessageKey("empty.table.participant.list");
tableEl.setSortSettings(options);
tableEl.setAndLoadPersistedPreferences(ureq, "participant-list-repo-entry");
}
use of org.olat.user.propertyhandlers.UserPropertyHandler in project OpenOLAT by OpenOLAT.
the class LecturesSearchController method doSearch.
private void doSearch(UserRequest ureq) {
LectureStatisticsSearchParameters params = searchForm.getSearchParameters();
List<UserPropertyHandler> userPropertyHandlers = searchForm.getUserPropertyHandlers();
List<LectureBlockIdentityStatistics> statistics = lectureService.getLecturesStatistics(params, userPropertyHandlers, getIdentity(), admin);
Set<Long> identities = statistics.stream().map(LectureBlockIdentityStatistics::getIdentityKey).collect(Collectors.toSet());
Controller ctrl;
if (identities.size() <= 1) {
listCtrl = new LecturesListController(ureq, getWindowControl(), statistics, userPropertyHandlers, LecturesSearchFormController.PROPS_IDENTIFIER, true, true);
listenTo(listCtrl);
ctrl = listCtrl;
} else {
multipleUsersCtrl = new LecturesListSegmentController(ureq, getWindowControl(), statistics, userPropertyHandlers, LecturesSearchFormController.PROPS_IDENTIFIER);
listenTo(multipleUsersCtrl);
ctrl = multipleUsersCtrl;
}
stackPanel.popUpToRootController(ureq);
stackPanel.pushController(translate("results"), ctrl);
}
use of org.olat.user.propertyhandlers.UserPropertyHandler in project OpenOLAT by OpenOLAT.
the class LectureBlockExport method addHeaders_3.
private void addHeaders_3(OpenXMLWorksheet exportSheet) {
Row headerRow = exportSheet.newRow();
int pos = 0;
if (isAdministrativeUser) {
headerRow.addCell(pos++, translator.translate("table.header.username"));
}
for (UserPropertyHandler userPropertyHandler : userPropertyHandlers) {
if (userPropertyHandler == null)
continue;
String propName = userPropertyHandler.getName();
headerRow.addCell(pos++, translator.translate("form.name." + propName));
}
for (int i = 0; i < lectureBlock.getPlannedLecturesNumber(); i++) {
headerRow.addCell(pos++, Integer.toString(i + 1));
}
if (authorizedAbsenceEnabled) {
// authorized absence
headerRow.addCell(pos++, translator.translate("table.header.authorized.absence"));
// authorized absence reason
headerRow.addCell(pos++, translator.translate("authorized.absence.reason"));
}
// comment
headerRow.addCell(pos++, translator.translate("table.header.comment"));
}
use of org.olat.user.propertyhandlers.UserPropertyHandler in project OpenOLAT by OpenOLAT.
the class LectureBlockExport method addFooter.
private void addFooter(OpenXMLWorksheet exportSheet) {
exportSheet.newRow();
exportSheet.newRow();
Row footerRow = exportSheet.newRow();
int pos = 0;
if (isAdministrativeUser) {
pos++;
}
for (UserPropertyHandler userPropertyHandler : userPropertyHandlers) {
if (userPropertyHandler == null)
continue;
pos++;
}
footerRow.addCell(pos, translator.translate("export.footer.lectures.hint"));
}
Aggregations