Search in sources :

Example 1 with IQRunController

use of org.olat.course.nodes.iq.IQRunController in project OpenOLAT by OpenOLAT.

the class IQSELFCourseNode method createNodeRunConstructionResult.

/**
 * @see org.olat.course.nodes.CourseNode#createNodeRunConstructionResult(org.olat.core.gui.UserRequest,
 *      org.olat.core.gui.control.WindowControl,
 *      org.olat.course.run.userview.UserCourseEnvironment,
 *      org.olat.course.run.userview.NodeEvaluation)
 */
@Override
public NodeRunConstructionResult createNodeRunConstructionResult(UserRequest ureq, WindowControl wControl, UserCourseEnvironment userCourseEnv, NodeEvaluation ne, String nodecmd) {
    Controller runController;
    ModuleConfiguration config = getModuleConfiguration();
    AssessmentManager am = userCourseEnv.getCourseEnvironment().getAssessmentManager();
    boolean onyx = IQEditController.CONFIG_VALUE_QTI2.equals(config.get(IQEditController.CONFIG_KEY_TYPE_QTI));
    if (onyx) {
        Translator trans = Util.createPackageTranslator(IQEditController.class, ureq.getLocale());
        runController = MessageUIFactory.createInfoMessage(ureq, wControl, "", trans.translate("error.onyx"));
    } else {
        RepositoryEntry testEntry = getReferencedRepositoryEntry();
        if (ImsQTI21Resource.TYPE_NAME.equals(testEntry.getOlatResource().getResourceableTypeName())) {
            runController = new QTI21AssessmentRunController(ureq, wControl, userCourseEnv, this);
        } else {
            IQSecurityCallback sec = new CourseIQSecurityCallback(this, am, ureq.getIdentity());
            runController = new IQRunController(userCourseEnv, getModuleConfiguration(), sec, ureq, wControl, this);
        }
    }
    Controller ctrl = TitledWrapperHelper.getWrapper(ureq, wControl, runController, this, "o_iqself_icon");
    return new NodeRunConstructionResult(ctrl);
}
Also used : QTI21AssessmentRunController(org.olat.course.nodes.iq.QTI21AssessmentRunController) ModuleConfiguration(org.olat.modules.ModuleConfiguration) CourseIQSecurityCallback(org.olat.course.nodes.iq.CourseIQSecurityCallback) IQRunController(org.olat.course.nodes.iq.IQRunController) Translator(org.olat.core.gui.translator.Translator) PackageTranslator(org.olat.core.gui.translator.PackageTranslator) AssessmentManager(org.olat.course.assessment.AssessmentManager) IQSecurityCallback(org.olat.modules.iq.IQSecurityCallback) CourseIQSecurityCallback(org.olat.course.nodes.iq.CourseIQSecurityCallback) RepositoryEntry(org.olat.repository.RepositoryEntry) QTI21AssessmentRunController(org.olat.course.nodes.iq.QTI21AssessmentRunController) IQEditController(org.olat.course.nodes.iq.IQEditController) NodeEditController(org.olat.course.editor.NodeEditController) TabbableController(org.olat.core.gui.control.generic.tabbable.TabbableController) Controller(org.olat.core.gui.control.Controller) IQRunController(org.olat.course.nodes.iq.IQRunController) NodeRunConstructionResult(org.olat.course.run.navigation.NodeRunConstructionResult)

Example 2 with IQRunController

use of org.olat.course.nodes.iq.IQRunController in project OpenOLAT by OpenOLAT.

the class IQTESTCourseNode method createNodeRunConstructionResult.

