use of org.olat.modules.portfolio.Binder in project OpenOLAT by OpenOLAT.
the class PortfolioServiceImpl method setAssessmentStatus.
@Override
public void setAssessmentStatus(Identity assessedIdentity, BinderRef binderRef, AssessmentEntryStatus status, Identity coachingIdentity) {
Boolean fullyAssessed = Boolean.FALSE;
if (status == AssessmentEntryStatus.done) {
fullyAssessed = Boolean.TRUE;
}
Binder binder = binderDao.loadByKey(binderRef.getKey());
RepositoryEntry entry = binder.getEntry();
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;
UserCourseEnvironment userCourseEnv = AssessmentHelper.createAndInitUserCourseEnvironment(assessedIdentity, course);
AssessmentEvaluation eval = pfNode.getUserScoreEvaluation(userCourseEnv);
ScoreEvaluation scoreEval = new ScoreEvaluation(eval.getScore(), eval.getPassed(), status, true, fullyAssessed, null, null, binder.getKey());
pfNode.updateUserScoreEvaluation(scoreEval, userCourseEnv, coachingIdentity, false, Role.coach);
}
} else {
OLATResource resource = ((BinderImpl) binder.getTemplate()).getOlatResource();
RepositoryEntry referenceEntry = repositoryService.loadByResourceKey(resource.getKey());
AssessmentEntry assessmentEntry = assessmentService.getOrCreateAssessmentEntry(assessedIdentity, null, binder.getEntry(), binder.getSubIdent(), referenceEntry);
assessmentEntry.setFullyAssessed(fullyAssessed);
assessmentEntry.setAssessmentStatus(status);
assessmentService.updateAssessmentEntry(assessmentEntry);
}
}
use of org.olat.modules.portfolio.Binder in project OpenOLAT by OpenOLAT.
the class PortfolioServiceImpl method deleteSection.
@Override
public Binder deleteSection(Binder binder, Section section) {
Section reloadedSection = binderDao.loadSectionByKey(section.getKey());
Binder reloadedBinder = reloadedSection.getBinder();
return binderDao.deleteSection(reloadedBinder, reloadedSection);
}
use of org.olat.modules.portfolio.Binder in project OpenOLAT by OpenOLAT.
the class PortfolioServiceImpl method appendNewSection.
@Override
public SectionRef appendNewSection(String title, String description, Date begin, Date end, BinderRef binder) {
Binder reloadedBinder = binderDao.loadByKey(binder.getKey());
SectionImpl newSection = binderDao.createSection(title, description, begin, end, reloadedBinder);
return new SectionKeyRef(newSection.getKey());
}
use of org.olat.modules.portfolio.Binder in project OpenOLAT by OpenOLAT.
the class PortfolioNotificationsHandler method createSubscriptionInfo.
@Override
public SubscriptionInfo createSubscriptionInfo(Subscriber subscriber, Locale locale, Date compareDate) {
SubscriptionInfo si = null;
Publisher publisher = subscriber.getPublisher();
Binder binder = binderDao.loadByKey(publisher.getResId());
if (isInkoveValid(binder, compareDate, publisher)) {
BinderSecurityCallback secCallback = null;
Identity identity = subscriber.getIdentity();
if (binderDao.isMember(binder, identity, PortfolioRoles.owner.name())) {
secCallback = BinderSecurityCallbackFactory.getCallbackForOwnedBinder(binder);
} else {
List<AccessRights> rights = portfolioService.getAccessRights(binder, identity);
if (rights.size() > 0) {
secCallback = BinderSecurityCallbackFactory.getCallbackForCoach(binder, rights);
}
}
if (secCallback != null) {
si = new SubscriptionInfo(subscriber.getKey(), publisher.getType(), getTitleItemForBinder(binder), null);
List<SubscriptionListItem> allItems = getAllItems(binder, secCallback, compareDate, locale);
for (SubscriptionListItem item : allItems) {
// only a type of icon
SubscriptionListItem clonedItem = new SubscriptionListItem(item.getDescription(), item.getDescriptionTooltip(), item.getLink(), item.getBusinessPath(), item.getDate(), "o_ep_icon");
si.addSubscriptionListItem(clonedItem);
}
}
}
if (si == null) {
// no info, return empty
si = NotificationsManager.getInstance().getNoSubscriptionInfo();
}
return si;
}
use of org.olat.modules.portfolio.Binder in project OpenOLAT by OpenOLAT.
the class BinderTemplateHandler method cleanupOnDelete.
@Override
public boolean cleanupOnDelete(RepositoryEntry entry, OLATResourceable res) {
PortfolioService portfolioService = CoreSpringFactory.getImpl(PortfolioService.class);
Binder template = portfolioService.getBinderByResource(entry.getOlatResource());
return portfolioService.deleteBinderTemplate(template, entry);
}
Aggregations