Search in sources :

Example 1 with QTI21QuestionType

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;
}
Also used : BadResourceException(uk.ac.ed.ph.jqtiplus.provision.BadResourceException) GenericTreeNode(org.olat.core.gui.components.tree.GenericTreeNode) ResolvedAssessmentItem(uk.ac.ed.ph.jqtiplus.resolution.ResolvedAssessmentItem) QTI21QuestionType(org.olat.ims.qti21.model.QTI21QuestionType) ResolvedAssessmentItem(uk.ac.ed.ph.jqtiplus.resolution.ResolvedAssessmentItem) AssessmentItem(uk.ac.ed.ph.jqtiplus.node.item.AssessmentItem)

Example 2 with QTI21QuestionType

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;
}
Also used : BadResourceException(uk.ac.ed.ph.jqtiplus.provision.BadResourceException) GenericTreeNode(org.olat.core.gui.components.tree.GenericTreeNode) ResolvedAssessmentItem(uk.ac.ed.ph.jqtiplus.resolution.ResolvedAssessmentItem) QTI21QuestionType(org.olat.ims.qti21.model.QTI21QuestionType) ResolvedAssessmentItem(uk.ac.ed.ph.jqtiplus.resolution.ResolvedAssessmentItem) AssessmentItem(uk.ac.ed.ph.jqtiplus.node.item.AssessmentItem)

Example 3 with QTI21QuestionType

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);
}
Also used : FormLayoutContainer(org.olat.core.gui.components.form.flexible.impl.FormLayoutContainer) QTI21QuestionType(org.olat.ims.qti21.model.QTI21QuestionType)

Example 4 with QTI21QuestionType

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());
}
Also used : QTIMetadataConverter(org.olat.ims.qti.qpool.QTIMetadataConverter) TaxonomyLevel(org.olat.modules.taxonomy.TaxonomyLevel) QTI21QuestionType(org.olat.ims.qti21.model.QTI21QuestionType) QEducationalContext(org.olat.modules.qpool.model.QEducationalContext) QItemType(org.olat.modules.qpool.model.QItemType)

Example 5 with QTI21QuestionType

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);
    }
}
Also used : QTI21QuestionType(org.olat.ims.qti21.model.QTI21QuestionType)

Aggregations

QTI21QuestionType (org.olat.ims.qti21.model.QTI21QuestionType)20 AssessmentItem (uk.ac.ed.ph.jqtiplus.node.item.AssessmentItem)12 ResolvedAssessmentItem (uk.ac.ed.ph.jqtiplus.resolution.ResolvedAssessmentItem)12 GenericTreeNode (org.olat.core.gui.components.tree.GenericTreeNode)6 File (java.io.File)4 FIBAssessmentItemBuilder (org.olat.ims.qti21.model.xml.interactions.FIBAssessmentItemBuilder)4 AssessmentItemRef (uk.ac.ed.ph.jqtiplus.node.test.AssessmentItemRef)4 BadResourceException (uk.ac.ed.ph.jqtiplus.provision.BadResourceException)4 FileOutputStream (java.io.FileOutputStream)2 IOException (java.io.IOException)2 OutputStream (java.io.OutputStream)2 URI (java.net.URI)2 URISyntaxException (java.net.URISyntaxException)2 FormLayoutContainer (org.olat.core.gui.components.form.flexible.impl.FormLayoutContainer)2 TreeNode (org.olat.core.gui.components.tree.TreeNode)2 Translator (org.olat.core.gui.translator.Translator)2 AssertException (org.olat.core.logging.AssertException)2 LocalImpl (org.olat.core.util.vfs.LocalImpl)2 VFSContainer (org.olat.core.util.vfs.VFSContainer)2 VFSLeaf (org.olat.core.util.vfs.VFSLeaf)2