Search in sources :

Example 11 with LectureBlockRow

use of org.olat.modules.lecture.model.LectureBlockRow in project OpenOLAT by OpenOLAT.

the class AbstractTeacherOverviewController method loadModel.

protected void loadModel(LecturesBlockSearchParameters searchParams) {
    currentSearchParams = searchParams;
    List<LectureBlockRow> rows = getRows(searchParams);
    // reset
    List<LectureBlockRow> currentBlocks = new ArrayList<>();
    List<LectureBlockRow> pendingBlocks = new ArrayList<>();
    List<LectureBlockRow> nextBlocks = new ArrayList<>();
    List<LectureBlockRow> closedBlocks = new ArrayList<>();
    // only show the start button if
    Date now = new Date();
    for (LectureBlockRow row : rows) {
        LectureBlock block = row.getLectureBlock();
        if (canStartRollCall(row)) {
            startButton.setVisible(true);
            startButton.setUserObject(block);
            startButton.setPrimary(true);
            startWizardButton.setVisible(true);
            startWizardButton.setUserObject(block);
            currentBlocks.add(row);
        } else if (block.getStatus() == LectureBlockStatus.cancelled || block.getRollCallStatus() == LectureRollCallStatus.closed || block.getRollCallStatus() == LectureRollCallStatus.autoclosed) {
            closedBlocks.add(row);
        } else if (block.getStartDate() != null && block.getStartDate().after(now)) {
            nextBlocks.add(row);
        } else {
            pendingBlocks.add(row);
        }
    }
    currentLecturesBlockCtrl.loadModel(currentBlocks);
    mainVC.contextPut("currentBlockSize", currentBlocks.size());
    pendingLecturesBlockCtrl.loadModel(pendingBlocks);
    mainVC.contextPut("pendingBlockSize", pendingBlocks.size());
    nextLecturesBlockCtrl.loadModel(nextBlocks);
    mainVC.contextPut("nextBlockSize", nextBlocks.size());
    closedLecturesBlockCtrl.loadModel(closedBlocks);
    mainVC.contextPut("closedBlockSize", closedBlocks.size());
    mainVC.contextPut("totalBlockSize", getRowCount());
    dirtyTables = false;
}
Also used : LectureBlock(org.olat.modules.lecture.LectureBlock) ArrayList(java.util.ArrayList) LectureBlockRow(org.olat.modules.lecture.model.LectureBlockRow) Date(java.util.Date)

Example 12 with LectureBlockRow

use of org.olat.modules.lecture.model.LectureBlockRow in project OpenOLAT by OpenOLAT.

the class LectureListRepositoryController method formInnerEvent.

@Override
protected void formInnerEvent(UserRequest ureq, FormItem source, FormEvent event) {
    if (addLectureButton == source) {
        doAddLectureBlock(ureq);
    } else if (deleteLecturesButton == source) {
        doConfirmBulkDelete(ureq);
    } else if (source == tableEl) {
        if (event instanceof SelectionEvent) {
            SelectionEvent se = (SelectionEvent) event;
            String cmd = se.getCommand();
            LectureBlockRow row = tableModel.getObject(se.getIndex());
            if ("edit".equals(cmd)) {
                doEditLectureBlock(ureq, row);
            }
        }
    } else if (source instanceof FormLink) {
        FormLink link = (FormLink) source;
        String cmd = link.getCmd();
        if (cmd != null && cmd.startsWith("tools-")) {
            LectureBlockRow row = (LectureBlockRow) link.getUserObject();
            doOpenTools(ureq, row, link);
        }
    }
    super.formInnerEvent(ureq, source, event);
}
Also used : SelectionEvent(org.olat.core.gui.components.form.flexible.impl.elements.table.SelectionEvent) FormLink(org.olat.core.gui.components.form.flexible.elements.FormLink) LectureBlockRow(org.olat.modules.lecture.model.LectureBlockRow)

Example 13 with LectureBlockRow

use of org.olat.modules.lecture.model.LectureBlockRow in project OpenOLAT by OpenOLAT.

the class LectureListRepositoryController method loadModel.

