Search in sources :

Example 11 with HotspotInteraction

use of uk.ac.ed.ph.jqtiplus.node.item.interaction.HotspotInteraction in project openolat by klemens.

the class AssessmentObjectVelocityRenderDecorator method isSingleChoice.

/**
 * Check the maxChoices and the cardinality
 * @param interaction
 * @return
 */
public boolean isSingleChoice(Interaction interaction) {
    if (interaction instanceof ChoiceInteraction) {
        ChoiceInteraction choiceInteraction = (ChoiceInteraction) interaction;
        boolean sc = choiceInteraction.getMaxChoices() == 1;
        ResponseDeclaration responseDeclaration = assessmentItem.getResponseDeclaration(choiceInteraction.getResponseIdentifier());
        if (responseDeclaration != null && responseDeclaration.hasCardinality(Cardinality.MULTIPLE)) {
            return false;
        }
        return sc;
    } else if (interaction instanceof HottextInteraction) {
        HottextInteraction hottextInteraction = (HottextInteraction) interaction;
        boolean sc = hottextInteraction.getMaxChoices() == 1;
        ResponseDeclaration responseDeclaration = assessmentItem.getResponseDeclaration(hottextInteraction.getResponseIdentifier());
        if (responseDeclaration != null && responseDeclaration.hasCardinality(Cardinality.MULTIPLE)) {
            return false;
        }
        return sc;
    } else if (interaction instanceof HotspotInteraction) {
        HotspotInteraction hotspotInteraction = (HotspotInteraction) interaction;
        ResponseDeclaration responseDeclaration = assessmentItem.getResponseDeclaration(hotspotInteraction.getResponseIdentifier());
        if (responseDeclaration != null && responseDeclaration.hasCardinality(Cardinality.SINGLE)) {
            return true;
        }
        return false;
    }
    return false;
}
Also used : HotspotInteraction(uk.ac.ed.ph.jqtiplus.node.item.interaction.HotspotInteraction) InlineChoiceInteraction(uk.ac.ed.ph.jqtiplus.node.item.interaction.InlineChoiceInteraction) ChoiceInteraction(uk.ac.ed.ph.jqtiplus.node.item.interaction.ChoiceInteraction) HottextInteraction(uk.ac.ed.ph.jqtiplus.node.item.interaction.HottextInteraction) ResponseDeclaration(uk.ac.ed.ph.jqtiplus.node.item.response.declaration.ResponseDeclaration)

Example 12 with HotspotInteraction

use of uk.ac.ed.ph.jqtiplus.node.item.interaction.HotspotInteraction in project openolat by klemens.

the class QTI21AssessmentItemStatisticsController method interactionControllerFactory.

