Search in sources :

Example 16 with PortfolioCourseNode

use of org.olat.course.nodes.PortfolioCourseNode in project openolat by klemens.

the class PortfolioCourseNodeIndexer method doIndex.

@Override
public void doIndex(SearchResourceContext searchResourceContext, ICourse course, CourseNode courseNode, OlatFullIndexer indexWriter) throws IOException, InterruptedException {
    if (!portfolioModule.isEnabled())
        return;
    SearchResourceContext courseNodeResourceContext = createSearchResourceContext(searchResourceContext, courseNode, NODE_TYPE);
    Document document = CourseNodeDocument.createDocument(courseNodeResourceContext, courseNode);
    indexWriter.addDocument(document);
    PortfolioCourseNode portfolioNode = (PortfolioCourseNode) courseNode;
    RepositoryEntry repoEntry = portfolioNode.getReferencedRepositoryEntry();
    if (repoEntry != null) {
        OLATResource ores = repoEntry.getOlatResource();
        PortfolioStructure element = structureManager.loadPortfolioStructure(ores);
        if (element != null) {
            Document pDocument = PortfolioMapDocument.createDocument(courseNodeResourceContext, element);
            indexWriter.addDocument(pDocument);
        }
    }
}
Also used : PortfolioCourseNode(org.olat.course.nodes.PortfolioCourseNode) SearchResourceContext(org.olat.search.service.SearchResourceContext) PortfolioStructure(org.olat.portfolio.model.structel.PortfolioStructure) OLATResource(org.olat.resource.OLATResource) RepositoryEntry(org.olat.repository.RepositoryEntry) PortfolioMapDocument(org.olat.search.service.document.PortfolioMapDocument) Document(org.apache.lucene.document.Document) CourseNodeDocument(org.olat.search.service.document.CourseNodeDocument)

Example 17 with PortfolioCourseNode

use of org.olat.course.nodes.PortfolioCourseNode in project openolat by klemens.

the class OLATUpgrade_11_0_0 method postCopyPassedScore.

/**
 * Used if a passed or score value was set.
 * @param nodeAssessment
 * @param course
 */
private void postCopyPassedScore(AssessmentEntry entry, ICourse course) {
    String nodeIdent = entry.getSubIdent();
    CourseNode courseNode = course.getRunStructure().getNode(nodeIdent);
    if (courseNode instanceof GTACourseNode) {
    // 
    } else if (courseNode instanceof TACourseNode) {
        entry.setAssessmentStatus(AssessmentEntryStatus.done);
    } else if (courseNode instanceof IQTESTCourseNode) {
    // 
    } else if (courseNode instanceof PortfolioCourseNode) {
        entry.setAssessmentStatus(AssessmentEntryStatus.done);
    } else if (courseNode instanceof MSCourseNode) {
        entry.setAssessmentStatus(AssessmentEntryStatus.done);
    } else if (courseNode instanceof BasicLTICourseNode) {
        entry.setAssessmentStatus(AssessmentEntryStatus.done);
    } else if (courseNode instanceof ScormCourseNode) {
        entry.setAssessmentStatus(AssessmentEntryStatus.done);
    }
}
Also used : BasicLTICourseNode(org.olat.course.nodes.BasicLTICourseNode) IQTESTCourseNode(org.olat.course.nodes.IQTESTCourseNode) PortfolioCourseNode(org.olat.course.nodes.PortfolioCourseNode) MSCourseNode(org.olat.course.nodes.MSCourseNode) GTACourseNode(org.olat.course.nodes.GTACourseNode) STCourseNode(org.olat.course.nodes.STCourseNode) GTACourseNode(org.olat.course.nodes.GTACourseNode) MSCourseNode(org.olat.course.nodes.MSCourseNode) ScormCourseNode(org.olat.course.nodes.ScormCourseNode) CourseNode(org.olat.course.nodes.CourseNode) PortfolioCourseNode(org.olat.course.nodes.PortfolioCourseNode) TACourseNode(org.olat.course.nodes.TACourseNode) AssessableCourseNode(org.olat.course.nodes.AssessableCourseNode) IQTESTCourseNode(org.olat.course.nodes.IQTESTCourseNode) BasicLTICourseNode(org.olat.course.nodes.BasicLTICourseNode) GTACourseNode(org.olat.course.nodes.GTACourseNode) TACourseNode(org.olat.course.nodes.TACourseNode) ScormCourseNode(org.olat.course.nodes.ScormCourseNode)

Example 18 with PortfolioCourseNode

use of org.olat.course.nodes.PortfolioCourseNode in project openolat by klemens.

the class BinderConfiguration method createConfig.

