use of org.olat.course.nodes.AssessableCourseNode in project openolat by klemens.
the class IdentityCertificatesController method doGenerateCertificate.
private void doGenerateCertificate(UserRequest ureq) {
ICourse course = CourseFactory.loadCourse(courseEntry);
CourseNode rootNode = course.getRunStructure().getRootNode();
Roles roles = securityManager.getRoles(assessedIdentity);
IdentityEnvironment identityEnv = new IdentityEnvironment(assessedIdentity, roles);
UserCourseEnvironment assessedUserCourseEnv = new UserCourseEnvironmentImpl(identityEnv, course.getCourseEnvironment());
ScoreAccounting scoreAccounting = assessedUserCourseEnv.getScoreAccounting();
scoreAccounting.evaluateAll();
ScoreEvaluation scoreEval = scoreAccounting.evalCourseNode((AssessableCourseNode) rootNode);
CertificateTemplate template = null;
Long templateKey = course.getCourseConfig().getCertificateTemplate();
if (templateKey != null) {
template = certificatesManager.getTemplateById(templateKey);
}
Float score = scoreEval == null ? null : scoreEval.getScore();
Boolean passed = scoreEval == null ? null : scoreEval.getPassed();
CertificateInfos certificateInfos = new CertificateInfos(assessedIdentity, score, passed);
certificatesManager.generateCertificate(certificateInfos, courseEntry, template, true);
loadList();
showInfo("msg.certificate.pending");
fireEvent(ureq, Event.CHANGED_EVENT);
}
use of org.olat.course.nodes.AssessableCourseNode in project openolat by klemens.
the class IdentityListCourseNodeController method doSetVisibility.
private void doSetVisibility(UserRequest ureq, Boolean visibility, List<AssessedIdentityElementRow> rows) {
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(), scoreEval.getAssessmentStatus(), visibility, scoreEval.getFullyAssessed(), scoreEval.getCurrentRunCompletion(), scoreEval.getCurrentRunStatus(), scoreEval.getAssessmentID());
assessableCourseNode.updateUserScoreEvaluation(doneEval, assessedUserCourseEnv, getIdentity(), false, Role.coach);
}
loadModel(ureq);
}
use of org.olat.course.nodes.AssessableCourseNode in project openolat by klemens.
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;
}
use of org.olat.course.nodes.AssessableCourseNode in project openolat by klemens.
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());
}
}
}
use of org.olat.course.nodes.AssessableCourseNode in project openolat by klemens.
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;
}
Aggregations