Search in sources :

Example 16 with UserNodeAuditManager

use of org.olat.course.auditing.UserNodeAuditManager in project openolat by klemens.

the class MSCourseNode method getUserLog.

/**
 * @see org.olat.course.nodes.AssessableCourseNode#getUserLog(org.olat.course.run.userview.UserCourseEnvironment)
 */
@Override
public String getUserLog(UserCourseEnvironment userCourseEnvironment) {
    UserNodeAuditManager am = userCourseEnvironment.getCourseEnvironment().getAuditManager();
    String logValue = am.getUserNodeLog(this, userCourseEnvironment.getIdentityEnvironment().getIdentity());
    return logValue;
}
Also used : UserNodeAuditManager(org.olat.course.auditing.UserNodeAuditManager)

Example 17 with UserNodeAuditManager

use of org.olat.course.auditing.UserNodeAuditManager in project openolat by klemens.

the class QTI21AssessmentRunController method exposeResults.

/**
 * WARNING! The variables  and are not used
 * in the velocity template and the CONFIG_KEY_RESULT_ON_HOME_PAGE is not editable
 * in the configuration of the course element for QTI 2.1!!!!
 *
 * Provides the show results button if results available or a message with the visibility period.
 *
 * @param ureq
 */
private void exposeResults(UserRequest ureq, boolean resultsVisible) {
    // migration: check if old tests have no summary configured
    boolean showResultsOnHomePage = config.getBooleanSafe(IQEditController.CONFIG_KEY_RESULT_ON_HOME_PAGE);
    QTI21AssessmentResultsOptions showSummary = deliveryOptions.getAssessmentResultsOptions();
    if (resultsVisible && !showSummary.none()) {
        mainVC.contextPut("showResultsOnHomePage", Boolean.valueOf(showResultsOnHomePage));
        boolean dateRelatedVisibility = isResultVisible(config);
        if (showResultsOnHomePage && dateRelatedVisibility) {
            mainVC.contextPut("showResultsVisible", Boolean.TRUE);
            showResultsButton = LinkFactory.createLink("command.showResults", "command.showResults", getTranslator(), mainVC, this, Link.LINK | Link.NONTRANSLATED);
            showResultsButton.setCustomDisplayText(translate("showResults.title"));
            showResultsButton.setElementCssClass("o_qti_show_assessment_results");
            showResultsButton.setIconLeftCSS("o_icon o_icon-fw o_icon_open_togglebox");
            hideResultsButton = LinkFactory.createLink("command.hideResults", "command.hideResults", getTranslator(), mainVC, this, Link.LINK | Link.NONTRANSLATED);
            hideResultsButton.setCustomDisplayText(translate("showResults.title"));
            hideResultsButton.setElementCssClass("o_qti_hide_assessment_results");
            hideResultsButton.setIconLeftCSS("o_icon o_icon-fw o_icon_close_togglebox");
            if (isPanelOpen(ureq, "results", true)) {
                doShowResults(ureq);
            }
        } else if (showResultsOnHomePage) {
            exposeVisiblityPeriod();
            mainVC.contextPut("showResultsVisible", Boolean.FALSE);
        } else {
            exposeVisiblityPeriod();
            mainVC.contextPut("showResultsVisible", Boolean.FALSE);
        }
    } else {
        exposeVisiblityPeriod();
        mainVC.contextPut("showResultsVisible", Boolean.FALSE);
        mainVC.contextPut("showResultsOnHomePage", Boolean.valueOf(showResultsOnHomePage && !showSummary.none()));
    }
    if (!anonym && resultsVisible) {
        UserNodeAuditManager am = userCourseEnv.getCourseEnvironment().getAuditManager();
        mainVC.contextPut("log", am.getUserNodeLog(courseNode, getIdentity()));
    }
}
Also used : UserNodeAuditManager(org.olat.course.auditing.UserNodeAuditManager) QTI21AssessmentResultsOptions(org.olat.ims.qti21.QTI21AssessmentResultsOptions)

