Search in sources :

Example 66 with ModuleConfiguration

use of org.olat.modules.ModuleConfiguration in project OpenOLAT by OpenOLAT.

the class QTI21AssessmentDetailsController method getSignatureOptions.

private DigitalSignatureOptions getSignatureOptions(AssessmentTestSession session) {
    RepositoryEntry sessionTestEntry = session.getTestEntry();
    QTI21DeliveryOptions deliveryOptions = qtiService.getDeliveryOptions(sessionTestEntry);
    boolean digitalSignature = deliveryOptions.isDigitalSignature();
    boolean sendMail = deliveryOptions.isDigitalSignatureMail();
    if (courseNode != null) {
        ModuleConfiguration config = courseNode.getModuleConfiguration();
        digitalSignature = config.getBooleanSafe(IQEditController.CONFIG_DIGITAL_SIGNATURE, deliveryOptions.isDigitalSignature());
        sendMail = config.getBooleanSafe(IQEditController.CONFIG_DIGITAL_SIGNATURE_SEND_MAIL, deliveryOptions.isDigitalSignatureMail());
    }
    DigitalSignatureOptions options = new DigitalSignatureOptions(digitalSignature, sendMail, entry, testEntry);
    if (digitalSignature) {
        if (courseNode == null) {
            AssessmentEntryOutcomesListener.decorateResourceConfirmation(entry, testEntry, session, options, null, getLocale());
        } else {
            CourseEnvironment courseEnv = CourseFactory.loadCourse(entry).getCourseEnvironment();
            QTI21AssessmentRunController.decorateCourseConfirmation(session, options, courseEnv, courseNode, sessionTestEntry, null, getLocale());
        }
    }
    return options;
}
Also used : QTI21DeliveryOptions(org.olat.ims.qti21.QTI21DeliveryOptions) ModuleConfiguration(org.olat.modules.ModuleConfiguration) UserCourseEnvironment(org.olat.course.run.userview.UserCourseEnvironment) CourseEnvironment(org.olat.course.run.environment.CourseEnvironment) DigitalSignatureOptions(org.olat.ims.qti21.model.DigitalSignatureOptions) RepositoryEntry(org.olat.repository.RepositoryEntry)

Example 67 with ModuleConfiguration

use of org.olat.modules.ModuleConfiguration in project openolat by klemens.

the class OpenMeetingsEditController method event.

@Override
protected void event(UserRequest ureq, Controller source, Event event) {
    if (source == accessibilityCondContr) {
        if (event == Event.CHANGED_EVENT) {
            Condition cond = accessibilityCondContr.getCondition();
            courseNode.setPreConditionAccess(cond);
            fireEvent(ureq, NodeEditController.NODECONFIG_CHANGED_EVENT);
        }
    } else if (source == editForm) {
        // config form action
        if (event == Event.DONE_EVENT || event == Event.CHANGED_EVENT) {
            OpenMeetingsRoom room = editForm.getRoom();
            if (room != null) {
                ModuleConfiguration moduleConfiguration = courseNode.getModuleConfiguration();
                moduleConfiguration.set(CONFIG_ROOM_NAME, room.getName());
                moduleConfiguration.set(CONFIG_ROOM_SIZE, new Long(room.getSize()));
                moduleConfiguration.set(CONFIG_ROOM_MODERATION, new Boolean(room.isModerated()));
                moduleConfiguration.set(CONFIG_ROOM_AUDIO_ONLY, new Boolean(room.isAudioOnly()));
                moduleConfiguration.set(CONFIG_ROOM_COMMENT, room.getComment());
                moduleConfiguration.set(CONFIG_ROOM_TYPE, new Long(room.getType()));
            }
        }
        if (event == Event.DONE_EVENT) {
            fireEvent(ureq, NodeEditController.NODECONFIG_CHANGED_EVENT);
        }
    }
}
Also used : Condition(org.olat.course.condition.Condition) OpenMeetingsRoom(org.olat.modules.openmeetings.model.OpenMeetingsRoom) ModuleConfiguration(org.olat.modules.ModuleConfiguration)

Example 68 with ModuleConfiguration

use of org.olat.modules.ModuleConfiguration in project openolat by klemens.

the class OpenMeetingsEditController method getDefaultValues.