private Component interactionControllerFactory(UserRequest ureq, Interaction interaction, StatisticsItem itemStats) {
    Controller interactionCtrl = null;
    if (interaction instanceof ChoiceInteraction) {
        interactionCtrl = new SimpleChoiceInteractionStatisticsController(ureq, getWindowControl(), itemRef, item, (ChoiceInteraction) interaction, itemStats, resourceResult);
    } else if (interaction instanceof MatchInteraction) {
        String responseIdentifier = interaction.getResponseIdentifier().toString();
        if (responseIdentifier.startsWith("KPRIM_") || QTI21QuestionType.hasClass(interaction, QTI21Constants.CSS_MATCH_KPRIM)) {
            interactionCtrl = new KPrimStatisticsController(ureq, getWindowControl(), itemRef, item, (MatchInteraction) interaction, resourceResult);
        } else {
            interactionCtrl = new MatchStatisticsController(ureq, getWindowControl(), itemRef, item, (MatchInteraction) interaction, resourceResult);
        }
    } else if (interaction instanceof HotspotInteraction) {
        interactionCtrl = new HotspotInteractionStatisticsController(ureq, getWindowControl(), itemRef, item, (HotspotInteraction) interaction, itemStats, resourceResult);
    } else if (interaction instanceof HottextInteraction) {
        interactionCtrl = new HottextInteractionStatisticsController(ureq, getWindowControl(), itemRef, item, (HottextInteraction) interaction, itemStats, resourceResult);
    }
    if (interactionCtrl == null) {
        interactionCtrl = new UnsupportedInteractionController(ureq, getWindowControl(), interaction);
    }
    listenTo(interactionCtrl);
    return interactionCtrl.getInitialComponent();
}
Also used : MatchInteraction(uk.ac.ed.ph.jqtiplus.node.item.interaction.MatchInteraction) KPrimStatisticsController(org.olat.ims.qti21.ui.statistics.interactions.KPrimStatisticsController) HotspotInteraction(uk.ac.ed.ph.jqtiplus.node.item.interaction.HotspotInteraction) HottextInteractionStatisticsController(org.olat.ims.qti21.ui.statistics.interactions.HottextInteractionStatisticsController) ChoiceInteraction(uk.ac.ed.ph.jqtiplus.node.item.interaction.ChoiceInteraction) SimpleChoiceInteractionStatisticsController(org.olat.ims.qti21.ui.statistics.interactions.SimpleChoiceInteractionStatisticsController) HottextInteraction(uk.ac.ed.ph.jqtiplus.node.item.interaction.HottextInteraction) MatchStatisticsController(org.olat.ims.qti21.ui.statistics.interactions.MatchStatisticsController) UnsupportedInteractionController(org.olat.ims.qti21.ui.statistics.interactions.UnsupportedInteractionController) TextEntryInteractionsStatisticsController(org.olat.ims.qti21.ui.statistics.interactions.TextEntryInteractionsStatisticsController) HotspotInteractionStatisticsController(org.olat.ims.qti21.ui.statistics.interactions.HotspotInteractionStatisticsController) MatchStatisticsController(org.olat.ims.qti21.ui.statistics.interactions.MatchStatisticsController) UserFilterController(org.olat.modules.assessment.ui.UserFilterController) SimpleChoiceInteractionStatisticsController(org.olat.ims.qti21.ui.statistics.interactions.SimpleChoiceInteractionStatisticsController) KPrimStatisticsController(org.olat.ims.qti21.ui.statistics.interactions.KPrimStatisticsController) HottextInteractionStatisticsController(org.olat.ims.qti21.ui.statistics.interactions.HottextInteractionStatisticsController) Controller(org.olat.core.gui.control.Controller) BasicController(org.olat.core.gui.control.controller.BasicController) UnsupportedInteractionController(org.olat.ims.qti21.ui.statistics.interactions.UnsupportedInteractionController) HotspotInteractionStatisticsController(org.olat.ims.qti21.ui.statistics.interactions.HotspotInteractionStatisticsController)

Aggregations

HotspotInteraction (uk.ac.ed.ph.jqtiplus.node.item.interaction.HotspotInteraction)12 ChoiceInteraction (uk.ac.ed.ph.jqtiplus.node.item.interaction.ChoiceInteraction)6 ArrayList (java.util.ArrayList)4 AssessmentItemFactory.appendHotspotInteraction (org.olat.ims.qti21.model.xml.AssessmentItemFactory.appendHotspotInteraction)4 Block (uk.ac.ed.ph.jqtiplus.node.content.basic.Block)4 HottextInteraction (uk.ac.ed.ph.jqtiplus.node.item.interaction.HottextInteraction)4 MatchInteraction (uk.ac.ed.ph.jqtiplus.node.item.interaction.MatchInteraction)4 ResponseDeclaration (uk.ac.ed.ph.jqtiplus.node.item.response.declaration.ResponseDeclaration)4 IOException (java.io.IOException)2 Test (org.junit.Test)2 Controller (org.olat.core.gui.control.Controller)2 BasicController (org.olat.core.gui.control.controller.BasicController)2 StringOutput (org.olat.core.gui.render.StringOutput)2 HotspotAssessmentItemBuilder (org.olat.ims.qti21.model.xml.interactions.HotspotAssessmentItemBuilder)2 HotspotInteractionStatisticsController (org.olat.ims.qti21.ui.statistics.interactions.HotspotInteractionStatisticsController)2 HottextInteractionStatisticsController (org.olat.ims.qti21.ui.statistics.interactions.HottextInteractionStatisticsController)2 KPrimStatisticsController (org.olat.ims.qti21.ui.statistics.interactions.KPrimStatisticsController)2 MatchStatisticsController (org.olat.ims.qti21.ui.statistics.interactions.MatchStatisticsController)2 SimpleChoiceInteractionStatisticsController (org.olat.ims.qti21.ui.statistics.interactions.SimpleChoiceInteractionStatisticsController)2 TextEntryInteractionsStatisticsController (org.olat.ims.qti21.ui.statistics.interactions.TextEntryInteractionsStatisticsController)2