Search in sources :

Example 16 with AssessableCourseNode

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

the class AssessmentCourseTreeController method doSelectCourseNodeBusinessGroupsView.

private Controller doSelectCourseNodeBusinessGroupsView(UserRequest ureq, CourseNode courseNode) {
    OLATResourceable oresGroups = OresHelper.createOLATResourceableInstance("BusinessGroups", 0l);
    WindowControl bwControl = BusinessControlFactory.getInstance().createBusinessWindowControl(oresGroups, null, getWindowControl());
    OLATResourceable oresNode = OresHelper.createOLATResourceableInstance("Node", new Long(courseNode.getIdent()));
    WindowControl bbwControl = BusinessControlFactory.getInstance().createBusinessWindowControl(oresNode, null, bwControl);
    if (courseNode instanceof AssessableCourseNode && ((AssessableCourseNode) courseNode).isAssessedBusinessGroups()) {
        if (courseNode instanceof GTACourseNode) {
            CourseEnvironment courseEnv = CourseFactory.loadCourse(courseEntry).getCourseEnvironment();
            List<BusinessGroup> coachedGroups;
            if (assessmentCallback.isAdmin()) {
                coachedGroups = courseEnv.getCourseGroupManager().getAllBusinessGroups();
            } else {
                coachedGroups = assessmentCallback.getCoachedGroups();
            }
            businessGroupListCtrl = ((GTACourseNode) courseNode).getCoachedGroupListController(ureq, bbwControl, stackPanel, coachCourseEnv, assessmentCallback.isAdmin(), coachedGroups);
        }
    } else {
        businessGroupListCtrl = new AssessedBusinessGroupCourseNodeListController(ureq, bbwControl, stackPanel, courseEntry, courseNode, coachCourseEnv, toolContainer, assessmentCallback);
    }
    return businessGroupListCtrl;
}
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 17 with AssessableCourseNode

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

the class AssessmentCourseTreeController method doSelectCourseNodeUsersView.

private Controller doSelectCourseNodeUsersView(UserRequest ureq, CourseNode courseNode) {
    OLATResourceable oresUsers = OresHelper.createOLATResourceableInstance("Users", 0l);
    WindowControl bwControl = BusinessControlFactory.getInstance().createBusinessWindowControl(oresUsers, null, getWindowControl());
    OLATResourceable oresNode = OresHelper.createOLATResourceableInstance("Node", new Long(courseNode.getIdent()));
    WindowControl bbwControl = BusinessControlFactory.getInstance().createBusinessWindowControl(oresNode, null, bwControl);
    if (courseNode instanceof AssessableCourseNode) {
        identityListCtrl = ((AssessableCourseNode) courseNode).getIdentityListController(ureq, getWindowControl(), stackPanel, courseEntry, null, coachCourseEnv, toolContainer, assessmentCallback);
    } else {
        identityListCtrl = new IdentityListCourseNodeController(ureq, bbwControl, stackPanel, courseEntry, null, courseNode, coachCourseEnv, toolContainer, assessmentCallback);
    }
    return identityListCtrl;
}
Also used : AssessableCourseNode(org.olat.course.nodes.AssessableCourseNode) OLATResourceable(org.olat.core.id.OLATResourceable) WindowControl(org.olat.core.gui.control.WindowControl)

Example 18 with AssessableCourseNode

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

the class InitialAttemptsRuleEditor method searchAttemptableNodes.

private void searchAttemptableNodes(CourseNode courseNode, List<CourseNode> nodes) {
    if (courseNode instanceof AssessableCourseNode) {
        AssessableCourseNode assessableCourseNode = (AssessableCourseNode) courseNode;
        if (assessableCourseNode.hasAttemptsConfigured()) {
            nodes.add(courseNode);
        }
    }
    for (int i = 0; i < courseNode.getChildCount(); i++) {
        CourseNode child = (CourseNode) courseNode.getChildAt(i);
        searchAttemptableNodes(child, nodes);
    }
}
Also used : AssessableCourseNode(org.olat.course.nodes.AssessableCourseNode) AssessableCourseNode(org.olat.course.nodes.AssessableCourseNode) CourseNode(org.olat.course.nodes.CourseNode)

Example 19 with AssessableCourseNode

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

the class ScoreAccounting method getScoreEvaluation.

/**
 * Get the score evaluation for a given course node without using the cache.
 * @param courseNode
 * @return The score evaluation
 */
public AssessmentEvaluation getScoreEvaluation(CourseNode courseNode) {
    AssessmentEvaluation se = null;
    if (courseNode instanceof AssessableCourseNode) {
        AssessableCourseNode acn = (AssessableCourseNode) courseNode;
        se = acn.getUserScoreEvaluation(userCourseEnvironment);
    }
    return se;
}
Also used : AssessableCourseNode(org.olat.course.nodes.AssessableCourseNode) PersistentAssessableCourseNode(org.olat.course.nodes.PersistentAssessableCourseNode) CalculatedAssessableCourseNode(org.olat.course.nodes.CalculatedAssessableCourseNode)

Example 20 with AssessableCourseNode

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

the class ReturnboxFullAccessCallback method event.

/**
 * @see org.olat.core.gui.control.DefaultController#event(org.olat.core.gui.UserRequest, org.olat.core.gui.control.Controller, org.olat.core.gui.control.Event)
 */
