use of org.olat.course.run.userview.UserCourseEnvironmentImpl in project openolat by klemens.
the class CourseRuntimeController method getUserCourseEnvironment.
private UserCourseEnvironmentImpl getUserCourseEnvironment() {
RunMainController run = getRunMainController();
UserCourseEnvironmentImpl uce = run == null ? null : run.getUce();
if (uce != null && uce.isCourseReadOnly() && overrideReadOnly) {
uce.setCourseReadOnly(Boolean.FALSE);
}
return uce;
}
use of org.olat.course.run.userview.UserCourseEnvironmentImpl in project openolat by klemens.
the class CourseRuntimeController method processBusinessGroupModifiedEvent.
private void processBusinessGroupModifiedEvent(BusinessGroupModifiedEvent bgme) {
Identity identity = getIdentity();
// was adding or removing of the user
if (bgme.wasMyselfAdded(identity) || bgme.wasMyselfRemoved(identity)) {
reSecurity = repositoryManager.isAllowed(getIdentity(), roles, getRepositoryEntry());
reloadGroupMemberships(reSecurity);
loadRights(reSecurity);
initToolbar();
} else if (bgme.getCommand().equals(BusinessGroupModifiedEvent.GROUPRIGHTS_MODIFIED_EVENT)) {
// check if this affects a right group where the user does participate.
// if so, we need to rebuild the toolboxes
UserCourseEnvironmentImpl uce = getUserCourseEnvironment();
if (uce != null && (PersistenceHelper.listContainsObjectByKey(uce.getParticipatingGroups(), bgme.getModifiedGroupKey()) || PersistenceHelper.listContainsObjectByKey(uce.getCoachedGroups(), bgme.getModifiedGroupKey()))) {
reSecurity = repositoryManager.isAllowed(getIdentity(), roles, getRepositoryEntry());
reloadGroupMemberships(reSecurity);
loadRights(reSecurity);
initToolbar();
}
}
}
use of org.olat.course.run.userview.UserCourseEnvironmentImpl in project openolat by klemens.
the class RunMainController method loadUserCourseEnvironment.
private UserCourseEnvironmentImpl loadUserCourseEnvironment(UserRequest ureq, RepositoryEntrySecurity reSecurity) {
CourseGroupManager cgm = course.getCourseEnvironment().getCourseGroupManager();
List<BusinessGroup> coachedGroups;
if (reSecurity.isGroupCoach()) {
coachedGroups = cgm.getOwnedBusinessGroups(ureq.getIdentity());
} else {
coachedGroups = Collections.emptyList();
}
List<BusinessGroup> participatedGroups;
if (reSecurity.isGroupParticipant()) {
participatedGroups = cgm.getParticipatingBusinessGroups(ureq.getIdentity());
} else {
participatedGroups = Collections.emptyList();
}
List<BusinessGroup> waitingLists;
if (reSecurity.isGroupWaiting()) {
waitingLists = cgm.getWaitingListGroups(ureq.getIdentity());
} else {
waitingLists = Collections.emptyList();
}
return new UserCourseEnvironmentImpl(ureq.getUserSession().getIdentityEnvironment(), course.getCourseEnvironment(), getWindowControl(), coachedGroups, participatedGroups, waitingLists, reSecurity.isCourseCoach() || reSecurity.isGroupCoach(), reSecurity.isEntryAdmin(), reSecurity.isCourseParticipant() || reSecurity.isGroupParticipant(), reSecurity.isReadOnly());
}
use of org.olat.course.run.userview.UserCourseEnvironmentImpl in project openolat by klemens.
the class QTI21ResetDataController method formOK.
@Override
protected void formOK(UserRequest ureq) {
if (courseNode instanceof IQTESTCourseNode) {
IQTESTCourseNode testCourseNode = (IQTESTCourseNode) courseNode;
RepositoryEntry testEntry = courseNode.getReferencedRepositoryEntry();
RepositoryEntry courseEntry = courseEnv.getCourseGroupManager().getCourseEntry();
ICourse course = CourseFactory.loadCourse(courseEntry);
archiveData(course, options);
qtiService.deleteAssessmentTestSession(identities, testEntry, courseEntry, courseNode.getIdent());
for (Identity identity : identities) {
ScoreEvaluation scoreEval = new ScoreEvaluation(null, null, AssessmentEntryStatus.notStarted, null, Boolean.FALSE, 0.0d, AssessmentRunStatus.notStarted, null);
IdentityEnvironment ienv = new IdentityEnvironment(identity, studentRoles);
UserCourseEnvironment uce = new UserCourseEnvironmentImpl(ienv, courseEnv);
testCourseNode.updateUserScoreEvaluation(scoreEval, uce, getIdentity(), false, Role.coach);
testCourseNode.updateCurrentCompletion(uce, getIdentity(), null, AssessmentRunStatus.notStarted, Role.coach);
}
} else if (assessedEntry != null) {
archiveData(assessedEntry);
qtiService.deleteAssessmentTestSession(identities, assessedEntry, null, null);
}
fireEvent(ureq, Event.CHANGED_EVENT);
}
Aggregations