Search in sources :

Example 56 with AssessmentManager

use of org.olat.course.assessment.AssessmentManager 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 57 with AssessmentManager

use of org.olat.course.assessment.AssessmentManager in project OpenOLAT by OpenOLAT.

the class IQTESTCourseNode method removeIndividualAssessmentDocument.

@Override
public void removeIndividualAssessmentDocument(File document, UserCourseEnvironment userCourseEnvironment, Identity coachingIdentity) {
    if (document != null) {
        AssessmentManager am = userCourseEnvironment.getCourseEnvironment().getAssessmentManager();
        Identity assessedIdentity = userCourseEnvironment.getIdentityEnvironment().getIdentity();
        am.removeIndividualAssessmentDocument(this, coachingIdentity, assessedIdentity, document);
    }
}
Also used : AssessmentManager(org.olat.course.assessment.AssessmentManager) Identity(org.olat.core.id.Identity)

Example 58 with AssessmentManager

use of org.olat.course.assessment.AssessmentManager in project OpenOLAT by OpenOLAT.

the class IQTESTCourseNode method getUserCoachComment.

/**
 * @see org.olat.course.nodes.AssessableCourseNode#getUserCoachComment(org.olat.course.run.userview.UserCourseEnvironment)
 */
@Override
public String getUserCoachComment(UserCourseEnvironment userCourseEnvironment) {
    AssessmentManager am = userCourseEnvironment.getCourseEnvironment().getAssessmentManager();
    Identity mySelf = userCourseEnvironment.getIdentityEnvironment().getIdentity();
    return am.getNodeCoachComment(this, mySelf);
}
Also used : AssessmentManager(org.olat.course.assessment.AssessmentManager) Identity(org.olat.core.id.Identity)

Example 59 with AssessmentManager

use of org.olat.course.assessment.AssessmentManager in project OpenOLAT by OpenOLAT.

the class GetAttemptsFunction method call.

/**
 * @see com.neemsoft.jmep.FunctionCB#call(java.lang.Object[])
 */
@Override
public Object call(Object[] inStack) {
    /*
		 * argument check
		 */
    if (inStack.length > 1) {
        return handleException(new ArgumentParseException(ArgumentParseException.NEEDS_FEWER_ARGUMENTS, name, "", "error.fewerargs", "solution.provideone.nodereference"));
    } else if (inStack.length < 1) {
        return handleException(new ArgumentParseException(ArgumentParseException.NEEDS_MORE_ARGUMENTS, name, "", "error.moreargs", "solution.provideone.nodereference"));
    }
    /*
		 * argument type check
		 */
    if (!(inStack[0] instanceof String))
        return handleException(new ArgumentParseException(ArgumentParseException.WRONG_ARGUMENT_FORMAT, name, "", "error.argtype.coursnodeidexpeted", "solution.example.node.infunction"));
    String nodeId = (String) inStack[0];
    /*
		 * check reference integrity
		 */
    CourseEditorEnv cev = getUserCourseEnv().getCourseEditorEnv();
    if (cev != null) {
        if (!cev.existsNode(nodeId)) {
            return handleException(new ArgumentParseException(ArgumentParseException.REFERENCE_NOT_FOUND, name, nodeId, "error.notfound.coursenodeid", "solution.copypastenodeid"));
        }
        // Allow self-referencing but do not allow dependencies to parents as they create cycles.
        if (!nodeId.equals(cev.getCurrentCourseNodeId())) {
            cev.addSoftReference("courseNodeId", nodeId, false);
        }
        // return a valid value to continue with condition evaluation test
        return defaultValue();
    }
    /*
		 * the real function evaluation which is used during run time
		 */
    CourseNode node = getUserCourseEnv().getCourseEnvironment().getRunStructure().getNode(nodeId);
    AssessmentManager am = getUserCourseEnv().getCourseEnvironment().getAssessmentManager();
    Identity identity = getUserCourseEnv().getIdentityEnvironment().getIdentity();
    return am.getNodeAttempts(node, identity);
}
Also used : CourseEditorEnv(org.olat.course.editor.CourseEditorEnv) AssessmentManager(org.olat.course.assessment.AssessmentManager) CourseNode(org.olat.course.nodes.CourseNode) Identity(org.olat.core.id.Identity)

