Search in sources :

Example 6 with EvaluationFormElementWrapper

use of org.olat.modules.forms.ui.model.EvaluationFormElementWrapper in project OpenOLAT by OpenOLAT.

the class CompareEvaluationsFormController method updateElements.

private void updateElements(UserRequest ureq) {
    List<EvaluationFormElementWrapper> elementWrappers = new ArrayList<>();
    for (AbstractElement element : form.getElements()) {
        appendsElement(ureq, element, elementWrappers);
    }
    flc.contextPut("elements", elementWrappers);
}
Also used : AbstractElement(org.olat.modules.forms.model.xml.AbstractElement) EvaluationFormElementWrapper(org.olat.modules.forms.ui.model.EvaluationFormElementWrapper) ArrayList(java.util.ArrayList)

Example 7 with EvaluationFormElementWrapper

use of org.olat.modules.forms.ui.model.EvaluationFormElementWrapper in project OpenOLAT by OpenOLAT.

the class CompareEvaluationsFormController method forgeFileUpload.

private List<EvaluationFormElementWrapper> forgeFileUpload(UserRequest ureq, FileUpload element) {
    List<EvaluationFormResponse> responses = identifierToResponses.get(element.getId());
    if (responses == null) {
        return new ArrayList<>();
    }
    List<EvaluationFormElementWrapper> fileUploadWrappers = new ArrayList<>(responses.size());
    for (EvaluationFormResponse response : responses) {
        if (response.getFileResponse() != null) {
            FileUploadCompareWrapper fileUploadWrapper = createFileUploadCompareWrapper(ureq, element, response);
            EvaluationFormElementWrapper wrapper = new EvaluationFormElementWrapper(element);
            wrapper.setFileUploadCompareWrapper(fileUploadWrapper);
            fileUploadWrappers.add(wrapper);
        }
    }
    return fileUploadWrappers;
}
Also used : EvaluationFormElementWrapper(org.olat.modules.forms.ui.model.EvaluationFormElementWrapper) ArrayList(java.util.ArrayList) FileUploadCompareWrapper(org.olat.modules.forms.ui.model.FileUploadCompareWrapper) EvaluationFormResponse(org.olat.modules.forms.EvaluationFormResponse)

Example 8 with EvaluationFormElementWrapper

use of org.olat.modules.forms.ui.model.EvaluationFormElementWrapper in project openolat by klemens.

the class CompareEvaluationsFormController method appendsElement.

private void appendsElement(UserRequest ureq, AbstractElement element, List<EvaluationFormElementWrapper> wrappers) {
    String type = element.getType();
    switch(type) {
        case "formhtitle":
        case "formhr":
        case "formhtmlraw":
            wrappers.add(new EvaluationFormElementWrapper(element));
            break;
        case "formrubric":
            Rubric rubric = (Rubric) element;
            EvaluationFormElementWrapper sliderWrapper;
            if (rubric.getSliders().size() > 2) {
                sliderWrapper = forgeRadarRubric((Rubric) element);
            } else {
                sliderWrapper = forgeRubric((Rubric) element);
            }
            if (sliderWrapper != null) {
                wrappers.add(sliderWrapper);
            }
            break;
        case "formtextinput":
            List<EvaluationFormElementWrapper> inputWrappers = forgeTextInput((TextInput) element);
            if (inputWrappers != null && !inputWrappers.isEmpty()) {
                wrappers.addAll(inputWrappers);
            }
            break;
        case "formfileupload":
            List<EvaluationFormElementWrapper> fileUploadWrappers = forgeFileUpload(ureq, (FileUpload) element);
            if (fileUploadWrappers != null && !fileUploadWrappers.isEmpty()) {
                wrappers.addAll(fileUploadWrappers);
            }
            break;
    }
}
Also used : Rubric(org.olat.modules.forms.model.xml.Rubric) EvaluationFormElementWrapper(org.olat.modules.forms.ui.model.EvaluationFormElementWrapper)

Example 9 with EvaluationFormElementWrapper

use of org.olat.modules.forms.ui.model.EvaluationFormElementWrapper in project openolat by klemens.

the class CompareEvaluationsFormController method forgeRubric.

