Search in sources :

Example 1 with TimelinePoint

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();
}
Also used : PortfolioElementRow(org.olat.modules.portfolio.ui.model.PortfolioElementRow) Category(org.olat.modules.portfolio.Category) OLATResourceable(org.olat.core.id.OLATResourceable) HashMap(java.util.HashMap) CategoryToElement(org.olat.modules.portfolio.CategoryToElement) ArrayList(java.util.ArrayList) Page(org.olat.modules.portfolio.Page) FormLink(org.olat.core.gui.components.form.flexible.elements.FormLink) Section(org.olat.modules.portfolio.Section) Assignment(org.olat.modules.portfolio.Assignment) ArrayList(java.util.ArrayList) List(java.util.List) TimelinePoint(org.olat.modules.portfolio.ui.component.TimelinePoint)

Example 2 with TimelinePoint

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);
}
Also used : PortfolioElementRow(org.olat.modules.portfolio.ui.model.PortfolioElementRow) ArrayList(java.util.ArrayList) TimelinePoint(org.olat.modules.portfolio.ui.component.TimelinePoint)

Example 3 with TimelinePoint

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();
}
Also used : PortfolioElementRow(org.olat.modules.portfolio.ui.model.PortfolioElementRow) Category(org.olat.modules.portfolio.Category) OLATResourceable(org.olat.core.id.OLATResourceable) HashMap(java.util.HashMap) CategoryToElement(org.olat.modules.portfolio.CategoryToElement) ArrayList(java.util.ArrayList) Page(org.olat.modules.portfolio.Page) FormLink(org.olat.core.gui.components.form.flexible.elements.FormLink) Section(org.olat.modules.portfolio.Section) Assignment(org.olat.modules.portfolio.Assignment) ArrayList(java.util.ArrayList) List(java.util.List) TimelinePoint(org.olat.modules.portfolio.ui.component.TimelinePoint)

Example 4 with TimelinePoint

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);
}
Also used : PortfolioElementRow(org.olat.modules.portfolio.ui.model.PortfolioElementRow) ArrayList(java.util.ArrayList) TimelinePoint(org.olat.modules.portfolio.ui.component.TimelinePoint)

Aggregations

ArrayList (java.util.ArrayList)4 TimelinePoint (org.olat.modules.portfolio.ui.component.TimelinePoint)4 PortfolioElementRow (org.olat.modules.portfolio.ui.model.PortfolioElementRow)4 HashMap (java.util.HashMap)2 List (java.util.List)2 FormLink (org.olat.core.gui.components.form.flexible.elements.FormLink)2 OLATResourceable (org.olat.core.id.OLATResourceable)2 Assignment (org.olat.modules.portfolio.Assignment)2 Category (org.olat.modules.portfolio.Category)2 CategoryToElement (org.olat.modules.portfolio.CategoryToElement)2 Page (org.olat.modules.portfolio.Page)2 Section (org.olat.modules.portfolio.Section)2