use of org.olat.course.auditing.UserNodeAuditManager in project OpenOLAT by OpenOLAT.
the class PreviewConfigController method generateEnvironment.
private void generateEnvironment() {
List<BGArea> tmpAreas = areaManager.loadAreas(psf.getAreaKeys());
List<BusinessGroup> groups = businessGroupService.loadBusinessGroups(psf.getGroupKeys());
// get learning areas for groups
Set<BGArea> areas = new HashSet<BGArea>();
areas.addAll(tmpAreas);
List<BGArea> areaByGroups = areaManager.findBGAreasOfBusinessGroups(groups);
areas.addAll(areaByGroups);
role = psf.getRole();
ICourse course = CourseFactory.loadCourse(ores);
// default is student
isGlobalAuthor = false;
isGuestOnly = false;
isCoach = false;
isCourseAdmin = false;
/*
* if (role.equals(PreviewSettingsForm.ROLE_STUDENT)) { } else
*/
if (role.equals(PreviewSettingsForm.ROLE_GUEST)) {
isGuestOnly = true;
} else if (role.equals(PreviewSettingsForm.ROLE_COURSECOACH)) {
isCoach = true;
} else if (role.equals(PreviewSettingsForm.ROLE_COURSEADMIN)) {
isCourseAdmin = true;
} else if (role.equals(PreviewSettingsForm.ROLE_GLOBALAUTHOR)) {
isGlobalAuthor = true;
}
final RepositoryEntry courseResource = course.getCourseEnvironment().getCourseGroupManager().getCourseEntry();
final CourseGroupManager cgm = new PreviewCourseGroupManager(courseResource, new ArrayList<BusinessGroup>(groups), new ArrayList<BGArea>(areas), isCoach, isCourseAdmin);
final UserNodeAuditManager auditman = new PreviewAuditManager();
final AssessmentManager am = new PreviewAssessmentManager();
final CoursePropertyManager cpm = new PreviewCoursePropertyManager();
final Structure runStructure = course.getEditorTreeModel().createStructureForPreview();
final String title = course.getCourseTitle();
final CourseConfig courseConfig = course.getCourseEnvironment().getCourseConfig();
simCourseEnv = new PreviewCourseEnvironment(title, runStructure, psf.getDate(), course.getCourseFolderContainer(), course.getCourseBaseContainer(), course.getResourceableId(), cpm, cgm, auditman, am, courseConfig);
simIdentEnv = new IdentityEnvironment();
simIdentEnv.setRoles(new Roles(false, false, false, isGlobalAuthor, isGuestOnly, false, false));
final Identity ident = new PreviewIdentity();
simIdentEnv.setIdentity(ident);
// identity must be set before attributes OLAT-4811
simIdentEnv.setAttributes(psf.getAttributesMap());
}
use of org.olat.course.auditing.UserNodeAuditManager in project OpenOLAT by OpenOLAT.
the class PreviewConfigHelper method getPreviewCourseEnvironment.
public static CourseEnvironment getPreviewCourseEnvironment(boolean isCoach, boolean isCourseAdmin, ICourse course) {
// generateEnvironment();
final RepositoryEntry courseResource = course.getCourseEnvironment().getCourseGroupManager().getCourseEntry();
final CourseGroupManager cgm = new PreviewCourseGroupManager(courseResource, new ArrayList<BusinessGroup>(), new ArrayList<BGArea>(), isCoach, isCourseAdmin);
final UserNodeAuditManager auditman = new PreviewAuditManager();
final AssessmentManager am = new PreviewAssessmentManager();
final CoursePropertyManager cpm = new PreviewCoursePropertyManager();
final Structure runStructure = course.getEditorTreeModel().createStructureForPreview();
final String title = course.getCourseTitle();
final CourseConfig courseConfig = course.getCourseEnvironment().getCourseConfig();
CourseEnvironment previewCourseEnvironment = new PreviewCourseEnvironment(title, runStructure, new Date(), course.getCourseFolderContainer(), course.getCourseBaseContainer(), course.getResourceableId(), cpm, cgm, auditman, am, courseConfig);
return previewCourseEnvironment;
}
use of org.olat.course.auditing.UserNodeAuditManager in project OpenOLAT by OpenOLAT.
the class DropboxController method getConfirmation.
private String getConfirmation(UserRequest ureq, String filename) {
// grab confirmation-text from bb-config
String confirmation = config.getStringValue(TACourseNode.CONF_DROPBOX_CONFIRMATION);
Context c = new VelocityContext();
Identity identity = ureq.getIdentity();
c.put("login", identity.getName());
c.put("first", identity.getUser().getProperty(UserConstants.FIRSTNAME, getLocale()));
c.put("last", identity.getUser().getProperty(UserConstants.LASTNAME, getLocale()));
c.put("email", UserManager.getInstance().getUserDisplayEmail(identity, getLocale()));
c.put("filename", filename);
Date now = new Date();
Formatter f = Formatter.getInstance(ureq.getLocale());
c.put("date", f.formatDate(now));
c.put("time", f.formatTime(now));
// update attempts counter for this user: one file - one attempts
AssessableCourseNode acn = (AssessableCourseNode) node;
acn.incrementUserAttempts(userCourseEnv, Role.user);
// log entry for this file
UserNodeAuditManager am = userCourseEnv.getCourseEnvironment().getAuditManager();
am.appendToUserNodeLog(node, identity, identity, "FILE UPLOADED: " + filename);
return VelocityHelper.getInstance().evaluateVTL(confirmation, c);
}
use of org.olat.course.auditing.UserNodeAuditManager in project OpenOLAT by OpenOLAT.
the class CourseAssessmentManagerImpl method saveNodeComment.
@Override
public void saveNodeComment(CourseNode courseNode, Identity identity, Identity assessedIdentity, String comment) {
ICourse course = CourseFactory.loadCourse(cgm.getCourseEntry());
AssessmentEntry nodeAssessment = getOrCreate(assessedIdentity, courseNode);
nodeAssessment.setComment(comment);
assessmentService.updateAssessmentEntry(nodeAssessment);
// node log
UserNodeAuditManager am = course.getCourseEnvironment().getAuditManager();
am.appendToUserNodeLog(courseNode, identity, assessedIdentity, "COMMENT set to: " + comment);
// notify about changes
AssessmentChangedEvent ace = new AssessmentChangedEvent(AssessmentChangedEvent.TYPE_USER_COMMENT_CHANGED, assessedIdentity);
CoordinatorManager.getInstance().getCoordinator().getEventBus().fireEventToListenersOf(ace, course);
// user activity logging
ThreadLocalUserActivityLogger.log(AssessmentLoggingAction.ASSESSMENT_USERCOMMENT_UPDATED, getClass(), LoggingResourceable.wrap(assessedIdentity), LoggingResourceable.wrapNonOlatResource(StringResourceableType.qtiUserComment, "", StringHelper.stripLineBreaks(comment)));
}
use of org.olat.course.auditing.UserNodeAuditManager in project OpenOLAT by OpenOLAT.
the class CourseAssessmentManagerImpl method saveNodeAttempts.
@Override
public void saveNodeAttempts(CourseNode courseNode, Identity identity, Identity assessedIdentity, Integer attempts, Role by) {
ICourse course = CourseFactory.loadCourse(cgm.getCourseEntry());
AssessmentEntry nodeAssessment = getOrCreate(assessedIdentity, courseNode);
if (by == Role.coach) {
nodeAssessment.setLastCoachModified(new Date());
} else if (by == Role.user) {
nodeAssessment.setLastUserModified(new Date());
}
nodeAssessment.setAttempts(attempts);
assessmentService.updateAssessmentEntry(nodeAssessment);
// node log
UserNodeAuditManager am = course.getCourseEnvironment().getAuditManager();
am.appendToUserNodeLog(courseNode, identity, assessedIdentity, "ATTEMPTS set to: " + String.valueOf(attempts));
// notify about changes
AssessmentChangedEvent ace = new AssessmentChangedEvent(AssessmentChangedEvent.TYPE_ATTEMPTS_CHANGED, assessedIdentity);
CoordinatorManager.getInstance().getCoordinator().getEventBus().fireEventToListenersOf(ace, course);
// user activity logging
ThreadLocalUserActivityLogger.log(AssessmentLoggingAction.ASSESSMENT_ATTEMPTS_UPDATED, getClass(), LoggingResourceable.wrap(assessedIdentity), LoggingResourceable.wrapNonOlatResource(StringResourceableType.qtiAttempts, "", String.valueOf(attempts)));
}
Aggregations