use of org.olat.commons.calendar.model.KalendarEvent in project OpenOLAT by OpenOLAT.
the class DENEditTableDataModel method getValueAt.
@Override
public Object getValueAt(int row, int col) {
KalendarEvent event = getObject(row);
switch(col) {
case 0:
return event.getSubject();
case 1:
// begin
return event.getBegin();
case 2:
// duration
Date begin = event.getBegin();
Date end = event.getEnd();
long milliSeconds = denManager.getDuration(begin, end);
return denManager.formatDuration(milliSeconds, translator);
case 3:
// location
return event.getLocation();
case 4:
return event.getComment();
case 5:
return event.getNumParticipants();
default:
return "error";
}
}
use of org.olat.commons.calendar.model.KalendarEvent in project OpenOLAT by OpenOLAT.
the class DENManager method deleteParticipants.
/**
* Delete all participants in the events with the given IDs
* @param course
* @param courseNode
* @param eventIDs of the events, where all participants should be deleted
* @return list with the actualized events
*/
protected List<KalendarEvent> deleteParticipants(OLATResourceable ores, DENCourseNode courseNode, List<String> eventIDs) {
List<KalendarEvent> events = getDENEvents(ores.getResourceableId(), courseNode.getIdent());
for (KalendarEvent event : events) {
if (eventIDs.contains(event.getID())) {
removeDateInUserCalendar(event);
event.setParticipants(new String[0]);
}
}
persistDENSettings(events, ores, courseNode);
return events;
}
use of org.olat.commons.calendar.model.KalendarEvent in project OpenOLAT by OpenOLAT.
the class DENManager method updateMultipleDatesInList.
/**
* Update multiple dates in a list of KalendarEvents with the given informations from a manage dates form
* @param datesForm of type DENEditManageDatesForm
* @param dataList
* @param selectedDates
* @return list with actualized KalendarEvents
*/
protected List<KalendarEvent> updateMultipleDatesInList(String subjectStr, String commentStr, String locationStr, String movementGapStr, int numParticipants, List<KalendarEvent> dataList, BitSet selectedDates) {
for (int i = 0; i < dataList.size(); i++) {
if (selectedDates.get(i)) {
KalendarEvent oldEvent = dataList.get(i);
StringTokenizer strTok = new StringTokenizer(movementGapStr.substring(1), ":", false);
int gap = 1000 * 60 * 60 * Integer.parseInt(strTok.nextToken()) + 1000 * 60 * Integer.parseInt(strTok.nextToken());
Date newBegin, newEnd;
if (movementGapStr.startsWith("+")) {
newBegin = new Date(oldEvent.getBegin().getTime() + gap);
newEnd = new Date(oldEvent.getEnd().getTime() + gap);
} else {
newBegin = new Date(oldEvent.getBegin().getTime() - gap);
newEnd = new Date(oldEvent.getEnd().getTime() - gap);
}
String eventId = oldEvent.getID();
KalendarEvent newEvent = new KalendarEvent(eventId, null, subjectStr.equals(new String()) ? oldEvent.getSubject() : subjectStr, newBegin, newEnd);
if (numParticipants != 0)
newEvent.setNumParticipants(numParticipants);
else
newEvent.setNumParticipants(oldEvent.getNumParticipants());
if (!locationStr.equals(new String()))
newEvent.setLocation(locationStr);
else
newEvent.setLocation(oldEvent.getLocation());
if (!commentStr.equals(new String()))
newEvent.setComment(commentStr);
else
newEvent.setComment(oldEvent.getComment());
newEvent.setParticipants(oldEvent.getParticipants());
newEvent.setSourceNodeId(oldEvent.getSourceNodeId());
dataList.remove(i);
dataList.add(i, newEvent);
}
}
return dataList;
}
use of org.olat.commons.calendar.model.KalendarEvent in project OpenOLAT by OpenOLAT.
the class DENRunController method event.
@Override
protected void event(UserRequest ureq, Controller source, Event event) {
if (runDENTable == source) {
// the link to enroll or cancel enrollment is clicked
if (event.getCommand().equals(Table.COMMANDLINK_ROWACTION_CLICKED)) {
TableEvent tableEvent = (TableEvent) event;
KalendarEvent calEvent = runTableData.getObject(tableEvent.getRowId());
if (tableEvent.getActionId().equals(DENRunTableDataModel.CMD_ENROLL_IN_DATE)) {
// do enroll
status = denManager.doEnroll(ureq.getIdentity(), calEvent, ores, courseNode);
if (!status.isEnrolled())
showError();
} else if (tableEvent.getActionId().equals(DENRunTableDataModel.CMD_ENROLLED_CANCEL)) {
// cancel enrollment
status = denManager.cancelEnroll(ureq.getIdentity(), calEvent, ores);
if (!status.isCancelled())
showError();
}
createOrUpdateDateTable(ureq, courseNode);
runDENTable.setTableDataModel(runTableData);
fireEvent(ureq, Event.DONE_EVENT);
// inform subscription context about changes
NotificationsManager.getInstance().markPublisherNews(subsContext, ureq.getIdentity(), true);
// </OPAL-122>
}
}
}
use of org.olat.commons.calendar.model.KalendarEvent in project OpenOLAT by OpenOLAT.
the class CopyEventToCalendarController method formOK.
@Override
protected void formOK(UserRequest ureq) {
for (MultipleSelectionElement copyEl : copyEls) {
if (copyEl.isEnabled() && copyEl.isAtLeastSelected(1)) {
KalendarRenderWrapper calendarWrapper = (KalendarRenderWrapper) copyEl.getUserObject();
Kalendar cal = calendarWrapper.getKalendar();
KalendarEvent clonedKalendarEvent = (KalendarEvent) XStreamHelper.xstreamClone(kalendarEvent);
if (clonedKalendarEvent.getKalendarEventLinks().size() > 0) {
clonedKalendarEvent.setKalendarEventLinks(new ArrayList<KalendarEventLink>());
}
calendarManager.addEventTo(cal, clonedKalendarEvent);
}
}
fireEvent(ureq, Event.DONE_EVENT);
}
Aggregations