use of org.olat.modules.portfolio.ui.component.TimelinePoint in project openolat by klemens.
the class MyPageListController method loadModel.
@Override
protected void loadModel(UserRequest ureq, String searchString) {
Map<Long, Long> numberOfCommentsMap = portfolioService.getNumberOfCommentsOnOwnedPage(getIdentity());
List<CategoryToElement> categorizedElements = portfolioService.getCategorizedOwnedPages(getIdentity());
Map<OLATResourceable, List<Category>> categorizedElementMap = new HashMap<>();
for (CategoryToElement categorizedElement : categorizedElements) {
List<Category> categories = categorizedElementMap.get(categorizedElement.getCategorizedResource());
if (categories == null) {
categories = new ArrayList<>();
categorizedElementMap.put(categorizedElement.getCategorizedResource(), categories);
}
categories.add(categorizedElement.getCategory());
}
List<Assignment> assignments = portfolioService.searchOwnedAssignments(getIdentity());
Map<Page, List<Assignment>> pageToAssignments = new HashMap<>();
for (Assignment assignment : assignments) {
Page page = assignment.getPage();
List<Assignment> assignmentList;
if (pageToAssignments.containsKey(page)) {
assignmentList = pageToAssignments.get(page);
} else {
assignmentList = new ArrayList<>();
pageToAssignments.put(page, assignmentList);
}
assignmentList.add(assignment);
}
FormLink newEntryButton = uifactory.addFormLink("new.entry." + (++counter), "new.entry", "create.new.page", null, flc, Link.BUTTON);
newEntryButton.setCustomEnabledLinkCSS("btn btn-primary");
List<Page> pages = portfolioService.searchOwnedPages(getIdentity(), searchString);
List<PortfolioElementRow> rows = new ArrayList<>(pages.size());
List<TimelinePoint> points = new ArrayList<>(pages.size());
for (Page page : pages) {
if (page.getPageStatus() == PageStatus.deleted) {
continue;
}
List<Assignment> assignmentList = pageToAssignments.get(page);
PortfolioElementRow row = forgePageRow(ureq, page, null, assignmentList, categorizedElementMap, numberOfCommentsMap, true);
rows.add(row);
if (page.getSection() != null) {
Section section = page.getSection();
row.setMetaSectionTitle(section.getTitle());
if (section.getBinder() != null) {
row.setMetaBinderTitle(section.getBinder().getTitle());
}
}
row.setNewFloatingEntryLink(newEntryButton);
String s = page.getPageStatus() == null ? "draft" : page.getPageStatus().name();
points.add(new TimelinePoint(page.getKey().toString(), page.getTitle(), page.getCreationDate(), s));
}
timelineEl.setPoints(points);
// clean up the posters
disposeRows();
model.setObjects(rows);
tableEl.reset();
tableEl.reloadData();
}
use of org.olat.modules.portfolio.ui.component.TimelinePoint in project OpenOLAT by OpenOLAT.
the class BinderPageListController method updateTimeline.
private void updateTimeline() {
List<PortfolioElementRow> pages = model.getObjects();
List<TimelinePoint> points = new ArrayList<>(pages.size());
for (PortfolioElementRow page : pages) {
if (page.isPage()) {
String s = page.getPageStatus() == null ? "draft" : page.getPageStatus().name();
points.add(new TimelinePoint(page.getKey().toString(), page.getTitle(), page.getCreationDate(), s));
}
}
timelineEl.setPoints(points);
}
use of org.olat.modules.portfolio.ui.component.TimelinePoint in project OpenOLAT by OpenOLAT.
the class MyPageListController method loadModel.
@Override
protected void loadModel(UserRequest ureq, String searchString) {
Map<Long, Long> numberOfCommentsMap = portfolioService.getNumberOfCommentsOnOwnedPage(getIdentity());
List<CategoryToElement> categorizedElements = portfolioService.getCategorizedOwnedPages(getIdentity());
Map<OLATResourceable, List<Category>> categorizedElementMap = new HashMap<>();
for (CategoryToElement categorizedElement : categorizedElements) {
List<Category> categories = categorizedElementMap.get(categorizedElement.getCategorizedResource());
if (categories == null) {
categories = new ArrayList<>();
categorizedElementMap.put(categorizedElement.getCategorizedResource(), categories);
}
categories.add(categorizedElement.getCategory());
}
List<Assignment> assignments = portfolioService.searchOwnedAssignments(getIdentity());
Map<Page, List<Assignment>> pageToAssignments = new HashMap<>();
for (Assignment assignment : assignments) {
Page page = assignment.getPage();
List<Assignment> assignmentList;
if (pageToAssignments.containsKey(page)) {
assignmentList = pageToAssignments.get(page);
} else {
assignmentList = new ArrayList<>();
pageToAssignments.put(page, assignmentList);
}
assignmentList.add(assignment);
}
FormLink newEntryButton = uifactory.addFormLink("new.entry." + (++counter), "new.entry", "create.new.page", null, flc, Link.BUTTON);
newEntryButton.setCustomEnabledLinkCSS("btn btn-primary");
List<Page> pages = portfolioService.searchOwnedPages(getIdentity(), searchString);
List<PortfolioElementRow> rows = new ArrayList<>(pages.size());
List<TimelinePoint> points = new ArrayList<>(pages.size());
for (Page page : pages) {
if (page.getPageStatus() == PageStatus.deleted) {
continue;
}
List<Assignment> assignmentList = pageToAssignments.get(page);
PortfolioElementRow row = forgePageRow(ureq, page, null, assignmentList, categorizedElementMap, numberOfCommentsMap, true);
rows.add(row);
if (page.getSection() != null) {
Section section = page.getSection();
row.setMetaSectionTitle(section.getTitle());
if (section.getBinder() != null) {
row.setMetaBinderTitle(section.getBinder().getTitle());
}
}
row.setNewFloatingEntryLink(newEntryButton);
String s = page.getPageStatus() == null ? "draft" : page.getPageStatus().name();
points.add(new TimelinePoint(page.getKey().toString(), page.getTitle(), page.getCreationDate(), s));
}
timelineEl.setPoints(points);
// clean up the posters
disposeRows();
model.setObjects(rows);
tableEl.reset();
tableEl.reloadData();
}
use of org.olat.modules.portfolio.ui.component.TimelinePoint in project openolat by klemens.
the class BinderPageListController method updateTimeline.
private void updateTimeline() {
List<PortfolioElementRow> pages = model.getObjects();
List<TimelinePoint> points = new ArrayList<>(pages.size());
for (PortfolioElementRow page : pages) {
if (page.isPage()) {
String s = page.getPageStatus() == null ? "draft" : page.getPageStatus().name();
points.add(new TimelinePoint(page.getKey().toString(), page.getTitle(), page.getCreationDate(), s));
}
}
timelineEl.setPoints(points);
}
Aggregations