Example 18 with UserNodeAuditManager

use of org.olat.course.auditing.UserNodeAuditManager in project openolat by klemens.

the class BasicLTICourseNode method getUserLog.

@Override
public String getUserLog(UserCourseEnvironment userCourseEnvironment) {
    // having score defined means the node is assessable
    UserNodeAuditManager am = userCourseEnvironment.getCourseEnvironment().getAuditManager();
    Identity mySelf = userCourseEnvironment.getIdentityEnvironment().getIdentity();
    return am.getUserNodeLog(this, mySelf);
}
Also used : UserNodeAuditManager(org.olat.course.auditing.UserNodeAuditManager) Identity(org.olat.core.id.Identity)

Example 19 with UserNodeAuditManager

use of org.olat.course.auditing.UserNodeAuditManager in project openolat by klemens.

the class ReturnboxFullAccessCallback method event.

/**
 * @see org.olat.core.gui.control.DefaultController#event(org.olat.core.gui.UserRequest, org.olat.core.gui.control.Controller, org.olat.core.gui.control.Event)
 */
@Override
public void event(UserRequest ureq, Controller source, Event event) {
    if (source == dropboxFolderRunController) {
        if (event instanceof FolderEvent) {
            FolderEvent folderEvent = (FolderEvent) event;
            if (folderEvent.getCommand().equals(FolderEvent.DELETE_EVENT)) {
                UserNodeAuditManager am = userCourseEnv.getCourseEnvironment().getAuditManager();
                // log entry for this file
                Identity coach = ureq.getIdentity();
                Identity student = userCourseEnv.getIdentityEnvironment().getIdentity();
                am.appendToUserNodeLog(node, coach, student, "FILE DELETED: " + folderEvent.getFilename());
            }
        }
    } else if (source == returnboxFolderRunController) {
        if (event instanceof FolderEvent) {
            FolderEvent folderEvent = (FolderEvent) event;
            if (folderEvent.getCommand().equals(FolderEvent.UPLOAD_EVENT) || folderEvent.getCommand().equals(FolderEvent.NEW_FILE_EVENT)) {
                UserNodeAuditManager am = userCourseEnv.getCourseEnvironment().getAuditManager();
                // log entry for this file
                Identity coach = ureq.getIdentity();
                Identity student = userCourseEnv.getIdentityEnvironment().getIdentity();
                if (node instanceof AssessableCourseNode) {
                    AssessableCourseNode acn = (AssessableCourseNode) node;
                    AssessmentEvaluation eval = acn.getUserScoreEvaluation(userCourseEnv);
                    if (eval.getAssessmentStatus() == null || eval.getAssessmentStatus() == AssessmentEntryStatus.notStarted) {
                        eval = new AssessmentEvaluation(eval, AssessmentEntryStatus.inProgress);
                        acn.updateUserScoreEvaluation(eval, userCourseEnv, coach, false, Role.coach);
                    }
                }
                am.appendToUserNodeLog(node, coach, student, "FILE UPLOADED: " + folderEvent.getFilename());
                String toMail = UserManager.getInstance().getUserDisplayEmail(student, ureq.getLocale());
                OLATResourceable ores = OresHelper.createOLATResourceableInstance(CourseNode.class, Long.valueOf(node.getIdent()));
                ContextEntry ce = BusinessControlFactory.getInstance().createContextEntry(ores);
                BusinessControl bc = BusinessControlFactory.getInstance().createBusinessControl(ce, getWindowControl().getBusinessControl());
                String link = BusinessControlFactory.getInstance().getAsURIString(bc, true);
                log.debug("DEBUG : Returnbox notification email with link=" + link);
                String subject = translate("returnbox.email.subject");
                String body = translate("returnbox.email.body", new String[] { userCourseEnv.getCourseEnvironment().getCourseTitle(), node.getShortTitle(), folderEvent.getFilename(), link });
                MailContext context = new MailContextImpl(getWindowControl().getBusinessControl().getAsString());
                MailBundle bundle = new MailBundle();
                bundle.setContext(context);
                bundle.setToId(student);
                bundle.setContent(subject, body);
                MailerResult result = CoreSpringFactory.getImpl(MailManager.class).sendMessage(bundle);
                if (result.getReturnCode() > 0) {
                    am.appendToUserNodeLog(node, coach, student, "MAIL SEND FAILED TO:" + toMail + "; MailReturnCode: " + result.getReturnCode());
                    log.warn("Could not send email 'returnbox notification' to " + student + "with email=" + toMail);
                } else {
                    log.info("Send email 'returnbox notification' to " + student + "with email=" + toMail);
                }
            }
        } else if (FolderCommand.FOLDERCOMMAND_FINISHED == event) {
            if (node instanceof AssessableCourseNode) {
                AssessableCourseNode acn = (AssessableCourseNode) node;
                AssessmentEvaluation eval = acn.getUserScoreEvaluation(userCourseEnv);
                if (eval == null) {
                    eval = AssessmentEvaluation.EMPTY_EVAL;
                }
                if (eval.getAssessmentStatus() == null || eval.getAssessmentStatus() == AssessmentEntryStatus.notStarted) {
                    eval = new AssessmentEvaluation(eval, AssessmentEntryStatus.inProgress);
                    acn.updateUserScoreEvaluation(eval, userCourseEnv, getIdentity(), false, Role.coach);
                    fireEvent(ureq, Event.CHANGED_EVENT);
                }
            }
        }
    } else if (source == statusForm) {
        if (event == Event.DONE_EVENT) {
            // get identity not from request (this would be an author)
            StatusManager.getInstance().saveStatusFormData(statusForm, node, userCourseEnv);
        }
    } else if (source == dialogBoxController) {
        if (DialogBoxUIFactory.isYesEvent(event) && assignedTask != null) {
            // cancel task assignment, and show "no task assigned to user"
            removeAssignedTask(userCourseEnv, userCourseEnv.getIdentityEnvironment().getIdentity());
            // update UI
            myContent.contextPut("assignedtask", null);
        }
    }
}
Also used : MailContextImpl(org.olat.core.util.mail.MailContextImpl) AssessmentEvaluation(org.olat.course.run.scoring.AssessmentEvaluation) OLATResourceable(org.olat.core.id.OLATResourceable) MailContext(org.olat.core.util.mail.MailContext) MailerResult(org.olat.core.util.mail.MailerResult) BusinessControl(org.olat.core.id.context.BusinessControl) ContextEntry(org.olat.core.id.context.ContextEntry) UserNodeAuditManager(org.olat.course.auditing.UserNodeAuditManager) AssessableCourseNode(org.olat.course.nodes.AssessableCourseNode) FolderEvent(org.olat.core.commons.modules.bc.FolderEvent) CourseNode(org.olat.course.nodes.CourseNode) TACourseNode(org.olat.course.nodes.TACourseNode) AssessableCourseNode(org.olat.course.nodes.AssessableCourseNode) Identity(org.olat.core.id.Identity) MailBundle(org.olat.core.util.mail.MailBundle)

