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);
}
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;
}
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;
}
}
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;
}
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;
}
Aggregations