@Override
public NodeRunConstructionResult createNodeRunConstructionResult(UserRequest ureq, WindowControl wControl, UserCourseEnvironment userCourseEnv, NodeEvaluation ne, String nodecmd) {
    updateModuleConfigDefaults(false);
    Controller controller;
    // Do not allow guests to start tests
    Roles roles = ureq.getUserSession().getRoles();
    Translator trans = Util.createPackageTranslator(IQTESTCourseNode.class, ureq.getLocale());
    if (roles.isGuestOnly()) {
        if (isGuestAllowedForQTI21(getReferencedRepositoryEntry())) {
            controller = new QTI21AssessmentRunController(ureq, wControl, userCourseEnv, this);
        } else {
            String title = trans.translate("guestnoaccess.title");
            String message = trans.translate("guestnoaccess.message");
            controller = MessageUIFactory.createInfoMessage(ureq, wControl, title, message);
        }
    } else {
        ModuleConfiguration config = getModuleConfiguration();
        boolean onyx = IQEditController.CONFIG_VALUE_QTI2.equals(config.get(IQEditController.CONFIG_KEY_TYPE_QTI));
        if (onyx) {
            Translator transe = Util.createPackageTranslator(IQEditController.class, ureq.getLocale());
            controller = MessageUIFactory.createInfoMessage(ureq, wControl, "", transe.translate("error.onyx"));
        } else {
            RepositoryEntry testEntry = getReferencedRepositoryEntry();
            OLATResource ores = testEntry.getOlatResource();
            if (ImsQTI21Resource.TYPE_NAME.equals(ores.getResourceableTypeName())) {
                // QTI 2.1
                controller = new QTI21AssessmentRunController(ureq, wControl, userCourseEnv, this);
            } else {
                // QTI 1.2
                TestFileResource fr = new TestFileResource();
                fr.overrideResourceableId(ores.getResourceableId());
                if (!CoordinatorManager.getInstance().getCoordinator().getLocker().isLocked(fr, null)) {
                    AssessmentManager am = userCourseEnv.getCourseEnvironment().getAssessmentManager();
                    IQSecurityCallback sec = new CourseIQSecurityCallback(this, am, ureq.getIdentity());
                    controller = new IQRunController(userCourseEnv, getModuleConfiguration(), sec, ureq, wControl, this, testEntry);
                } else {
                    String title = trans.translate("editor.lock.title");
                    String message = trans.translate("editor.lock.message");
                    controller = MessageUIFactory.createInfoMessage(ureq, wControl, title, message);
                }
            }
        }
    }
    Controller ctrl = TitledWrapperHelper.getWrapper(ureq, wControl, controller, this, "o_iqtest_icon");
    return new NodeRunConstructionResult(ctrl);
}
Also used : QTI21AssessmentRunController(org.olat.course.nodes.iq.QTI21AssessmentRunController) ModuleConfiguration(org.olat.modules.ModuleConfiguration) CourseIQSecurityCallback(org.olat.course.nodes.iq.CourseIQSecurityCallback) IQRunController(org.olat.course.nodes.iq.IQRunController) AssessmentManager(org.olat.course.assessment.AssessmentManager) OLATResource(org.olat.resource.OLATResource) Roles(org.olat.core.id.Roles) RepositoryEntry(org.olat.repository.RepositoryEntry) QTI21AssessmentRunController(org.olat.course.nodes.iq.QTI21AssessmentRunController) IQIdentityListCourseNodeController(org.olat.course.nodes.iq.IQIdentityListCourseNodeController) IQRunController(org.olat.course.nodes.iq.IQRunController) QTI21AssessmentDetailsController(org.olat.ims.qti21.ui.QTI21AssessmentDetailsController) IQPreviewController(org.olat.course.nodes.iq.IQPreviewController) IQEditController(org.olat.course.nodes.iq.IQEditController) NodeEditController(org.olat.course.editor.NodeEditController) QTI12ResultDetailsController(org.olat.ims.qti.QTI12ResultDetailsController) TabbableController(org.olat.core.gui.control.generic.tabbable.TabbableController) AssessmentCourseNodeController(org.olat.course.assessment.ui.tool.AssessmentCourseNodeController) Controller(org.olat.core.gui.control.Controller) TestFileResource(org.olat.ims.qti.fileresource.TestFileResource) NodeRunConstructionResult(org.olat.course.run.navigation.NodeRunConstructionResult) Translator(org.olat.core.gui.translator.Translator) IQSecurityCallback(org.olat.modules.iq.IQSecurityCallback) CourseIQSecurityCallback(org.olat.course.nodes.iq.CourseIQSecurityCallback)

Example 3 with IQRunController

use of org.olat.course.nodes.iq.IQRunController in project openolat by klemens.

the class IQSURVCourseNode method createNodeRunConstructionResult.

/**
 * @see org.olat.course.nodes.CourseNode#createNodeRunConstructionResult(org.olat.core.gui.UserRequest,
 *      org.olat.core.gui.control.WindowControl,
 *      org.olat.course.run.userview.UserCourseEnvironment,
 *      org.olat.course.run.userview.NodeEvaluation)
 */
