use of org.olat.modules.reminder.Reminder in project OpenOLAT by OpenOLAT.
the class CourseSendReminderListController method doResend.
private void doResend(SentReminderRow row) {
Reminder reloadedReminder = reminderService.loadByKey(row.getReminderKey());
Identity id = securityManager.loadIdentityByKey(row.getIdentityKey());
List<Identity> identitiesToRemind = Collections.singletonList(id);
MailerResult result = reminderService.sendReminder(reloadedReminder, identitiesToRemind);
if (result.getReturnCode() != MailerResult.OK) {
MailHelper.printErrorsAndWarnings(result, getWindowControl(), false, getLocale());
} else {
showInfo("reminder.resend");
}
updateModel();
}
use of org.olat.modules.reminder.Reminder in project OpenOLAT by OpenOLAT.
the class CourseReminderLogsController method doResend.
private void doResend(SentReminderRow row) {
Reminder reloadedReminder = reminderService.loadByKey(row.getReminderKey());
Identity id = securityManager.loadIdentityByKey(row.getIdentityKey());
List<Identity> identitiesToRemind = Collections.singletonList(id);
MailerResult result = reminderService.sendReminder(reloadedReminder, identitiesToRemind);
if (result.getReturnCode() != MailerResult.OK) {
MailHelper.printErrorsAndWarnings(result, getWindowControl(), false, getLocale());
} else {
showInfo("reminder.resend");
}
}
use of org.olat.modules.reminder.Reminder in project OpenOLAT by OpenOLAT.
the class CourseReminderLogsController method doOpenReminder.
private void doOpenReminder(UserRequest ureq, SentReminderRow row) {
removeAsListenerAndDispose(reminderEditCtrl);
Reminder reminder = reminderService.loadByKey(row.getReminderKey());
reminderEditCtrl = new CourseReminderEditController(ureq, getWindowControl(), reminder);
listenTo(reminderEditCtrl);
toolbarPanel.pushController(translate("edit.reminder"), reminderEditCtrl);
}
use of org.olat.modules.reminder.Reminder in project openolat by klemens.
the class CourseHandler method cloneReminders.
private void cloneReminders(Identity author, CourseEnvironmentMapper envMapper, RepositoryEntry source, RepositoryEntry target) {
ReminderModule reminderModule = CoreSpringFactory.getImpl(ReminderModule.class);
ReminderService reminderService = CoreSpringFactory.getImpl(ReminderService.class);
List<Reminder> reminders = reminderService.getReminders(source);
for (Reminder reminder : reminders) {
String configuration = reminder.getConfiguration();
ReminderRules rules = reminderService.toRules(configuration);
ReminderRules clonedRules = new ReminderRules();
for (ReminderRule rule : rules.getRules()) {
RuleSPI ruleSpi = reminderModule.getRuleSPIByType(rule.getType());
if (ruleSpi != null) {
ReminderRule clonedRule = ruleSpi.clone(rule, envMapper);
if (clonedRule != null)
clonedRules.getRules().add(clonedRule);
}
}
Reminder clonedReminder = reminderService.createReminder(target, author);
clonedReminder.setDescription(reminder.getDescription());
clonedReminder.setEmailSubject(reminder.getEmailSubject());
clonedReminder.setEmailBody(reminder.getEmailBody());
clonedReminder.setConfiguration(reminderService.toXML(clonedRules));
reminderService.save(clonedReminder);
}
}
use of org.olat.modules.reminder.Reminder in project openolat by klemens.
the class CourseHandler method importReminders.
private void importReminders(RepositoryEntry re, File fImportBaseDirectory, CourseEnvironmentMapper envMapper, Identity initialAuthor) {
ReminderModule reminderModule = CoreSpringFactory.getImpl(ReminderModule.class);
ReminderService reminderService = CoreSpringFactory.getImpl(ReminderService.class);
List<Reminder> reminders = reminderService.importRawReminders(initialAuthor, re, fImportBaseDirectory);
if (reminders.size() > 0) {
for (Reminder reminder : reminders) {
ReminderRules clonedRules = new ReminderRules();
String configuration = reminder.getConfiguration();
ReminderRules rules = reminderService.toRules(configuration);
for (ReminderRule rule : rules.getRules()) {
RuleSPI ruleSpi = reminderModule.getRuleSPIByType(rule.getType());
if (ruleSpi != null) {
ReminderRule clonedRule = ruleSpi.clone(rule, envMapper);
clonedRules.getRules().add(clonedRule);
}
}
String convertedConfiguration = reminderService.toXML(clonedRules);
reminder.setConfiguration(convertedConfiguration);
reminderService.save(reminder);
}
}
}
Aggregations