Search in sources :

Example 1 with UserAssignmentInfos

use of org.olat.modules.portfolio.ui.model.UserAssignmentInfos in project OpenOLAT by OpenOLAT.

the class PageMetadataController method initAssignments.

private void initAssignments(UserRequest ureq) {
    boolean needMapper = false;
    List<UserAssignmentInfos> assignmentInfos = new ArrayList<>(assignments.size());
    for (Assignment assignment : assignments) {
        List<File> documents = null;
        File storage = fileStorage.getAssignmentDirectory(assignment);
        if (storage != null) {
            documents = Arrays.<File>asList(storage.listFiles());
            if (documents.size() > 0) {
                needMapper = true;
            }
        }
        UserAssignmentInfos infos = new UserAssignmentInfos(assignment, documents);
        assignmentInfos.add(infos);
    }
    mainVC.contextPut("assignments", assignmentInfos);
    if (needMapper) {
        String mapperUri = registerCacheableMapper(ureq, "assigment-" + page.getKey(), new DocumentMapper());
        mainVC.contextPut("mapperUri", mapperUri);
    }
}
Also used : Assignment(org.olat.modules.portfolio.Assignment) UserAssignmentInfos(org.olat.modules.portfolio.ui.model.UserAssignmentInfos) ArrayList(java.util.ArrayList) File(java.io.File)

Example 2 with UserAssignmentInfos

use of org.olat.modules.portfolio.ui.model.UserAssignmentInfos in project openolat by klemens.

the class PageMetadataController method initAssignments.

private void initAssignments(UserRequest ureq) {
    boolean needMapper = false;
    List<UserAssignmentInfos> assignmentInfos = new ArrayList<>(assignments.size());
    for (Assignment assignment : assignments) {
        List<File> documents = null;
        File storage = fileStorage.getAssignmentDirectory(assignment);
        if (storage != null) {
            documents = Arrays.<File>asList(storage.listFiles());
            if (documents.size() > 0) {
                needMapper = true;
            }
        }
        UserAssignmentInfos infos = new UserAssignmentInfos(assignment, documents);
        assignmentInfos.add(infos);
    }
    mainVC.contextPut("assignments", assignmentInfos);
    if (needMapper) {
        String mapperUri = registerCacheableMapper(ureq, "assigment-" + page.getKey(), new DocumentMapper());
        mainVC.contextPut("mapperUri", mapperUri);
    }
}
Also used : Assignment(org.olat.modules.portfolio.Assignment) UserAssignmentInfos(org.olat.modules.portfolio.ui.model.UserAssignmentInfos) ArrayList(java.util.ArrayList) File(java.io.File)

Aggregations

File (java.io.File)2 ArrayList (java.util.ArrayList)2 Assignment (org.olat.modules.portfolio.Assignment)2 UserAssignmentInfos (org.olat.modules.portfolio.ui.model.UserAssignmentInfos)2