Search in sources :

Example 1 with EvaluationFormResponse

use of org.olat.modules.forms.EvaluationFormResponse in project OpenOLAT by OpenOLAT.

the class EvaluationFormController method forgeRubric.

private EvaluationFormElementWrapper forgeRubric(Rubric element) {
    EvaluationFormElementWrapper wrapper = new EvaluationFormElementWrapper(element);
    List<Slider> sliders = element.getSliders();
    List<SliderWrapper> sliderWrappers = new ArrayList<>(sliders.size());
    for (Slider slider : sliders) {
        String responseIdentifier = slider.getId();
        EvaluationFormResponse response = identifierToResponses.get(responseIdentifier);
        SliderType type = element.getSliderType();
        SliderWrapper sliderWrapper = null;
        if (type == SliderType.discrete) {
            sliderWrapper = forgeDiscreteRadioButtons(slider, element, response);
        } else if (type == SliderType.discrete_slider) {
            sliderWrapper = forgeDiscreteSlider(slider, element, response);
        } else if (type == SliderType.continuous) {
            sliderWrapper = forgeContinuousSlider(slider, element, response);
        }
        if (sliderWrapper != null) {
            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) SliderType(org.olat.modules.forms.model.xml.Rubric.SliderType) EvaluationFormResponse(org.olat.modules.forms.EvaluationFormResponse)

Example 2 with EvaluationFormResponse

use of org.olat.modules.forms.EvaluationFormResponse in project OpenOLAT by OpenOLAT.

the class EvaluationFormController method saveNumericalResponse.

private void saveNumericalResponse(BigDecimal numericalValue, String stringuifiedReponse, String responseIdentifier) {
    if (evaluator == null || readOnly)
        return;
    EvaluationFormResponse response = identifierToResponses.get(responseIdentifier);
    if (response == null) {
        response = evaluationFormManager.createResponseForPortfolioEvaluation(responseIdentifier, numericalValue, stringuifiedReponse, session);
    } else {
        response = evaluationFormManager.updateResponseForPortfolioEvaluation(numericalValue, stringuifiedReponse, response);
    }
    updateCache(responseIdentifier, response);
}
Also used : EvaluationFormResponse(org.olat.modules.forms.EvaluationFormResponse)

Example 3 with EvaluationFormResponse

use of org.olat.modules.forms.EvaluationFormResponse in project OpenOLAT by OpenOLAT.

the class CompareEvaluationsFormController method loadResponses.

private void loadResponses() {
    flc.contextPut("messageNotDone", Boolean.FALSE);
    List<Identity> evaluatorIdentities = evaluators.stream().map(evaluator -> evaluator.getIdentity()).collect(Collectors.toList());
    List<EvaluationFormResponse> responses = evaluationFormManager.getResponsesFromPortfolioEvaluation(evaluatorIdentities, anchor, EvaluationFormSessionStatus.done);
    for (EvaluationFormResponse response : responses) {
        List<EvaluationFormResponse> responseList = identifierToResponses.get(response.getResponseIdentifier());
        if (responseList == null) {
            responseList = new ArrayList<>();
            identifierToResponses.put(response.getResponseIdentifier(), responseList);
        }
        responseList.add(response);
    }
}
Also used : EvaluationFormSessionStatus(org.olat.modules.forms.EvaluationFormSessionStatus) EvaluationFormElementWrapper(org.olat.modules.forms.ui.model.EvaluationFormElementWrapper) Autowired(org.springframework.beans.factory.annotation.Autowired) TextInput(org.olat.modules.forms.model.xml.TextInput) Map(java.util.Map) EvaluationFormManager(org.olat.modules.forms.EvaluationFormManager) VFSLeaf(org.olat.core.util.vfs.VFSLeaf) Rubric(org.olat.modules.forms.model.xml.Rubric) AbstractElement(org.olat.modules.forms.model.xml.AbstractElement) Slider(org.olat.modules.forms.model.xml.Slider) RadarChartElement(org.olat.core.gui.components.chart.RadarChartElement) FORM_XML_FILE(org.olat.modules.forms.handler.EvaluationFormResource.FORM_XML_FILE) WindowControl(org.olat.core.gui.control.WindowControl) FileUploadCompareWrapper(org.olat.modules.forms.ui.model.FileUploadCompareWrapper) Collectors(java.util.stream.Collectors) List(java.util.List) Identity(org.olat.core.id.Identity) Format(org.olat.core.gui.components.chart.RadarChartComponent.Format) TextInputWrapper(org.olat.modules.forms.ui.model.TextInputWrapper) SliderType(org.olat.modules.forms.model.xml.Rubric.SliderType) VFSMediaMapper(org.olat.core.util.vfs.VFSMediaMapper) FormEvent(org.olat.core.gui.components.form.flexible.impl.FormEvent) PageBody(org.olat.modules.portfolio.PageBody) HashMap(java.util.HashMap) FileResourceManager(org.olat.fileresource.FileResourceManager) RepositoryEntry(org.olat.repository.RepositoryEntry) Form(org.olat.modules.forms.model.xml.Form) FormItem(org.olat.core.gui.components.form.flexible.FormItem) ArrayList(java.util.ArrayList) FormBasicController(org.olat.core.gui.components.form.flexible.impl.FormBasicController) FormItemContainer(org.olat.core.gui.components.form.flexible.FormItemContainer) MetaInfo(org.olat.core.commons.modules.bc.meta.MetaInfo) StringHelper(org.olat.core.util.StringHelper) MetaTagged(org.olat.core.commons.modules.bc.meta.tagged.MetaTagged) Formatter(org.olat.core.util.Formatter) RadarSeries(org.olat.core.gui.components.chart.RadarSeries) SliderOverviewElement(org.olat.modules.forms.ui.component.SliderOverviewElement) Evaluator(org.olat.modules.forms.ui.model.Evaluator) SliderWrapper(org.olat.modules.forms.ui.model.SliderWrapper) Controller(org.olat.core.gui.control.Controller) File(java.io.File) SliderPoint(org.olat.modules.forms.ui.component.SliderPoint) EvaluationFormSession(org.olat.modules.forms.EvaluationFormSession) EvaluationFormResponse(org.olat.modules.forms.EvaluationFormResponse) CSSHelper(org.olat.core.gui.util.CSSHelper) FormXStream(org.olat.modules.forms.model.xml.FormXStream) UserRequest(org.olat.core.gui.UserRequest) XStreamHelper(org.olat.core.util.xml.XStreamHelper) FileUpload(org.olat.modules.forms.model.xml.FileUpload) Identity(org.olat.core.id.Identity) EvaluationFormResponse(org.olat.modules.forms.EvaluationFormResponse)

Example 4 with EvaluationFormResponse

use of org.olat.modules.forms.EvaluationFormResponse in project OpenOLAT by OpenOLAT.

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)

Example 5 with EvaluationFormResponse

use of org.olat.modules.forms.EvaluationFormResponse 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)

