use of org.olat.commons.calendar.model.KalendarEventLink in project openolat by klemens.
the class CourseLinkProviderController method formOK.
@Override
protected void formOK(UserRequest ureq) {
List<KalendarEventLink> kalendarEventLinks = kalendarEvent.getKalendarEventLinks();
TreeNode rootNode = courseNodeTreeModel.getRootNode();
for (Iterator<KalendarEventLink> linkIt = kalendarEventLinks.iterator(); linkIt.hasNext(); ) {
KalendarEventLink link = linkIt.next();
if (COURSE_LINK_PROVIDER.equals(link.getProvider())) {
linkIt.remove();
}
}
clearSelection(rootNode);
Collection<String> nodeIds = multiSelectTree.getSelectedKeys();
rebuildKalendarEventLinks(rootNode, nodeIds, kalendarEventLinks);
// the calendar event.
if (kalendarEvent.getCalendar() != null) {
calendarManager.updateEventFrom(kalendarEvent.getCalendar(), kalendarEvent);
}
fireEvent(ureq, Event.DONE_EVENT);
}
use of org.olat.commons.calendar.model.KalendarEventLink in project openolat by klemens.
the class CourseLinkProviderController method rebuildKalendarEventLinks.
private void rebuildKalendarEventLinks(INode node, Collection<String> selectedNodeIDs, List<KalendarEventLink> kalendarEventLinks) {
if (selectedNodeIDs.contains(node.getIdent()) && node instanceof LinkTreeNode) {
// assemble link
LinkTreeNode treeNode = (LinkTreeNode) node;
OLATResourceable courseOres = treeNode.getCourse();
if (courseOres != null) {
RepositoryEntry re = RepositoryManager.getInstance().lookupRepositoryEntry(courseOres, true);
List<ContextEntry> ces = new ArrayList<ContextEntry>();
ces.add(BusinessControlFactory.getInstance().createContextEntry(re));
if (treeNode.getCourseNode() != null) {
String courseNodeId = treeNode.getCourseNode().getIdent();
OLATResourceable oresNode = OresHelper.createOLATResourceableInstance("CourseNode", Long.valueOf(courseNodeId));
ces.add(BusinessControlFactory.getInstance().createContextEntry(oresNode));
}
String extLink = BusinessControlFactory.getInstance().getAsURIString(ces, false);
KalendarEventLink link = new KalendarEventLink(COURSE_LINK_PROVIDER, node.getIdent(), treeNode.getTitle(), extLink, treeNode.getIconCssClass());
kalendarEventLinks.add(link);
treeNode.setSelected(true);
}
}
for (int i = 0; i < node.getChildCount(); i++) {
rebuildKalendarEventLinks(node.getChildAt(i), selectedNodeIDs, kalendarEventLinks);
}
}
Aggregations