Search in sources :

Example 1 with LectureBlock

use of org.olat.modules.lecture.LectureBlock in project OpenOLAT by OpenOLAT.

the class ParticipantLectureBlocksController method doAppeal.

private void doAppeal(UserRequest ureq, LectureBlockAndRollCall row) {
    if (appealCtrl != null)
        return;
    LectureBlock block = lectureService.getLectureBlock(row.getLectureBlockRef());
    List<Identity> teachers = lectureService.getTeachers(block);
    List<Identity> onwers = repositoryService.getMembers(entry, GroupRoles.owner.name());
    ContactList contactList = new ContactList(translate("appeal.contact.list"));
    contactList.addAllIdentites(teachers);
    contactList.addAllIdentites(onwers);
    StringBuilder teacherNames = new StringBuilder();
    for (Identity teacher : teachers) {
        if (teacherNames.length() > 0)
            teacherNames.append(", ");
        teacherNames.append(teacher.getUser().getFirstName()).append(" ").append(teacher.getUser().getLastName());
    }
    String date = Formatter.getInstance(getLocale()).formatDate(block.getStartDate());
    String[] args = new String[] { row.getLectureBlockTitle(), teacherNames.toString(), date };
    ContactMessage cmsg = new ContactMessage(getIdentity());
    cmsg.addEmailTo(contactList);
    cmsg.setSubject(translate("appeal.subject", args));
    cmsg.setBodyText(translate("appeal.body", args));
    appealCtrl = new ContactFormController(ureq, getWindowControl(), true, false, false, cmsg);
    appealCtrl.setUserObject(row);
    appealCtrl.setContactFormTitle(translate("new.appeal.title"));
    listenTo(appealCtrl);
    String title = translate("appeal.title", new String[] { row.getLectureBlockTitle() });
    cmc = new CloseableModalController(getWindowControl(), "close", appealCtrl.getInitialComponent(), true, title);
    listenTo(cmc);
    cmc.activate();
}
Also used : LectureBlock(org.olat.modules.lecture.LectureBlock) CloseableModalController(org.olat.core.gui.control.generic.closablewrapper.CloseableModalController) ContactFormController(org.olat.modules.co.ContactFormController) ContactList(org.olat.core.util.mail.ContactList) Identity(org.olat.core.id.Identity) ContactMessage(org.olat.core.util.mail.ContactMessage)

Example 2 with LectureBlock

use of org.olat.modules.lecture.LectureBlock in project OpenOLAT by OpenOLAT.

the class LectureServiceImpl method sendReminders.

@Override
public void sendReminders() {
    int reminderPeriod = lectureModule.getRollCallReminderPeriod();
    if (reminderPeriod > 0) {
        Calendar cal = Calendar.getInstance();
        cal.add(Calendar.DATE, -reminderPeriod);
        Date endDate = cal.getTime();
        boolean reminderEnabled = lectureModule.isRollCallReminderEnabled();
        List<LectureBlockToTeacher> toRemindList = lectureBlockReminderDao.getLectureBlockTeachersToReminder(endDate);
        for (LectureBlockToTeacher toRemind : toRemindList) {
            Identity teacher = toRemind.getTeacher();
            LectureBlock lectureBlock = toRemind.getLectureBlock();
            if (reminderEnabled) {
                sendReminder(teacher, lectureBlock);
            } else {
                lectureBlockReminderDao.createReminder(lectureBlock, teacher, "disabled");
            }
        }
    }
}
Also used : LectureBlockToTeacher(org.olat.modules.lecture.model.LectureBlockToTeacher) LectureBlock(org.olat.modules.lecture.LectureBlock) Calendar(java.util.Calendar) Identity(org.olat.core.id.Identity) Date(java.util.Date)

Example 3 with LectureBlock

use of org.olat.modules.lecture.LectureBlock in project OpenOLAT by OpenOLAT.

the class LectureServiceImpl method copyLectureBlock.