Aggregations

EvaluationFormResponse (org.olat.modules.forms.EvaluationFormResponse)26 EvaluationFormElementWrapper (org.olat.modules.forms.ui.model.EvaluationFormElementWrapper)16 ArrayList (java.util.ArrayList)14 Identity (org.olat.core.id.Identity)10 Slider (org.olat.modules.forms.model.xml.Slider)8 SliderWrapper (org.olat.modules.forms.ui.model.SliderWrapper)8 EvaluationFormSession (org.olat.modules.forms.EvaluationFormSession)6 TextInputWrapper (org.olat.modules.forms.ui.model.TextInputWrapper)6 File (java.io.File)4 HashMap (java.util.HashMap)4 RadarChartElement (org.olat.core.gui.components.chart.RadarChartElement)4 RadarSeries (org.olat.core.gui.components.chart.RadarSeries)4 SliderType (org.olat.modules.forms.model.xml.Rubric.SliderType)4 FileUploadCompareWrapper (org.olat.modules.forms.ui.model.FileUploadCompareWrapper)4 PageBody (org.olat.modules.portfolio.PageBody)4 RepositoryEntry (org.olat.repository.RepositoryEntry)4 BigDecimal (java.math.BigDecimal)2 Path (java.nio.file.Path)2 List (java.util.List)2 Map (java.util.Map)2