@Override
public void event(UserRequest ureq, Controller source, Event event) {
    if (source == dropboxFolderRunController) {
        if (event instanceof FolderEvent) {
            FolderEvent folderEvent = (FolderEvent) event;
            if (folderEvent.getCommand().equals(FolderEvent.DELETE_EVENT)) {
                UserNodeAuditManager am = userCourseEnv.getCourseEnvironment().getAuditManager();
                // log entry for this file
                Identity coach = ureq.getIdentity();
                Identity student = userCourseEnv.getIdentityEnvironment().getIdentity();
                am.appendToUserNodeLog(node, coach, student, "FILE DELETED: " + folderEvent.getFilename());
            }
        }
    } else if (source == returnboxFolderRunController) {
        if (event instanceof FolderEvent) {
            FolderEvent folderEvent = (FolderEvent) event;
            if (folderEvent.getCommand().equals(FolderEvent.UPLOAD_EVENT) || folderEvent.getCommand().equals(FolderEvent.NEW_FILE_EVENT)) {
                UserNodeAuditManager am = userCourseEnv.getCourseEnvironment().getAuditManager();
                // log entry for this file
                Identity coach = ureq.getIdentity();
                Identity student = userCourseEnv.getIdentityEnvironment().getIdentity();
                if (node instanceof AssessableCourseNode) {
                    AssessableCourseNode acn = (AssessableCourseNode) node;
                    AssessmentEvaluation eval = acn.getUserScoreEvaluation(userCourseEnv);
                    if (eval.getAssessmentStatus() == null || eval.getAssessmentStatus() == AssessmentEntryStatus.notStarted) {
                        eval = new AssessmentEvaluation(eval, AssessmentEntryStatus.inProgress);
                        acn.updateUserScoreEvaluation(eval, userCourseEnv, coach, false, Role.coach);
                    }
                }
                am.appendToUserNodeLog(node, coach, student, "FILE UPLOADED: " + folderEvent.getFilename());
                String toMail = UserManager.getInstance().getUserDisplayEmail(student, ureq.getLocale());
                OLATResourceable ores = OresHelper.createOLATResourceableInstance(CourseNode.class, Long.valueOf(node.getIdent()));
                ContextEntry ce = BusinessControlFactory.getInstance().createContextEntry(ores);
                BusinessControl bc = BusinessControlFactory.getInstance().createBusinessControl(ce, getWindowControl().getBusinessControl());
                String link = BusinessControlFactory.getInstance().getAsURIString(bc, true);
                log.debug("DEBUG : Returnbox notification email with link=" + link);
                String subject = translate("returnbox.email.subject");
                String body = translate("returnbox.email.body", new String[] { userCourseEnv.getCourseEnvironment().getCourseTitle(), node.getShortTitle(), folderEvent.getFilename(), link });
                MailContext context = new MailContextImpl(getWindowControl().getBusinessControl().getAsString());
                MailBundle bundle = new MailBundle();
                bundle.setContext(context);
                bundle.setToId(student);
                bundle.setContent(subject, body);
                MailerResult result = CoreSpringFactory.getImpl(MailManager.class).sendMessage(bundle);
                if (result.getReturnCode() > 0) {
                    am.appendToUserNodeLog(node, coach, student, "MAIL SEND FAILED TO:" + toMail + "; MailReturnCode: " + result.getReturnCode());
                    log.warn("Could not send email 'returnbox notification' to " + student + "with email=" + toMail);
                } else {
                    log.info("Send email 'returnbox notification' to " + student + "with email=" + toMail);
                }
            }
        } else if (FolderCommand.FOLDERCOMMAND_FINISHED == event) {
            if (node instanceof AssessableCourseNode) {
                AssessableCourseNode acn = (AssessableCourseNode) node;
                AssessmentEvaluation eval = acn.getUserScoreEvaluation(userCourseEnv);
                if (eval == null) {
                    eval = AssessmentEvaluation.EMPTY_EVAL;
                }
                if (eval.getAssessmentStatus() == null || eval.getAssessmentStatus() == AssessmentEntryStatus.notStarted) {
                    eval = new AssessmentEvaluation(eval, AssessmentEntryStatus.inProgress);
                    acn.updateUserScoreEvaluation(eval, userCourseEnv, getIdentity(), false, Role.coach);
                    fireEvent(ureq, Event.CHANGED_EVENT);
                }
            }
        }
    } else if (source == statusForm) {
        if (event == Event.DONE_EVENT) {
            // get identity not from request (this would be an author)
            StatusManager.getInstance().saveStatusFormData(statusForm, node, userCourseEnv);
        }
    } else if (source == dialogBoxController) {
        if (DialogBoxUIFactory.isYesEvent(event) && assignedTask != null) {
            // cancel task assignment, and show "no task assigned to user"
            removeAssignedTask(userCourseEnv, userCourseEnv.getIdentityEnvironment().getIdentity());
            // update UI
            myContent.contextPut("assignedtask", null);
        }
    }
}
Also used : MailContextImpl(org.olat.core.util.mail.MailContextImpl) AssessmentEvaluation(org.olat.course.run.scoring.AssessmentEvaluation) OLATResourceable(org.olat.core.id.OLATResourceable) MailContext(org.olat.core.util.mail.MailContext) MailerResult(org.olat.core.util.mail.MailerResult) BusinessControl(org.olat.core.id.context.BusinessControl) ContextEntry(org.olat.core.id.context.ContextEntry) UserNodeAuditManager(org.olat.course.auditing.UserNodeAuditManager) AssessableCourseNode(org.olat.course.nodes.AssessableCourseNode) FolderEvent(org.olat.core.commons.modules.bc.FolderEvent) CourseNode(org.olat.course.nodes.CourseNode) TACourseNode(org.olat.course.nodes.TACourseNode) AssessableCourseNode(org.olat.course.nodes.AssessableCourseNode) Identity(org.olat.core.id.Identity) MailBundle(org.olat.core.util.mail.MailBundle)

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