Search in sources :

Example 26 with RepositoryEntryLectureConfiguration

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);
}
Also used : RepositoryEntryLectureConfiguration(org.olat.modules.lecture.RepositoryEntryLectureConfiguration)

Example 27 with RepositoryEntryLectureConfiguration

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);
		}*/
}
Also used : RepositoryEntryLectureConfiguration(org.olat.modules.lecture.RepositoryEntryLectureConfiguration) Identity(org.olat.core.id.Identity)

Example 28 with RepositoryEntryLectureConfiguration

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;
}
Also used : RepositoryEntry(org.olat.repository.RepositoryEntry) RepositoryEntryLectureConfiguration(org.olat.modules.lecture.RepositoryEntryLectureConfiguration)

Example 29 with RepositoryEntryLectureConfiguration

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();
}
Also used : RestSecurityHelper.getRoles(org.olat.restapi.security.RestSecurityHelper.getRoles) Roles(org.olat.core.id.Roles) RepositoryEntryLectureConfiguration(org.olat.modules.lecture.RepositoryEntryLectureConfiguration) Path(javax.ws.rs.Path) Produces(javax.ws.rs.Produces) GET(javax.ws.rs.GET)

Example 30 with RepositoryEntryLectureConfiguration

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);
}
Also used : LectureBlock(org.olat.modules.lecture.LectureBlock) RepositoryEntry(org.olat.repository.RepositoryEntry) Identity(org.olat.core.id.Identity) RepositoryEntryLectureConfiguration(org.olat.modules.lecture.RepositoryEntryLectureConfiguration) Test(org.junit.Test)

Aggregations

RepositoryEntryLectureConfiguration (org.olat.modules.lecture.RepositoryEntryLectureConfiguration)40 RepositoryEntry (org.olat.repository.RepositoryEntry)30 Test (org.junit.Test)26 Identity (org.olat.core.id.Identity)18 LectureBlock (org.olat.modules.lecture.LectureBlock)16 Path (javax.ws.rs.Path)4 Produces (javax.ws.rs.Produces)4 Group (org.olat.basesecurity.Group)4 Roles (org.olat.core.id.Roles)4 BusinessGroup (org.olat.group.BusinessGroup)4 LectureBlockToGroup (org.olat.modules.lecture.LectureBlockToGroup)4 LectureBlockStatistics (org.olat.modules.lecture.model.LectureBlockStatistics)4 RestSecurityHelper.getRoles (org.olat.restapi.security.RestSecurityHelper.getRoles)4 URI (java.net.URI)2 Calendar (java.util.Calendar)2 Date (java.util.Date)2 Consumes (javax.ws.rs.Consumes)2 GET (javax.ws.rs.GET)2 POST (javax.ws.rs.POST)2 HttpResponse (org.apache.http.HttpResponse)2