private OpenMeetingsRoom getDefaultValues() {
    OpenMeetingsRoom room = new OpenMeetingsRoom();
    ModuleConfiguration moduleConfiguration = courseNode.getModuleConfiguration();
    Object name = moduleConfiguration.get(CONFIG_ROOM_NAME);
    if (name instanceof String) {
        room.setName((String) name);
    }
    Object size = moduleConfiguration.get(CONFIG_ROOM_SIZE);
    if (size instanceof Long) {
        room.setSize(((Long) size).longValue());
    }
    Object moderated = moduleConfiguration.get(CONFIG_ROOM_MODERATION);
    if (moderated instanceof Boolean) {
        room.setModerated(((Boolean) moderated).booleanValue());
    } else if (moderated == null) {
        room.setModerated(true);
    }
    Object comment = moduleConfiguration.get(CONFIG_ROOM_COMMENT);
    if (comment instanceof String) {
        room.setComment((String) comment);
    }
    Object type = moduleConfiguration.get(CONFIG_ROOM_TYPE);
    if (type instanceof Long) {
        room.setType(((Long) type).longValue());
    } else if (type == null) {
        room.setType(3);
    }
    Object isAudioOnly = moduleConfiguration.get(CONFIG_ROOM_AUDIO_ONLY);
    if (isAudioOnly instanceof Boolean) {
        room.setAudioOnly(((Boolean) isAudioOnly).booleanValue());
    } else if (isAudioOnly == null) {
        room.setAudioOnly(true);
    }
    return room;
}
Also used : OpenMeetingsRoom(org.olat.modules.openmeetings.model.OpenMeetingsRoom) ModuleConfiguration(org.olat.modules.ModuleConfiguration)

Example 69 with ModuleConfiguration

use of org.olat.modules.ModuleConfiguration in project openolat by klemens.

the class ScormAPIMapper method calculatePassed.

private void calculatePassed(String olatSahsId, Properties lessonStatusProp, boolean finish) {
    int found = 0;
    boolean passedScos = true;
    for (Iterator<Object> it_status = lessonStatusProp.values().iterator(); it_status.hasNext(); ) {
        String status = (String) it_status.next();
        passedScos &= "passed".equals(status);
        found++;
    }
    boolean passed = (found == scormAdapter.getNumOfSCOs()) && passedScos;
    // if advanceScore option is set update the score only if it is higher
    // <OLATEE-27>
    ModuleConfiguration config = scormNode.getModuleConfiguration();
    if (config.getBooleanSafe(ScormEditController.CONFIG_ADVANCESCORE, true)) {
        if (currentPassed == null || !currentPassed.booleanValue()) {
            // </OLATEE-27>
            boolean increment = !attemptsIncremented && finish;
            ScoreEvaluation sceval = new ScoreEvaluation(new Float(0.0f), Boolean.valueOf(passed));
            scormNode.updateUserScoreEvaluation(sceval, userCourseEnv, identity, increment, Role.user);
            if (increment) {
                attemptsIncremented = true;
            }
        } else if (!config.getBooleanSafe(ScormEditController.CONFIG_ATTEMPTSDEPENDONSCORE, false)) {
            boolean increment = !attemptsIncremented && finish;
            ScoreEvaluation sceval = scormNode.getUserScoreEvaluation(userCourseEnv);
            scormNode.updateUserScoreEvaluation(sceval, userCourseEnv, identity, increment, Role.user);
            if (increment) {
                attemptsIncremented = true;
            }
        }
    } else {
        boolean increment = !attemptsIncremented && finish;
        ScoreEvaluation sceval = new ScoreEvaluation(new Float(0.0f), Boolean.valueOf(passed));
        scormNode.updateUserScoreEvaluation(sceval, userCourseEnv, identity, false, Role.user);
        if (increment) {
            attemptsIncremented = true;
        }
    }
    if (log.isDebug()) {
        String msg = "for scorm node:" + scormNode.getIdent() + " (" + scormNode.getShortTitle() + ") a lmsCommit for scoId " + olatSahsId + " occured, passed: " + passed + ", all lesson status now = " + lessonStatusProp.toString();
        log.debug(msg, null);
    }
}
Also used : ScoreEvaluation(org.olat.course.run.scoring.ScoreEvaluation) ModuleConfiguration(org.olat.modules.ModuleConfiguration)

