Search in sources :

Example 71 with AssessableCourseNode

use of org.olat.course.nodes.AssessableCourseNode in project OpenOLAT by OpenOLAT.

the class IdentityListCourseNodeController method doSetDone.

private void doSetDone(UserRequest ureq) {
    Set<Integer> selections = tableEl.getMultiSelectedIndex();
    List<AssessedIdentityElementRow> rows = new ArrayList<>(selections.size());
    for (Integer i : selections) {
        AssessedIdentityElementRow row = usersTableModel.getObject(i.intValue());
        if (row != null && row.getAssessmentStatus() != AssessmentEntryStatus.done) {
            rows.add(row);
        }
    }
    if (rows == null || rows.isEmpty()) {
        showWarning("warning.bulk.done");
    } else if (courseNode instanceof AssessableCourseNode) {
        ICourse course = CourseFactory.loadCourse(courseEntry);
        AssessableCourseNode assessableCourseNode = (AssessableCourseNode) courseNode;
        for (AssessedIdentityElementRow row : rows) {
            Identity assessedIdentity = securityManager.loadIdentityByKey(row.getIdentityKey());
            Roles roles = securityManager.getRoles(assessedIdentity);
            IdentityEnvironment identityEnv = new IdentityEnvironment(assessedIdentity, roles);
            UserCourseEnvironment assessedUserCourseEnv = new UserCourseEnvironmentImpl(identityEnv, course.getCourseEnvironment(), coachCourseEnv.isCourseReadOnly());
            assessedUserCourseEnv.getScoreAccounting().evaluateAll();
            ScoreEvaluation scoreEval = assessableCourseNode.getUserScoreEvaluation(assessedUserCourseEnv);
            ScoreEvaluation doneEval = new ScoreEvaluation(scoreEval.getScore(), scoreEval.getPassed(), AssessmentEntryStatus.done, null, scoreEval.getFullyAssessed(), scoreEval.getCurrentRunCompletion(), scoreEval.getCurrentRunStatus(), scoreEval.getAssessmentID());
            assessableCourseNode.updateUserScoreEvaluation(doneEval, assessedUserCourseEnv, getIdentity(), false, Role.coach);
        }
        loadModel(ureq);
    }
}
Also used : ScoreEvaluation(org.olat.course.run.scoring.ScoreEvaluation) UserCourseEnvironment(org.olat.course.run.userview.UserCourseEnvironment) AssessedIdentityElementRow(org.olat.modules.assessment.ui.AssessedIdentityElementRow) ArrayList(java.util.ArrayList) ICourse(org.olat.course.ICourse) Roles(org.olat.core.id.Roles) CalculatedAssessableCourseNode(org.olat.course.nodes.CalculatedAssessableCourseNode) AssessableCourseNode(org.olat.course.nodes.AssessableCourseNode) UserCourseEnvironmentImpl(org.olat.course.run.userview.UserCourseEnvironmentImpl) Identity(org.olat.core.id.Identity) IdentityEnvironment(org.olat.core.id.IdentityEnvironment)

Example 72 with AssessableCourseNode

use of org.olat.course.nodes.AssessableCourseNode in project OpenOLAT by OpenOLAT.

the class IdentityListCourseNodeController method initForm.

