use of org.olat.modules.lecture.LectureBlockRollCall in project openolat by klemens.
the class LecturesBlockPDFExport method getRows.
private Row[] getRows(List<Identity> rows, List<LectureBlockRollCall> rollCalls) {
int numOfRows = rows.size();
Map<Identity, LectureBlockRollCall> rollCallMap = new HashMap<>();
for (LectureBlockRollCall rollCall : rollCalls) {
rollCallMap.put(rollCall.getIdentity(), rollCall);
}
Row[] content = new Row[numOfRows];
for (int i = 0; i < numOfRows; i++) {
Identity row = rows.get(i);
String fullname = getName(row);
String comment = null;
boolean authorised = false;
boolean[] absences = new boolean[numOfLectures];
Arrays.fill(absences, false);
LectureBlockRollCall rollCall = rollCallMap.get(rows.get(i));
if (rollCall != null) {
if (rollCall.getLecturesAbsentList() != null) {
List<Integer> absenceList = rollCall.getLecturesAbsentList();
for (int j = 0; j < numOfLectures; j++) {
absences[j] = absenceList.contains(new Integer(j));
}
}
if (rollCall.getAbsenceAuthorized() != null) {
authorised = rollCall.getAbsenceAuthorized().booleanValue();
}
if (StringHelper.containsNonWhitespace(rollCall.getComment())) {
comment = rollCall.getComment();
}
}
content[i] = new Row(fullname, absences, authorised, comment);
}
return content;
}
use of org.olat.modules.lecture.LectureBlockRollCall in project openolat by klemens.
the class ParticipantLectureBlocksController method doAppealAudit.
private void doAppealAudit(LectureBlockAndRollCall row, String message) {
logAudit("Appeal send for lecture block: " + row.getLectureBlockTitle() + " (" + row.getLectureBlockRef().getKey() + ")", null);
LectureBlock lectureBlock = lectureService.getLectureBlock(row.getLectureBlockRef());
LectureBlockRollCall rollCall = lectureService.getRollCall(row.getRollCallRef());
lectureService.auditLog(Action.sendAppeal, null, null, message, lectureBlock, rollCall, entry, assessedIdentity, null);
dbInstance.commit();
loadModel();
tableEl.reset(false, false, true);
}
use of org.olat.modules.lecture.LectureBlockRollCall in project openolat by klemens.
the class LectureBlockRollCallWebService method getRollCalls.
/**
* Return a list lecture block roll call.
*
* @response.representation.200.qname {http://www.example.com}lectureBlockRollCallVO
* @response.representation.200.mediaType application/xml, application/json
* @response.representation.200.doc A lecture block roll call
* @response.representation.200.example {@link org.olat.modules.lecture.restapi.Examples#SAMPLE_LECTUREBLOCKROLLCALLVO}
* @response.representation.401.doc The roles of the authenticated user are not sufficient
* @param closed If true, the status of the block is done or the status of the roll call is closed or auto closed
* @param hasAbsence If true, the roll call has an absence
* @param hasSupervisorNotificationDate If true, the roll call has a supervisor notification date set
* @param httpRequest The HTTP request
* @return The roll calls
*/
@GET
@Path("/")
@Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
public Response getRollCalls(@QueryParam("closed") Boolean closed, @QueryParam("hasAbsence") Boolean hasAbsence, @QueryParam("hasSupervisorNotificationDate") Boolean hasSupervisorNotificationDate, @QueryParam("lectureBlockKey") Long lectureBlockKey, @Context HttpServletRequest httpRequest) {
Roles roles = getRoles(httpRequest);
if (!roles.isOLATAdmin()) {
return Response.serverError().status(Status.UNAUTHORIZED).build();
}
LectureService lectureService = CoreSpringFactory.getImpl(LectureService.class);
LectureBlockRollCallSearchParameters searchParams = new LectureBlockRollCallSearchParameters();
if (hasAbsence != null) {
searchParams.setHasAbsence(hasAbsence);
}
if (hasSupervisorNotificationDate != null) {
searchParams.setHasSupervisorNotificationDate(hasSupervisorNotificationDate);
}
if (closed != null) {
searchParams.setClosed(closed);
}
if (lectureBlockKey != null) {
searchParams.setLectureBlockKey(lectureBlockKey);
}
List<LectureBlockRollCall> rollCalls = lectureService.getRollCalls(searchParams);
List<LectureBlockRollCallVO> voList = new ArrayList<>(rollCalls.size());
for (LectureBlockRollCall rollCall : rollCalls) {
voList.add(new LectureBlockRollCallVO(rollCall));
}
LectureBlockRollCallVO[] voes = voList.toArray(new LectureBlockRollCallVO[voList.size()]);
return Response.ok(voes).build();
}
use of org.olat.modules.lecture.LectureBlockRollCall in project openolat by klemens.
the class LectureBlockRollCallWebService method getRollCall.
/**
* Return the lecture block roll call specified by the primary key.
*
* @response.representation.200.qname {http://www.example.com}lectureBlockRollCallVO
* @response.representation.200.mediaType application/xml, application/json
* @response.representation.200.doc A lecture block roll call
* @response.representation.200.example {@link org.olat.modules.lecture.restapi.Examples#SAMPLE_LECTUREBLOCKROLLCALLVO}
* @response.representation.401.doc The roles of the authenticated user are not sufficient
* @response.representation.404.doc The role call was not found
* @param rollCallKey The primary key of the roll call
* @param httpRequest The HTTP request
* @return The roll call
*/
@GET
@Path("{rollCallKey}")
@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
public Response getRollCall(@PathParam("rollCallKey") Long rollCallKey, @Context HttpServletRequest httpRequest) {
Roles roles = getRoles(httpRequest);
if (!roles.isOLATAdmin()) {
return Response.serverError().status(Status.UNAUTHORIZED).build();
}
LectureService lectureService = CoreSpringFactory.getImpl(LectureService.class);
LectureBlockRollCallSearchParameters searchParams = new LectureBlockRollCallSearchParameters();
searchParams.setRollCallKey(rollCallKey);
List<LectureBlockRollCall> rollCalls = lectureService.getRollCalls(searchParams);
if (rollCalls.size() == 1) {
LectureBlockRollCall rollCall = rollCalls.get(0);
LectureBlockRollCallVO vo = new LectureBlockRollCallVO(rollCall);
return Response.ok(vo).build();
}
return Response.serverError().status(Status.NOT_FOUND).build();
}
Aggregations