public static BinderConfiguration createConfig(Binder binder) {
    boolean withScore = false;
    boolean withPassed = false;
    boolean assessable = false;
    Float maxScore = null;
    Float minScore = null;
    String displayname;
    RepositoryEntry entry = binder.getEntry();
    if (binder.getSubIdent() != null) {
        try {
            ICourse course = CourseFactory.loadCourse(entry);
            displayname = course.getCourseTitle();
            CourseNode courseNode = course.getRunStructure().getNode(binder.getSubIdent());
            if (courseNode instanceof PortfolioCourseNode) {
                PortfolioCourseNode pfNode = (PortfolioCourseNode) courseNode;
                withScore = pfNode.hasScoreConfigured();
                if (withScore) {
                    maxScore = pfNode.getMaxScoreConfiguration();
                    minScore = pfNode.getMinScoreConfiguration();
                }
                withPassed = pfNode.hasPassedConfigured();
                assessable = withPassed || withScore;
            } else {
                withPassed = true;
                withScore = false;
                assessable = true;
            }
        } catch (CorruptedCourseException e) {
            displayname = entry.getDisplayname();
            withPassed = withScore = assessable = false;
            log.error("Corrupted course: " + entry, e);
        }
    } else if (entry != null) {
        displayname = entry.getDisplayname();
        withPassed = true;
        withScore = false;
        assessable = true;
    } else {
        displayname = null;
        withPassed = withScore = assessable = false;
    }
    return new BinderConfiguration(assessable, withScore, maxScore, minScore, withPassed, true, true, false, displayname);
}
Also used : PortfolioCourseNode(org.olat.course.nodes.PortfolioCourseNode) CorruptedCourseException(org.olat.course.CorruptedCourseException) ICourse(org.olat.course.ICourse) RepositoryEntry(org.olat.repository.RepositoryEntry) CourseNode(org.olat.course.nodes.CourseNode) PortfolioCourseNode(org.olat.course.nodes.PortfolioCourseNode)

Example 19 with PortfolioCourseNode

use of org.olat.course.nodes.PortfolioCourseNode in project openolat by klemens.

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 20 with PortfolioCourseNode

use of org.olat.course.nodes.PortfolioCourseNode in project openolat by klemens.

the class PortfolioServiceImpl method updateAssessmentEntryLastModification.

private void updateAssessmentEntryLastModification(Binder binder, Identity doer, Role by) {
    if (binder.getEntry() == null)
        return;
    RepositoryEntry entry = binder.getEntry();
    List<Identity> assessedIdentities = getMembers(binder, PortfolioRoles.owner.name());
    // order status from the entry / section
    if ("CourseModule".equals(entry.getOlatResource().getResourceableTypeName())) {
        ICourse course = CourseFactory.loadCourse(entry);
        CourseNode courseNode = course.getRunStructure().getNode(binder.getSubIdent());
        if (courseNode instanceof PortfolioCourseNode) {
            PortfolioCourseNode pfNode = (PortfolioCourseNode) courseNode;
            for (Identity assessedIdentity : assessedIdentities) {
                UserCourseEnvironment userCourseEnv = AssessmentHelper.createAndInitUserCourseEnvironment(assessedIdentity, course);
                pfNode.updateLastModifications(userCourseEnv, doer, by);
            }
        }
    } else {
        OLATResource resource = ((BinderImpl) binder.getTemplate()).getOlatResource();
        RepositoryEntry referenceEntry = repositoryService.loadByResourceKey(resource.getKey());
        for (Identity assessedIdentity : assessedIdentities) {
            AssessmentEntry assessmentEntry = assessmentService.getOrCreateAssessmentEntry(assessedIdentity, null, binder.getEntry(), binder.getSubIdent(), referenceEntry);
            if (by == Role.coach) {
                assessmentEntry.setLastCoachModified(new Date());
            } else if (by == Role.user) {
                assessmentEntry.setLastUserModified(new Date());
            }
            assessmentService.updateAssessmentEntry(assessmentEntry);
        }
    }
}
Also used : PortfolioCourseNode(org.olat.course.nodes.PortfolioCourseNode) UserCourseEnvironment(org.olat.course.run.userview.UserCourseEnvironment) OLATResource(org.olat.resource.OLATResource) BinderImpl(org.olat.modules.portfolio.model.BinderImpl) ICourse(org.olat.course.ICourse) RepositoryEntry(org.olat.repository.RepositoryEntry) CourseNode(org.olat.course.nodes.CourseNode) PortfolioCourseNode(org.olat.course.nodes.PortfolioCourseNode) Identity(org.olat.core.id.Identity) AssessmentEntry(org.olat.modules.assessment.AssessmentEntry) Date(java.util.Date)

Aggregations

PortfolioCourseNode (org.olat.course.nodes.PortfolioCourseNode)20 RepositoryEntry (org.olat.repository.RepositoryEntry)18 CourseNode (org.olat.course.nodes.CourseNode)14 ICourse (org.olat.course.ICourse)10 OLATResource (org.olat.resource.OLATResource)10 UserCourseEnvironment (org.olat.course.run.userview.UserCourseEnvironment)8 AssessmentEntry (org.olat.modules.assessment.AssessmentEntry)8 BinderImpl (org.olat.modules.portfolio.model.BinderImpl)8 Date (java.util.Date)6 Binder (org.olat.modules.portfolio.Binder)6 SynchedBinder (org.olat.modules.portfolio.model.SynchedBinder)6 AtomicBoolean (java.util.concurrent.atomic.AtomicBoolean)4 AssessableCourseNode (org.olat.course.nodes.AssessableCourseNode)4 BasicLTICourseNode (org.olat.course.nodes.BasicLTICourseNode)4 GTACourseNode (org.olat.course.nodes.GTACourseNode)4 IQTESTCourseNode (org.olat.course.nodes.IQTESTCourseNode)4 MSCourseNode (org.olat.course.nodes.MSCourseNode)4 STCourseNode (org.olat.course.nodes.STCourseNode)4 ScormCourseNode (org.olat.course.nodes.ScormCourseNode)4 TACourseNode (org.olat.course.nodes.TACourseNode)4