use of org.olat.course.nodes.AssessableCourseNode in project openolat by klemens.
the class IdentityAssessmentOverviewController method formInnerEvent.
@Override
protected void formInnerEvent(UserRequest ureq, FormItem source, FormEvent event) {
if (tableEl == source) {
if (event instanceof SelectionEvent) {
SelectionEvent se = (SelectionEvent) event;
String cmd = se.getCommand();
AssessmentNodeData nodeData = tableModel.getObject(se.getIndex());
if (CMD_SELECT_NODE.equals(cmd)) {
CourseNode node = runStructure.getNode(nodeData.getIdent());
selectedCourseNode = (AssessableCourseNode) node;
fireEvent(ureq, EVENT_NODE_SELECTED);
}
}
}
super.formInnerEvent(ureq, source, event);
}
use of org.olat.course.nodes.AssessableCourseNode in project openolat by klemens.
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);
}
}
use of org.olat.course.nodes.AssessableCourseNode in project openolat by klemens.
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());
}
use of org.olat.course.nodes.AssessableCourseNode in project openolat by klemens.
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;
}
use of org.olat.course.nodes.AssessableCourseNode in project openolat by klemens.
the class GroupBulkDownloadResource method prepare.
@Override
public void prepare(HttpServletResponse hres) {
try {
hres.setCharacterEncoding(encoding);
} catch (Exception e) {
log.error("", e);
}
String label = StringHelper.transformDisplayNameToFileSystemName(courseNode.getShortName()) + "_" + Formatter.formatDatetimeWithMinutes(new Date()) + ".zip";
String urlEncodedLabel = StringHelper.urlEncodeUTF8(label);
hres.setHeader("Content-Disposition", "attachment; filename*=UTF-8''" + urlEncodedLabel);
hres.setHeader("Content-Description", urlEncodedLabel);
try (ZipOutputStream zout = new ZipOutputStream(hres.getOutputStream())) {
zout.setLevel(9);
ICourse course = CourseFactory.loadCourse(courseOres);
GTAManager gtaManager = CoreSpringFactory.getImpl(GTAManager.class);
if (courseNode.getModuleConfiguration().getBooleanSafe(GTACourseNode.GTASK_GRADING)) {
List<Identity> assessableIdentities = CoreSpringFactory.getImpl(BusinessGroupService.class).getMembers(groups, GroupRoles.participant.name());
String courseTitle = course.getCourseTitle();
String fileName = ExportUtil.createFileNameWithTimeStamp(courseTitle, "xlsx");
List<AssessableCourseNode> nodes = Collections.<AssessableCourseNode>singletonList(courseNode);
try (OutputStream out = new ShieldOutputStream(zout)) {
zout.putNextEntry(new ZipEntry(fileName));
ScoreAccountingHelper.createCourseResultsOverviewXMLTable(assessableIdentities, nodes, course, locale, out);
zout.closeEntry();
} catch (Exception e) {
log.error("", e);
}
}
TaskList taskList = gtaManager.getTaskList(course.getCourseEnvironment().getCourseGroupManager().getCourseEntry(), courseNode);
for (BusinessGroup businessGroup : groups) {
courseNode.archiveNodeData(course, businessGroup, taskList, "", zout);
}
} catch (Exception e) {
log.error("", e);
}
}
Aggregations