use of org.olat.ims.qti.editor.beecom.objects.OutcomesProcessing in project OpenOLAT by OpenOLAT.
the class OutcomesProcessingParser method parse.
/**
* @see org.olat.ims.qti.editor.beecom.IParser#parse(org.dom4j.Element)
*/
public Object parse(Element element) {
// assert element.getName().equalsIgnoreCase("outcomes_processing");
OutcomesProcessing outcomesProcessing = new OutcomesProcessing();
List decvars = element.selectNodes("*/decvar");
if (decvars.size() == 0)
return outcomesProcessing;
Element decvar = (Element) decvars.get(0);
for (Iterator iter = decvar.attributeIterator(); iter.hasNext(); ) {
Attribute attr = (Attribute) iter.next();
outcomesProcessing.setField(attr.getName(), attr.getValue());
}
return outcomesProcessing;
}
use of org.olat.ims.qti.editor.beecom.objects.OutcomesProcessing in project openolat by klemens.
the class AssessmentController method event.
/**
* @see org.olat.core.gui.control.DefaultController#event(org.olat.core.gui.UserRequest,
* org.olat.core.gui.components.Component, org.olat.core.gui.control.Event)
*/
public void event(UserRequest ureq, Component source, Event event) {
if (source == main) {
if (event.getCommand().equals("sao")) {
// asessment options submitted
// Handle all data that is useless in survey mode
String newTitle = ureq.getParameter("title");
String oldTitle = assessment.getTitle();
boolean hasTitleChange = newTitle != null && !newTitle.equals(oldTitle);
String newObjectives = ureq.getParameter("objectives");
String oldObjectives = assessment.getObjectives();
boolean hasObjectivesChange = newObjectives != null && !newObjectives.equals(oldObjectives);
NodeBeforeChangeEvent nce = new NodeBeforeChangeEvent();
if (hasTitleChange) {
nce.setNewTitle(newTitle);
}
if (hasObjectivesChange) {
nce.setNewObjectives(newObjectives);
}
if (hasTitleChange || hasObjectivesChange) {
// create a memento first
fireEvent(ureq, nce);
// then apply changes
assessment.setTitle(newTitle);
assessment.setObjectives(newObjectives);
}
//
if (!surveyMode && !restrictedEdit) {
// ordering
assessment.getSelection_ordering().setOrderType(ureq.getParameter("order_type"));
assessment.getSelection_ordering().setSelectionNumber(ureq.getParameter("selection_number"));
main.contextPut("order_type", assessment.getSelection_ordering().getOrderType());
main.contextPut("selection_number", String.valueOf(assessment.getSelection_ordering().getSelectionNumber()));
Control tmpControl = QTIEditHelper.getControl(assessment);
boolean oldInheritControls = assessment.isInheritControls();
boolean newInheritControls = ureq.getParameter("inheritswitch").equals("Yes");
assessment.setInheritControls(newInheritControls);
String feedbackswitchTmp = ureq.getParameter("feedbackswitch");
String hintswitchTmp = ureq.getParameter("hintswitch");
String solutionswitchTmp = ureq.getParameter("solutionswitch");
tmpControl.setSwitches(feedbackswitchTmp, hintswitchTmp, solutionswitchTmp);
if (tmpControl.getHint() != Control.CTRL_UNDEF || tmpControl.getHint() != Control.CTRL_UNDEF || tmpControl.getSolution() != Control.CTRL_UNDEF)
assessment.setInheritControls(true);
if (oldInheritControls && !newInheritControls) {
tmpControl.setSwitches(Control.CTRL_UNDEF, Control.CTRL_UNDEF, Control.CTRL_UNDEF);
assessment.setInheritControls(false);
}
OutcomesProcessing outcomesProcessing = assessment.getOutcomes_processing();
if (outcomesProcessing == null) {
// Create outcomes processing object if it doesn't already exist.
// Happens
// when creating a new assessment
outcomesProcessing = new OutcomesProcessing();
assessment.setOutcomes_processing(outcomesProcessing);
}
String cutval = ureq.getParameter(OutcomesProcessing.CUTVALUE);
try {
Float.parseFloat(cutval);
} catch (NumberFormatException nfe) {
cutval = "0.0";
this.showWarning("error.cutval");
}
outcomesProcessing.setField(OutcomesProcessing.CUTVALUE, cutval);
main.contextPut(OutcomesProcessing.CUTVALUE, cutval);
if (ureq.getParameter("duration").equals("Yes")) {
String durationMin = ureq.getParameter("duration_min");
String durationSec = ureq.getParameter("duration_sec");
try {
Integer.parseInt(durationMin);
int sec = Integer.parseInt(durationSec);
if (sec > 60)
throw new NumberFormatException();
} catch (NumberFormatException nfe) {
durationMin = "0";
durationSec = "0";
this.showWarning("error.duration");
}
Duration d = new Duration(durationMin, durationSec);
assessment.setDuration(d);
main.contextPut("duration", assessment.getDuration());
} else {
assessment.setDuration(null);
main.contextRemove("duration");
}
}
qtiPackage.serializeQTIDocument();
// refresh for removing dirty marking of button even if nothing changed
main.setDirty(true);
}
}
}
use of org.olat.ims.qti.editor.beecom.objects.OutcomesProcessing in project openolat by klemens.
the class QTIWordExport method renderAssessment.
public static void renderAssessment(Assessment assessment, OpenXMLDocument document, Translator translator) {
String title = assessment.getTitle();
document.appendTitle(title);
OutcomesProcessing outcomesProcessing = assessment.getOutcomes_processing();
if (outcomesProcessing != null) {
String cutValue = outcomesProcessing.getField(OutcomesProcessing.CUTVALUE);
String cutValueLabel = translator.translate("cut_value");
document.appendText(cutValueLabel + ": " + cutValue, true);
}
String objectives = assessment.getObjectives();
document.appendText(objectives, true);
}
use of org.olat.ims.qti.editor.beecom.objects.OutcomesProcessing in project openolat by klemens.
the class OutcomesProcessingParser method parse.
/**
* @see org.olat.ims.qti.editor.beecom.IParser#parse(org.dom4j.Element)
*/
public Object parse(Element element) {
// assert element.getName().equalsIgnoreCase("outcomes_processing");
OutcomesProcessing outcomesProcessing = new OutcomesProcessing();
List decvars = element.selectNodes("*/decvar");
if (decvars.size() == 0)
return outcomesProcessing;
Element decvar = (Element) decvars.get(0);
for (Iterator iter = decvar.attributeIterator(); iter.hasNext(); ) {
Attribute attr = (Attribute) iter.next();
outcomesProcessing.setField(attr.getName(), attr.getValue());
}
return outcomesProcessing;
}
use of org.olat.ims.qti.editor.beecom.objects.OutcomesProcessing in project OpenOLAT by OpenOLAT.
the class AssessmentController method event.
/**
* @see org.olat.core.gui.control.DefaultController#event(org.olat.core.gui.UserRequest,
* org.olat.core.gui.components.Component, org.olat.core.gui.control.Event)
*/
public void event(UserRequest ureq, Component source, Event event) {
if (source == main) {
if (event.getCommand().equals("sao")) {
// asessment options submitted
// Handle all data that is useless in survey mode
String newTitle = ureq.getParameter("title");
String oldTitle = assessment.getTitle();
boolean hasTitleChange = newTitle != null && !newTitle.equals(oldTitle);
String newObjectives = ureq.getParameter("objectives");
String oldObjectives = assessment.getObjectives();
boolean hasObjectivesChange = newObjectives != null && !newObjectives.equals(oldObjectives);
NodeBeforeChangeEvent nce = new NodeBeforeChangeEvent();
if (hasTitleChange) {
nce.setNewTitle(newTitle);
}
if (hasObjectivesChange) {
nce.setNewObjectives(newObjectives);
}
if (hasTitleChange || hasObjectivesChange) {
// create a memento first
fireEvent(ureq, nce);
// then apply changes
assessment.setTitle(newTitle);
assessment.setObjectives(newObjectives);
}
//
if (!surveyMode && !restrictedEdit) {
// ordering
assessment.getSelection_ordering().setOrderType(ureq.getParameter("order_type"));
assessment.getSelection_ordering().setSelectionNumber(ureq.getParameter("selection_number"));
main.contextPut("order_type", assessment.getSelection_ordering().getOrderType());
main.contextPut("selection_number", String.valueOf(assessment.getSelection_ordering().getSelectionNumber()));
Control tmpControl = QTIEditHelper.getControl(assessment);
boolean oldInheritControls = assessment.isInheritControls();
boolean newInheritControls = ureq.getParameter("inheritswitch").equals("Yes");
assessment.setInheritControls(newInheritControls);
String feedbackswitchTmp = ureq.getParameter("feedbackswitch");
String hintswitchTmp = ureq.getParameter("hintswitch");
String solutionswitchTmp = ureq.getParameter("solutionswitch");
tmpControl.setSwitches(feedbackswitchTmp, hintswitchTmp, solutionswitchTmp);
if (tmpControl.getHint() != Control.CTRL_UNDEF || tmpControl.getHint() != Control.CTRL_UNDEF || tmpControl.getSolution() != Control.CTRL_UNDEF)
assessment.setInheritControls(true);
if (oldInheritControls && !newInheritControls) {
tmpControl.setSwitches(Control.CTRL_UNDEF, Control.CTRL_UNDEF, Control.CTRL_UNDEF);
assessment.setInheritControls(false);
}
OutcomesProcessing outcomesProcessing = assessment.getOutcomes_processing();
if (outcomesProcessing == null) {
// Create outcomes processing object if it doesn't already exist.
// Happens
// when creating a new assessment
outcomesProcessing = new OutcomesProcessing();
assessment.setOutcomes_processing(outcomesProcessing);
}
String cutval = ureq.getParameter(OutcomesProcessing.CUTVALUE);
try {
Float.parseFloat(cutval);
} catch (NumberFormatException nfe) {
cutval = "0.0";
this.showWarning("error.cutval");
}
outcomesProcessing.setField(OutcomesProcessing.CUTVALUE, cutval);
main.contextPut(OutcomesProcessing.CUTVALUE, cutval);
if (ureq.getParameter("duration").equals("Yes")) {
String durationMin = ureq.getParameter("duration_min");
String durationSec = ureq.getParameter("duration_sec");
try {
Integer.parseInt(durationMin);
int sec = Integer.parseInt(durationSec);
if (sec > 60)
throw new NumberFormatException();
} catch (NumberFormatException nfe) {
durationMin = "0";
durationSec = "0";
this.showWarning("error.duration");
}
Duration d = new Duration(durationMin, durationSec);
assessment.setDuration(d);
main.contextPut("duration", assessment.getDuration());
} else {
assessment.setDuration(null);
main.contextRemove("duration");
}
}
qtiPackage.serializeQTIDocument();
// refresh for removing dirty marking of button even if nothing changed
main.setDirty(true);
}
}
}
Aggregations