Search in sources :

Example 1 with Page

use of org.olat.modules.portfolio.Page in project OpenOLAT by OpenOLAT.

the class AbstractPageListController method doOpenAssignment.

private void doOpenAssignment(UserRequest ureq, PortfolioElementRow row) {
    Assignment assignment = row.getAssignment();
    if (assignment.getAssignmentType() == AssignmentType.essay || assignment.getAssignmentType() == AssignmentType.document) {
        Page page = assignment.getPage();
        Page reloadedPage = portfolioService.getPageByKey(page.getKey());
        doOpenPage(ureq, reloadedPage, false);
    } else {
        showWarning("not.implemented");
    }
}
Also used : Assignment(org.olat.modules.portfolio.Assignment) Page(org.olat.modules.portfolio.Page)

Example 2 with Page

use of org.olat.modules.portfolio.Page in project OpenOLAT by OpenOLAT.

the class AbstractPageListController method doOpenRow.

protected void doOpenRow(UserRequest ureq, PortfolioElementRow row, boolean newElement) {
    if (row.isPage()) {
        Page reloadedPage = portfolioService.getPageByKey(row.getKey());
        doOpenPage(ureq, reloadedPage, newElement);
    } else if (row.isPendingAssignment()) {
        if (secCallback.canNewAssignment()) {
            doEditAssignment(ureq, row);
        } else {
        // TODO portfolio
        }
    }
}
Also used : Page(org.olat.modules.portfolio.Page)

Example 3 with Page

use of org.olat.modules.portfolio.Page in project OpenOLAT by OpenOLAT.

the class BinderAssessmentController method loadModel.

private void loadModel() {
    List<AssessmentSection> aSections = portfolioService.getAssessmentSections(binder, null);
    Map<Section, AssessmentSection> aSectionsMap = new HashMap<>();
    for (AssessmentSection aSection : aSections) {
        aSectionsMap.put(aSection.getSection(), aSection);
    }
    // binder done only is an owner is present
    // and all owners have done the binder
    boolean binderDone = false;
    List<Identity> assessedIdentities = portfolioService.getMembers(binder, PortfolioRoles.owner.name());
    int countDone = 0;
    for (Identity assessedIdentity : assessedIdentities) {
        AssessmentEntryStatus status = portfolioService.getAssessmentStatus(assessedIdentity, binder);
        if (status == AssessmentEntryStatus.done) {
            countDone++;
        }
    }
    binderDone = (countDone > 0 && countDone == assessedIdentities.size());
    boolean allClosed = true;
    List<Section> sections = portfolioService.getSections(binder);
    List<AssessmentSectionWrapper> rows = new ArrayList<>();
    Map<Section, AssessmentSectionWrapper> sectionToRows = new HashMap<>();
    for (Section section : sections) {
        AssessmentSection assessmentSection = aSectionsMap.get(section);
        AssessmentSectionWrapper row = new AssessmentSectionWrapper(section, assessmentSection);
        sectionToRows.put(section, row);
        if (secCallback.canViewAssess(section) || secCallback.canAssess(section)) {
            rows.add(row);
        }
        allClosed &= section.getSectionStatus() == SectionStatus.closed;
    }
    List<Page> pages = portfolioService.getPages(binder, null);
    for (Page page : pages) {
        AssessmentSectionWrapper row = sectionToRows.get(page.getSection());
        if (row != null) {
            row.setNumOfPages(row.getNumOfPages() + 1);
        }
    }
    boolean allowedToAssess = false;
    boolean allowedToAssessBinder = secCallback.canAssess(binder);
    for (AssessmentSectionWrapper row : rows) {
        boolean canAssess = secCallback.canAssess(row.getSection());
        if (canAssess && !binderDone) {
            forgeAssessmentSection(row);
            allowedToAssess = true;
        }
    }
    reopenLink.setVisible(allowedToAssessBinder && binderDone);
    saveAndDoneLink.setVisible(allowedToAssessBinder && !binderDone && allClosed);
    saveButton.setVisible(allowedToAssess);
    cancelButton.setVisible(allowedToAssess);
    model.setObjects(rows);
    tableEl.reset();
    tableEl.reloadData();
}
Also used : HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) Page(org.olat.modules.portfolio.Page) AssessmentSection(org.olat.modules.portfolio.AssessmentSection) Section(org.olat.modules.portfolio.Section) AssessmentEntryStatus(org.olat.modules.assessment.model.AssessmentEntryStatus) AssessmentSection(org.olat.modules.portfolio.AssessmentSection) Identity(org.olat.core.id.Identity)

