use of org.olat.commons.calendar.ui.components.KalendarRenderWrapper 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.commons.calendar.ui.components.KalendarRenderWrapper in project OpenOLAT by OpenOLAT.
the class CalendarPersonalConfigurationController method doToogleAggregated.
private void doToogleAggregated(UserRequest ureq, CalendarPersonalConfigurationRow row) {
KalendarRenderWrapper calendarWrapper = row.getWrapper();
calendarWrapper.setInAggregatedFeed(!calendarWrapper.isInAggregatedFeed());
calendarManager.saveCalendarConfigForIdentity(calendarWrapper, getIdentity());
enableDisableIcons(row.getAggregatedLink(), calendarWrapper.isInAggregatedFeed());
fireEvent(ureq, Event.CHANGED_EVENT);
}
use of org.olat.commons.calendar.ui.components.KalendarRenderWrapper in project OpenOLAT by OpenOLAT.
the class CalendarPersonalConfigurationController method doDeleteToken.
private void doDeleteToken(CalendarPersonalConfigurationRow row) {
KalendarRenderWrapper calendarWrapper = row.getWrapper();
calendarWrapper.setToken(null);
calendarManager.saveCalendarConfigForIdentity(calendarWrapper, getIdentity());
tableEl.reloadData();
}
use of org.olat.commons.calendar.ui.components.KalendarRenderWrapper in project OpenOLAT by OpenOLAT.
the class CalendarPersonalConfigurationController method doSetColor.
private void doSetColor(UserRequest ureq, CalendarPersonalConfigurationRow row, String cssColor) {
KalendarRenderWrapper calendarWrapper = row.getWrapper();
calendarWrapper.setCssClass(cssColor);
calendarManager.saveCalendarConfigForIdentity(calendarWrapper, getIdentity());
row.getColorLink().setIconLeftCSS("o_cal_config_color ".concat(row.getCssClass()));
fireEvent(ureq, new CalendarGUISettingEvent(calendarWrapper));
}
use of org.olat.commons.calendar.ui.components.KalendarRenderWrapper in project OpenOLAT by OpenOLAT.
the class CalendarPersonalConfigurationController method initForm.
@Override
protected void initForm(FormItemContainer formLayout, Controller listener, UserRequest ureq) {
if (allowImport) {
importTypeFileButton = uifactory.addFormLink("cal.import.type.file", formLayout, Link.BUTTON);
importTypeFileButton.setIconLeftCSS("o_icon o_icon_import");
importTypeUrlButton = uifactory.addFormLink("cal.synchronize.type.url", formLayout, Link.BUTTON);
importTypeUrlButton.setIconLeftCSS("o_icon o_icon_calendar_sync");
}
// add the table
FlexiTableColumnModel columnsModel = FlexiTableDataModelFactory.createFlexiTableColumnModel();
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(ConfigCols.type.i18nKey(), ConfigCols.type.ordinal(), true, ConfigCols.type.name(), new CalendarTypeClassRenderer()));
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(ConfigCols.cssClass.i18nKey(), ConfigCols.cssClass.ordinal(), true, ConfigCols.cssClass.name()));
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(ConfigCols.name.i18nKey(), ConfigCols.name.ordinal(), true, ConfigCols.name.name()));
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(ConfigCols.visible.i18nKey(), ConfigCols.visible.ordinal(), true, ConfigCols.visible.name()));
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(ConfigCols.aggregated.i18nKey(), ConfigCols.aggregated.ordinal(), true, ConfigCols.aggregated.name()));
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(ConfigCols.feed.i18nKey(), ConfigCols.feed.ordinal()));
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(ConfigCols.tools.i18nKey(), ConfigCols.tools.ordinal()));
model = new CalendarPersonalConfigurationDataModel(columnsModel);
List<CalendarPersonalConfigurationRow> rows = new ArrayList<>(calendars.size());
for (KalendarRenderWrapper calendar : calendars) {
CalendarPersonalConfigurationRow row = new CalendarPersonalConfigurationRow(calendar);
initLinks(row);
rows.add(row);
}
model.setObjects(rows);
tableEl = uifactory.addTableElement(getWindowControl(), "table", model, 20, false, getTranslator(), formLayout);
tableEl.setMultiSelect(false);
tableEl.setPageSize(50);
tableEl.setCustomizeColumns(false);
tableEl.setNumOfRowsEnabled(false);
}
Aggregations