use of org.olat.commons.calendar.model.Kalendar in project OpenOLAT by OpenOLAT.
the class LectureServiceImpl method syncInternalCalendar.
private void syncInternalCalendar(LectureBlock lectureBlock, List<Identity> identities) {
RepositoryEntry entry = lectureBlock.getEntry();
for (Identity identity : identities) {
Kalendar cal = calendarMgr.getCalendar(CalendarManager.TYPE_USER, identity.getName());
syncEvent(lectureBlock, entry, cal);
lectureParticipantSummaryDao.updateCalendarSynchronization(entry, identity);
}
}
use of org.olat.commons.calendar.model.Kalendar in project OpenOLAT by OpenOLAT.
the class CourseCalendarPeekViewController method init.
private void init(UserRequest ureq, CalCourseNode courseNode, UserCourseEnvironment courseEnv, NodeEvaluation ne) {
CourseCalendars myCal = CourseCalendars.createCourseCalendarsWrapper(ureq, getWindowControl(), courseEnv, ne);
Date refDate;
ModuleConfiguration config = courseNode.getModuleConfiguration();
if (CalEditController.getAutoDate(config)) {
refDate = new Date();
} else {
refDate = CalEditController.getStartDate(config);
if (refDate == null)
refDate = new Date();
}
List<KalendarEvent> nextEvents = new ArrayList<KalendarEvent>();
for (KalendarRenderWrapper calendar : myCal.getCalendars()) {
Kalendar cal = calendar.getKalendar();
Collection<KalendarEvent> events = cal.getEvents();
for (KalendarEvent event : events) {
if (refDate.compareTo(event.getBegin()) <= 0) {
nextEvents.add(event);
}
}
}
Collections.sort(nextEvents, new KalendarEventComparator());
List<KalendarEvent> nextThreeEvents = nextEvents.subList(0, Math.min(3, nextEvents.size()));
TableGuiConfiguration tableConfig = new TableGuiConfiguration();
tableConfig.setTableEmptyMessage(translate("calendar.noEvents"));
tableConfig.setDisplayTableHeader(false);
tableConfig.setCustomCssClass("o_portlet_table");
tableConfig.setDisplayRowCount(false);
tableConfig.setPageingEnabled(false);
tableConfig.setDownloadOffered(false);
tableConfig.setSortingEnabled(false);
removeAsListenerAndDispose(tableController);
tableController = new TableController(tableConfig, ureq, getWindowControl(), getTranslator());
listenTo(tableController);
// dummy header key, won't be used since setDisplayTableHeader is set to
// false
tableController.addColumnDescriptor(new DefaultColumnDescriptor("calendar.date", 0, null, ureq.getLocale()));
tableController.addColumnDescriptor(new DefaultColumnDescriptor("calendar.subject", 1, null, ureq.getLocale(), ColumnDescriptor.ALIGNMENT_LEFT));
tableController.setTableDataModel(new CourseCalendarPeekViewModel(nextThreeEvents, getTranslator()));
}
use of org.olat.commons.calendar.model.Kalendar in project OpenOLAT by OpenOLAT.
the class CourseCalendarController method needToDifferentiateManagedEvents.
private boolean needToDifferentiateManagedEvents(List<KalendarRenderWrapper> calendars) {
boolean hasManaged = false;
for (KalendarRenderWrapper wrapper : calendars) {
Kalendar cal = wrapper.getKalendar();
hasManaged |= cal.hasManagedEvents();
}
return hasManaged;
}
use of org.olat.commons.calendar.model.Kalendar in project OpenOLAT by OpenOLAT.
the class CalendarUserConfigurationDAOTest method createConfiguration.
@Test
public void createConfiguration() {
Identity user = JunitTestHelper.createAndPersistIdentityAsRndUser("Cal-1");
String calendarId = UUID.randomUUID().toString();
Kalendar calendar = new Kalendar(calendarId, CalendarManager.TYPE_USER);
CalendarUserConfiguration config = calendarDao.createCalendarUserConfiguration(calendar, user);
dbInstance.commit();
Assert.assertNotNull(config);
Assert.assertNotNull(config.getKey());
Assert.assertNotNull(config.getCreationDate());
Assert.assertNotNull(config.getLastModified());
Assert.assertEquals(calendarId, config.getCalendarId());
Assert.assertEquals(CalendarManager.TYPE_USER, config.getType());
Assert.assertEquals(user, config.getIdentity());
}
use of org.olat.commons.calendar.model.Kalendar in project OpenOLAT by OpenOLAT.
the class CalendarUserConfigurationDAOTest method getCalendarUserConfigurations.
@Test
public void getCalendarUserConfigurations() {
Identity user = JunitTestHelper.createAndPersistIdentityAsRndUser("Cal-2");
String calendarId = UUID.randomUUID().toString();
Kalendar calendar = new Kalendar(calendarId, CalendarManager.TYPE_COURSE);
CalendarUserConfiguration config = calendarDao.createCalendarUserConfiguration(calendar, user);
dbInstance.commit();
Assert.assertNotNull(config);
// retrieve
List<CalendarUserConfiguration> configList = calendarDao.getCalendarUserConfigurations(user);
Assert.assertNotNull(configList);
Assert.assertEquals(1, configList.size());
Assert.assertEquals(config, configList.get(0));
// paranoia check
CalendarUserConfiguration loadedConfig = configList.get(0);
Assert.assertNotNull(loadedConfig.getCreationDate());
Assert.assertNotNull(loadedConfig.getLastModified());
Assert.assertEquals(config.getKey(), loadedConfig.getKey());
Assert.assertEquals(calendarId, loadedConfig.getCalendarId());
Assert.assertEquals(CalendarManager.TYPE_COURSE, loadedConfig.getType());
Assert.assertEquals(user, loadedConfig.getIdentity());
Assert.assertTrue(loadedConfig.isVisible());
Assert.assertTrue(loadedConfig.isInAggregatedFeed());
}
Aggregations