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();
}
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");
}
}
}
}
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;
}
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);
}
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;
}
Aggregations