Example 70 with ModuleConfiguration

use of org.olat.modules.ModuleConfiguration in project openolat by klemens.

the class AbstractCourseNodeWebService method updateCourseNode.

// fxdiff FXOLAT-122: course management
private CourseNodeVO updateCourseNode(String nodeId, String shortTitle, String longTitle, String learningObjectives, String visibilityExpertRules, String accessExpertRules, CustomConfigDelegate delegateConfig, CourseEditSession editSession) {
    ICourse course = editSession.getCourse();
    TreeNode updateEditorNode = course.getEditorTreeModel().getNodeById(nodeId);
    CourseNode updatedNode = course.getEditorTreeModel().getCourseNode(nodeId);
    if (StringHelper.containsNonWhitespace(shortTitle)) {
        updatedNode.setShortTitle(shortTitle);
    }
    if (StringHelper.containsNonWhitespace(longTitle)) {
        updatedNode.setLongTitle(longTitle);
    }
    if (StringHelper.containsNonWhitespace(learningObjectives)) {
        updatedNode.setLearningObjectives(learningObjectives);
    }
    if (visibilityExpertRules != null) {
        Condition cond = createExpertCondition(CONDITION_ID_VISIBILITY, visibilityExpertRules);
        updatedNode.setPreConditionVisibility(cond);
    }
    if (StringHelper.containsNonWhitespace(accessExpertRules) && updatedNode instanceof AbstractAccessableCourseNode) {
        Condition cond = createExpertCondition(CONDITION_ID_ACCESS, accessExpertRules);
        ((AbstractAccessableCourseNode) updatedNode).setPreConditionAccess(cond);
    }
    if (delegateConfig != null) {
        ModuleConfiguration moduleConfig = updatedNode.getModuleConfiguration();
        delegateConfig.configure(course, updatedNode, moduleConfig);
    }
    course.getEditorTreeModel().nodeConfigChanged(updateEditorNode);
    CourseEditorTreeNode editorNode = course.getEditorTreeModel().getCourseEditorNodeContaining(updatedNode);
    CourseNodeVO vo = get(updatedNode);
    vo.setParentId(editorNode.getParent() == null ? null : editorNode.getParent().getIdent());
    return vo;
}
Also used : Condition(org.olat.course.condition.Condition) ModuleConfiguration(org.olat.modules.ModuleConfiguration) CourseNodeVO(org.olat.restapi.support.vo.CourseNodeVO) TreeNode(org.olat.core.gui.components.tree.TreeNode) CourseEditorTreeNode(org.olat.course.tree.CourseEditorTreeNode) CourseEditorTreeNode(org.olat.course.tree.CourseEditorTreeNode) ICourse(org.olat.course.ICourse) AbstractAccessableCourseNode(org.olat.course.nodes.AbstractAccessableCourseNode) CourseNode(org.olat.course.nodes.CourseNode) AbstractAccessableCourseNode(org.olat.course.nodes.AbstractAccessableCourseNode)

Aggregations

ModuleConfiguration (org.olat.modules.ModuleConfiguration)296 ArrayList (java.util.ArrayList)34 OLATRuntimeException (org.olat.core.logging.OLATRuntimeException)28 ICourse (org.olat.course.ICourse)26 CourseNode (org.olat.course.nodes.CourseNode)26 Date (java.util.Date)22 RepositoryEntry (org.olat.repository.RepositoryEntry)22 File (java.io.File)20 CheckboxList (org.olat.course.nodes.cl.model.CheckboxList)18 List (java.util.List)16 Identity (org.olat.core.id.Identity)16 CheckboxManager (org.olat.course.nodes.cl.CheckboxManager)16 UserCourseEnvironment (org.olat.course.run.userview.UserCourseEnvironment)16 Translator (org.olat.core.gui.translator.Translator)14 AssessmentManager (org.olat.course.assessment.AssessmentManager)14 CourseEnvironment (org.olat.course.run.environment.CourseEnvironment)14 ScoreEvaluation (org.olat.course.run.scoring.ScoreEvaluation)14 VFSItem (org.olat.core.util.vfs.VFSItem)12 BusinessGroup (org.olat.group.BusinessGroup)12 Checkbox (org.olat.course.nodes.cl.model.Checkbox)11