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;
}
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;
}
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);
}
}
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;
}
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);
}
}
}
Aggregations