@Override
public NodeRunConstructionResult createNodeRunConstructionResult(UserRequest ureq, WindowControl wControl, UserCourseEnvironment userCourseEnv, NodeEvaluation ne, String nodecmd) {
    Controller controller;
    // Do not allow guests to start questionnaires
    Roles roles = ureq.getUserSession().getRoles();
    if (roles.isGuestOnly()) {
        Translator trans = Util.createPackageTranslator(IQSURVCourseNode.class, ureq.getLocale());
        String title = trans.translate("guestnoaccess.title");
        String message = trans.translate("guestnoaccess.message");
        controller = MessageUIFactory.createInfoMessage(ureq, wControl, title, message);
    } else {
        ModuleConfiguration config = getModuleConfiguration();
        boolean onyx = IQEditController.CONFIG_VALUE_QTI2.equals(config.get(IQEditController.CONFIG_KEY_TYPE_QTI));
        if (onyx) {
            Translator trans = Util.createPackageTranslator(IQEditController.class, ureq.getLocale());
            controller = MessageUIFactory.createInfoMessage(ureq, wControl, "", trans.translate("error.onyx"));
        } else {
            RepositoryEntry repositoryEntry = getReferencedRepositoryEntry();
            OLATResourceable ores = repositoryEntry.getOlatResource();
            Long resId = ores.getResourceableId();
            SurveyFileResource fr = new SurveyFileResource();
            fr.overrideResourceableId(resId);
            if (!CoordinatorManager.getInstance().getCoordinator().getLocker().isLocked(fr, null)) {
                AssessmentManager am = userCourseEnv.getCourseEnvironment().getAssessmentManager();
                IQSecurityCallback sec = new CourseIQSecurityCallback(this, am, ureq.getIdentity());
                controller = new IQRunController(userCourseEnv, getModuleConfiguration(), sec, ureq, wControl, this);
            } else {
                Translator trans = Util.createPackageTranslator(IQSURVCourseNode.class, ureq.getLocale());
                String title = trans.translate("editor.lock.title");
                String message = trans.translate("editor.lock.message");
                controller = MessageUIFactory.createInfoMessage(ureq, wControl, title, message);
            }
        }
    }
    Controller ctrl = TitledWrapperHelper.getWrapper(ureq, wControl, controller, this, "o_iqsurv_icon");
    return new NodeRunConstructionResult(ctrl);
}
Also used : ModuleConfiguration(org.olat.modules.ModuleConfiguration) CourseIQSecurityCallback(org.olat.course.nodes.iq.CourseIQSecurityCallback) IQRunController(org.olat.course.nodes.iq.IQRunController) OLATResourceable(org.olat.core.id.OLATResourceable) AssessmentManager(org.olat.course.assessment.AssessmentManager) Roles(org.olat.core.id.Roles) RepositoryEntry(org.olat.repository.RepositoryEntry) IQEditController(org.olat.course.nodes.iq.IQEditController) NodeEditController(org.olat.course.editor.NodeEditController) TabbableController(org.olat.core.gui.control.generic.tabbable.TabbableController) Controller(org.olat.core.gui.control.Controller) IQRunController(org.olat.course.nodes.iq.IQRunController) NodeRunConstructionResult(org.olat.course.run.navigation.NodeRunConstructionResult) SurveyFileResource(org.olat.ims.qti.fileresource.SurveyFileResource) Translator(org.olat.core.gui.translator.Translator) PackageTranslator(org.olat.core.gui.translator.PackageTranslator) IQSecurityCallback(org.olat.modules.iq.IQSecurityCallback) CourseIQSecurityCallback(org.olat.course.nodes.iq.CourseIQSecurityCallback)

Example 4 with IQRunController

use of org.olat.course.nodes.iq.IQRunController in project openolat by klemens.

the class IQSELFCourseNode method createNodeRunConstructionResult.

/**
 * @see org.olat.course.nodes.CourseNode#createNodeRunConstructionResult(org.olat.core.gui.UserRequest,
 *      org.olat.core.gui.control.WindowControl,
 *      org.olat.course.run.userview.UserCourseEnvironment,
 *      org.olat.course.run.userview.NodeEvaluation)
 */
