use of org.olat.modules.portfolio.Assignment in project OpenOLAT by OpenOLAT.
the class AbstractPageListController method doEditAssignment.
protected void doEditAssignment(UserRequest ureq, PortfolioElementRow row) {
if (editAssignmentCtrl != null)
return;
Assignment assignment = row.getAssignment();
editAssignmentCtrl = new AssignmentEditController(ureq, getWindowControl(), assignment);
listenTo(editAssignmentCtrl);
String title = translate("edit.assignment");
cmc = new CloseableModalController(getWindowControl(), null, editAssignmentCtrl.getInitialComponent(), true, title, true);
listenTo(cmc);
cmc.activate();
}
use of org.olat.modules.portfolio.Assignment in project OpenOLAT by OpenOLAT.
the class AbstractPageListController method doMoveDownAssignment.
private void doMoveDownAssignment(UserRequest ureq, PortfolioElementRow row) {
Assignment assigment = row.getAssignment();
Section section = row.getSection();
section = portfolioService.moveDownAssignment(section, assigment);
loadModel(ureq, null);
}
use of org.olat.modules.portfolio.Assignment 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.Assignment in project OpenOLAT by OpenOLAT.
the class AbstractPageListController method forgePageRow.
protected PortfolioElementRow forgePageRow(UserRequest ureq, Page page, AssessmentSection assessmentSection, List<Assignment> assignments, Map<OLATResourceable, List<Category>> categorizedElementMap, Map<Long, Long> numberOfCommentsMap, boolean selectElement) {
Section section = page.getSection();
PortfolioElementRow row = new PortfolioElementRow(page, assessmentSection, config.isAssessable());
String openLinkId = "open_" + (++counter);
FormLink openLink = uifactory.addFormLink(openLinkId, "open.full", "open.full.page", null, flc, Link.BUTTON_SMALL);
openLink.setIconRightCSS("o_icon o_icon_start");
openLink.setEnabled(selectElement);
openLink.setPrimary(true);
row.setOpenFormLink(openLink);
openLink.setUserObject(row);
addCategoriesToRow(row, categorizedElementMap);
if (assignments != null) {
for (Assignment assignment : assignments) {
if (page.equals(assignment.getPage())) {
row.setAssignment(assignment);
}
}
}
decorateImage(ureq, row, page);
if (numberOfCommentsMap != null) {
Long numOfComments = numberOfCommentsMap.get(page.getKey());
if (numOfComments != null) {
row.setNumOfComments(numOfComments.longValue());
} else {
row.setNumOfComments(0);
}
} else {
row.setNumOfComments(0);
}
if (secCallback.canCloseSection(section)) {
if (SectionStatus.isClosed(section)) {
FormLink reopenLink = uifactory.addFormLink("ropens_" + (++counter), "reopen.section", "reopen.section", null, flc, Link.BUTTON_SMALL);
reopenLink.setUserObject(row);
row.setReopenSectionLink(reopenLink);
} else {
FormLink closeLink = uifactory.addFormLink("closes_" + (++counter), "close.section", "close.section", null, flc, Link.BUTTON_SMALL);
closeLink.setUserObject(row);
row.setCloseSectionLink(closeLink);
}
}
if (portfolioV2Module.isEntriesCommentsEnabled() && secCallback.canComment(page)) {
String title;
String cssClass = "o_icon o_icon-fw o_icon_comments";
if (row.getNumOfComments() == 1) {
title = translate("comment.one");
} else if (row.getNumOfComments() > 1) {
title = translate("comment.several", new String[] { Long.toString(row.getNumOfComments()) });
} else {
title = translate("comment.zero");
cssClass += "_none";
}
FormLink commentLink = uifactory.addFormLink("com_" + (++counter), "comment", title, null, flc, Link.LINK | Link.NONTRANSLATED);
commentLink.setIconLeftCSS(cssClass);
commentLink.setUserObject(row);
row.setCommentFormLink(commentLink);
}
return row;
}
use of org.olat.modules.portfolio.Assignment in project OpenOLAT by OpenOLAT.
the class AbstractPageListController method doStartAssignment.
private Assignment doStartAssignment(UserRequest ureq, Long assignmentKey) {
Assignment startedAssigment = portfolioService.startAssignment(assignmentKey, getIdentity());
doOpenPage(ureq, startedAssigment.getPage(), true);
loadModel(ureq, null);
return startedAssigment;
}
Aggregations