Search in sources :

Example 1 with BinderRefImpl

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

the class BinderListController method activate.

@Override
public void activate(UserRequest ureq, List<ContextEntry> entries, StateEntry state) {
    if (entries == null || entries.isEmpty())
        return;
    String resName = entries.get(0).getOLATResourceable().getResourceableTypeName();
    if ("Binder".equalsIgnoreCase(resName)) {
        Long portfolioKey = entries.get(0).getOLATResourceable().getResourceableId();
        Activateable2 activateable = doOpenBinder(ureq, new BinderRefImpl(portfolioKey));
        if (activateable != null) {
            List<ContextEntry> subEntries = entries.subList(1, entries.size());
            activateable.activate(ureq, subEntries, entries.get(0).getTransientState());
        }
    }
}
Also used : Activateable2(org.olat.core.gui.control.generic.dtabs.Activateable2) BinderRefImpl(org.olat.modules.portfolio.model.BinderRefImpl) ContextEntry(org.olat.core.id.context.ContextEntry)

Example 2 with BinderRefImpl

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

the class PortfolioHomeController method activate.

@Override
public void activate(UserRequest ureq, List<ContextEntry> entries, StateEntry state) {
    if (entries == null || entries.isEmpty())
        return;
    List<ContextEntry> subEntries = entries.subList(1, entries.size());
    String resName = entries.get(0).getOLATResourceable().getResourceableTypeName();
    if ("Binder".equalsIgnoreCase(resName)) {
        BinderRef binder = new BinderRefImpl(entries.get(0).getOLATResourceable().getResourceableId());
        if (portfolioService.isMember(binder, getIdentity(), PortfolioRoles.owner.name())) {
            doOpenMyBinders(ureq).activate(ureq, entries, entries.get(0).getTransientState());
        } else {
            doOpenSharedWithMe(ureq).activate(ureq, entries, entries.get(0).getTransientState());
        }
    } else if ("MyBinders".equalsIgnoreCase(resName)) {
        doOpenMyBinders(ureq).activate(ureq, subEntries, entries.get(0).getTransientState());
    } else if ("MediaCenter".equalsIgnoreCase(resName)) {
        doOpenMediaCenter(ureq).activate(ureq, subEntries, entries.get(0).getTransientState());
    } else if ("SharedWithMe".equalsIgnoreCase(resName)) {
        doOpenSharedWithMe(ureq).activate(ureq, subEntries, entries.get(0).getTransientState());
    } else if ("MySharedItems".equalsIgnoreCase(resName)) {
        doOpenMySharedItems(ureq).activate(ureq, subEntries, entries.get(0).getTransientState());
    } else if ("MyPages".equalsIgnoreCase(resName)) {
        doOpenMyPages(ureq).activate(ureq, subEntries, entries.get(0).getTransientState());
    }
}
Also used : ContextEntry(org.olat.core.id.context.ContextEntry) BinderRefImpl(org.olat.modules.portfolio.model.BinderRefImpl) BinderRef(org.olat.modules.portfolio.BinderRef)

Example 3 with BinderRefImpl

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

the class BinderListController method activate.

@Override
public void activate(UserRequest ureq, List<ContextEntry> entries, StateEntry state) {
    if (entries == null || entries.isEmpty())
        return;
    String resName = entries.get(0).getOLATResourceable().getResourceableTypeName();
    if ("Binder".equalsIgnoreCase(resName)) {
        Long portfolioKey = entries.get(0).getOLATResourceable().getResourceableId();
        Activateable2 activateable = doOpenBinder(ureq, new BinderRefImpl(portfolioKey));
        if (activateable != null) {
            List<ContextEntry> subEntries = entries.subList(1, entries.size());
            activateable.activate(ureq, subEntries, entries.get(0).getTransientState());
        }
    }
}
Also used : Activateable2(org.olat.core.gui.control.generic.dtabs.Activateable2) BinderRefImpl(org.olat.modules.portfolio.model.BinderRefImpl) ContextEntry(org.olat.core.id.context.ContextEntry)

Example 4 with BinderRefImpl

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

the class BinderContextEntryControllerCreator method getTabContext.