@Override
public NodeRunConstructionResult createNodeRunConstructionResult(UserRequest ureq, WindowControl wControl, UserCourseEnvironment userCourseEnv, NodeEvaluation ne, String nodecmd) {
    Controller runController;
    ModuleConfiguration config = getModuleConfiguration();
    AssessmentManager am = userCourseEnv.getCourseEnvironment().getAssessmentManager();
    boolean onyx = IQEditController.CONFIG_VALUE_QTI2.equals(config.get(IQEditController.CONFIG_KEY_TYPE_QTI));
    if (onyx) {
        Translator trans = Util.createPackageTranslator(IQEditController.class, ureq.getLocale());
        runController = MessageUIFactory.createInfoMessage(ureq, wControl, "", trans.translate("error.onyx"));
    } else {
        RepositoryEntry testEntry = getReferencedRepositoryEntry();
        if (ImsQTI21Resource.TYPE_NAME.equals(testEntry.getOlatResource().getResourceableTypeName())) {
            runController = new QTI21AssessmentRunController(ureq, wControl, userCourseEnv, this);
        } else {
            IQSecurityCallback sec = new CourseIQSecurityCallback(this, am, ureq.getIdentity());
            runController = new IQRunController(userCourseEnv, getModuleConfiguration(), sec, ureq, wControl, this);
        }
    }
    Controller ctrl = TitledWrapperHelper.getWrapper(ureq, wControl, runController, this, "o_iqself_icon");
    return new NodeRunConstructionResult(ctrl);
}
Also used : QTI21AssessmentRunController(org.olat.course.nodes.iq.QTI21AssessmentRunController) ModuleConfiguration(org.olat.modules.ModuleConfiguration) CourseIQSecurityCallback(org.olat.course.nodes.iq.CourseIQSecurityCallback) IQRunController(org.olat.course.nodes.iq.IQRunController) Translator(org.olat.core.gui.translator.Translator) PackageTranslator(org.olat.core.gui.translator.PackageTranslator) AssessmentManager(org.olat.course.assessment.AssessmentManager) IQSecurityCallback(org.olat.modules.iq.IQSecurityCallback) CourseIQSecurityCallback(org.olat.course.nodes.iq.CourseIQSecurityCallback) RepositoryEntry(org.olat.repository.RepositoryEntry) QTI21AssessmentRunController(org.olat.course.nodes.iq.QTI21AssessmentRunController) IQEditController(org.olat.course.nodes.iq.IQEditController) NodeEditController(org.olat.course.editor.NodeEditController) TabbableController(org.olat.core.gui.control.generic.tabbable.TabbableController) Controller(org.olat.core.gui.control.Controller) IQRunController(org.olat.course.nodes.iq.IQRunController) NodeRunConstructionResult(org.olat.course.run.navigation.NodeRunConstructionResult)

Example 5 with IQRunController

use of org.olat.course.nodes.iq.IQRunController in project OpenOLAT by OpenOLAT.

the class IQSURVCourseNode method createNodeRunConstructionResult.

/**
 * @see org.olat.course.nodes.CourseNode#createNodeRunConstructionResult(org.olat.core.gui.UserRequest,
 *      org.olat.core.gui.control.WindowControl,
 *      org.olat.course.run.userview.UserCourseEnvironment,
 *      org.olat.course.run.userview.NodeEvaluation)
 */
