use of org.olat.modules.forms.EvaluationFormResponse in project OpenOLAT by OpenOLAT.
the class EvaluationFormController method forgeTextInput.
private EvaluationFormElementWrapper forgeTextInput(TextInput element) {
String initialValue = "";
EvaluationFormResponse response = identifierToResponses.get(element.getId());
if (response != null && StringHelper.containsNonWhitespace(response.getStringuifiedResponse())) {
initialValue = response.getStringuifiedResponse();
}
int rows = 12;
if (element.getRows() > 0) {
rows = element.getRows();
}
TextElement textEl = uifactory.addTextAreaElement("textinput_" + (count++), null, Integer.MAX_VALUE, rows, 72, false, initialValue, flc);
textEl.setEnabled(!readOnly);
FormLink saveButton = uifactory.addFormLink("save_" + (count++), "save", null, flc, Link.BUTTON);
saveButton.setVisible(!readOnly);
TextInputWrapper textInputWrapper = new TextInputWrapper(element, textEl, saveButton);
saveButton.setUserObject(textInputWrapper);
textEl.setUserObject(textInputWrapper);
EvaluationFormElementWrapper wrapper = new EvaluationFormElementWrapper(element);
wrapper.setTextInputWrapper(textInputWrapper);
return wrapper;
}
use of org.olat.modules.forms.EvaluationFormResponse in project OpenOLAT by OpenOLAT.
the class EvaluationFormController method saveFileResponse.
private void saveFileResponse(File file, String filename, String responseIdentifier) {
if (evaluator == null || readOnly)
return;
EvaluationFormResponse response = identifierToResponses.get(responseIdentifier);
try {
if (response == null) {
response = evaluationFormManager.createResponseForPortfolioEvaluation(responseIdentifier, file, filename, session);
} else {
response = evaluationFormManager.updateResponseForPortfolioEvaluation(file, filename, response);
}
} catch (IOException e) {
showError("error.cannot.save.file");
log.warn("Cannot save file for an evaluation form response!", e);
}
updateCache(responseIdentifier, response);
}
use of org.olat.modules.forms.EvaluationFormResponse in project OpenOLAT by OpenOLAT.
the class CompareEvaluationsFormController method forgeSliderStats.
private SliderWrapper forgeSliderStats(Slider slider, Rubric element, List<EvaluationFormResponse> responses) {
String id = "overview_" + (count++);
SliderOverviewElement overviewEl = new SliderOverviewElement(id);
overviewEl.setMinValue(element.getStart());
overviewEl.setMaxValue(element.getEnd());
flc.add(id, overviewEl);
List<SliderPoint> values = new ArrayList<>();
if (responses != null && responses.size() > 0) {
for (EvaluationFormResponse response : responses) {
if (response.getNumericalResponse() != null) {
Identity evaluator = response.getSession().getIdentity();
String color = evaluatorToColors.get(evaluator);
double value = response.getNumericalResponse().doubleValue();
values.add(new SliderPoint(color, value));
}
}
}
overviewEl.setValues(values);
return new SliderWrapper(slider, overviewEl);
}
use of org.olat.modules.forms.EvaluationFormResponse 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.EvaluationFormResponse 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;
}
Aggregations