Search in sources :

Example 1 with LectureBlockRow

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

the class TeacherLecturesTableController method loadModel.

protected void loadModel(List<LectureBlockRow> blocks) {
    for (LectureBlockRow row : blocks) {
        FormLink toolsLink = uifactory.addFormLink("tools_" + (counter++), "tools", "", null, null, Link.NONTRANSLATED);
        toolsLink.setIconLeftCSS("o_icon o_icon-lg o_icon_actions");
        toolsLink.setUserObject(row);
        row.setToolsLink(toolsLink);
    }
    tableModel.setObjects(blocks);
    tableEl.reset(true, true, true);
}
Also used : FormLink(org.olat.core.gui.components.form.flexible.elements.FormLink) LectureBlockRow(org.olat.modules.lecture.model.LectureBlockRow)

Example 2 with LectureBlockRow

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

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 3 with LectureBlockRow

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

the class AbstractTeacherOverviewController method activate.

@Override
public void activate(UserRequest ureq, List<ContextEntry> entries, StateEntry state) {
    if (entries == null || entries.isEmpty())
        return;
    String name = entries.get(0).getOLATResourceable().getResourceableTypeName();
    Long id = entries.get(0).getOLATResourceable().getResourceableId();
    if ("LectureBlock".equalsIgnoreCase(name)) {
        boolean started = false;
        if (entries.size() > 1) {
            String action = entries.get(1).getOLATResourceable().getResourceableTypeName();
            if ("Start".equalsIgnoreCase(action)) {
                LectureBlockRow row = currentLecturesBlockCtrl.getRow(id);
                if (row != null && canStartRollCall(row)) {
                    doStartRollCall(ureq, row.getLectureBlock());
                    started = true;
                }
            } else if ("StartWizard".equalsIgnoreCase(action)) {
                LectureBlockRow row = currentLecturesBlockCtrl.getRow(id);
                if (row != null && canStartRollCall(row)) {
                    doStartWizardRollCall(ureq, row.getLectureBlock());
                    started = true;
                }
            }
        }
        if (!started) {
            activateLectureBlockInTable(ureq, entries, state);
        }
    }
}
Also used : LectureBlockRow(org.olat.modules.lecture.model.LectureBlockRow)

Example 4 with LectureBlockRow

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

the class LectureListRepositoryController method event.

@Override
protected void event(UserRequest ureq, Controller source, Event event) {
    if (editLectureCtrl == source) {
        if (event == Event.DONE_EVENT) {
            loadModel();
        }
        cmc.deactivate();
        cleanUp();
    } else if (cmc == source) {
        cleanUp();
    } else if (toolsCalloutCtrl == source) {
        cleanUp();
    } else if (toolsCtrl == source) {
        if (event == Event.DONE_EVENT) {
            if (toolsCalloutCtrl != null) {
                toolsCalloutCtrl.deactivate();
                cleanUp();
            }
        }
    } else if (deleteDialogCtrl == source) {
        if (DialogBoxUIFactory.isYesEvent(event) || DialogBoxUIFactory.isOkEvent(event)) {
            LectureBlockRow row = (LectureBlockRow) deleteDialogCtrl.getUserObject();
            doDelete(row);
            loadModel();
            cleanUp();
        }
    } else if (bulkDeleteDialogCtrl == source) {
        if (DialogBoxUIFactory.isYesEvent(event) || DialogBoxUIFactory.isOkEvent(event)) {
            @SuppressWarnings("unchecked") List<LectureBlock> blocks = (List<LectureBlock>) bulkDeleteDialogCtrl.getUserObject();
            doDelete(blocks);
            loadModel();
            cleanUp();
        }
    }
    super.event(ureq, source, event);
}
Also used : LectureBlock(org.olat.modules.lecture.LectureBlock) List(java.util.List) ArrayList(java.util.ArrayList) LectureBlockRow(org.olat.modules.lecture.model.LectureBlockRow)

Example 5 with LectureBlockRow

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

the class LectureListRepositoryController method doConfirmBulkDelete.

private void doConfirmBulkDelete(UserRequest ureq) {
    Set<Integer> selections = tableEl.getMultiSelectedIndex();
    List<LectureBlock> blocks = new ArrayList<>();
    for (Integer selection : selections) {
        LectureBlockRow blockRow = tableModel.getObject(selection);
        if (!LectureBlockManagedFlag.isManaged(blockRow.getLectureBlock(), LectureBlockManagedFlag.delete)) {
            blocks.add(blockRow.getLectureBlock());
        }
    }
    if (blocks.isEmpty()) {
        showWarning("error.atleastone.lecture");
    } else {
        StringBuilder titles = new StringBuilder();
        for (LectureBlock block : blocks) {
            if (titles.length() > 0)
                titles.append(", ");
            titles.append(StringHelper.escapeHtml(block.getTitle()));
        }
        String text = translate("confirm.delete.lectures", new String[] { titles.toString() });
        bulkDeleteDialogCtrl = activateYesNoDialog(ureq, translate("delete.lectures.title"), text, bulkDeleteDialogCtrl);
        bulkDeleteDialogCtrl.setUserObject(blocks);
    }
}
Also used : LectureBlock(org.olat.modules.lecture.LectureBlock) ArrayList(java.util.ArrayList) 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