use of org.olat.modules.portfolio.Section in project OpenOLAT by OpenOLAT.
the class BinderAssessmentController method forgeAssessmentSection.
private void forgeAssessmentSection(AssessmentSectionWrapper row) {
AssessmentSection assessmentSection = row.getAssessmentSection();
Section section = row.getSection();
if (!SectionStatus.isClosed(section)) {
// score
String pointVal = null;
if (assessmentSection != null && assessmentSection.getScore() != null) {
BigDecimal score = assessmentSection.getScore();
pointVal = AssessmentHelper.getRoundedScore(score);
}
TextElement pointEl = uifactory.addTextElement("point" + (++counter), null, 5, pointVal, flc);
pointEl.setDisplaySize(5);
row.setScoreEl(pointEl);
// passed
Boolean passed = assessmentSection == null ? null : assessmentSection.getPassed();
MultipleSelectionElement passedEl = uifactory.addCheckboxesHorizontal("check" + (++counter), null, flc, onKeys, onValues);
if (passed != null && passed.booleanValue()) {
passedEl.select(onKeys[0], passed.booleanValue());
}
row.setPassedEl(passedEl);
}
if (SectionStatus.isClosed(section)) {
FormLink reopenButton = uifactory.addFormLink("reopen" + (++counter), "reopen", "reopen", null, flc, Link.BUTTON);
reopenButton.setElementCssClass("o_sel_pf_reopen_section");
reopenButton.setUserObject(row);
row.setButton(reopenButton);
} else {
FormLink closeButton = uifactory.addFormLink("close" + (++counter), "close", "close.section", null, flc, Link.BUTTON);
closeButton.setElementCssClass("o_sel_pf_close_section");
closeButton.setUserObject(row);
row.setButton(closeButton);
}
}
use of org.olat.modules.portfolio.Section in project OpenOLAT by OpenOLAT.
the class PageDAO method removePage.
public Page removePage(Page page) {
PageImpl reloadedPage = (PageImpl) loadByKey(page.getKey());
Section section = reloadedPage.getSection();
if (section != null) {
section.getPages().remove(reloadedPage);
}
reloadedPage.setLastModified(new Date());
reloadedPage.setSection(null);
reloadedPage.setPageStatus(PageStatus.deleted);
unlinkAssignment(page);
if (section != null) {
dbInstance.getCurrentEntityManager().merge(section);
}
return dbInstance.getCurrentEntityManager().merge(reloadedPage);
}
use of org.olat.modules.portfolio.Section in project OpenOLAT by OpenOLAT.
the class PortfolioServiceImpl method addAssignment.
@Override
public Assignment addAssignment(String title, String summary, String content, AssignmentType type, Section section, boolean onlyAutoEvaluation, boolean reviewerSeeAutoEvaluation, boolean anonymousExternEvaluation, RepositoryEntry formEntry) {
File newStorage = portfolioFileStorage.generateAssignmentSubDirectory();
String storage = portfolioFileStorage.getRelativePath(newStorage);
Section reloadedSection = binderDao.loadSectionByKey(section.getKey());
return assignmentDao.createAssignment(title, summary, content, storage, type, AssignmentStatus.template, reloadedSection, onlyAutoEvaluation, reviewerSeeAutoEvaluation, anonymousExternEvaluation, formEntry);
}
use of org.olat.modules.portfolio.Section in project OpenOLAT by OpenOLAT.
the class PortfolioServiceImpl method deleteAssignment.
@Override
public boolean deleteAssignment(Assignment assignment) {
Assignment reloadedAssignment = assignmentDao.loadAssignmentByKey(assignment.getKey());
Section reloadedSection = reloadedAssignment.getSection();
boolean removed = false;
if (reloadedSection != null) {
removed = ((SectionImpl) reloadedSection).getAssignments().remove(reloadedAssignment);
}
assignmentDao.deleteAssignment(reloadedAssignment);
if (removed) {
binderDao.updateSection(reloadedSection);
}
return true;
}
use of org.olat.modules.portfolio.Section 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;
}
Aggregations