use of org.olat.modules.co.ContactForm in project OpenOLAT by OpenOLAT.
the class BGEmailCompositionStepController method initForm.
@Override
protected void initForm(FormItemContainer formLayout, Controller listener, UserRequest ureq) {
StringBuilder groupNames = new StringBuilder();
for (int i = 0; i < 5 && i < groups.size(); i++) {
if (groupNames.length() > 0)
groupNames.append(" - ");
groupNames.append(groups.get(i).getName());
}
String contactsName;
if (groups.size() > 5) {
String otherGroups = Integer.toString(groups.size() - 5);
contactsName = translate("email.other.groups", new String[] { groupNames.toString(), otherGroups });
} else {
contactsName = groupNames.toString();
}
ContactList contacts = new ContactList(contactsName);
Boolean sendToTutorObj = (Boolean) getFromRunContext("tutors");
boolean sendToTutors = sendToTutorObj == null ? false : sendToTutorObj.booleanValue();
if (sendToTutors) {
List<Identity> coaches = businessGroupService.getMembers(groups, GroupRoles.coach.name());
contacts.addAllIdentites(coaches);
}
Boolean sendToParticipantObj = (Boolean) getFromRunContext("participants");
boolean sendToParticipants = sendToParticipantObj == null ? false : sendToParticipantObj.booleanValue();
if (sendToParticipants) {
List<Identity> participants = businessGroupService.getMembers(groups, GroupRoles.participant.name());
contacts.addAllIdentites(participants);
}
contactForm = new ContactForm(ureq, getWindowControl(), mainForm, getIdentity(), false, false, false, false);
contactForm.addEmailTo(contacts);
formLayout.add("wrapped", contactForm.getInitialFormItem());
}
use of org.olat.modules.co.ContactForm in project openolat by klemens.
the class BGEmailCompositionStepController method initForm.
@Override
protected void initForm(FormItemContainer formLayout, Controller listener, UserRequest ureq) {
StringBuilder groupNames = new StringBuilder();
for (int i = 0; i < 5 && i < groups.size(); i++) {
if (groupNames.length() > 0)
groupNames.append(" - ");
groupNames.append(groups.get(i).getName());
}
String contactsName;
if (groups.size() > 5) {
String otherGroups = Integer.toString(groups.size() - 5);
contactsName = translate("email.other.groups", new String[] { groupNames.toString(), otherGroups });
} else {
contactsName = groupNames.toString();
}
ContactList contacts = new ContactList(contactsName);
Boolean sendToTutorObj = (Boolean) getFromRunContext("tutors");
boolean sendToTutors = sendToTutorObj == null ? false : sendToTutorObj.booleanValue();
if (sendToTutors) {
List<Identity> coaches = businessGroupService.getMembers(groups, GroupRoles.coach.name());
contacts.addAllIdentites(coaches);
}
Boolean sendToParticipantObj = (Boolean) getFromRunContext("participants");
boolean sendToParticipants = sendToParticipantObj == null ? false : sendToParticipantObj.booleanValue();
if (sendToParticipants) {
List<Identity> participants = businessGroupService.getMembers(groups, GroupRoles.participant.name());
contacts.addAllIdentites(participants);
}
contactForm = new ContactForm(ureq, getWindowControl(), mainForm, getIdentity(), false, false, false, false);
contactForm.addEmailTo(contacts);
formLayout.add("wrapped", contactForm.getInitialFormItem());
}
Aggregations