use of org.olat.modules.portfolio.model.BinderStatistics in project openolat by klemens.
the class ConfirmMoveBinderToTrashController method initForm.
@Override
protected void initForm(FormItemContainer formLayout, Controller listener, UserRequest ureq) {
StringBuilder names = new StringBuilder();
int numOfPages = 0;
int numOfSections = 0;
int numOfComments = 0;
for (BinderStatistics stat : stats) {
if (names.length() > 0)
names.append(", ");
names.append(StringHelper.escapeHtml(stat.getTitle()));
numOfPages += stat.getNumOfPages();
numOfSections += stat.getNumOfSections();
numOfComments += stat.getNumOfComments();
}
String[] args = new String[] { names.toString(), Integer.toString(numOfSections), Integer.toString(numOfPages), Integer.toString(numOfComments) };
if (formLayout instanceof FormLayoutContainer) {
FormLayoutContainer layoutCont = (FormLayoutContainer) formLayout;
layoutCont.contextPut("msg", translate("delete.binder.warning", args));
layoutCont.contextPut("dangerCssClass", "o_warning");
}
String[] onValues = new String[] { translate("trash.binder.acknowledge") };
acknowledgeEl = uifactory.addCheckboxesHorizontal("acknowledge", "delete.binder.acknowledge", formLayout, onKeys, onValues);
uifactory.addFormCancelButton("cancel", formLayout, ureq, getWindowControl());
uifactory.addFormSubmitButton("delete", "delete.binder", formLayout);
}
use of org.olat.modules.portfolio.model.BinderStatistics in project openolat by klemens.
the class DeletedBinderController method loadModel.
@Override
protected void loadModel() {
List<BinderStatistics> binderRows = portfolioService.searchOwnedDeletedBinders(getIdentity());
List<BinderRow> rows = new ArrayList<>(binderRows.size());
for (BinderStatistics binderRow : binderRows) {
rows.add(forgePortfolioRow(binderRow));
}
model.setObjects(rows);
tableEl.reset();
tableEl.reloadData();
}
use of org.olat.modules.portfolio.model.BinderStatistics in project openolat by klemens.
the class TableOfContentController method doConfirmMoveToTrashBinder.
private void doConfirmMoveToTrashBinder(UserRequest ureq) {
if (moveBinderToTrashCtrl != null)
return;
BinderStatistics stats = portfolioService.getBinderStatistics(binder);
moveBinderToTrashCtrl = new ConfirmMoveBinderToTrashController(ureq, getWindowControl(), stats);
listenTo(moveBinderToTrashCtrl);
String title = translate("delete.binder");
cmc = new CloseableModalController(getWindowControl(), null, moveBinderToTrashCtrl.getInitialComponent(), true, title, true);
listenTo(cmc);
cmc.activate();
}
use of org.olat.modules.portfolio.model.BinderStatistics in project openolat by klemens.
the class TableOfContentController method doConfirmDeleteBinder.
private void doConfirmDeleteBinder(UserRequest ureq) {
if (moveBinderToTrashCtrl != null)
return;
BinderStatistics stats = portfolioService.getBinderStatistics(binder);
deleteBinderCtrl = new ConfirmDeleteBinderController(ureq, getWindowControl(), stats);
listenTo(deleteBinderCtrl);
String title = translate("delete.binder");
cmc = new CloseableModalController(getWindowControl(), null, deleteBinderCtrl.getInitialComponent(), true, title, true);
listenTo(cmc);
cmc.activate();
}
use of org.olat.modules.portfolio.model.BinderStatistics in project OpenOLAT by OpenOLAT.
the class PortfolioServiceTest method searchOwnedBinders.
@Test
public void searchOwnedBinders() {
Identity owner = JunitTestHelper.createAndPersistIdentityAsRndUser("binder-owner-");
Binder binder = portfolioService.createNewBinder("Binder 2", "Binder with one section.", null, owner);
dbInstance.commitAndCloseSession();
portfolioService.appendNewSection("First section", "My first section.", null, null, binder);
dbInstance.commitAndCloseSession();
portfolioService.appendNewSection("Second section", "My second section.", null, null, binder);
dbInstance.commitAndCloseSession();
List<Section> sections = portfolioService.getSections(binder);
for (int i = 0; i < 2; i++) {
Section section = sections.get(1);
portfolioService.appendNewPage(owner, "Page-1-" + i, "", null, null, section);
portfolioService.appendNewPage(owner, "Page-2-" + i, "", null, null, section);
}
List<BinderStatistics> rows = portfolioService.searchOwnedBinders(owner);
Assert.assertNotNull(rows);
Assert.assertEquals(1, rows.size());
BinderStatistics myBinder = rows.get(0);
Assert.assertEquals(2, myBinder.getNumOfSections());
Assert.assertEquals(4, myBinder.getNumOfPages());
}
Aggregations