@Override
public LectureBlock copyLectureBlock(String newTitle, LectureBlock block) {
    LectureBlock copy = lectureBlockDao.createLectureBlock(block.getEntry());
    copy.setTitle(newTitle);
    copy.setDescription(block.getDescription());
    copy.setPreparation(block.getPreparation());
    copy.setLocation(block.getLocation());
    copy.setRollCallStatus(LectureRollCallStatus.open);
    copy.setEffectiveLecturesNumber(block.getEffectiveLecturesNumber());
    copy.setPlannedLecturesNumber(block.getPlannedLecturesNumber());
    copy.setStartDate(block.getStartDate());
    copy.setEndDate(block.getEndDate());
    copy = lectureBlockDao.update(copy);
    return copy;
}
Also used : LectureBlock(org.olat.modules.lecture.LectureBlock)

Example 4 with LectureBlock

use of org.olat.modules.lecture.LectureBlock in project OpenOLAT by OpenOLAT.

the class LectureServiceImpl method deleteLectureBlock.

@Override
public void deleteLectureBlock(LectureBlock lectureBlock) {
    // first remove events
    LectureBlock reloadedBlock = lectureBlockDao.loadByKey(lectureBlock.getKey());
    RepositoryEntry entry = reloadedBlock.getEntry();
    RepositoryEntryLectureConfiguration config = getRepositoryEntryLectureConfiguration(entry);
    if (ConfigurationHelper.isSyncCourseCalendarEnabled(config, lectureModule)) {
        unsyncCourseCalendar(lectureBlock, entry);
    }
    if (ConfigurationHelper.isSyncTeacherCalendarEnabled(config, lectureModule)) {
        List<Identity> teachers = getTeachers(reloadedBlock);
        unsyncInternalCalendar(reloadedBlock, teachers);
    }
    lectureBlockDao.delete(reloadedBlock);
}
Also used : LectureBlock(org.olat.modules.lecture.LectureBlock) RepositoryEntry(org.olat.repository.RepositoryEntry) RepositoryEntryLectureConfiguration(org.olat.modules.lecture.RepositoryEntryLectureConfiguration) Identity(org.olat.core.id.Identity)

Example 5 with LectureBlock

use of org.olat.modules.lecture.LectureBlock in project OpenOLAT by OpenOLAT.

the class LectureServiceImpl method delete.

@Override
public int delete(RepositoryEntry entry) {
    int rows = 0;
    List<LectureBlock> blocksToDelete = lectureBlockDao.getLectureBlocks(entry);
    for (LectureBlock blockToDelete : blocksToDelete) {
        rows += lectureBlockDao.delete(blockToDelete);
    }
    rows += lectureConfigurationDao.deleteConfiguration(entry);
    rows += lectureParticipantSummaryDao.deleteSummaries(entry);
    return rows;
}
Also used : LectureBlock(org.olat.modules.lecture.LectureBlock)

Aggregations

LectureBlock (org.olat.modules.lecture.LectureBlock)232 Identity (org.olat.core.id.Identity)132 Test (org.junit.Test)116 RepositoryEntry (org.olat.repository.RepositoryEntry)98 Date (java.util.Date)64 LectureBlockRollCall (org.olat.modules.lecture.LectureBlockRollCall)42 URI (java.net.URI)30 ArrayList (java.util.ArrayList)30 HttpResponse (org.apache.http.HttpResponse)30 Group (org.olat.basesecurity.Group)30 Calendar (java.util.Calendar)26 ICourse (org.olat.course.ICourse)24 BusinessGroup (org.olat.group.BusinessGroup)24 CourseConfigVO (org.olat.restapi.support.vo.CourseConfigVO)24 LectureBlockToGroup (org.olat.modules.lecture.LectureBlockToGroup)22 RepositoryEntryLectureConfiguration (org.olat.modules.lecture.RepositoryEntryLectureConfiguration)20 LecturesBlockSearchParameters (org.olat.modules.lecture.model.LecturesBlockSearchParameters)16 List (java.util.List)14 HttpGet (org.apache.http.client.methods.HttpGet)14 LectureBlockToTeacher (org.olat.modules.lecture.model.LectureBlockToTeacher)14