Search in sources :

Example 1 with ContactForm

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());
}
Also used : ContactForm(org.olat.modules.co.ContactForm) ContactList(org.olat.core.util.mail.ContactList) Identity(org.olat.core.id.Identity)

Example 2 with ContactForm

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());
}
Also used : ContactForm(org.olat.modules.co.ContactForm) ContactList(org.olat.core.util.mail.ContactList) Identity(org.olat.core.id.Identity)

Aggregations

Identity (org.olat.core.id.Identity)2 ContactList (org.olat.core.util.mail.ContactList)2 ContactForm (org.olat.modules.co.ContactForm)2