use of org.olat.modules.reminder.model.ReminderRuleImpl in project openolat by klemens.
the class CourseLaunchRuleEditor method getConfiguration.
@Override
public ReminderRule getConfiguration() {
ReminderRuleImpl configuredRule = new ReminderRuleImpl();
configuredRule.setType(ruleType);
configuredRule.setOperator(">");
configuredRule.setRightOperand(valueEl.getValue());
configuredRule.setRightUnit(unitEl.getSelectedKey());
return configuredRule;
}
use of org.olat.modules.reminder.model.ReminderRuleImpl in project openolat by klemens.
the class CourseLaunchRuleEditor method initForm.
@Override
public FormItem initForm(FormItemContainer formLayout, Controller listener, UserRequest ureq) {
String page = Util.getPackageVelocityRoot(this.getClass()) + "/course_launch.html";
String id = Long.toString(CodeHelper.getRAMUniqueID());
Translator trans = formLayout.getTranslator();
FormLayoutContainer ruleCont = FormLayoutContainer.createCustomFormLayout("course.launch.".concat(id), formLayout.getTranslator(), page);
ruleCont.setRootForm(formLayout.getRootForm());
formLayout.add(ruleCont);
ruleCont.getFormItemComponent().contextPut("id", id);
String currentValue = null;
String currentUnit = null;
if (rule instanceof ReminderRuleImpl) {
ReminderRuleImpl r = (ReminderRuleImpl) rule;
currentValue = r.getRightOperand();
currentUnit = r.getRightUnit();
}
valueEl = uifactory.addTextElement("launchvalue.".concat(id), null, 128, currentValue, ruleCont);
valueEl.setDomReplacementWrapperRequired(false);
valueEl.setDisplaySize(3);
String[] unitValues = new String[] { trans.translate(LaunchUnit.day.name()), trans.translate(LaunchUnit.week.name()), trans.translate(LaunchUnit.month.name()), trans.translate(LaunchUnit.year.name()) };
unitEl = uifactory.addDropdownSingleselect("launchunit.".concat(id), null, ruleCont, unitKeys, unitValues, null);
unitEl.setDomReplacementWrapperRequired(false);
boolean selected = false;
if (currentUnit != null) {
for (String unitKey : unitKeys) {
if (currentUnit.equals(unitKey)) {
unitEl.select(unitKey, true);
selected = true;
}
}
}
if (!selected) {
unitEl.select(unitKeys[1], true);
}
return ruleCont;
}
use of org.olat.modules.reminder.model.ReminderRuleImpl in project openolat by klemens.
the class DateRuleEditor method getConfiguration.
@Override
public ReminderRule getConfiguration() {
ReminderRuleImpl configuredRule = new ReminderRuleImpl();
configuredRule.setType(DateRuleSPI.class.getSimpleName());
configuredRule.setOperator(DateRuleSPI.AFTER);
if (afterEl.getDate() != null) {
configuredRule.setRightOperand(Formatter.formatDatetime(afterEl.getDate()));
}
return configuredRule;
}
use of org.olat.modules.reminder.model.ReminderRuleImpl in project openolat by klemens.
the class DateRuleEditor method initForm.
@Override
public FormItem initForm(FormItemContainer formLayout, Controller listener, UserRequest ureq) {
String id = Long.toString(CodeHelper.getRAMUniqueID());
String page = Util.getPackageVelocityRoot(this.getClass()) + "/rule_1_element.html";
FormLayoutContainer ruleCont = FormLayoutContainer.createCustomFormLayout(".".concat(id), formLayout.getTranslator(), page);
ruleCont.setRootForm(formLayout.getRootForm());
formLayout.add(ruleCont);
ruleCont.getFormItemComponent().contextPut("id", id);
Date after = null;
if (rule instanceof ReminderRuleImpl) {
ReminderRuleImpl ruleImpl = (ReminderRuleImpl) rule;
try {
after = Formatter.parseDatetime(ruleImpl.getRightOperand());
} catch (ParseException e) {
log.error("", e);
}
}
afterEl = uifactory.addDateChooser("ruleElement.".concat(id), null, after, ruleCont);
afterEl.setDateChooserTimeEnabled(true);
return ruleCont;
}
use of org.olat.modules.reminder.model.ReminderRuleImpl in project openolat by klemens.
the class RepositoryEntryRoleEditor method getConfiguration.
@Override
public ReminderRule getConfiguration() {
ReminderRuleImpl configuredRule = null;
if (roleEl.isOneSelected()) {
configuredRule = new ReminderRuleImpl();
configuredRule.setType(RepositoryEntryRoleRuleSPI.class.getSimpleName());
configuredRule.setOperator("=");
configuredRule.setRightOperand(roleEl.getSelectedKey());
}
return configuredRule;
}
Aggregations