Search in sources :

Example 41 with Binder

use of org.olat.modules.portfolio.Binder in project openolat by klemens.

the class BinderListController method doCreateBinderFromCourseTemplate.

private void doCreateBinderFromCourseTemplate(UserRequest ureq, CourseTemplateRow row) {
    RepositoryEntry courseEntry = row.getCourseEntry();
    RepositoryEntry templateEntry = row.getTemplateEntry();
    PortfolioCourseNode courseNode = row.getCourseNode();
    Binder templateBinder = portfolioService.getBinderByResource(templateEntry.getOlatResource());
    Binder copyBinder = portfolioService.getBinder(getIdentity(), templateBinder, courseEntry, courseNode.getIdent());
    if (copyBinder == null) {
        Date deadline = courseNode.getDeadline();
        copyBinder = portfolioService.assignBinder(getIdentity(), templateBinder, courseEntry, courseNode.getIdent(), deadline);
        DBFactory.getInstance().commit();
        SynchedBinder synchedBinder = portfolioService.loadAndSyncBinder(copyBinder);
        copyBinder = synchedBinder.getBinder();
        if (copyBinder != null) {
            showInfo("map.copied", StringHelper.escapeHtml(templateBinder.getTitle()));
            ThreadLocalUserActivityLogger.addLoggingResourceInfo(LoggingResourceable.wrap(copyBinder));
            ThreadLocalUserActivityLogger.log(PortfolioLoggingAction.PORTFOLIO_TASK_STARTED, getClass());
        }
    }
    doOpenBinder(ureq, copyBinder).activate(ureq, null, null);
}
Also used : SynchedBinder(org.olat.modules.portfolio.model.SynchedBinder) Binder(org.olat.modules.portfolio.Binder) PortfolioCourseNode(org.olat.course.nodes.PortfolioCourseNode) RepositoryEntry(org.olat.repository.RepositoryEntry) SynchedBinder(org.olat.modules.portfolio.model.SynchedBinder) Date(java.util.Date)

Example 42 with Binder

use of org.olat.modules.portfolio.Binder in project openolat by klemens.

the class BinderOnePageController method loadMetadataAndComponents.

private void loadMetadataAndComponents(UserRequest ureq, BinderRef binderRef) {
    Binder binder = portfolioService.getBinderByKey(binderRef.getKey());
    // load metadata
    List<Identity> owners = portfolioService.getMembers(binder, PortfolioRoles.owner.name());
    StringBuilder ownerSb = new StringBuilder();
    for (Identity owner : owners) {
        if (ownerSb.length() > 0)
            ownerSb.append(", ");
        ownerSb.append(userManager.getUserDisplayName(owner));
    }
    mainVC.contextPut("owners", ownerSb.toString());
    mainVC.contextPut("binderTitle", binder.getTitle());
    mainVC.contextPut("binderKey", binder.getKey());
    // load pages
    List<Section> sections = portfolioService.getSections(binder);
    List<Page> pages = portfolioService.getPages(binder, null);
    for (Section section : sections) {
        loadSection(section);
        for (Page page : pages) {
            if (section.equals(page.getSection())) {
                loadPage(ureq, page);
            }
        }
    }
}
Also used : Binder(org.olat.modules.portfolio.Binder) Page(org.olat.modules.portfolio.Page) Identity(org.olat.core.id.Identity) Section(org.olat.modules.portfolio.Section) AssessmentSection(org.olat.modules.portfolio.AssessmentSection)

Example 43 with Binder

use of org.olat.modules.portfolio.Binder in project openolat by klemens.

the class BinderRuntimeController method doOptions.

private Activateable2 doOptions(UserRequest ureq) {
    OLATResourceable ores = OresHelper.createOLATResourceableType("Options");
    ThreadLocalUserActivityLogger.addLoggingResourceInfo(LoggingResourceable.wrapBusinessPath(ores));
    WindowControl swControl = addToHistory(ureq, ores, null);
    if (reSecurity.isEntryAdmin()) {
        Binder binder = portfolioService.getBinderByResource(getRepositoryEntry().getOlatResource());
        BinderDeliveryOptionsController ctrl = new BinderDeliveryOptionsController(ureq, swControl, binder);
        listenTo(ctrl);
        optionsCtrl = pushController(ureq, "Options", ctrl);
        currentToolCtr = optionsCtrl;
        setActiveTool(optionsLink);
        enableRuntimeNavBar(false);
        return optionsCtrl;
    }
    return null;
}
Also used : Binder(org.olat.modules.portfolio.Binder) OLATResourceable(org.olat.core.id.OLATResourceable) WindowControl(org.olat.core.gui.control.WindowControl)

Example 44 with Binder

use of org.olat.modules.portfolio.Binder in project openolat by klemens.

the class PortfolioServiceImpl method updateAssessmentSections.

