Search in sources :

Example 6 with SendTime

use of org.olat.modules.reminder.model.SendTime in project openolat by klemens.

the class CourseReminderEditController method getSendTimeDescription.

protected String getSendTimeDescription() {
    String interval = reminderModule.getInterval();
    String desc = translate("interval." + interval);
    String time;
    SendTime parsedTime = SendTime.parse(reminderModule.getDefaultSendTime());
    if (parsedTime.isValid()) {
        int hour = parsedTime.getHour();
        int minute = parsedTime.getMinute();
        Calendar cal = Calendar.getInstance();
        cal.set(Calendar.HOUR_OF_DAY, hour);
        cal.set(Calendar.MINUTE, minute);
        cal.set(Calendar.SECOND, 0);
        cal.set(Calendar.MILLISECOND, 0);
        time = Formatter.getInstance(getLocale()).formatTimeShort(cal.getTime());
    } else {
        time = "ERROR";
    }
    String descText = translate("send.time.description", new String[] { desc, time });
    String infoText = "<br /><em class='text-muted'>" + translate("send.time.info") + "</em>";
    return descText + infoText;
}
Also used : SendTime(org.olat.modules.reminder.model.SendTime) Calendar(java.util.Calendar)

Aggregations

SendTime (org.olat.modules.reminder.model.SendTime)6 Calendar (java.util.Calendar)2 TimeZone (java.util.TimeZone)2 AbstractComponent (org.olat.core.gui.components.AbstractComponent)2 FormLayoutContainer (org.olat.core.gui.components.form.flexible.impl.FormLayoutContainer)2