use of org.olat.modules.lecture.RepositoryEntryLectureConfiguration in project OpenOLAT by OpenOLAT.
the class LectureServiceImpl method getParticipantsLecturesStatistics.
@Override
public List<LectureBlockStatistics> getParticipantsLecturesStatistics(RepositoryEntry entry) {
boolean authorizedAbsenceEnabled = lectureModule.isAuthorizedAbsenceEnabled();
boolean calculateAttendanceRate = lectureModule.isRollCallCalculateAttendanceRateDefaultEnabled();
boolean absenceDefaultAuthorized = lectureModule.isAbsenceDefaultAuthorized();
boolean countAuthorizedAbsenceAsAttendant = lectureModule.isCountAuthorizedAbsenceAsAttendant();
double defaultRequiredAttendanceRate = lectureModule.getRequiredAttendanceRateDefault();
RepositoryEntryLectureConfiguration config = getRepositoryEntryLectureConfiguration(entry);
return lectureBlockRollCallDao.getStatistics(entry, config, authorizedAbsenceEnabled, absenceDefaultAuthorized, countAuthorizedAbsenceAsAttendant, calculateAttendanceRate, defaultRequiredAttendanceRate);
}
use of org.olat.modules.lecture.RepositoryEntryLectureConfiguration in project OpenOLAT by OpenOLAT.
the class LectureServiceImpl method syncCalendars.
@Override
public void syncCalendars(LectureBlock lectureBlock) {
RepositoryEntryLectureConfiguration config = lectureConfigurationDao.getConfiguration(lectureBlock);
if (ConfigurationHelper.isSyncTeacherCalendarEnabled(config, lectureModule)) {
List<Identity> teachers = getTeachers(lectureBlock);
syncInternalCalendar(lectureBlock, teachers);
} else {
List<Identity> teachers = getTeachers(lectureBlock);
unsyncInternalCalendar(lectureBlock, teachers);
}
if (ConfigurationHelper.isSyncCourseCalendarEnabled(config, lectureModule)) {
syncCourseCalendar(lectureBlock, config.getEntry());
} else {
unsyncCourseCalendar(lectureBlock, config.getEntry());
}
/*if(ConfigurationHelper.isSyncParticipantCalendarEnabled(config, lectureModule)) {
List<Identity> participants = getParticipants(lectureBlock);
syncInternalCalendar(lectureBlock, participants);
} else {
List<Identity> participants = getParticipants(lectureBlock);
unsyncInternalCalendar(lectureBlock, participants);
}*/
}
use of org.olat.modules.lecture.RepositoryEntryLectureConfiguration in project OpenOLAT by OpenOLAT.
the class LectureServiceImpl method getRepositoryEntryLectureConfiguration.
@Override
public RepositoryEntryLectureConfiguration getRepositoryEntryLectureConfiguration(RepositoryEntry entry) {
RepositoryEntryLectureConfiguration config = lectureConfigurationDao.getConfiguration(entry);
if (config == null) {
RepositoryEntry reloadedEntry = repositoryEntryDao.loadForUpdate(entry);
config = lectureConfigurationDao.getConfiguration(entry);
if (config == null) {
config = lectureConfigurationDao.createConfiguration(reloadedEntry);
}
dbInstance.commit();
}
return config;
}
use of org.olat.modules.lecture.RepositoryEntryLectureConfiguration in project OpenOLAT by OpenOLAT.
the class LectureBlocksWebService method getConfiguration.
/**
* Return the configuration of the specified course or repository entry.
* @response.representation.200.qname {http://www.example.com}repositoryEntryLectureConfigurationVO
* @response.representation.200.mediaType application/xml, application/json
* @response.representation.200.doc The configuration of the lecture's feature
* @response.representation.200.example {@link org.olat.modules.lecture.restapi.Examples#SAMPLE_REPOSITORYENTRYLECTURECONFIGURATIONVO}
* @response.representation.401.doc The roles of the authenticated user are not sufficient
* @response.representation.404.doc The course not found
* @param httpRequest The HTTP request
* @return The configuration
*/
@GET
@Path("configuration")
@Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
public Response getConfiguration(@Context HttpServletRequest httpRequest) {
Roles roles = getRoles(httpRequest);
if (!roles.isOLATAdmin()) {
return Response.serverError().status(Status.UNAUTHORIZED).build();
}
RepositoryEntryLectureConfiguration config = lectureService.getRepositoryEntryLectureConfiguration(entry);
RepositoryEntryLectureConfigurationVO configVo;
if (config == null) {
configVo = new RepositoryEntryLectureConfigurationVO();
} else {
configVo = new RepositoryEntryLectureConfigurationVO(config);
}
return Response.ok(configVo).build();
}
use of org.olat.modules.lecture.RepositoryEntryLectureConfiguration in project openolat by klemens.
the class LectureBlockDAOTest method hasLecturesAsTeacher.
@Test
public void hasLecturesAsTeacher() {
Identity teacher = JunitTestHelper.createAndPersistIdentityAsRndUser("teacher-1");
RepositoryEntry entry = JunitTestHelper.createAndPersistRepositoryEntry();
LectureBlock lectureBlock = createMinimalLectureBlock(entry);
dbInstance.commitAndCloseSession();
// enable lecture on this entry
RepositoryEntryLectureConfiguration config = lectureService.getRepositoryEntryLectureConfiguration(entry);
config.setLectureEnabled(true);
config = lectureService.updateRepositoryEntryLectureConfiguration(config);
lectureService.addTeacher(lectureBlock, teacher);
dbInstance.commitAndCloseSession();
boolean isTeacher = lectureBlockDao.hasLecturesAsTeacher(entry, teacher);
Assert.assertTrue(isTeacher);
}
Aggregations