@Override
public void updateAssessmentSections(BinderRef binderRef, List<AssessmentSectionChange> changes, Identity coachingIdentity) {
    Binder binder = binderDao.loadByKey(binderRef.getKey());
    Map<Identity, List<AssessmentSectionChange>> assessedIdentitiesToChangesMap = new HashMap<>();
    for (AssessmentSectionChange change : changes) {
        List<AssessmentSectionChange> identityChanges;
        if (assessedIdentitiesToChangesMap.containsKey(change.getIdentity())) {
            identityChanges = assessedIdentitiesToChangesMap.get(change.getIdentity());
        } else {
            identityChanges = new ArrayList<>();
            assessedIdentitiesToChangesMap.put(change.getIdentity(), identityChanges);
        }
        identityChanges.add(change);
    }
    for (Map.Entry<Identity, List<AssessmentSectionChange>> changesEntry : assessedIdentitiesToChangesMap.entrySet()) {
        Identity assessedIdentity = changesEntry.getKey();
        List<AssessmentSection> currentAssessmentSections = assessmentSectionDao.loadAssessmentSections(binder, assessedIdentity);
        Set<AssessmentSection> updatedAssessmentSections = new HashSet<>(currentAssessmentSections);
        List<AssessmentSectionChange> identityChanges = changesEntry.getValue();
        for (AssessmentSectionChange change : identityChanges) {
            AssessmentSection assessmentSection = change.getAssessmentSection();
            for (AssessmentSection currentAssessmentSection : currentAssessmentSections) {
                if (assessmentSection != null && assessmentSection.equals(currentAssessmentSection)) {
                    assessmentSection = currentAssessmentSection;
                } else if (change.getSection().equals(currentAssessmentSection.getSection())) {
                    assessmentSection = currentAssessmentSection;
                }
            }
            if (assessmentSection == null) {
                assessmentSection = assessmentSectionDao.createAssessmentSection(change.getScore(), change.getPassed(), change.getSection(), assessedIdentity);
            } else {
                ((AssessmentSectionImpl) assessmentSection).setScore(change.getScore());
                ((AssessmentSectionImpl) assessmentSection).setPassed(change.getPassed());
                assessmentSection = assessmentSectionDao.update(assessmentSection);
            }
            updatedAssessmentSections.add(assessmentSection);
        }
        updateAssessmentEntry(assessedIdentity, binder, updatedAssessmentSections, coachingIdentity);
    }
}
Also used : HashMap(java.util.HashMap) AssessmentSectionChange(org.olat.modules.portfolio.model.AssessmentSectionChange) Binder(org.olat.modules.portfolio.Binder) AssessedBinder(org.olat.modules.portfolio.model.AssessedBinder) SynchedBinder(org.olat.modules.portfolio.model.SynchedBinder) AssessmentSectionImpl(org.olat.modules.portfolio.model.AssessmentSectionImpl) AssessmentSection(org.olat.modules.portfolio.AssessmentSection) ArrayList(java.util.ArrayList) List(java.util.List) Identity(org.olat.core.id.Identity) Map(java.util.Map) HashMap(java.util.HashMap) HashSet(java.util.HashSet)

Example 45 with Binder

use of org.olat.modules.portfolio.Binder in project openolat by klemens.

the class CourseTemplateSearchController method loadModel.

private void loadModel(UserRequest ureq) {
    IdentityEnvironment identityEnv = ureq.getUserSession().getIdentityEnvironment();
    List<Binder> currentBinders = portfolioService.searchOwnedBindersFromCourseTemplate(getIdentity());
    Set<CurrentBinder> currentSet = new HashSet<>();
    for (Binder currentBinder : currentBinders) {
        Long courseEntryKey = currentBinder.getEntry().getKey();
        String nodeIdent = currentBinder.getSubIdent();
        currentSet.add(new CurrentBinder(courseEntryKey, nodeIdent));
    }
    List<RepositoryEntry> entries = portfolioService.searchCourseWithBinderTemplates(getIdentity());
    List<CourseTemplateRow> rows = new ArrayList<>(entries.size());
    for (RepositoryEntry entry : entries) {
        ICourse course = CourseFactory.loadCourse(entry);
        UserCourseEnvironment uce = new UserCourseEnvironmentImpl(identityEnv, course.getCourseEnvironment());
        uce.getScoreAccounting().evaluateAll();
        CourseNode rootNode = uce.getCourseEnvironment().getRunStructure().getRootNode();
        loadCourseModel(rootNode, uce, rows, currentSet);
    }
    model.setObjects(rows);
    tableEl.reset();
    tableEl.reloadData();
}
Also used : UserCourseEnvironment(org.olat.course.run.userview.UserCourseEnvironment) ArrayList(java.util.ArrayList) ICourse(org.olat.course.ICourse) RepositoryEntry(org.olat.repository.RepositoryEntry) CourseTemplateRow(org.olat.modules.portfolio.ui.model.CourseTemplateRow) Binder(org.olat.modules.portfolio.Binder) UserCourseEnvironmentImpl(org.olat.course.run.userview.UserCourseEnvironmentImpl) CourseNode(org.olat.course.nodes.CourseNode) PortfolioCourseNode(org.olat.course.nodes.PortfolioCourseNode) IdentityEnvironment(org.olat.core.id.IdentityEnvironment) HashSet(java.util.HashSet)

Aggregations

Binder (org.olat.modules.portfolio.Binder)144 Section (org.olat.modules.portfolio.Section)72 Identity (org.olat.core.id.Identity)70 Test (org.junit.Test)68 SynchedBinder (org.olat.modules.portfolio.model.SynchedBinder)58 Page (org.olat.modules.portfolio.Page)44 RepositoryEntry (org.olat.repository.RepositoryEntry)34 Assignment (org.olat.modules.portfolio.Assignment)30 ArrayList (java.util.ArrayList)22 SectionRef (org.olat.modules.portfolio.SectionRef)22 AssessedBinder (org.olat.modules.portfolio.model.AssessedBinder)20 AssessmentSection (org.olat.modules.portfolio.AssessmentSection)16 OLATResourceable (org.olat.core.id.OLATResourceable)14 BinderSecurityCallback (org.olat.modules.portfolio.BinderSecurityCallback)14 PortfolioService (org.olat.modules.portfolio.PortfolioService)14 BinderImpl (org.olat.modules.portfolio.model.BinderImpl)14 AccessRights (org.olat.modules.portfolio.model.AccessRights)12 Date (java.util.Date)10 WindowControl (org.olat.core.gui.control.WindowControl)10 AssessmentSectionImpl (org.olat.modules.portfolio.model.AssessmentSectionImpl)8