private void loadModel() {
    List<LectureBlockWithTeachers> blocks = lectureService.getLectureBlocksWithTeachers(entry);
    List<LectureBlockRow> rows = new ArrayList<>(blocks.size());
    for (LectureBlockWithTeachers block : blocks) {
        LectureBlock b = block.getLectureBlock();
        StringBuilder teachers = new StringBuilder();
        String separator = translate("user.fullname.separator");
        for (Identity teacher : block.getTeachers()) {
            if (teachers.length() > 0)
                teachers.append(" ").append(separator).append(" ");
            teachers.append(userManager.getUserDisplayName(teacher));
        }
        LectureBlockRow row = new LectureBlockRow(b, entry.getDisplayname(), entry.getExternalRef(), teachers.toString(), false);
        rows.add(row);
        String linkName = "tools-" + counter++;
        FormLink toolsLink = uifactory.addFormLink(linkName, "", null, flc, Link.LINK | Link.NONTRANSLATED);
        toolsLink.setIconRightCSS("o_icon o_icon_actions o_icon-lg");
        toolsLink.setUserObject(row);
        flc.add(linkName, toolsLink);
        row.setToolsLink(toolsLink);
    }
    tableModel.setObjects(rows);
    tableEl.reset(true, true, true);
    deleteLecturesButton.setVisible(!rows.isEmpty());
}
Also used : LectureBlockWithTeachers(org.olat.modules.lecture.model.LectureBlockWithTeachers) LectureBlock(org.olat.modules.lecture.LectureBlock) ArrayList(java.util.ArrayList) Identity(org.olat.core.id.Identity) FormLink(org.olat.core.gui.components.form.flexible.elements.FormLink) LectureBlockRow(org.olat.modules.lecture.model.LectureBlockRow)

Example 14 with LectureBlockRow

use of org.olat.modules.lecture.model.LectureBlockRow in project openolat by klemens.

the class TeacherLecturesTableController method formInnerEvent.

@Override
protected void formInnerEvent(UserRequest ureq, FormItem source, FormEvent event) {
    if (source == tableEl) {
        if (event instanceof SelectionEvent) {
            SelectionEvent se = (SelectionEvent) event;
            String cmd = se.getCommand();
            if ("details".equals(cmd)) {
                LectureBlockRow row = tableModel.getObject(se.getIndex());
                doSelectLectureBlock(ureq, row.getLectureBlock());
            } else if ("export".equals(cmd)) {
                LectureBlockRow row = tableModel.getObject(se.getIndex());
                doExportLectureBlock(ureq, row.getLectureBlock());
            } else if ("open.course".equals(cmd)) {
                LectureBlockRow row = tableModel.getObject(se.getIndex());
                doOpenCourseLectures(ureq, row);
            }
        }
    } else if (source instanceof FormLink) {
        FormLink link = (FormLink) source;
        String cmd = link.getCmd();
        if ("tools".equals(cmd)) {
            LectureBlockRow row = (LectureBlockRow) link.getUserObject();
            doOpenTools(ureq, row, link);
        }
    }
    super.formInnerEvent(ureq, source, event);
}
Also used : SelectionEvent(org.olat.core.gui.components.form.flexible.impl.elements.table.SelectionEvent) FormLink(org.olat.core.gui.components.form.flexible.elements.FormLink) LectureBlockRow(org.olat.modules.lecture.model.LectureBlockRow)

Example 15 with LectureBlockRow

use of org.olat.modules.lecture.model.LectureBlockRow in project openolat by klemens.

the class TeacherToolOverviewController method getRows.

@Override
protected List<LectureBlockRow> getRows(LecturesBlockSearchParameters searchParams) {
    List<LectureBlock> blocksWithTeachers = lectureService.getLectureBlocks(getIdentity(), searchParams);
    List<LectureBlockRow> rows = new ArrayList<>(blocksWithTeachers.size());
    for (LectureBlock block : blocksWithTeachers) {
        RepositoryEntry entry = block.getEntry();
        rows.add(new LectureBlockRow(block, entry.getDisplayname(), entry.getExternalRef(), "", true));
    }
    return rows;
}
Also used : LectureBlock(org.olat.modules.lecture.LectureBlock) ArrayList(java.util.ArrayList) RepositoryEntry(org.olat.repository.RepositoryEntry) LectureBlockRow(org.olat.modules.lecture.model.LectureBlockRow)

Aggregations

LectureBlockRow (org.olat.modules.lecture.model.LectureBlockRow)20 ArrayList (java.util.ArrayList)12 LectureBlock (org.olat.modules.lecture.LectureBlock)12 FormLink (org.olat.core.gui.components.form.flexible.elements.FormLink)8 SelectionEvent (org.olat.core.gui.components.form.flexible.impl.elements.table.SelectionEvent)4 Identity (org.olat.core.id.Identity)4 LectureBlockWithTeachers (org.olat.modules.lecture.model.LectureBlockWithTeachers)4 Date (java.util.Date)2 List (java.util.List)2 RepositoryEntry (org.olat.repository.RepositoryEntry)2