@Override
protected void initForm(FormItemContainer formLayout, Controller listener, UserRequest ureq) {
    if (formLayout instanceof FormLayoutContainer) {
        FormLayoutContainer layoutCont = (FormLayoutContainer) formLayout;
        layoutCont.contextPut("courseNodeTitle", courseNode.getShortTitle());
        layoutCont.contextPut("courseNodeCssClass", CourseNodeFactory.getInstance().getCourseNodeConfigurationEvenForDisabledBB(courseNode.getType()).getIconCSSClass());
        if (group != null) {
            layoutCont.contextPut("businessGroupName", group.getName());
        }
    }
    ICourse course = CourseFactory.loadCourse(courseEntry);
    String select = isSelectable() ? "select" : null;
    // add the table
    FlexiTableSortOptions options = new FlexiTableSortOptions();
    FlexiTableColumnModel columnsModel = FlexiTableDataModelFactory.createFlexiTableColumnModel();
    if (isAdministrativeUser) {
        options.setDefaultOrderBy(new SortKey(IdentityCourseElementCols.username.sortKey(), true));
        columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(IdentityCourseElementCols.username, select));
    }
    int colIndex = AssessmentToolConstants.USER_PROPS_OFFSET;
    for (int i = 0; i < userPropertyHandlers.size(); i++) {
        UserPropertyHandler userPropertyHandler = userPropertyHandlers.get(i);
        boolean visible = UserManager.getInstance().isMandatoryUserProperty(AssessmentToolConstants.usageIdentifyer, userPropertyHandler);
        columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(visible, userPropertyHandler.i18nColumnDescriptorLabelKey(), colIndex, select, true, "userProp-" + colIndex));
        if (!options.hasDefaultOrderBy()) {
            options.setDefaultOrderBy(new SortKey("userProp-" + colIndex, true));
        }
        colIndex++;
    }
    initAssessmentColumns(columnsModel);
    initStatusColumns(columnsModel);
    initModificationDatesColumns(columnsModel);
    initCalloutColumns(columnsModel);
    AssessableCourseNode assessableNode = courseNode instanceof AssessableCourseNode ? (AssessableCourseNode) courseNode : null;
    usersTableModel = new IdentityListCourseNodeTableModel(columnsModel, assessableNode, getLocale());
    tableEl = uifactory.addTableElement(getWindowControl(), "table", usersTableModel, 20, false, getTranslator(), formLayout);
    tableEl.setExportEnabled(true);
    tableEl.setSearchEnabled(new AssessedIdentityListProvider(getIdentity(), courseEntry, referenceEntry, courseNode.getIdent(), assessmentCallback), ureq.getUserSession());
    tableEl.setMultiSelect(!coachCourseEnv.isCourseReadOnly());
    tableEl.setSortSettings(options);
    tableEl.setSelectAllEnable(true);
    List<FlexiTableFilter> filters = new ArrayList<>();
    filters.add(new FlexiTableFilter(translate("filter.showAll"), "showAll", true));
    filters.add(FlexiTableFilter.SPACER);
    filters.add(new FlexiTableFilter(translate("filter.passed"), "passed"));
    filters.add(new FlexiTableFilter(translate("filter.failed"), "failed"));
    filters.add(new FlexiTableFilter(translate("filter.inProgress"), "inProgress"));
    filters.add(new FlexiTableFilter(translate("filter.inReview"), "inReview"));
    filters.add(new FlexiTableFilter(translate("filter.done"), "done"));
    tableEl.setFilters("", filters, false);
    if (assessmentCallback.canAssessBusinessGoupMembers() && group == null) {
        List<BusinessGroup> coachedGroups = null;
        if (assessmentCallback.isAdmin()) {
            coachedGroups = course.getCourseEnvironment().getCourseGroupManager().getAllBusinessGroups();
        } else {
            coachedGroups = assessmentCallback.getCoachedGroups();
        }
        if (coachedGroups.size() > 0) {
            List<FlexiTableFilter> groupFilters = new ArrayList<>();
            for (BusinessGroup coachedGroup : coachedGroups) {
                String groupName = StringHelper.escapeHtml(coachedGroup.getName());
                groupFilters.add(new FlexiTableFilter(groupName, coachedGroup.getKey().toString(), "o_icon o_icon_group"));
            }
            tableEl.setExtendedFilterButton(translate("filter.groups"), groupFilters);
        }
    }
    tableEl.setAndLoadPersistedPreferences(ureq, getTableId());
}
Also used : FlexiTableSortOptions(org.olat.core.gui.components.form.flexible.elements.FlexiTableSortOptions) BusinessGroup(org.olat.group.BusinessGroup) ArrayList(java.util.ArrayList) FormLayoutContainer(org.olat.core.gui.components.form.flexible.impl.FormLayoutContainer) ICourse(org.olat.course.ICourse) SortKey(org.olat.core.commons.persistence.SortKey) CalculatedAssessableCourseNode(org.olat.course.nodes.CalculatedAssessableCourseNode) AssessableCourseNode(org.olat.course.nodes.AssessableCourseNode) FlexiTableFilter(org.olat.core.gui.components.form.flexible.elements.FlexiTableFilter) FlexiTableColumnModel(org.olat.core.gui.components.form.flexible.impl.elements.table.FlexiTableColumnModel) DefaultFlexiColumnModel(org.olat.core.gui.components.form.flexible.impl.elements.table.DefaultFlexiColumnModel) UserPropertyHandler(org.olat.user.propertyhandlers.UserPropertyHandler)

