use of org.olat.modules.forms.ui.model.EvaluationFormElementWrapper in project OpenOLAT by OpenOLAT.
the class EvaluationFormController method forgeElement.
private EvaluationFormElementWrapper forgeElement(UserRequest ureq, AbstractElement element) {
EvaluationFormElementWrapper wrapper = null;
String type = element.getType();
switch(type) {
case "formhtitle":
case "formhr":
case "formhtmlraw":
wrapper = new EvaluationFormElementWrapper(element);
break;
case "formrubric":
wrapper = forgeRubric((Rubric) element);
break;
case "formtextinput":
wrapper = forgeTextInput((TextInput) element);
break;
case "formfileupload":
wrapper = forgeFileUpload(ureq, (FileUpload) element);
break;
}
return wrapper;
}
use of org.olat.modules.forms.ui.model.EvaluationFormElementWrapper in project OpenOLAT by OpenOLAT.
the class EvaluationFormController method doConfirmDone.
private void doConfirmDone(UserRequest ureq) {
for (EvaluationFormElementWrapper elementWrapper : elementWrapperList) {
if (elementWrapper.isTextInput()) {
TextInputWrapper wrapper = elementWrapper.getTextInputWrapper();
String value = wrapper.getTextEl().getValue();
saveNumericalResponse(null, value, wrapper.getId());
}
}
StringBuilder sb = new StringBuilder();
sb.append("<p>").append(translate("confirm.done")).append("</p>");
List<ValidationMessage> messages = new ArrayList<>();
validate(ureq, messages);
if (messages.size() > 0) {
for (ValidationMessage message : messages) {
sb.append("<p class='o_warning'>").append(message.getMessage()).append("</p>");
}
}
confirmDoneCtrl = activateYesNoDialog(ureq, null, sb.toString(), confirmDoneCtrl);
}
use of org.olat.modules.forms.ui.model.EvaluationFormElementWrapper in project OpenOLAT by OpenOLAT.
the class CompareEvaluationsFormController method forgeRadarRubric.
private EvaluationFormElementWrapper forgeRadarRubric(Rubric element) {
EvaluationFormElementWrapper wrapper = new EvaluationFormElementWrapper(element);
wrapper.setRadarOverview(true);
List<String> axisList = new ArrayList<>();
List<Slider> sliders = element.getSliders();
Map<EvaluationFormSession, RadarSeries> series = new HashMap<>();
for (Slider slider : sliders) {
String axis;
if (StringHelper.containsNonWhitespace(slider.getEndLabel())) {
axis = slider.getEndLabel();
} else if (StringHelper.containsNonWhitespace(slider.getStartLabel())) {
axis = slider.getStartLabel();
} else {
axis = "";
}
axisList.add(axis);
String responseIdentifier = slider.getId();
List<EvaluationFormResponse> responses = identifierToResponses.get(responseIdentifier);
if (responses != null && responses.size() > 0) {
for (EvaluationFormResponse response : responses) {
EvaluationFormSession responseSession = response.getSession();
if (!series.containsKey(responseSession)) {
Identity identity = responseSession.getIdentity();
String legend = getLegend(identity);
String color = evaluatorToColors.get(identity);
series.put(responseSession, new RadarSeries(legend, color));
}
if (response.getNumericalResponse() != null) {
double value = response.getNumericalResponse().doubleValue();
series.get(responseSession).addPoint(axis, value);
}
}
}
}
String id = "radar_" + (count++);
RadarChartElement radarEl = new RadarChartElement(id);
radarEl.setSeries(new ArrayList<>(series.values()));
radarEl.setShowLegend(true);
radarEl.setAxis(axisList);
if (element.getSliderType() == SliderType.discrete || element.getSliderType() == SliderType.discrete_slider) {
radarEl.setLevels(element.getSteps());
radarEl.setMaxValue(element.getSteps());
radarEl.setFormat(Format.integer);
} else if (element.getSliderType() == SliderType.continuous) {
radarEl.setLevels(10);
radarEl.setMaxValue(100);
radarEl.setFormat(Format.integer);
}
wrapper.setRadarEl(radarEl);
flc.add(id, radarEl);
return wrapper;
}
use of org.olat.modules.forms.ui.model.EvaluationFormElementWrapper in project OpenOLAT by OpenOLAT.
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 RubricController method updateForm.
protected void updateForm() {
EvaluationFormElementWrapper wrapper = new EvaluationFormElementWrapper(rubric);
List<Slider> sliders = rubric.getSliders();
List<SliderWrapper> sliderWrappers = new ArrayList<>(sliders.size());
for (Slider slider : sliders) {
SliderType type = rubric.getSliderType();
SliderWrapper sliderWrapper = null;
if (type == SliderType.discrete) {
sliderWrapper = forgeDiscreteRadioButtons(slider, rubric);
} else if (type == SliderType.discrete_slider) {
sliderWrapper = forgeDiscreteSlider(slider, rubric);
} else if (type == SliderType.continuous) {
sliderWrapper = forgeContinuousSlider(slider, rubric);
}
if (sliderWrapper != null) {
sliderWrappers.add(sliderWrapper);
}
}
wrapper.setSliders(sliderWrappers);
flc.contextPut("element", wrapper);
}
Aggregations