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;
}
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()));
}
}
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);
}
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);
}
}
}
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()));
}
}
Aggregations