@Override
public NodeRunConstructionResult createNodeRunConstructionResult(UserRequest ureq, WindowControl wControl, UserCourseEnvironment userCourseEnv, NodeEvaluation ne, String nodecmd) {
    Controller controller;
    // Do not allow guests to start questionnaires
    Roles roles = ureq.getUserSession().getRoles();
    if (roles.isGuestOnly()) {
        Translator trans = Util.createPackageTranslator(IQSURVCourseNode.class, ureq.getLocale());
        String title = trans.translate("guestnoaccess.title");
        String message = trans.translate("guestnoaccess.message");
        controller = MessageUIFactory.createInfoMessage(ureq, wControl, title, message);
    } else {
        ModuleConfiguration config = getModuleConfiguration();
        boolean onyx = IQEditController.CONFIG_VALUE_QTI2.equals(config.get(IQEditController.CONFIG_KEY_TYPE_QTI));
        if (onyx) {
            Translator trans = Util.createPackageTranslator(IQEditController.class, ureq.getLocale());
            controller = MessageUIFactory.createInfoMessage(ureq, wControl, "", trans.translate("error.onyx"));
        } else {
            RepositoryEntry repositoryEntry = getReferencedRepositoryEntry();
            OLATResourceable ores = repositoryEntry.getOlatResource();
            Long resId = ores.getResourceableId();
            SurveyFileResource fr = new SurveyFileResource();
            fr.overrideResourceableId(resId);
            if (!CoordinatorManager.getInstance().getCoordinator().getLocker().isLocked(fr, null)) {
                AssessmentManager am = userCourseEnv.getCourseEnvironment().getAssessmentManager();
                IQSecurityCallback sec = new CourseIQSecurityCallback(this, am, ureq.getIdentity());
                controller = new IQRunController(userCourseEnv, getModuleConfiguration(), sec, ureq, wControl, this);
            } else {
                Translator trans = Util.createPackageTranslator(IQSURVCourseNode.class, ureq.getLocale());
                String title = trans.translate("editor.lock.title");
                String message = trans.translate("editor.lock.message");
                controller = MessageUIFactory.createInfoMessage(ureq, wControl, title, message);
            }
        }
    }
    Controller ctrl = TitledWrapperHelper.getWrapper(ureq, wControl, controller, this, "o_iqsurv_icon");
    return new NodeRunConstructionResult(ctrl);
}
Also used : ModuleConfiguration(org.olat.modules.ModuleConfiguration) CourseIQSecurityCallback(org.olat.course.nodes.iq.CourseIQSecurityCallback) IQRunController(org.olat.course.nodes.iq.IQRunController) OLATResourceable(org.olat.core.id.OLATResourceable) AssessmentManager(org.olat.course.assessment.AssessmentManager) Roles(org.olat.core.id.Roles) RepositoryEntry(org.olat.repository.RepositoryEntry) IQEditController(org.olat.course.nodes.iq.IQEditController) NodeEditController(org.olat.course.editor.NodeEditController) TabbableController(org.olat.core.gui.control.generic.tabbable.TabbableController) Controller(org.olat.core.gui.control.Controller) IQRunController(org.olat.course.nodes.iq.IQRunController) NodeRunConstructionResult(org.olat.course.run.navigation.NodeRunConstructionResult) SurveyFileResource(org.olat.ims.qti.fileresource.SurveyFileResource) Translator(org.olat.core.gui.translator.Translator) PackageTranslator(org.olat.core.gui.translator.PackageTranslator) IQSecurityCallback(org.olat.modules.iq.IQSecurityCallback) CourseIQSecurityCallback(org.olat.course.nodes.iq.CourseIQSecurityCallback)

Aggregations

Controller (org.olat.core.gui.control.Controller)6 TabbableController (org.olat.core.gui.control.generic.tabbable.TabbableController)6 Translator (org.olat.core.gui.translator.Translator)6 AssessmentManager (org.olat.course.assessment.AssessmentManager)6 NodeEditController (org.olat.course.editor.NodeEditController)6 CourseIQSecurityCallback (org.olat.course.nodes.iq.CourseIQSecurityCallback)6 IQEditController (org.olat.course.nodes.iq.IQEditController)6 IQRunController (org.olat.course.nodes.iq.IQRunController)6 NodeRunConstructionResult (org.olat.course.run.navigation.NodeRunConstructionResult)6 ModuleConfiguration (org.olat.modules.ModuleConfiguration)6 IQSecurityCallback (org.olat.modules.iq.IQSecurityCallback)6 RepositoryEntry (org.olat.repository.RepositoryEntry)6 PackageTranslator (org.olat.core.gui.translator.PackageTranslator)4 Roles (org.olat.core.id.Roles)4 QTI21AssessmentRunController (org.olat.course.nodes.iq.QTI21AssessmentRunController)4 OLATResourceable (org.olat.core.id.OLATResourceable)2 AssessmentCourseNodeController (org.olat.course.assessment.ui.tool.AssessmentCourseNodeController)2 IQIdentityListCourseNodeController (org.olat.course.nodes.iq.IQIdentityListCourseNodeController)2 IQPreviewController (org.olat.course.nodes.iq.IQPreviewController)2 QTI12ResultDetailsController (org.olat.ims.qti.QTI12ResultDetailsController)2