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);
}
}
}
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);
}
}
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);
}
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);
}
}
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);
}
}
}
Aggregations