Example 60 with AssessmentManager

use of org.olat.course.assessment.AssessmentManager in project openolat by klemens.

the class QTI21ResultsExportMediaResource method createAssessedMembersDetail.

private List<AssessedMember> createAssessedMembersDetail(ZipOutputStream zout) throws IOException {
    AssessmentManager assessmentManager = courseEnv.getAssessmentManager();
    List<AssessmentEntry> assessmentEntries = assessmentManager.getAssessmentEntries(courseNode);
    Map<Identity, AssessmentEntry> assessmentEntryMap = new HashMap<>();
    for (AssessmentEntry assessmentEntry : assessmentEntries) {
        assessmentEntryMap.put(assessmentEntry.getIdentity(), assessmentEntry);
    }
    List<AssessedMember> assessedMembers = new ArrayList<>();
    for (Identity identity : identities) {
        String idDir = exportFolderName + "/" + DATA + identity.getName();
        idDir = idDir.endsWith(SEP) ? idDir : idDir + SEP;
        createZipDirectory(zout, idDir);
        // content of single assessed member
        List<ResultDetail> assessments = createResultDetail(identity, zout, idDir);
        List<File> assessmentDocuments = assessmentManager.getIndividualAssessmentDocuments(courseNode, identity);
        Boolean passed = null;
        BigDecimal score = null;
        if (assessmentEntryMap.containsKey(identity)) {
            AssessmentEntry assessmentEntry = assessmentEntryMap.get(identity);
            passed = assessmentEntry.getPassed();
            score = assessmentEntry.getScore();
        }
        String linkToUser = idDir.replace(exportFolderName + "/", "") + "index.html";
        String memberEmail = userManager.getUserDisplayEmail(identity, ureq.getLocale());
        AssessedMember member = new AssessedMember(identity.getName(), identity.getUser().getLastName(), identity.getUser().getFirstName(), memberEmail, assessments.size(), passed, score, linkToUser);
        String userDataDir = exportFolderName + "/" + DATA + identity.getName();
        String singleUserInfoHTML = createResultListingHTML(assessments, assessmentDocuments, member);
        convertToZipEntry(zout, userDataDir + "/index.html", singleUserInfoHTML);
        assessedMembers.add(member);
        // assessment documents
        for (File document : assessmentDocuments) {
            String assessmentDocDir = userDataDir + "/Assessment_documents/" + document.getName();
            ZipUtil.addFileToZip(assessmentDocDir, document, zout);
        }
    }
    return assessedMembers;
}
Also used : HashMap(java.util.HashMap) AssessmentManager(org.olat.course.assessment.AssessmentManager) ArrayList(java.util.ArrayList) AssessmentEntry(org.olat.modules.assessment.AssessmentEntry) BigDecimal(java.math.BigDecimal) Identity(org.olat.core.id.Identity) TransientIdentity(org.olat.admin.user.imp.TransientIdentity) File(java.io.File)

Aggregations

AssessmentManager (org.olat.course.assessment.AssessmentManager)244 Identity (org.olat.core.id.Identity)208 ScoreEvaluation (org.olat.course.run.scoring.ScoreEvaluation)34 RepositoryEntry (org.olat.repository.RepositoryEntry)20 OLATResourceable (org.olat.core.id.OLATResourceable)14 ModuleConfiguration (org.olat.modules.ModuleConfiguration)14 AssessmentEntry (org.olat.modules.assessment.AssessmentEntry)12 UserCourseEnvironment (org.olat.course.run.userview.UserCourseEnvironment)10 Date (java.util.Date)8 Controller (org.olat.core.gui.control.Controller)8 Translator (org.olat.core.gui.translator.Translator)8 IdentityEnvironment (org.olat.core.id.IdentityEnvironment)8 ICourse (org.olat.course.ICourse)8 File (java.io.File)6 TabbableController (org.olat.core.gui.control.generic.tabbable.TabbableController)6 Roles (org.olat.core.id.Roles)6 NodeEditController (org.olat.course.editor.NodeEditController)6 CourseNode (org.olat.course.nodes.CourseNode)6 CheckboxManager (org.olat.course.nodes.cl.CheckboxManager)6 CourseIQSecurityCallback (org.olat.course.nodes.iq.CourseIQSecurityCallback)6