use of org.olat.course.config.CourseConfig in project OpenOLAT by OpenOLAT.
the class CourseRuntimeController method doLayout.
private void doLayout(UserRequest ureq) {
if (delayedClose == Delayed.layout || requestForClose(ureq)) {
if (reSecurity.isEntryAdmin() || hasCourseRight(CourseRights.RIGHT_COURSEEDITOR)) {
removeCustomCSS();
ICourse course = CourseFactory.loadCourse(getRepositoryEntry());
boolean managedLayout = RepositoryEntryManagedFlag.isManaged(getRepositoryEntry(), RepositoryEntryManagedFlag.layout);
CourseConfig courseConfig = course.getCourseEnvironment().getCourseConfig().clone();
CourseLayoutGeneratorController ctrl = new CourseLayoutGeneratorController(ureq, getWindowControl(), getRepositoryEntry(), courseConfig, course.getCourseEnvironment(), !managedLayout);
listenTo(ctrl);
courseLayoutCtrl = pushController(ureq, translate("command.layout"), ctrl);
setActiveTool(layoutLink);
currentToolCtr = courseLayoutCtrl;
}
} else {
delayedClose = Delayed.layout;
}
}
use of org.olat.course.config.CourseConfig 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.config.CourseConfig in project OpenOLAT by OpenOLAT.
the class GlossaryManagerImpl method deleteGlossary.
// TODO:RH:gloss change courseconfig, to keep more than 1 single glossary as a list
/**
* @param res glossary to be deleted
*/
@Override
public void deleteGlossary(OLATResourceable res) {
// first remove all references
List<Reference> repoRefs = referenceManager.getReferencesTo(res);
for (Iterator<Reference> iter = repoRefs.iterator(); iter.hasNext(); ) {
Reference ref = iter.next();
if (ref.getUserdata().equals(GLOSSARY_REPO_REF_IDENTIFYER)) {
// remove the reference from the course configuration
// TODO:RH:improvement: this should use a callback method or send a general delete
// event so that the course can take care of this rather than having it
// here hardcoded
OLATResource courseResource = ref.getSource();
// ICourse course = CourseFactory.loadCourse(courseResource);
ICourse course = CourseFactory.openCourseEditSession(courseResource.getResourceableId());
CourseConfig cc = course.getCourseEnvironment().getCourseConfig();
cc.setGlossarySoftKey(null);
CourseFactory.setCourseConfig(course.getResourceableId(), cc);
CourseFactory.closeCourseEditSession(course.getResourceableId(), true);
// remove reference from the references table
referenceManager.delete(ref);
}
}
// now remove the resource itself
FileResourceManager.getInstance().deleteFileResource(res);
}
use of org.olat.course.config.CourseConfig in project OpenOLAT by OpenOLAT.
the class UserCalendarWebService method getCalendars.
private void getCalendars(CalendarVisitor calVisitor, UserRequest ureq) {
Roles roles = ureq.getUserSession().getRoles();
Identity retrievedUser = ureq.getIdentity();
CalendarModule calendarModule = CoreSpringFactory.getImpl(CalendarModule.class);
if (calendarModule.isEnabled()) {
if (calendarModule.isEnablePersonalCalendar()) {
KalendarRenderWrapper personalWrapper = getPersonalCalendar(ureq.getIdentity());
calVisitor.visit(personalWrapper);
}
if (calendarModule.isEnableCourseToolCalendar() || calendarModule.isEnableCourseElementCalendar()) {
RepositoryManager rm = RepositoryManager.getInstance();
ACService acManager = CoreSpringFactory.getImpl(ACService.class);
SearchRepositoryEntryParameters repoParams = new SearchRepositoryEntryParameters(retrievedUser, roles, "CourseModule");
repoParams.setOnlyExplicitMember(true);
repoParams.setIdentity(retrievedUser);
IdentityEnvironment ienv = new IdentityEnvironment();
ienv.setIdentity(retrievedUser);
ienv.setRoles(roles);
List<RepositoryEntry> entries = rm.genericANDQueryWithRolesRestriction(repoParams, 0, -1, true);
for (RepositoryEntry entry : entries) {
AccessResult result = acManager.isAccessible(entry, retrievedUser, false);
if (result.isAccessible()) {
try {
final ICourse course = CourseFactory.loadCourse(entry);
CourseConfig config = course.getCourseEnvironment().getCourseConfig();
UserCourseEnvironment userCourseEnv = new UserCourseEnvironmentImpl(ienv, course.getCourseEnvironment());
if (config.isCalendarEnabled()) {
KalendarRenderWrapper wrapper = CourseCalendars.getCourseCalendarWrapper(ureq, userCourseEnv, null);
calVisitor.visit(wrapper);
} else {
CalCourseNodeVisitor visitor = new CalCourseNodeVisitor();
new CourseTreeVisitor(course, ienv).visit(visitor, new VisibleTreeFilter());
if (visitor.isFound()) {
KalendarRenderWrapper wrapper = CourseCalendars.getCourseCalendarWrapper(ureq, userCourseEnv, null);
calVisitor.visit(wrapper);
}
}
} catch (Exception e) {
log.error("", e);
}
}
}
}
if (calendarModule.isEnableGroupCalendar()) {
CollaborationManager collaborationManager = CoreSpringFactory.getImpl(CollaborationManager.class);
// start found forums in groups
BusinessGroupService bgm = CoreSpringFactory.getImpl(BusinessGroupService.class);
SearchBusinessGroupParams params = new SearchBusinessGroupParams(retrievedUser, true, true);
params.addTools(CollaborationTools.TOOL_CALENDAR);
List<BusinessGroup> groups = bgm.findBusinessGroups(params, null, 0, -1);
for (BusinessGroup group : groups) {
KalendarRenderWrapper wrapper = collaborationManager.getCalendar(group, ureq, false);
calVisitor.visit(wrapper);
}
}
}
}
use of org.olat.course.config.CourseConfig in project OpenOLAT by OpenOLAT.
the class CourseLayoutHelper method getCSSBaseFolder.
/**
* get configured path for this courseEnvironment
* @param courseEnvironment
* @return
*/
public static VFSContainer getCSSBaseFolder(CourseEnvironment courseEnvironment) {
CourseConfig courseConfig = courseEnvironment.getCourseConfig();
String cssSet = courseConfig.getCssLayoutRef();
return getThemeBaseFolder(courseEnvironment, cssSet);
}
Aggregations