Search in sources :

Example 6 with Section

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

the class BinderAssessmentController method forgeAssessmentSection.

private void forgeAssessmentSection(AssessmentSectionWrapper row) {
    AssessmentSection assessmentSection = row.getAssessmentSection();
    Section section = row.getSection();
    if (!SectionStatus.isClosed(section)) {
        // score
        String pointVal = null;
        if (assessmentSection != null && assessmentSection.getScore() != null) {
            BigDecimal score = assessmentSection.getScore();
            pointVal = AssessmentHelper.getRoundedScore(score);
        }
        TextElement pointEl = uifactory.addTextElement("point" + (++counter), null, 5, pointVal, flc);
        pointEl.setDisplaySize(5);
        row.setScoreEl(pointEl);
        // passed
        Boolean passed = assessmentSection == null ? null : assessmentSection.getPassed();
        MultipleSelectionElement passedEl = uifactory.addCheckboxesHorizontal("check" + (++counter), null, flc, onKeys, onValues);
        if (passed != null && passed.booleanValue()) {
            passedEl.select(onKeys[0], passed.booleanValue());
        }
        row.setPassedEl(passedEl);
    }
    if (SectionStatus.isClosed(section)) {
        FormLink reopenButton = uifactory.addFormLink("reopen" + (++counter), "reopen", "reopen", null, flc, Link.BUTTON);
        reopenButton.setElementCssClass("o_sel_pf_reopen_section");
        reopenButton.setUserObject(row);
        row.setButton(reopenButton);
    } else {
        FormLink closeButton = uifactory.addFormLink("close" + (++counter), "close", "close.section", null, flc, Link.BUTTON);
        closeButton.setElementCssClass("o_sel_pf_close_section");
        closeButton.setUserObject(row);
        row.setButton(closeButton);
    }
}
Also used : TextElement(org.olat.core.gui.components.form.flexible.elements.TextElement) MultipleSelectionElement(org.olat.core.gui.components.form.flexible.elements.MultipleSelectionElement) AssessmentSection(org.olat.modules.portfolio.AssessmentSection) FormLink(org.olat.core.gui.components.form.flexible.elements.FormLink) AssessmentSection(org.olat.modules.portfolio.AssessmentSection) Section(org.olat.modules.portfolio.Section) BigDecimal(java.math.BigDecimal)

Example 7 with Section

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

the class PageDAO method removePage.

public Page removePage(Page page) {
    PageImpl reloadedPage = (PageImpl) loadByKey(page.getKey());
    Section section = reloadedPage.getSection();
    if (section != null) {
        section.getPages().remove(reloadedPage);
    }
    reloadedPage.setLastModified(new Date());
    reloadedPage.setSection(null);
    reloadedPage.setPageStatus(PageStatus.deleted);
    unlinkAssignment(page);
    if (section != null) {
        dbInstance.getCurrentEntityManager().merge(section);
    }
    return dbInstance.getCurrentEntityManager().merge(reloadedPage);
}
Also used : PageImpl(org.olat.modules.portfolio.model.PageImpl) Section(org.olat.modules.portfolio.Section) Date(java.util.Date)

Example 8 with Section

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

the class PortfolioServiceImpl method addAssignment.

@Override
public Assignment addAssignment(String title, String summary, String content, AssignmentType type, Section section, boolean onlyAutoEvaluation, boolean reviewerSeeAutoEvaluation, boolean anonymousExternEvaluation, RepositoryEntry formEntry) {
    File newStorage = portfolioFileStorage.generateAssignmentSubDirectory();
    String storage = portfolioFileStorage.getRelativePath(newStorage);
    Section reloadedSection = binderDao.loadSectionByKey(section.getKey());
    return assignmentDao.createAssignment(title, summary, content, storage, type, AssignmentStatus.template, reloadedSection, onlyAutoEvaluation, reviewerSeeAutoEvaluation, anonymousExternEvaluation, formEntry);
}
Also used : File(java.io.File) AssessmentSection(org.olat.modules.portfolio.AssessmentSection) Section(org.olat.modules.portfolio.Section)

Example 9 with Section

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

the class PortfolioServiceImpl method deleteAssignment.

@Override
public boolean deleteAssignment(Assignment assignment) {
    Assignment reloadedAssignment = assignmentDao.loadAssignmentByKey(assignment.getKey());
    Section reloadedSection = reloadedAssignment.getSection();
    boolean removed = false;
    if (reloadedSection != null) {
        removed = ((SectionImpl) reloadedSection).getAssignments().remove(reloadedAssignment);
    }
    assignmentDao.deleteAssignment(reloadedAssignment);
    if (removed) {
        binderDao.updateSection(reloadedSection);
    }
    return true;
}
Also used : Assignment(org.olat.modules.portfolio.Assignment) 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 10 with Section

use of org.olat.modules.portfolio.Section 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)

Aggregations

Section (org.olat.modules.portfolio.Section)190 Page (org.olat.modules.portfolio.Page)100 Test (org.junit.Test)86 Identity (org.olat.core.id.Identity)80 Binder (org.olat.modules.portfolio.Binder)72 AssessmentSection (org.olat.modules.portfolio.AssessmentSection)68 Assignment (org.olat.modules.portfolio.Assignment)48 BinderImpl (org.olat.modules.portfolio.model.BinderImpl)40 SynchedBinder (org.olat.modules.portfolio.model.SynchedBinder)38 ArrayList (java.util.ArrayList)36 RepositoryEntry (org.olat.repository.RepositoryEntry)26 SectionRef (org.olat.modules.portfolio.SectionRef)24 HashMap (java.util.HashMap)22 Date (java.util.Date)16 PageUserInformations (org.olat.modules.portfolio.PageUserInformations)14 BigDecimal (java.math.BigDecimal)12 FormLink (org.olat.core.gui.components.form.flexible.elements.FormLink)12 SectionImpl (org.olat.modules.portfolio.model.SectionImpl)12 PortfolioElementRow (org.olat.modules.portfolio.ui.model.PortfolioElementRow)12 FormLayoutContainer (org.olat.core.gui.components.form.flexible.impl.FormLayoutContainer)10