Search in sources :

Example 1 with CourseTemplateRow

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

the class CourseTemplateSearchController method loadCourseModel.

private void loadCourseModel(CourseNode courseNode, UserCourseEnvironment uce, List<CourseTemplateRow> rows, Set<CurrentBinder> currentSet) {
    if (courseNode instanceof PortfolioCourseNode) {
        PortfolioCourseNode pNode = (PortfolioCourseNode) courseNode;
        NodeEvaluation ne = pNode.eval(uce.getConditionInterpreter(), new TreeEvaluation(), new VisibleTreeFilter());
        if (NavigationHandler.mayAccessWholeTreeUp(ne)) {
            RepositoryEntry refEntry = pNode.getReferencedRepositoryEntry();
            if ("BinderTemplate".equals(refEntry.getOlatResource().getResourceableTypeName())) {
                RepositoryEntry courseEntry = uce.getCourseEnvironment().getCourseGroupManager().getCourseEntry();
                CurrentBinder binderKey = new CurrentBinder(courseEntry.getKey(), pNode.getIdent());
                if (!currentSet.contains(binderKey)) {
                    rows.add(new CourseTemplateRow(courseEntry, pNode, refEntry));
                }
            }
        }
    }
    for (int i = courseNode.getChildCount(); i-- > 0; ) {
        loadCourseModel((CourseNode) courseNode.getChildAt(i), uce, rows, currentSet);
    }
}
Also used : CourseTemplateRow(org.olat.modules.portfolio.ui.model.CourseTemplateRow) PortfolioCourseNode(org.olat.course.nodes.PortfolioCourseNode) VisibleTreeFilter(org.olat.course.run.userview.VisibleTreeFilter) TreeEvaluation(org.olat.course.run.userview.TreeEvaluation) RepositoryEntry(org.olat.repository.RepositoryEntry) NodeEvaluation(org.olat.course.run.userview.NodeEvaluation)

Example 2 with CourseTemplateRow

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

the class CourseTemplateSearchController method formInnerEvent.

@Override
protected void formInnerEvent(UserRequest ureq, FormItem source, FormEvent event) {
    if (source == tableEl) {
        if (event instanceof SelectionEvent) {
            SelectionEvent se = (SelectionEvent) event;
            String cmd = se.getCommand();
            CourseTemplateRow row = model.getObject(se.getIndex());
            if ("select".equals(cmd)) {
                selectedEntry = row;
                fireEvent(ureq, ReferencableEntriesSearchController.EVENT_REPOSITORY_ENTRY_SELECTED);
            }
        }
    }
    super.formInnerEvent(ureq, source, event);
}
Also used : CourseTemplateRow(org.olat.modules.portfolio.ui.model.CourseTemplateRow) SelectionEvent(org.olat.core.gui.components.form.flexible.impl.elements.table.SelectionEvent)

Example 3 with CourseTemplateRow

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

Example 4 with CourseTemplateRow

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

the class BinderListController method event.

@Override
protected void event(UserRequest ureq, Controller source, Event event) {
    if (newBinderCtrl == source) {
        if (event == Event.DONE_EVENT) {
            loadModel();
            doOpenBinder(ureq, newBinderCtrl.getBinder()).activate(ureq, null, null);
        }
        cmc.deactivate();
        cleanUp();
    } else if (chooseNewBinderTypeCtrl == source) {
        newBinderCalloutCtrl.deactivate();
        cleanUp();
        if (event instanceof NewBinderEvent) {
            String cmd = event.getCommand();
            if (NewBinderEvent.NEW_EMPTY.equals(cmd)) {
                doNewBinder(ureq);
            } else if (NewBinderEvent.NEW_EMPTY_FROM_TEMPLATE.equals(cmd)) {
                doNewBinderFromTemplate(ureq);
            } else if (NewBinderEvent.NEW_EMPTY_FROM_COURSE.equals(cmd)) {
                doNewBinderFromCourse(ureq);
            }
        }
    } else if (searchTemplateCtrl == source) {
        if (RepositoryTableModel.TABLE_ACTION_SELECT_LINK.equals(event.getCommand())) {
            RepositoryEntry repoEntry = searchTemplateCtrl.getSelectedEntry();
            doCreateBinderFromTemplate(ureq, repoEntry);
        }
        cmc.deactivate();
        cleanUp();
    } else if (searchCourseTemplateCtrl == source) {
        if (event == ReferencableEntriesSearchController.EVENT_REPOSITORY_ENTRY_SELECTED) {
            CourseTemplateRow templateRow = searchCourseTemplateCtrl.getSelectedEntry();
            doCreateBinderFromCourseTemplate(ureq, templateRow);
        }
        cmc.deactivate();
        cleanUp();
    } else if (newBinderCalloutCtrl == source) {
        cleanUp();
    } else if (binderCtrl == source) {
        if (event instanceof DeleteBinderEvent) {
            stackPanel.popUpToController(this);
            loadModel();
        }
    } else if (cmc == source) {
        cleanUp();
    }
    super.event(ureq, source, event);
}
Also used : CourseTemplateRow(org.olat.modules.portfolio.ui.model.CourseTemplateRow) DeleteBinderEvent(org.olat.modules.portfolio.ui.event.DeleteBinderEvent) RepositoryEntry(org.olat.repository.RepositoryEntry) NewBinderEvent(org.olat.modules.portfolio.ui.event.NewBinderEvent)

Example 5 with CourseTemplateRow

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

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

CourseTemplateRow (org.olat.modules.portfolio.ui.model.CourseTemplateRow)8 RepositoryEntry (org.olat.repository.RepositoryEntry)6 PortfolioCourseNode (org.olat.course.nodes.PortfolioCourseNode)4 ArrayList (java.util.ArrayList)2 HashSet (java.util.HashSet)2 SelectionEvent (org.olat.core.gui.components.form.flexible.impl.elements.table.SelectionEvent)2 IdentityEnvironment (org.olat.core.id.IdentityEnvironment)2 ICourse (org.olat.course.ICourse)2 CourseNode (org.olat.course.nodes.CourseNode)2 NodeEvaluation (org.olat.course.run.userview.NodeEvaluation)2 TreeEvaluation (org.olat.course.run.userview.TreeEvaluation)2 UserCourseEnvironment (org.olat.course.run.userview.UserCourseEnvironment)2 UserCourseEnvironmentImpl (org.olat.course.run.userview.UserCourseEnvironmentImpl)2 VisibleTreeFilter (org.olat.course.run.userview.VisibleTreeFilter)2 Binder (org.olat.modules.portfolio.Binder)2 DeleteBinderEvent (org.olat.modules.portfolio.ui.event.DeleteBinderEvent)2 NewBinderEvent (org.olat.modules.portfolio.ui.event.NewBinderEvent)2