@Override
public TabContext getTabContext(UserRequest ureq, OLATResourceable ores, ContextEntry mainEntry, List<ContextEntry> entries) {
    Identity identity = ureq.getIdentity();
    PortfolioService portfolioService = CoreSpringFactory.getImpl(PortfolioService.class);
    Long binderKey = mainEntry.getOLATResourceable().getResourceableId();
    BinderRef binder = new BinderRefImpl(binderKey);
    List<ContextEntry> rewritedEntries = new ArrayList<ContextEntry>();
    OLATResourceable homeRes = OresHelper.createOLATResourceableInstance("HomeSite", identity.getKey());
    rewritedEntries.add(BusinessControlFactory.getInstance().createContextEntry(homeRes));
    rewritedEntries.add(BusinessControlFactory.getInstance().createContextEntry(OresHelper.createOLATResourceableInstance("PortfolioV2", 0l)));
    if (portfolioService.isMember(binder, identity, PortfolioRoles.owner.name())) {
        rewritedEntries.add(BusinessControlFactory.getInstance().createContextEntry(OresHelper.createOLATResourceableInstance("MyBinders", 0l)));
    } else if (portfolioService.isMember(binder, identity, PortfolioRoles.coach.name(), PortfolioRoles.reviewer.name())) {
        rewritedEntries.add(BusinessControlFactory.getInstance().createContextEntry(OresHelper.createOLATResourceableInstance("SharedWithMe", 0l)));
    }
    // Binder
    rewritedEntries.add(mainEntry);
    if (entries != null && !entries.isEmpty()) {
        // more details
        rewritedEntries.addAll(entries);
    }
    // -> HomeSite
    return new TabContext("", homeRes, rewritedEntries);
}
Also used : TabContext(org.olat.core.id.context.TabContext) OLATResourceable(org.olat.core.id.OLATResourceable) ArrayList(java.util.ArrayList) Identity(org.olat.core.id.Identity) BinderRefImpl(org.olat.modules.portfolio.model.BinderRefImpl) ContextEntry(org.olat.core.id.context.ContextEntry)

Example 5 with BinderRefImpl

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

the class PortfolioHomeController method activate.

@Override
public void activate(UserRequest ureq, List<ContextEntry> entries, StateEntry state) {
    if (entries == null || entries.isEmpty())
        return;
    List<ContextEntry> subEntries = entries.subList(1, entries.size());
    String resName = entries.get(0).getOLATResourceable().getResourceableTypeName();
    if ("Binder".equalsIgnoreCase(resName)) {
        BinderRef binder = new BinderRefImpl(entries.get(0).getOLATResourceable().getResourceableId());
        if (portfolioService.isMember(binder, getIdentity(), PortfolioRoles.owner.name())) {
            doOpenMyBinders(ureq).activate(ureq, entries, entries.get(0).getTransientState());
        } else {
            doOpenSharedWithMe(ureq).activate(ureq, entries, entries.get(0).getTransientState());
        }
    } else if ("MyBinders".equalsIgnoreCase(resName)) {
        doOpenMyBinders(ureq).activate(ureq, subEntries, entries.get(0).getTransientState());
    } else if ("MediaCenter".equalsIgnoreCase(resName)) {
        doOpenMediaCenter(ureq).activate(ureq, subEntries, entries.get(0).getTransientState());
    } else if ("SharedWithMe".equalsIgnoreCase(resName)) {
        doOpenSharedWithMe(ureq).activate(ureq, subEntries, entries.get(0).getTransientState());
    } else if ("MySharedItems".equalsIgnoreCase(resName)) {
        doOpenMySharedItems(ureq).activate(ureq, subEntries, entries.get(0).getTransientState());
    } else if ("MyPages".equalsIgnoreCase(resName)) {
        doOpenMyPages(ureq).activate(ureq, subEntries, entries.get(0).getTransientState());
    }
}
Also used : ContextEntry(org.olat.core.id.context.ContextEntry) BinderRefImpl(org.olat.modules.portfolio.model.BinderRefImpl) BinderRef(org.olat.modules.portfolio.BinderRef)

Aggregations

ContextEntry (org.olat.core.id.context.ContextEntry)6 BinderRefImpl (org.olat.modules.portfolio.model.BinderRefImpl)6 ArrayList (java.util.ArrayList)2 Activateable2 (org.olat.core.gui.control.generic.dtabs.Activateable2)2 Identity (org.olat.core.id.Identity)2 OLATResourceable (org.olat.core.id.OLATResourceable)2 TabContext (org.olat.core.id.context.TabContext)2 BinderRef (org.olat.modules.portfolio.BinderRef)2