private EvaluationFormElementWrapper forgeRubric(Rubric element) {
    EvaluationFormElementWrapper wrapper = new EvaluationFormElementWrapper(element);
    wrapper.setSliderOverview(true);
    List<Slider> sliders = element.getSliders();
    List<SliderWrapper> sliderWrappers = new ArrayList<>(sliders.size());
    for (Slider slider : sliders) {
        String responseIdentifier = slider.getId();
        List<EvaluationFormResponse> responses = identifierToResponses.get(responseIdentifier);
        SliderWrapper sliderWrapper = forgeSliderStats(slider, element, responses);
        sliderWrappers.add(sliderWrapper);
    }
    wrapper.setSliders(sliderWrappers);
    return wrapper;
}
Also used : SliderWrapper(org.olat.modules.forms.ui.model.SliderWrapper) Slider(org.olat.modules.forms.model.xml.Slider) EvaluationFormElementWrapper(org.olat.modules.forms.ui.model.EvaluationFormElementWrapper) ArrayList(java.util.ArrayList) EvaluationFormResponse(org.olat.modules.forms.EvaluationFormResponse)

Example 10 with EvaluationFormElementWrapper

use of org.olat.modules.forms.ui.model.EvaluationFormElementWrapper in project openolat by klemens.

the class CompareEvaluationsFormController method forgeTextInput.

private List<EvaluationFormElementWrapper> forgeTextInput(TextInput element) {
    List<EvaluationFormResponse> responses = identifierToResponses.get(element.getId());
    if (responses == null) {
        // in review - selbstreview ??
        return new ArrayList<>();
    }
    List<EvaluationFormElementWrapper> inputWrappers = new ArrayList<>(responses.size());
    for (EvaluationFormResponse response : responses) {
        if (StringHelper.containsNonWhitespace(response.getStringuifiedResponse())) {
            String initialValue = response.getStringuifiedResponse();
            if (initialValue != null) {
                initialValue = Formatter.stripTabsAndReturns(initialValue).toString();
            }
            Identity evaluator = response.getSession().getIdentity();
            String legend = getLegend(evaluator);
            String color = evaluatorToColors.get(evaluator);
            TextInputWrapper textInputWrapper = new TextInputWrapper(legend, color, initialValue, null);
            EvaluationFormElementWrapper wrapper = new EvaluationFormElementWrapper(element);
            wrapper.setTextInputWrapper(textInputWrapper);
            inputWrappers.add(wrapper);
        }
    }
    return inputWrappers;
}
Also used : TextInputWrapper(org.olat.modules.forms.ui.model.TextInputWrapper) EvaluationFormElementWrapper(org.olat.modules.forms.ui.model.EvaluationFormElementWrapper) ArrayList(java.util.ArrayList) EvaluationFormResponse(org.olat.modules.forms.EvaluationFormResponse) Identity(org.olat.core.id.Identity)

Aggregations

EvaluationFormElementWrapper (org.olat.modules.forms.ui.model.EvaluationFormElementWrapper)28 ArrayList (java.util.ArrayList)18 EvaluationFormResponse (org.olat.modules.forms.EvaluationFormResponse)14 Slider (org.olat.modules.forms.model.xml.Slider)8 SliderWrapper (org.olat.modules.forms.ui.model.SliderWrapper)8 TextInputWrapper (org.olat.modules.forms.ui.model.TextInputWrapper)8 Identity (org.olat.core.id.Identity)4 AbstractElement (org.olat.modules.forms.model.xml.AbstractElement)4 Rubric (org.olat.modules.forms.model.xml.Rubric)4 SliderType (org.olat.modules.forms.model.xml.Rubric.SliderType)4 FileUploadWrapper (org.olat.modules.forms.ui.model.FileUploadWrapper)4 ValidationMessage (org.olat.modules.portfolio.ui.editor.ValidationMessage)4 File (java.io.File)2 HashMap (java.util.HashMap)2 RadarChartElement (org.olat.core.gui.components.chart.RadarChartElement)2 RadarSeries (org.olat.core.gui.components.chart.RadarSeries)2 FileElement (org.olat.core.gui.components.form.flexible.elements.FileElement)2 FormLink (org.olat.core.gui.components.form.flexible.elements.FormLink)2 TextElement (org.olat.core.gui.components.form.flexible.elements.TextElement)2 EvaluationFormSession (org.olat.modules.forms.EvaluationFormSession)2