use of org.olat.ims.qti21.model.QTI21QuestionType in project OpenOLAT by OpenOLAT.
the class QTI21StatisticResourceResult method buildRecursively.
private TreeNode buildRecursively(AssessmentItemRef itemRef, TreeNode parentNode) {
GenericTreeNode itemNode = new GenericTreeNode();
ResolvedAssessmentItem resolvedAssessmentItem = resolvedAssessmentTest.getResolvedAssessmentItem(itemRef);
BadResourceException ex = resolvedAssessmentItem.getItemLookup().getBadResourceException();
if (ex == null) {
AssessmentItem assessmentItem = resolvedAssessmentItem.getItemLookup().getRootNodeHolder().getRootNode();
itemNode.setTitle(assessmentItem.getTitle());
QTI21QuestionType type = QTI21QuestionType.getTypeRelax(assessmentItem);
if (type != null) {
itemNode.setIconCssClass("o_icon ".concat(type.getCssClass()));
} else {
itemNode.setIconCssClass("o_icon o_mi_qtiunkown");
}
itemNode.setUserObject(itemRef);
parentNode.addChild(itemNode);
}
return itemNode;
}
use of org.olat.ims.qti21.model.QTI21QuestionType in project OpenOLAT by OpenOLAT.
the class AssessmentTestEditorAndComposerTreeModel method buildRecursively.
private TreeNode buildRecursively(AssessmentItemRef itemRef, TreeNode parentNode) {
GenericTreeNode itemNode = new GenericTreeNode(itemRef.getIdentifier().toString());
ResolvedAssessmentItem resolvedAssessmentItem = resolvedAssessmentTest.getResolvedAssessmentItem(itemRef);
if (resolvedAssessmentItem == null || resolvedAssessmentItem.getItemLookup() == null || resolvedAssessmentItem.getItemLookup().getRootNodeHolder() == null) {
itemNode.setTitle("ERROR - Not found");
itemNode.setIconCssClass("o_icon o_icon_error");
itemNode.setUserObject(itemRef);
parentNode.addChild(itemNode);
} else {
BadResourceException ex = resolvedAssessmentItem.getItemLookup().getBadResourceException();
if (ex != null) {
itemNode.setTitle("ERROR");
itemNode.setIconCssClass("o_icon o_icon_error");
itemNode.setUserObject(itemRef);
parentNode.addChild(itemNode);
} else {
AssessmentItem assessmentItem = resolvedAssessmentItem.getItemLookup().getRootNodeHolder().getRootNode();
itemNode.setTitle(assessmentItem.getTitle());
QTI21QuestionType type = QTI21QuestionType.getType(assessmentItem);
if (type != null) {
itemNode.setIconCssClass("o_icon ".concat(type.getCssClass()));
} else {
itemNode.setIconCssClass("o_icon o_mi_qtiunkown");
}
itemNode.setUserObject(itemRef);
parentNode.addChild(itemNode);
}
}
return itemNode;
}
use of org.olat.ims.qti21.model.QTI21QuestionType in project OpenOLAT by OpenOLAT.
the class UnkownItemConversionConfirmationController method initForm.
@Override
protected void initForm(FormItemContainer formLayout, Controller listener, UserRequest ureq) {
if (formLayout instanceof FormLayoutContainer) {
FormLayoutContainer layoutCont = (FormLayoutContainer) formLayout;
layoutCont.contextPut("warnings", report.getWarnings());
layoutCont.contextPut("questionType", translate("new." + report.getType().name()));
}
if (report.getAlternatives().size() > 0) {
String[] theKeys = new String[report.getAlternatives().size()];
String[] theValues = new String[theKeys.length];
for (int i = 0; i < report.getAlternatives().size(); i++) {
QTI21QuestionType alternative = report.getAlternatives().get(i);
theKeys[i] = alternative.name();
theValues[i] = translate("new." + alternative.name());
}
alternativeEl = uifactory.addDropdownSingleselect("questions.alternative", formLayout, theKeys, theValues, null);
alternativeEl.setDomReplacementWrapperRequired(false);
}
uifactory.addFormCancelButton("cancel", formLayout, ureq, getWindowControl());
uifactory.addFormSubmitButton("convert", formLayout);
}
use of org.olat.ims.qti21.model.QTI21QuestionType in project OpenOLAT by OpenOLAT.
the class QTI21ImportProcessor method processItemMetadata.
// additionalInformations, assessmentType
protected void processItemMetadata(QuestionItemImpl poolItem, AssessmentItemMetadata metadata) {
// non heuristic set of question type
String typeStr = null;
QTI21QuestionType questionType = metadata.getQuestionType();
if (questionType != null && questionType.getPoolQuestionType() != null) {
typeStr = questionType.getPoolQuestionType().name();
}
if (typeStr != null) {
QItemType type = qItemTypeDao.loadByType(typeStr);
if (type != null) {
poolItem.setType(type);
}
}
String coverage = metadata.getCoverage();
if (StringHelper.containsNonWhitespace(coverage)) {
poolItem.setCoverage(coverage);
}
String language = metadata.getLanguage();
if (StringHelper.containsNonWhitespace(language)) {
poolItem.setLanguage(language);
}
String keywords = metadata.getKeywords();
if (StringHelper.containsNonWhitespace(keywords)) {
poolItem.setKeywords(keywords);
}
String taxonomyPath = metadata.getTaxonomyPath();
if (StringHelper.containsNonWhitespace(taxonomyPath)) {
QTIMetadataConverter converter = new QTIMetadataConverter(qItemTypeDao, qEduContextDao, qpoolService);
TaxonomyLevel taxonomyLevel = converter.toTaxonomy(taxonomyPath);
poolItem.setTaxonomyLevel(taxonomyLevel);
}
// educational
String level = metadata.getLevel();
if (StringHelper.containsNonWhitespace(level)) {
QTIMetadataConverter converter = new QTIMetadataConverter(qItemTypeDao, qEduContextDao, qpoolService);
QEducationalContext educationalContext = converter.toEducationalContext(level);
poolItem.setEducationalContext(educationalContext);
}
String time = metadata.getTypicalLearningTime();
if (StringHelper.containsNonWhitespace(time)) {
poolItem.setEducationalLearningTime(time);
}
String editor = metadata.getEditor();
if (StringHelper.containsNonWhitespace(editor)) {
poolItem.setEditor(editor);
}
String editorVersion = metadata.getEditorVersion();
if (StringHelper.containsNonWhitespace(editorVersion)) {
poolItem.setEditorVersion(editorVersion);
}
// OpenOLAT
poolItem.setDifficulty(metadata.getDifficulty());
poolItem.setDifferentiation(metadata.getDifferentiation());
poolItem.setStdevDifficulty(metadata.getStdevDifficulty());
int numOfAnswerAlternatives = metadata.getNumOfAnswerAlternatives();
if (numOfAnswerAlternatives > 0) {
poolItem.setNumOfAnswerAlternatives(numOfAnswerAlternatives);
}
poolItem.setTopic(metadata.getTopic());
poolItem.setAssessmentType(metadata.getAssessmentType());
poolItem.setAdditionalInformations(metadata.getAdditionalInformations());
}
use of org.olat.ims.qti21.model.QTI21QuestionType in project OpenOLAT by OpenOLAT.
the class AlienItemAnalyzer method analyze.
public Report analyze() {
try {
// processing are quiet large.
if (item.getToolName() != null && "TAO".equalsIgnoreCase(item.getToolName())) {
return new Report(QTI21QuestionType.unkown, true);
}
QTI21QuestionType type = QTI21QuestionType.getTypeRelax(item);
Report report = new Report(type);
checkTemplateProcessing(report);
checkFeedback(report);
checkItemBody(report);
checkCustomOperator(report);
checkKprim(report);
return report;
} catch (Exception e) {
log.error("", e);
return new Report(QTI21QuestionType.unkown, true);
}
}
Aggregations