Search in sources :

Example 1 with BinderStatistics

use of org.olat.modules.portfolio.model.BinderStatistics in project OpenOLAT by OpenOLAT.

the class BinderListController method loadModel.

protected void loadModel() {
    List<BinderStatistics> binderRows = portfolioService.searchOwnedBinders(getIdentity());
    List<BinderRow> rows = new ArrayList<>(binderRows.size());
    for (BinderStatistics binderRow : binderRows) {
        rows.add(forgePortfolioRow(binderRow));
    }
    if (portfolioModule.isLearnerCanCreateBinders() || portfolioModule.isCanCreateBindersFromTemplate() || portfolioModule.isCanCreateBindersFromCourse()) {
        rows.add(new BinderRow());
    }
    model.setObjects(rows);
    tableEl.reset();
    tableEl.reloadData();
}
Also used : BinderRow(org.olat.modules.portfolio.ui.model.BinderRow) ArrayList(java.util.ArrayList) BinderStatistics(org.olat.modules.portfolio.model.BinderStatistics)

Example 2 with BinderStatistics

use of org.olat.modules.portfolio.model.BinderStatistics in project OpenOLAT by OpenOLAT.

the class DeletedBinderController method doConfirmDelete.

private void doConfirmDelete(UserRequest ureq) {
    if (deleteBinderCtrl != null)
        return;
    List<BinderRow> rows = getSelectedRows();
    if (rows.isEmpty()) {
        showWarning("binder.atleastone");
    } else {
        List<BinderStatistics> stats = new ArrayList<>(rows.size());
        for (BinderRow row : rows) {
            stats.add(row.getStatistics());
        }
        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();
    }
}
Also used : BinderRow(org.olat.modules.portfolio.ui.model.BinderRow) CloseableModalController(org.olat.core.gui.control.generic.closablewrapper.CloseableModalController) ArrayList(java.util.ArrayList) BinderStatistics(org.olat.modules.portfolio.model.BinderStatistics)

Example 3 with BinderStatistics

use of org.olat.modules.portfolio.model.BinderStatistics in project OpenOLAT by OpenOLAT.

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();
}
Also used : CloseableModalController(org.olat.core.gui.control.generic.closablewrapper.CloseableModalController) BinderStatistics(org.olat.modules.portfolio.model.BinderStatistics)

Example 4 with BinderStatistics

use of org.olat.modules.portfolio.model.BinderStatistics in project OpenOLAT by OpenOLAT.

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();
}
Also used : CloseableModalController(org.olat.core.gui.control.generic.closablewrapper.CloseableModalController) BinderStatistics(org.olat.modules.portfolio.model.BinderStatistics)

Example 5 with BinderStatistics

use of org.olat.modules.portfolio.model.BinderStatistics in project openolat by klemens.

the class BinderDAO method searchOwnedBinders.

/**
 * The same type of query is user for the categories
 * @param owner
 * @return
 */
public List<BinderStatistics> searchOwnedBinders(IdentityRef owner, boolean deleted) {
    StringBuilder sb = new StringBuilder(1024);
    sb.append("select binder.key, binder.title, binder.imagePath, binder.lastModified, binder.status,").append(" binderEntry.displayname,").append(" (select count(section.key) from pfsection as section").append("   where section.binder.key=binder.key").append(" ) as numOfSections,").append(" (select count(page.key) from pfpage as page, pfsection as pageSection").append("   where pageSection.binder.key=binder.key and page.section.key=pageSection.key").append(" ) as numOfPages,").append(" (select count(comment.key) from usercomment as comment, pfpage as page, pfsection as pageSection").append("   where pageSection.binder.key=binder.key and page.section.key=pageSection.key and comment.resId=page.key and comment.resName='Page'").append(" ) as numOfComments").append(" from pfbinder as binder").append(" left join binder.baseGroup as baseGroup").append(" left join baseGroup.members as membership").append(" left join binder.entry binderEntry").append(" where binder.olatResource is null and membership.identity.key=:identityKey and membership.role=:role");
    if (deleted) {
        sb.append(" and binder.status='").append(BinderStatus.deleted.name()).append("'");
    } else {
        sb.append(" and (binder.status is null or binder.status='").append(BinderStatus.open.name()).append("')");
    }
    List<Object[]> objects = dbInstance.getCurrentEntityManager().createQuery(sb.toString(), Object[].class).setParameter("identityKey", owner.getKey()).setParameter("role", PortfolioRoles.owner.name()).getResultList();
    List<BinderStatistics> rows = new ArrayList<>(objects.size());
    for (Object[] object : objects) {
        int pos = 0;
        Long key = (Long) object[pos++];
        String title = (String) object[pos++];
        String imagePath = (String) object[pos++];
        Date lastModified = (Date) object[pos++];
        String status = (String) object[pos++];
        String repoEntryName = (String) object[pos++];
        int numOfSections = ((Number) object[pos++]).intValue();
        int numOfPages = ((Number) object[pos++]).intValue();
        int numOfComments = ((Number) object[pos++]).intValue();
        rows.add(new BinderStatistics(key, title, imagePath, lastModified, numOfSections, numOfPages, status, repoEntryName, numOfComments));
    }
    return rows;
}
Also used : ArrayList(java.util.ArrayList) BinderStatistics(org.olat.modules.portfolio.model.BinderStatistics) Date(java.util.Date)

Aggregations

BinderStatistics (org.olat.modules.portfolio.model.BinderStatistics)20 ArrayList (java.util.ArrayList)8 CloseableModalController (org.olat.core.gui.control.generic.closablewrapper.CloseableModalController)6 BinderRow (org.olat.modules.portfolio.ui.model.BinderRow)6 Date (java.util.Date)4 FormLayoutContainer (org.olat.core.gui.components.form.flexible.impl.FormLayoutContainer)4 Test (org.junit.Test)2 Identity (org.olat.core.id.Identity)2 Binder (org.olat.modules.portfolio.Binder)2 Section (org.olat.modules.portfolio.Section)2 SynchedBinder (org.olat.modules.portfolio.model.SynchedBinder)2