use of org.olat.modules.portfolio.Binder in project openolat by klemens.
the class BinderListController method doCreateBinderFromCourseTemplate.
private void doCreateBinderFromCourseTemplate(UserRequest ureq, CourseTemplateRow row) {
RepositoryEntry courseEntry = row.getCourseEntry();
RepositoryEntry templateEntry = row.getTemplateEntry();
PortfolioCourseNode courseNode = row.getCourseNode();
Binder templateBinder = portfolioService.getBinderByResource(templateEntry.getOlatResource());
Binder copyBinder = portfolioService.getBinder(getIdentity(), templateBinder, courseEntry, courseNode.getIdent());
if (copyBinder == null) {
Date deadline = courseNode.getDeadline();
copyBinder = portfolioService.assignBinder(getIdentity(), templateBinder, courseEntry, courseNode.getIdent(), deadline);
DBFactory.getInstance().commit();
SynchedBinder synchedBinder = portfolioService.loadAndSyncBinder(copyBinder);
copyBinder = synchedBinder.getBinder();
if (copyBinder != null) {
showInfo("map.copied", StringHelper.escapeHtml(templateBinder.getTitle()));
ThreadLocalUserActivityLogger.addLoggingResourceInfo(LoggingResourceable.wrap(copyBinder));
ThreadLocalUserActivityLogger.log(PortfolioLoggingAction.PORTFOLIO_TASK_STARTED, getClass());
}
}
doOpenBinder(ureq, copyBinder).activate(ureq, null, null);
}
use of org.olat.modules.portfolio.Binder in project openolat by klemens.
the class BinderOnePageController method loadMetadataAndComponents.
private void loadMetadataAndComponents(UserRequest ureq, BinderRef binderRef) {
Binder binder = portfolioService.getBinderByKey(binderRef.getKey());
// load metadata
List<Identity> owners = portfolioService.getMembers(binder, PortfolioRoles.owner.name());
StringBuilder ownerSb = new StringBuilder();
for (Identity owner : owners) {
if (ownerSb.length() > 0)
ownerSb.append(", ");
ownerSb.append(userManager.getUserDisplayName(owner));
}
mainVC.contextPut("owners", ownerSb.toString());
mainVC.contextPut("binderTitle", binder.getTitle());
mainVC.contextPut("binderKey", binder.getKey());
// load pages
List<Section> sections = portfolioService.getSections(binder);
List<Page> pages = portfolioService.getPages(binder, null);
for (Section section : sections) {
loadSection(section);
for (Page page : pages) {
if (section.equals(page.getSection())) {
loadPage(ureq, page);
}
}
}
}
use of org.olat.modules.portfolio.Binder in project openolat by klemens.
the class BinderRuntimeController method doOptions.
private Activateable2 doOptions(UserRequest ureq) {
OLATResourceable ores = OresHelper.createOLATResourceableType("Options");
ThreadLocalUserActivityLogger.addLoggingResourceInfo(LoggingResourceable.wrapBusinessPath(ores));
WindowControl swControl = addToHistory(ureq, ores, null);
if (reSecurity.isEntryAdmin()) {
Binder binder = portfolioService.getBinderByResource(getRepositoryEntry().getOlatResource());
BinderDeliveryOptionsController ctrl = new BinderDeliveryOptionsController(ureq, swControl, binder);
listenTo(ctrl);
optionsCtrl = pushController(ureq, "Options", ctrl);
currentToolCtr = optionsCtrl;
setActiveTool(optionsLink);
enableRuntimeNavBar(false);
return optionsCtrl;
}
return null;
}
use of org.olat.modules.portfolio.Binder in project openolat by klemens.
the class PortfolioServiceImpl method updateAssessmentSections.
@Override
public void updateAssessmentSections(BinderRef binderRef, List<AssessmentSectionChange> changes, Identity coachingIdentity) {
Binder binder = binderDao.loadByKey(binderRef.getKey());
Map<Identity, List<AssessmentSectionChange>> assessedIdentitiesToChangesMap = new HashMap<>();
for (AssessmentSectionChange change : changes) {
List<AssessmentSectionChange> identityChanges;
if (assessedIdentitiesToChangesMap.containsKey(change.getIdentity())) {
identityChanges = assessedIdentitiesToChangesMap.get(change.getIdentity());
} else {
identityChanges = new ArrayList<>();
assessedIdentitiesToChangesMap.put(change.getIdentity(), identityChanges);
}
identityChanges.add(change);
}
for (Map.Entry<Identity, List<AssessmentSectionChange>> changesEntry : assessedIdentitiesToChangesMap.entrySet()) {
Identity assessedIdentity = changesEntry.getKey();
List<AssessmentSection> currentAssessmentSections = assessmentSectionDao.loadAssessmentSections(binder, assessedIdentity);
Set<AssessmentSection> updatedAssessmentSections = new HashSet<>(currentAssessmentSections);
List<AssessmentSectionChange> identityChanges = changesEntry.getValue();
for (AssessmentSectionChange change : identityChanges) {
AssessmentSection assessmentSection = change.getAssessmentSection();
for (AssessmentSection currentAssessmentSection : currentAssessmentSections) {
if (assessmentSection != null && assessmentSection.equals(currentAssessmentSection)) {
assessmentSection = currentAssessmentSection;
} else if (change.getSection().equals(currentAssessmentSection.getSection())) {
assessmentSection = currentAssessmentSection;
}
}
if (assessmentSection == null) {
assessmentSection = assessmentSectionDao.createAssessmentSection(change.getScore(), change.getPassed(), change.getSection(), assessedIdentity);
} else {
((AssessmentSectionImpl) assessmentSection).setScore(change.getScore());
((AssessmentSectionImpl) assessmentSection).setPassed(change.getPassed());
assessmentSection = assessmentSectionDao.update(assessmentSection);
}
updatedAssessmentSections.add(assessmentSection);
}
updateAssessmentEntry(assessedIdentity, binder, updatedAssessmentSections, coachingIdentity);
}
}
use of org.olat.modules.portfolio.Binder 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();
}
Aggregations