Example 73 with AssessableCourseNode

use of org.olat.course.nodes.AssessableCourseNode in project OpenOLAT by OpenOLAT.

the class AssessmentIdentityCourseController method hasPrevious.

private boolean hasPrevious(CourseNode courseNode) {
    int index = treeOverviewCtrl.getIndexOf(courseNode);
    int numOfNodes = treeOverviewCtrl.getNumberOfNodes();
    if (index > 0 && index <= numOfNodes) {
        for (int i = index; i-- > 0; ) {
            CourseNode previousNode = treeOverviewCtrl.getNode(i);
            if (previousNode instanceof AssessableCourseNode && !(previousNode instanceof STCourseNode)) {
                return true;
            }
        }
    }
    return false;
}
Also used : AssessableCourseNode(org.olat.course.nodes.AssessableCourseNode) STCourseNode(org.olat.course.nodes.STCourseNode) AssessableCourseNode(org.olat.course.nodes.AssessableCourseNode) CourseNode(org.olat.course.nodes.CourseNode) STCourseNode(org.olat.course.nodes.STCourseNode)

Example 74 with AssessableCourseNode

use of org.olat.course.nodes.AssessableCourseNode in project OpenOLAT by OpenOLAT.

the class AssessmentIdentityListCourseTreeController method doSelectCourseNode.

private Controller doSelectCourseNode(UserRequest ureq, CourseNode courseNode) {
    removeAsListenerAndDispose(currentCtrl);
    OLATResourceable ores = OresHelper.createOLATResourceableInstance("Node", new Long(courseNode.getIdent()));
    WindowControl bwControl = BusinessControlFactory.getInstance().createBusinessWindowControl(ores, null, getWindowControl());
    if (courseNode instanceof AssessableCourseNode) {
        if (((AssessableCourseNode) courseNode).isAssessedBusinessGroups() && courseNode instanceof GTACourseNode) {
            CourseEnvironment courseEnv = CourseFactory.loadCourse(courseEntry).getCourseEnvironment();
            List<BusinessGroup> coachedGroups;
            if (businessGroup != null) {
                coachedGroups = Collections.singletonList(businessGroup);
            } else if (assessmentCallback.isAdmin()) {
                coachedGroups = courseEnv.getCourseGroupManager().getAllBusinessGroups();
            } else {
                coachedGroups = assessmentCallback.getCoachedGroups();
            }
            currentCtrl = ((GTACourseNode) courseNode).getCoachedGroupListController(ureq, bwControl, stackPanel, coachCourseEnv, assessmentCallback.isAdmin(), coachedGroups);
        } else {
            currentCtrl = ((AssessableCourseNode) courseNode).getIdentityListController(ureq, bwControl, stackPanel, courseEntry, businessGroup, coachCourseEnv, toolContainer, assessmentCallback);
        }
    } else {
        currentCtrl = new IdentityListCourseNodeController(ureq, bwControl, stackPanel, courseEntry, businessGroup, courseNode, coachCourseEnv, toolContainer, assessmentCallback);
    }
    listenTo(currentCtrl);
    mainPanel.setContent(currentCtrl.getInitialComponent());
    addToHistory(ureq, currentCtrl);
    return currentCtrl;
}
Also used : AssessableCourseNode(org.olat.course.nodes.AssessableCourseNode) CourseEnvironment(org.olat.course.run.environment.CourseEnvironment) UserCourseEnvironment(org.olat.course.run.userview.UserCourseEnvironment) OLATResourceable(org.olat.core.id.OLATResourceable) BusinessGroup(org.olat.group.BusinessGroup) GTACourseNode(org.olat.course.nodes.GTACourseNode) WindowControl(org.olat.core.gui.control.WindowControl)

Example 75 with AssessableCourseNode