Example 20 with UserNodeAuditManager

use of org.olat.course.auditing.UserNodeAuditManager in project OpenOLAT by OpenOLAT.

the class QTI21AssessmentRunController method exposeResults.

/**
 * WARNING! The variables  and are not used
 * in the velocity template and the CONFIG_KEY_RESULT_ON_HOME_PAGE is not editable
 * in the configuration of the course element for QTI 2.1!!!!
 *
 * Provides the show results button if results available or a message with the visibility period.
 *
 * @param ureq
 */
private void exposeResults(UserRequest ureq, boolean resultsVisible) {
    // migration: check if old tests have no summary configured
    boolean showResultsOnHomePage = config.getBooleanSafe(IQEditController.CONFIG_KEY_RESULT_ON_HOME_PAGE);
    QTI21AssessmentResultsOptions showSummary = deliveryOptions.getAssessmentResultsOptions();
    if (resultsVisible && !showSummary.none()) {
        mainVC.contextPut("showResultsOnHomePage", Boolean.valueOf(showResultsOnHomePage));
        boolean dateRelatedVisibility = isResultVisible(config);
        if (showResultsOnHomePage && dateRelatedVisibility) {
            mainVC.contextPut("showResultsVisible", Boolean.TRUE);
            showResultsButton = LinkFactory.createLink("command.showResults", "command.showResults", getTranslator(), mainVC, this, Link.LINK | Link.NONTRANSLATED);
            showResultsButton.setCustomDisplayText(translate("showResults.title"));
            showResultsButton.setElementCssClass("o_qti_show_assessment_results");
            showResultsButton.setIconLeftCSS("o_icon o_icon-fw o_icon_open_togglebox");
            hideResultsButton = LinkFactory.createLink("command.hideResults", "command.hideResults", getTranslator(), mainVC, this, Link.LINK | Link.NONTRANSLATED);
            hideResultsButton.setCustomDisplayText(translate("showResults.title"));
            hideResultsButton.setElementCssClass("o_qti_hide_assessment_results");
            hideResultsButton.setIconLeftCSS("o_icon o_icon-fw o_icon_close_togglebox");
            if (isPanelOpen(ureq, "results", true)) {
                doShowResults(ureq);
            }
        } else if (showResultsOnHomePage) {
            exposeVisiblityPeriod();
            mainVC.contextPut("showResultsVisible", Boolean.FALSE);
        } else {
            exposeVisiblityPeriod();
            mainVC.contextPut("showResultsVisible", Boolean.FALSE);
        }
    } else {
        exposeVisiblityPeriod();
        mainVC.contextPut("showResultsVisible", Boolean.FALSE);
        mainVC.contextPut("showResultsOnHomePage", Boolean.valueOf(showResultsOnHomePage && !showSummary.none()));
    }
    if (!anonym && resultsVisible) {
        UserNodeAuditManager am = userCourseEnv.getCourseEnvironment().getAuditManager();
        mainVC.contextPut("log", am.getUserNodeLog(courseNode, getIdentity()));
    }
}
Also used : UserNodeAuditManager(org.olat.course.auditing.UserNodeAuditManager) QTI21AssessmentResultsOptions(org.olat.ims.qti21.QTI21AssessmentResultsOptions)

