use of org.olat.modules.portfolio.Page in project OpenOLAT by OpenOLAT.
the class AbstractPageListController method doOpenAssignment.
private void doOpenAssignment(UserRequest ureq, PortfolioElementRow row) {
Assignment assignment = row.getAssignment();
if (assignment.getAssignmentType() == AssignmentType.essay || assignment.getAssignmentType() == AssignmentType.document) {
Page page = assignment.getPage();
Page reloadedPage = portfolioService.getPageByKey(page.getKey());
doOpenPage(ureq, reloadedPage, false);
} else {
showWarning("not.implemented");
}
}
use of org.olat.modules.portfolio.Page in project OpenOLAT by OpenOLAT.
the class AbstractPageListController method doOpenRow.
protected void doOpenRow(UserRequest ureq, PortfolioElementRow row, boolean newElement) {
if (row.isPage()) {
Page reloadedPage = portfolioService.getPageByKey(row.getKey());
doOpenPage(ureq, reloadedPage, newElement);
} else if (row.isPendingAssignment()) {
if (secCallback.canNewAssignment()) {
doEditAssignment(ureq, row);
} else {
// TODO portfolio
}
}
}
use of org.olat.modules.portfolio.Page in project OpenOLAT by OpenOLAT.
the class BinderAssessmentController method loadModel.
private void loadModel() {
List<AssessmentSection> aSections = portfolioService.getAssessmentSections(binder, null);
Map<Section, AssessmentSection> aSectionsMap = new HashMap<>();
for (AssessmentSection aSection : aSections) {
aSectionsMap.put(aSection.getSection(), aSection);
}
// binder done only is an owner is present
// and all owners have done the binder
boolean binderDone = false;
List<Identity> assessedIdentities = portfolioService.getMembers(binder, PortfolioRoles.owner.name());
int countDone = 0;
for (Identity assessedIdentity : assessedIdentities) {
AssessmentEntryStatus status = portfolioService.getAssessmentStatus(assessedIdentity, binder);
if (status == AssessmentEntryStatus.done) {
countDone++;
}
}
binderDone = (countDone > 0 && countDone == assessedIdentities.size());
boolean allClosed = true;
List<Section> sections = portfolioService.getSections(binder);
List<AssessmentSectionWrapper> rows = new ArrayList<>();
Map<Section, AssessmentSectionWrapper> sectionToRows = new HashMap<>();
for (Section section : sections) {
AssessmentSection assessmentSection = aSectionsMap.get(section);
AssessmentSectionWrapper row = new AssessmentSectionWrapper(section, assessmentSection);
sectionToRows.put(section, row);
if (secCallback.canViewAssess(section) || secCallback.canAssess(section)) {
rows.add(row);
}
allClosed &= section.getSectionStatus() == SectionStatus.closed;
}
List<Page> pages = portfolioService.getPages(binder, null);
for (Page page : pages) {
AssessmentSectionWrapper row = sectionToRows.get(page.getSection());
if (row != null) {
row.setNumOfPages(row.getNumOfPages() + 1);
}
}
boolean allowedToAssess = false;
boolean allowedToAssessBinder = secCallback.canAssess(binder);
for (AssessmentSectionWrapper row : rows) {
boolean canAssess = secCallback.canAssess(row.getSection());
if (canAssess && !binderDone) {
forgeAssessmentSection(row);
allowedToAssess = true;
}
}
reopenLink.setVisible(allowedToAssessBinder && binderDone);
saveAndDoneLink.setVisible(allowedToAssessBinder && !binderDone && allClosed);
saveButton.setVisible(allowedToAssess);
cancelButton.setVisible(allowedToAssess);
model.setObjects(rows);
tableEl.reset();
tableEl.reloadData();
}
use of org.olat.modules.portfolio.Page in project OpenOLAT by OpenOLAT.
the class PortfolioServiceImpl method changeSectionStatus.
@Override
public Section changeSectionStatus(Section section, SectionStatus status, Identity coach) {
PageStatus newPageStatus;
if (status == SectionStatus.closed) {
newPageStatus = PageStatus.closed;
} else {
newPageStatus = PageStatus.inRevision;
}
Section reloadedSection = binderDao.loadSectionByKey(section.getKey());
List<Page> pages = reloadedSection.getPages();
for (Page page : pages) {
if (page != null) {
((PageImpl) page).setPageStatus(newPageStatus);
pageDao.updatePage(page);
if (newPageStatus == PageStatus.closed) {
// set user informations to done
pageUserInfosDao.updateStatus(page, PageUserStatus.done);
}
}
}
((SectionImpl) reloadedSection).setSectionStatus(status);
reloadedSection = binderDao.updateSection(reloadedSection);
return reloadedSection;
}
use of org.olat.modules.portfolio.Page in project OpenOLAT by OpenOLAT.
the class PortfolioServiceImpl method updatePage.
@Override
public Page updatePage(Page page, SectionRef newParentSection) {
Page updatedPage;
if (newParentSection == null) {
updatedPage = pageDao.updatePage(page);
} else {
Section currentSection = null;
if (page.getSection() != null) {
currentSection = binderDao.loadSectionByKey(page.getSection().getKey());
currentSection.getPages().remove(page);
}
Section newParent = binderDao.loadSectionByKey(newParentSection.getKey());
((PageImpl) page).setSection(newParent);
newParent.getPages().add(page);
updatedPage = pageDao.updatePage(page);
if (currentSection != null) {
binderDao.updateSection(currentSection);
}
binderDao.updateSection(newParent);
}
return updatedPage;
}
Aggregations