Search in sources :

Example 1 with Assignment

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

the class AbstractPageListController method doEditAssignment.

protected void doEditAssignment(UserRequest ureq, PortfolioElementRow row) {
    if (editAssignmentCtrl != null)
        return;
    Assignment assignment = row.getAssignment();
    editAssignmentCtrl = new AssignmentEditController(ureq, getWindowControl(), assignment);
    listenTo(editAssignmentCtrl);
    String title = translate("edit.assignment");
    cmc = new CloseableModalController(getWindowControl(), null, editAssignmentCtrl.getInitialComponent(), true, title, true);
    listenTo(cmc);
    cmc.activate();
}
Also used : Assignment(org.olat.modules.portfolio.Assignment) CloseableModalController(org.olat.core.gui.control.generic.closablewrapper.CloseableModalController)

Example 2 with Assignment

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

the class AbstractPageListController method doMoveDownAssignment.

private void doMoveDownAssignment(UserRequest ureq, PortfolioElementRow row) {
    Assignment assigment = row.getAssignment();
    Section section = row.getSection();
    section = portfolioService.moveDownAssignment(section, assigment);
    loadModel(ureq, null);
}
Also used : Assignment(org.olat.modules.portfolio.Assignment) AssessmentSection(org.olat.modules.portfolio.AssessmentSection) Section(org.olat.modules.portfolio.Section)

Example 3 with Assignment

use of org.olat.modules.portfolio.Assignment 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 4 with Assignment

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

the class AbstractPageListController method forgePageRow.

protected PortfolioElementRow forgePageRow(UserRequest ureq, Page page, AssessmentSection assessmentSection, List<Assignment> assignments, Map<OLATResourceable, List<Category>> categorizedElementMap, Map<Long, Long> numberOfCommentsMap, boolean selectElement) {
    Section section = page.getSection();
    PortfolioElementRow row = new PortfolioElementRow(page, assessmentSection, config.isAssessable());
    String openLinkId = "open_" + (++counter);
    FormLink openLink = uifactory.addFormLink(openLinkId, "open.full", "open.full.page", null, flc, Link.BUTTON_SMALL);
    openLink.setIconRightCSS("o_icon o_icon_start");
    openLink.setEnabled(selectElement);
    openLink.setPrimary(true);
    row.setOpenFormLink(openLink);
    openLink.setUserObject(row);
    addCategoriesToRow(row, categorizedElementMap);
    if (assignments != null) {
        for (Assignment assignment : assignments) {
            if (page.equals(assignment.getPage())) {
                row.setAssignment(assignment);
            }
        }
    }
    decorateImage(ureq, row, page);
    if (numberOfCommentsMap != null) {
        Long numOfComments = numberOfCommentsMap.get(page.getKey());
        if (numOfComments != null) {
            row.setNumOfComments(numOfComments.longValue());
        } else {
            row.setNumOfComments(0);
        }
    } else {
        row.setNumOfComments(0);
    }
    if (secCallback.canCloseSection(section)) {
        if (SectionStatus.isClosed(section)) {
            FormLink reopenLink = uifactory.addFormLink("ropens_" + (++counter), "reopen.section", "reopen.section", null, flc, Link.BUTTON_SMALL);
            reopenLink.setUserObject(row);
            row.setReopenSectionLink(reopenLink);
        } else {
            FormLink closeLink = uifactory.addFormLink("closes_" + (++counter), "close.section", "close.section", null, flc, Link.BUTTON_SMALL);
            closeLink.setUserObject(row);
            row.setCloseSectionLink(closeLink);
        }
    }
    if (portfolioV2Module.isEntriesCommentsEnabled() && secCallback.canComment(page)) {
        String title;
        String cssClass = "o_icon o_icon-fw o_icon_comments";
        if (row.getNumOfComments() == 1) {
            title = translate("comment.one");
        } else if (row.getNumOfComments() > 1) {
            title = translate("comment.several", new String[] { Long.toString(row.getNumOfComments()) });
        } else {
            title = translate("comment.zero");
            cssClass += "_none";
        }
        FormLink commentLink = uifactory.addFormLink("com_" + (++counter), "comment", title, null, flc, Link.LINK | Link.NONTRANSLATED);
        commentLink.setIconLeftCSS(cssClass);
        commentLink.setUserObject(row);
        row.setCommentFormLink(commentLink);
    }
    return row;
}
Also used : PortfolioElementRow(org.olat.modules.portfolio.ui.model.PortfolioElementRow) Assignment(org.olat.modules.portfolio.Assignment) FormLink(org.olat.core.gui.components.form.flexible.elements.FormLink) AssessmentSection(org.olat.modules.portfolio.AssessmentSection) Section(org.olat.modules.portfolio.Section)

Example 5 with Assignment

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

the class AbstractPageListController method doStartAssignment.

private Assignment doStartAssignment(UserRequest ureq, Long assignmentKey) {
    Assignment startedAssigment = portfolioService.startAssignment(assignmentKey, getIdentity());
    doOpenPage(ureq, startedAssigment.getPage(), true);
    loadModel(ureq, null);
    return startedAssigment;
}
Also used : Assignment(org.olat.modules.portfolio.Assignment)

Aggregations

Assignment (org.olat.modules.portfolio.Assignment)78 Section (org.olat.modules.portfolio.Section)48 Binder (org.olat.modules.portfolio.Binder)30 Identity (org.olat.core.id.Identity)28 Test (org.junit.Test)26 Page (org.olat.modules.portfolio.Page)26 ArrayList (java.util.ArrayList)24 RepositoryEntry (org.olat.repository.RepositoryEntry)20 AssessmentSection (org.olat.modules.portfolio.AssessmentSection)18 SynchedBinder (org.olat.modules.portfolio.model.SynchedBinder)18 SectionRef (org.olat.modules.portfolio.SectionRef)16 File (java.io.File)8 HashMap (java.util.HashMap)8 List (java.util.List)8 FormLink (org.olat.core.gui.components.form.flexible.elements.FormLink)8 CloseableModalController (org.olat.core.gui.control.generic.closablewrapper.CloseableModalController)8 OLATResourceable (org.olat.core.id.OLATResourceable)8 SectionImpl (org.olat.modules.portfolio.model.SectionImpl)8 PortfolioElementRow (org.olat.modules.portfolio.ui.model.PortfolioElementRow)8 Link (org.olat.core.gui.components.link.Link)6