Aggregations

UserNodeAuditManager (org.olat.course.auditing.UserNodeAuditManager)46 ICourse (org.olat.course.ICourse)18 AssessmentEntry (org.olat.modules.assessment.AssessmentEntry)16 Identity (org.olat.core.id.Identity)14 AssessmentChangedEvent (org.olat.course.assessment.AssessmentChangedEvent)12 File (java.io.File)10 CoursePropertyManager (org.olat.course.properties.CoursePropertyManager)10 Date (java.util.Date)8 AssessableCourseNode (org.olat.course.nodes.AssessableCourseNode)8 RepositoryEntry (org.olat.repository.RepositoryEntry)8 SyncerExecutor (org.olat.core.util.coordinate.SyncerExecutor)4 SystemFileFilter (org.olat.core.util.io.SystemFileFilter)4 MailContext (org.olat.core.util.mail.MailContext)4 Structure (org.olat.course.Structure)4 AssessmentManager (org.olat.course.assessment.AssessmentManager)4 CertificateTemplate (org.olat.course.certificate.CertificateTemplate)4 CertificateInfos (org.olat.course.certificate.model.CertificateInfos)4 CourseConfig (org.olat.course.config.CourseConfig)4 CourseGroupManager (org.olat.course.groupsandrights.CourseGroupManager)4 CourseNode (org.olat.course.nodes.CourseNode)4