use of org.olat.course.nodes.AssessableCourseNode in project OpenOLAT by OpenOLAT.

the class AssessedBusinessGroupCourseNodeListController method initForm.

@Override
protected void initForm(FormItemContainer formLayout, Controller listener, UserRequest ureq) {
    FlexiTableColumnModel columnsModel = FlexiTableDataModelFactory.createFlexiTableColumnModel();
    columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(false, ABGCols.key, "select"));
    columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(ABGCols.name, "select"));
    if (courseNode instanceof AssessableCourseNode) {
        AssessableCourseNode aNode = (AssessableCourseNode) courseNode;
        if (aNode.hasPassedConfigured()) {
            columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(ABGCols.countPassed, new ProgressRenderer(false, getTranslator())));
        }
        if (aNode.hasScoreConfigured()) {
            columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(ABGCols.averageScore, new ScoreCellRenderer()));
        }
    }
    tableModel = new AssessedBusinessGroupTableModel(columnsModel, getLocale());
    tableEl = uifactory.addTableElement(getWindowControl(), "table", tableModel, 20, false, getTranslator(), formLayout);
    tableEl.setExportEnabled(true);
    FlexiTableSortOptions options = new FlexiTableSortOptions();
    options.setDefaultOrderBy(new SortKey(ABGCols.name.name(), true));
    tableEl.setSortSettings(options);
    tableEl.setAndLoadPersistedPreferences(ureq, "assessment-tool-group-list");
    if (formLayout instanceof FormLayoutContainer) {
        FormLayoutContainer layoutcont = (FormLayoutContainer) formLayout;
        if (courseNode != null) {
            String courseNodeCssClass = CourseNodeFactory.getInstance().getCourseNodeConfigurationEvenForDisabledBB(courseNode.getType()).getIconCSSClass();
            layoutcont.contextPut("courseNodeCssClass", courseNodeCssClass);
            layoutcont.contextPut("courseNodeTitle", courseNode.getShortTitle());
        }
    }
}
Also used : AssessableCourseNode(org.olat.course.nodes.AssessableCourseNode) FlexiTableSortOptions(org.olat.core.gui.components.form.flexible.elements.FlexiTableSortOptions) ScoreCellRenderer(org.olat.modules.assessment.ui.ScoreCellRenderer) FlexiTableColumnModel(org.olat.core.gui.components.form.flexible.impl.elements.table.FlexiTableColumnModel) FormLayoutContainer(org.olat.core.gui.components.form.flexible.impl.FormLayoutContainer) ProgressRenderer(org.olat.modules.coach.ui.ProgressRenderer) SortKey(org.olat.core.commons.persistence.SortKey) DefaultFlexiColumnModel(org.olat.core.gui.components.form.flexible.impl.elements.table.DefaultFlexiColumnModel)

Aggregations

AssessableCourseNode (org.olat.course.nodes.AssessableCourseNode)118 CourseNode (org.olat.course.nodes.CourseNode)48 ICourse (org.olat.course.ICourse)40 Identity (org.olat.core.id.Identity)32 UserCourseEnvironment (org.olat.course.run.userview.UserCourseEnvironment)28 ScoreEvaluation (org.olat.course.run.scoring.ScoreEvaluation)26 IdentityEnvironment (org.olat.core.id.IdentityEnvironment)22 UserCourseEnvironmentImpl (org.olat.course.run.userview.UserCourseEnvironmentImpl)22 Date (java.util.Date)20 IQTESTCourseNode (org.olat.course.nodes.IQTESTCourseNode)18 STCourseNode (org.olat.course.nodes.STCourseNode)18 ArrayList (java.util.ArrayList)16 AssessmentEntry (org.olat.modules.assessment.AssessmentEntry)16 CalculatedAssessableCourseNode (org.olat.course.nodes.CalculatedAssessableCourseNode)14 GTACourseNode (org.olat.course.nodes.GTACourseNode)12 File (java.io.File)10 IOException (java.io.IOException)10 WindowControl (org.olat.core.gui.control.WindowControl)10 MSCourseNode (org.olat.course.nodes.MSCourseNode)10 PersistentAssessableCourseNode (org.olat.course.nodes.PersistentAssessableCourseNode)10