Example 4 with Page

use of org.olat.modules.portfolio.Page in project OpenOLAT by OpenOLAT.

the class PortfolioServiceImpl method changeSectionStatus.

@Override
public Section changeSectionStatus(Section section, SectionStatus status, Identity coach) {
    PageStatus newPageStatus;
    if (status == SectionStatus.closed) {
        newPageStatus = PageStatus.closed;
    } else {
        newPageStatus = PageStatus.inRevision;
    }
    Section reloadedSection = binderDao.loadSectionByKey(section.getKey());
    List<Page> pages = reloadedSection.getPages();
    for (Page page : pages) {
        if (page != null) {
            ((PageImpl) page).setPageStatus(newPageStatus);
            pageDao.updatePage(page);
            if (newPageStatus == PageStatus.closed) {
                // set user informations to done
                pageUserInfosDao.updateStatus(page, PageUserStatus.done);
            }
        }
    }
    ((SectionImpl) reloadedSection).setSectionStatus(status);
    reloadedSection = binderDao.updateSection(reloadedSection);
    return reloadedSection;
}
Also used : PageImpl(org.olat.modules.portfolio.model.PageImpl) PageStatus(org.olat.modules.portfolio.PageStatus) AssessedPage(org.olat.modules.portfolio.model.AssessedPage) Page(org.olat.modules.portfolio.Page) AssessmentSection(org.olat.modules.portfolio.AssessmentSection) Section(org.olat.modules.portfolio.Section) SectionImpl(org.olat.modules.portfolio.model.SectionImpl) AssessmentSectionImpl(org.olat.modules.portfolio.model.AssessmentSectionImpl)

Example 5 with Page

use of org.olat.modules.portfolio.Page in project OpenOLAT by OpenOLAT.

the class PortfolioServiceImpl method updatePage.

@Override
public Page updatePage(Page page, SectionRef newParentSection) {
    Page updatedPage;
    if (newParentSection == null) {
        updatedPage = pageDao.updatePage(page);
    } else {
        Section currentSection = null;
        if (page.getSection() != null) {
            currentSection = binderDao.loadSectionByKey(page.getSection().getKey());
            currentSection.getPages().remove(page);
        }
        Section newParent = binderDao.loadSectionByKey(newParentSection.getKey());
        ((PageImpl) page).setSection(newParent);
        newParent.getPages().add(page);
        updatedPage = pageDao.updatePage(page);
        if (currentSection != null) {
            binderDao.updateSection(currentSection);
        }
        binderDao.updateSection(newParent);
    }
    return updatedPage;
}
Also used : PageImpl(org.olat.modules.portfolio.model.PageImpl) AssessedPage(org.olat.modules.portfolio.model.AssessedPage) Page(org.olat.modules.portfolio.Page) AssessmentSection(org.olat.modules.portfolio.AssessmentSection) Section(org.olat.modules.portfolio.Section)

Aggregations

Page (org.olat.modules.portfolio.Page)136 Section (org.olat.modules.portfolio.Section)98 Test (org.junit.Test)70 Identity (org.olat.core.id.Identity)64 Binder (org.olat.modules.portfolio.Binder)44 ArrayList (java.util.ArrayList)32 BinderImpl (org.olat.modules.portfolio.model.BinderImpl)32 AssessmentSection (org.olat.modules.portfolio.AssessmentSection)26 SynchedBinder (org.olat.modules.portfolio.model.SynchedBinder)26 Assignment (org.olat.modules.portfolio.Assignment)24 RepositoryEntry (org.olat.repository.RepositoryEntry)22 HashMap (java.util.HashMap)20 SectionRef (org.olat.modules.portfolio.SectionRef)20 PageUserInformations (org.olat.modules.portfolio.PageUserInformations)18 AssessedPage (org.olat.modules.portfolio.model.AssessedPage)16 PageBody (org.olat.modules.portfolio.PageBody)14 OLATResourceable (org.olat.core.id.OLATResourceable)12 AccessRights (org.olat.modules.portfolio.model.AccessRights)12 CategoryToElement (org.olat.modules.portfolio.CategoryToElement)10 Date (java.util.Date)8