use of org.olat.course.run.userview.UserCourseEnvironmentImpl in project OpenOLAT by OpenOLAT.
the class CourseRuntimeController method initToolbar.
@Override
protected void initToolbar(Dropdown toolsDropdown, Dropdown settingsDropdown) {
toolbarPanel.removeAllTools();
if (corrupted)
return;
ICourse course = CourseFactory.loadCourse(getRepositoryEntry());
UserCourseEnvironmentImpl uce = getUserCourseEnvironment();
if (!course.getCourseConfig().isToolbarEnabled() && !reSecurity.isEntryAdmin() && !reSecurity.isCourseCoach() && !reSecurity.isGroupCoach() && !hasCourseRight(CourseRights.RIGHT_COURSEEDITOR) && !hasCourseRight(CourseRights.RIGHT_MEMBERMANAGEMENT) && !hasCourseRight(CourseRights.RIGHT_GROUPMANAGEMENT) && !hasCourseRight(CourseRights.RIGHT_ARCHIVING) && !hasCourseRight(CourseRights.RIGHT_STATISTICS) && !hasCourseRight(CourseRights.RIGHT_DB) && !hasCourseRight(CourseRights.RIGHT_ASSESSMENT) && !hasCourseRight(CourseRights.RIGHT_ASSESSMENT_MODE)) {
toolbarPanel.setToolbarEnabled(false);
} else {
toolbarPanel.setToolbarEnabled(true);
}
if (!isAssessmentLock()) {
initTools(toolsDropdown, course, uce);
initSettingsTools(settingsDropdown);
initEditionTools(settingsDropdown);
initDeleteTools(settingsDropdown, true);
}
initToolsMyCourse(course, uce);
initGeneralTools(course);
if (getRunMainController() != null) {
getRunMainController().initToolbar();
}
setCourseClosedMessage(uce);
}
use of org.olat.course.run.userview.UserCourseEnvironmentImpl in project OpenOLAT by OpenOLAT.
the class CourseRuntimeController method doAssessmentStatistics.
/**
* Only an helper method for the 2 methods above. Don't call it directly, there is no request on close guard.
* @param ureq
* @param i18nCrumbKey
* @param typeName
* @param tool
* @param types
* @return
*/
private Activateable2 doAssessmentStatistics(UserRequest ureq, String i18nCrumbKey, String typeName, Link tool, QTIType... types) {
OLATResourceable ores = OresHelper.createOLATResourceableType(typeName);
ThreadLocalUserActivityLogger.addLoggingResourceInfo(LoggingResourceable.wrapBusinessPath(ores));
WindowControl swControl = addToHistory(ureq, ores, null);
if (reSecurity.isEntryAdmin() || reSecurity.isCourseCoach() || reSecurity.isGroupCoach() || hasCourseRight(CourseRights.RIGHT_STATISTICS)) {
removeCustomCSS();
UserCourseEnvironmentImpl uce = getUserCourseEnvironment();
StatisticCourseNodesController ctrl = new StatisticCourseNodesController(ureq, swControl, toolbarPanel, reSecurity, uce, types);
listenTo(ctrl);
statsToolCtr = pushController(ureq, translate(i18nCrumbKey), ctrl);
currentToolCtr = statsToolCtr;
setActiveTool(tool);
return statsToolCtr;
}
return null;
}
use of org.olat.course.run.userview.UserCourseEnvironmentImpl in project OpenOLAT by OpenOLAT.
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 OpenOLAT.
the class CourseRuntimeController method loadRights.
@Override
protected void loadRights(RepositoryEntrySecurity security) {
super.loadRights(security);
if (corrupted)
return;
ICourse course = CourseFactory.loadCourse(getRepositoryEntry());
CourseGroupManager cgm = course.getCourseEnvironment().getCourseGroupManager();
// 3) all other rights are defined in the groupmanagement using the learning
// group rights
UserCourseEnvironmentImpl uce = getUserCourseEnvironment();
if (uce != null) {
uce.setUserRoles(security.isEntryAdmin(), security.isCourseCoach() || security.isGroupCoach(), security.isCourseParticipant() || security.isGroupParticipant());
if (security.isReadOnly()) {
if (overrideReadOnly) {
uce.setCourseReadOnly(Boolean.FALSE);
} else {
uce.setCourseReadOnly(Boolean.TRUE);
}
} else {
uce.setCourseReadOnly(Boolean.FALSE);
}
}
courseRightsCache = new HashMap<>();
if (!security.isEntryAdmin() && !isGuestOnly) {
List<String> rights = cgm.getRights(getIdentity());
courseRightsCache.put(CourseRights.RIGHT_GROUPMANAGEMENT, Boolean.valueOf(rights.contains(CourseRights.RIGHT_GROUPMANAGEMENT)));
courseRightsCache.put(CourseRights.RIGHT_MEMBERMANAGEMENT, Boolean.valueOf(rights.contains(CourseRights.RIGHT_MEMBERMANAGEMENT)));
courseRightsCache.put(CourseRights.RIGHT_COURSEEDITOR, Boolean.valueOf(rights.contains(CourseRights.RIGHT_COURSEEDITOR)));
courseRightsCache.put(CourseRights.RIGHT_ARCHIVING, Boolean.valueOf(rights.contains(CourseRights.RIGHT_ARCHIVING)));
courseRightsCache.put(CourseRights.RIGHT_ASSESSMENT, Boolean.valueOf(rights.contains(CourseRights.RIGHT_ASSESSMENT)));
courseRightsCache.put(CourseRights.RIGHT_ASSESSMENT_MODE, Boolean.valueOf(rights.contains(CourseRights.RIGHT_ASSESSMENT_MODE)));
courseRightsCache.put(CourseRights.RIGHT_GLOSSARY, Boolean.valueOf(rights.contains(CourseRights.RIGHT_GLOSSARY)));
courseRightsCache.put(CourseRights.RIGHT_STATISTICS, Boolean.valueOf(rights.contains(CourseRights.RIGHT_STATISTICS)));
courseRightsCache.put(CourseRights.RIGHT_DB, Boolean.valueOf(rights.contains(CourseRights.RIGHT_DB)));
}
}
use of org.olat.course.run.userview.UserCourseEnvironmentImpl in project OpenOLAT by OpenOLAT.
the class EPFrontendManager method submitMap.
private void submitMap(PortfolioStructureMap map, boolean logActivity, Role by) {
// add an exception
if (!(map instanceof EPStructuredMap))
return;
EPStructuredMap submittedMap = (EPStructuredMap) map;
structureManager.submitMap(submittedMap);
EPTargetResource resource = submittedMap.getTargetResource();
OLATResourceable courseOres = resource.getOLATResourceable();
ICourse course = CourseFactory.loadCourse(courseOres);
AssessmentManager am = course.getCourseEnvironment().getAssessmentManager();
CourseNode courseNode = course.getRunStructure().getNode(resource.getSubPath());
List<Identity> owners = policyManager.getOwners(submittedMap);
for (Identity owner : owners) {
if (courseNode != null) {
// courseNode might have been deleted meanwhile
IdentityEnvironment ienv = new IdentityEnvironment();
ienv.setIdentity(owner);
UserCourseEnvironment uce = new UserCourseEnvironmentImpl(ienv, course.getCourseEnvironment());
if (logActivity) {
am.incrementNodeAttempts(courseNode, owner, uce, by);
} else {
am.incrementNodeAttemptsInBackground(courseNode, owner, uce);
}
RepositoryEntry referenceEntry = courseNode.getReferencedRepositoryEntry();
RepositoryEntry courseEntry = course.getCourseEnvironment().getCourseGroupManager().getCourseEntry();
assessmentService.updateAssessmentEntry(owner, courseEntry, courseNode.getIdent(), referenceEntry, AssessmentEntryStatus.inReview);
}
assessmentNotificationsHandler.markPublisherNews(owner, course.getResourceableId());
log.audit("Map " + map + " from " + owner.getName() + " has been submitted.");
}
}
Aggregations