use of org.olat.ims.qti.container.HttpItemInput in project OpenOLAT by OpenOLAT.
the class CourseAssessmentWebService method convertToHttpItemInput.
private Map<String, ItemInput> convertToHttpItemInput(Map<Long, String> results) {
Map<String, ItemInput> datas = new HashMap<String, ItemInput>();
for (Long key : results.keySet()) {
HttpItemInput iip = new HttpItemInput(results.get(key));
iip.putSingle(key.toString(), results.get(key));
// TODO somehow obtain answer from value
datas.put(iip.getIdent(), iip);
}
return datas;
}
use of org.olat.ims.qti.container.HttpItemInput in project OpenOLAT by OpenOLAT.
the class IQManager method getItemsInput.
/**
* Extract item inputs from http request
*
* @param ureq The request to extract item responses from.
* @return ItemsInput
*/
public ItemsInput getItemsInput(UserRequest ureq) {
ItemsInput result = new ItemsInput();
Enumeration<String> params = ureq.getHttpReq().getParameterNames();
while (params.hasMoreElements()) {
String paramKey = params.nextElement();
StringTokenizer st = new StringTokenizer(paramKey, "§", false);
String value = ureq.getParameter(paramKey);
if (st.countTokens() == 4) {
String itemType = st.nextToken();
String itemIdent = st.nextToken();
String responseID = st.nextToken();
HttpItemInput itemInput = (HttpItemInput) result.getItemInput(itemIdent);
if (itemInput == null) {
itemInput = new HttpItemInput(itemIdent);
result.addItemInput(itemInput);
}
// all items. it does not provide any response data
if (itemType.equals("qti"))
itemInput.putSingle(responseID, value);
}
// refactoring to new setFormDirty() javascript method sends now an additional param "olat_fosm" which has no tokens inside
// so assertExc. is useless.
// else {
// throw new AssertException ("not 4 tokens in form name: orig='"+paramKey+"'");
// }
// <input id="QTI_1098869464495" type="checkbox"
// name="qti§QTIEDIT:MCQ:1098869464490§1098869464492§1098869464495" ....
}
return result;
}
use of org.olat.ims.qti.container.HttpItemInput in project openolat by klemens.
the class IQManager method getItemsInput.
/**
* Extract item inputs from http request
*
* @param ureq The request to extract item responses from.
* @return ItemsInput
*/
public ItemsInput getItemsInput(UserRequest ureq) {
ItemsInput result = new ItemsInput();
Enumeration<String> params = ureq.getHttpReq().getParameterNames();
while (params.hasMoreElements()) {
String paramKey = params.nextElement();
StringTokenizer st = new StringTokenizer(paramKey, "§", false);
String value = ureq.getParameter(paramKey);
if (st.countTokens() == 4) {
String itemType = st.nextToken();
String itemIdent = st.nextToken();
String responseID = st.nextToken();
HttpItemInput itemInput = (HttpItemInput) result.getItemInput(itemIdent);
if (itemInput == null) {
itemInput = new HttpItemInput(itemIdent);
result.addItemInput(itemInput);
}
// all items. it does not provide any response data
if (itemType.equals("qti"))
itemInput.putSingle(responseID, value);
}
// refactoring to new setFormDirty() javascript method sends now an additional param "olat_fosm" which has no tokens inside
// so assertExc. is useless.
// else {
// throw new AssertException ("not 4 tokens in form name: orig='"+paramKey+"'");
// }
// <input id="QTI_1098869464495" type="checkbox"
// name="qti§QTIEDIT:MCQ:1098869464490§1098869464492§1098869464495" ....
}
return result;
}
use of org.olat.ims.qti.container.HttpItemInput in project openolat by klemens.
the class CourseAssessmentWebService method convertToHttpItemInput.
private Map<String, ItemInput> convertToHttpItemInput(Map<Long, String> results) {
Map<String, ItemInput> datas = new HashMap<String, ItemInput>();
for (Long key : results.keySet()) {
HttpItemInput iip = new HttpItemInput(results.get(key));
iip.putSingle(key.toString(), results.get(key));
// TODO somehow obtain answer from value
datas.put(iip.getIdent(), iip);
}
return datas;
}
Aggregations