Skip to content
Snippets Groups Projects
Commit dae92084 authored by srosse's avatar srosse
Browse files

OO-4542: check daily recording of absences option in cockpit

parent a1864316
No related branches found
No related tags found
No related merge requests found
...@@ -105,6 +105,7 @@ public class DailyLectureBlockOverviewController extends FormBasicController { ...@@ -105,6 +105,7 @@ public class DailyLectureBlockOverviewController extends FormBasicController {
private final Formatter formatter; private final Formatter formatter;
private final boolean isAdministrativeUser; private final boolean isAdministrativeUser;
private final boolean authorizedAbsenceEnabled; private final boolean authorizedAbsenceEnabled;
private final boolean dailyRecordingEnabled;
private final Identity profiledIdentity; private final Identity profiledIdentity;
private final LecturesSecurityCallback secCallback; private final LecturesSecurityCallback secCallback;
private final RollCallSecurityCallback rollCallSecCallback; private final RollCallSecurityCallback rollCallSecCallback;
...@@ -134,6 +135,7 @@ public class DailyLectureBlockOverviewController extends FormBasicController { ...@@ -134,6 +135,7 @@ public class DailyLectureBlockOverviewController extends FormBasicController {
Roles roles = ureq.getUserSession().getRoles(); Roles roles = ureq.getUserSession().getRoles();
isAdministrativeUser = securityModule.isUserAllowedAdminProps(roles); isAdministrativeUser = securityModule.isUserAllowedAdminProps(roles);
authorizedAbsenceEnabled = lectureModule.isAuthorizedAbsenceEnabled(); authorizedAbsenceEnabled = lectureModule.isAuthorizedAbsenceEnabled();
dailyRecordingEnabled = lectureModule.getDailyRollCall() == DailyRollCall.daily;
initForm(ureq); initForm(ureq);
loadModel(); loadModel();
...@@ -187,7 +189,7 @@ public class DailyLectureBlockOverviewController extends FormBasicController { ...@@ -187,7 +189,7 @@ public class DailyLectureBlockOverviewController extends FormBasicController {
toolsCol.setSortable(false); toolsCol.setSortable(false);
columnsModel.addFlexiColumnModel(toolsCol); columnsModel.addFlexiColumnModel(toolsCol);
tableModel = new DailyLectureBlockTableModel(columnsModel, getLocale()); tableModel = new DailyLectureBlockTableModel(columnsModel, getLocale(), dailyRecordingEnabled);
tableEl = uifactory.addTableElement(getWindowControl(), "table", tableModel, 20, false, getTranslator(), formLayout); tableEl = uifactory.addTableElement(getWindowControl(), "table", tableModel, 20, false, getTranslator(), formLayout);
FlexiTableSortOptions sortOptions = new FlexiTableSortOptions(); FlexiTableSortOptions sortOptions = new FlexiTableSortOptions();
sortOptions.setDefaultOrderBy(new SortKey(BlockCols.times.name(), true)); sortOptions.setDefaultOrderBy(new SortKey(BlockCols.times.name(), true));
......
...@@ -46,10 +46,12 @@ public class DailyLectureBlockTableModel extends DefaultFlexiTreeTableDataModel< ...@@ -46,10 +46,12 @@ public class DailyLectureBlockTableModel extends DefaultFlexiTreeTableDataModel<
implements SortableFlexiTableDataModel<DailyLectureBlockRow> { implements SortableFlexiTableDataModel<DailyLectureBlockRow> {
private final Locale locale; private final Locale locale;
private final boolean dailyRecordingEnabled;
public DailyLectureBlockTableModel(FlexiTableColumnModel columnModel, Locale locale) { public DailyLectureBlockTableModel(FlexiTableColumnModel columnModel, Locale locale, boolean dailyRecordingEnabled) {
super(columnModel); super(columnModel);
this.locale = locale; this.locale = locale;
this.dailyRecordingEnabled = dailyRecordingEnabled;
} }
@Override @Override
...@@ -114,7 +116,7 @@ implements SortableFlexiTableDataModel<DailyLectureBlockRow> { ...@@ -114,7 +116,7 @@ implements SortableFlexiTableDataModel<DailyLectureBlockRow> {
switch(BlockCols.values()[col]) { switch(BlockCols.values()[col]) {
case times: return row.getLectureBlock(); case times: return row.getLectureBlock();
case tools: return row.getTools(); case tools: return row.getTools();
case details: return Boolean.TRUE; case details: return Boolean.valueOf(dailyRecordingEnabled);
default: return null; default: return null;
} }
} }
...@@ -130,20 +132,22 @@ implements SortableFlexiTableDataModel<DailyLectureBlockRow> { ...@@ -130,20 +132,22 @@ implements SortableFlexiTableDataModel<DailyLectureBlockRow> {
case numOfAbsences: return row.getNumOfAbsences(); case numOfAbsences: return row.getNumOfAbsences();
case warnings: case warnings:
case alerts: return row.getLectureBlockBlockStatistics(); case alerts: return row.getLectureBlockBlockStatistics();
case details: { case details: return allowDetails(row);
Date end = row.getLectureBlock().getEndDate();
Date start = row.getLectureBlock().getStartDate();
Date now = new Date();
return end.before(new Date()) || (row.isIamTeacher() && start.compareTo(now) <= 0);
}
case tools: return row.getTools(); case tools: return row.getTools();
default: return "ERROR"; default: return "ERROR";
} }
} }
private boolean allowDetails(DailyLectureBlockRow row) {
Date end = row.getLectureBlock().getEndDate();
Date start = row.getLectureBlock().getStartDate();
Date now = new Date();
return end.before(new Date()) || (row.isIamTeacher() && start.compareTo(now) <= 0);
}
@Override @Override
public DefaultFlexiTableDataModel<DailyLectureBlockRow> createCopyWithEmptyList() { public DefaultFlexiTableDataModel<DailyLectureBlockRow> createCopyWithEmptyList() {
return new DailyLectureBlockTableModel(getTableColumnModel(), locale); return new DailyLectureBlockTableModel(getTableColumnModel(), locale, dailyRecordingEnabled);
} }
public enum BlockCols implements FlexiSortableColumnDef { public enum BlockCols implements FlexiSortableColumnDef {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment