use of org.olat.course.nodes.AssessableCourseNode in project openolat by klemens.
the class ChooseColumnsStepForm method initForm.
@Override
protected void initForm(FormItemContainer formLayout, Controller listener, UserRequest ureq) {
setFormTitle("chooseColumns.title");
setFormDescription("chooseColumns.description");
setFormContextHelp("Using Course Tools#bulkassessment_map");
AssessableCourseNode courseNode = (AssessableCourseNode) getFromRunContext("courseNode");
BulkAssessmentSettings settings = new BulkAssessmentSettings(courseNode);
String[] usernameKeys = new String[numOfColumns];
String[] usernameValues = new String[numOfColumns];
String[] otherKeys = new String[numOfColumns + 1];
String[] otherValues = new String[numOfColumns + 1];
for (int i = 0; i < numOfColumns; i++) {
usernameKeys[i] = "col" + i;
usernameValues[i] = translate("column", Integer.toString(i + 1));
otherKeys[i] = "col" + i;
otherValues[i] = translate("column", Integer.toString(i + 1));
}
otherKeys[otherKeys.length - 1] = "col9999";
otherValues[otherValues.length - 1] = translate("column.dontuse");
FormLayoutContainer choosersCont = FormLayoutContainer.createDefaultFormLayout("choosers", getTranslator());
choosersCont.setElementCssClass("o_sel_bulk_assessment_columns");
choosersCont.setRootForm(mainForm);
formLayout.add(choosersCont);
int pos = 0;
userNameColumnEl = uifactory.addDropdownSingleselect("table.header.identifier", choosersCont, usernameKeys, usernameValues, null);
if (columnsSettings != null && columnsSettings.getUsernameColumn() < usernameKeys.length) {
userNameColumnEl.select(getSelectedKey(pos++, columnsSettings.getUsernameColumn(), usernameKeys), true);
} else if (usernameKeys.length > 0) {
userNameColumnEl.select(usernameKeys[Math.min(pos++, usernameKeys.length - 1)], true);
}
if (settings.isHasScore()) {
scoreColumnEl = uifactory.addDropdownSingleselect("table.header.score", choosersCont, otherKeys, otherValues, null);
if (columnsSettings != null && columnsSettings.getScoreColumn() < otherKeys.length) {
scoreColumnEl.select(getSelectedKey(pos++, columnsSettings.getScoreColumn(), otherKeys), true);
} else if (otherKeys.length > 0) {
scoreColumnEl.select(otherKeys[Math.min(pos++, otherKeys.length - 1)], true);
}
}
if (settings.isHasPassed() && settings.getCut() == null) {
passedColumnEl = uifactory.addDropdownSingleselect("table.header.passed", choosersCont, otherKeys, otherValues, null);
if (columnsSettings != null && columnsSettings.getPassedColumn() < otherKeys.length) {
passedColumnEl.select(getSelectedKey(pos++, columnsSettings.getPassedColumn(), otherKeys), true);
} else if (otherKeys.length > 0) {
passedColumnEl.select(otherKeys[Math.min(pos++, otherKeys.length - 1)], true);
}
}
if (settings.isHasUserComment()) {
commentColumnEl = uifactory.addDropdownSingleselect("table.header.comment", choosersCont, otherKeys, otherValues, null);
if (columnsSettings != null && columnsSettings.getCommentColumn() < otherKeys.length) {
commentColumnEl.select(getSelectedKey(pos++, columnsSettings.getCommentColumn(), otherKeys), true);
} else if (otherKeys.length > 0) {
commentColumnEl.select(otherKeys[Math.min(pos++, otherKeys.length - 1)], true);
}
}
FlexiTableColumnModel tableColumnModel = FlexiTableDataModelFactory.createFlexiTableColumnModel();
for (int i = 0; i < numOfColumns; i++) {
DefaultFlexiColumnModel colModel = new DefaultFlexiColumnModel("ccc" + (i + 1), i);
tableColumnModel.addFlexiColumnModel(colModel);
}
overviewDataModel.setTableColumnModel(tableColumnModel);
FlexiTableElement tableEl = uifactory.addTableElement(getWindowControl(), "overviewList", overviewDataModel, getTranslator(), formLayout);
tableEl.setCustomizeColumns(false);
}
use of org.olat.course.nodes.AssessableCourseNode in project openolat by klemens.
the class QTI21ArchiveFormat method writeHeaders_1.
private void writeHeaders_1(OpenXMLWorksheet exportSheet, OpenXMLWorkbook workbook) {
CellStyle headerStyle = workbook.getStyles().getHeaderStyle();
// first header
Row header1Row = exportSheet.newRow();
int col = 1;
if (anonymizerCallback != null) {
// anonymized name -> test duration
col += 0;
} else {
for (UserPropertyHandler userPropertyHandler : userPropertyHandlers) {
if (userPropertyHandler != null) {
col++;
}
}
// homepage -> test duration
col += 1;
}
// course node points and passed
if (courseNode instanceof AssessableCourseNode) {
AssessableCourseNode assessableCourseNode = (AssessableCourseNode) courseNode;
if (assessableCourseNode.hasScoreConfigured()) {
header1Row.addCell(col++, translator.translate("archive.table.header.node"), headerStyle);
}
if (assessableCourseNode.hasPassedConfigured()) {
if (assessableCourseNode.hasScoreConfigured()) {
col++;
} else {
header1Row.addCell(col++, translator.translate("archive.table.header.node"), headerStyle);
}
}
}
// test points, passed and dates
header1Row.addCell(col++, translator.translate("archive.table.header.test"), headerStyle);
col += 5;
List<AbstractInfos> infos = getItemInfos();
for (int i = 0; i < infos.size(); i++) {
int delta = col;
AbstractInfos info = infos.get(i);
if (info instanceof ItemInfos) {
ItemInfos item = (ItemInfos) info;
if (exportConfig.isResponseCols() || exportConfig.isPointCol() || exportConfig.isTimeCols() || exportConfig.isCommentCol()) {
List<Interaction> interactions = item.getInteractions();
for (int j = 0; j < interactions.size(); j++) {
Interaction interaction = interactions.get(j);
col = interactionArchiveMap.get(interaction.getQtiClassName()).writeHeader1(item.getAssessmentItem(), interaction, i, j, header1Row, col, workbook);
}
}
if (!exportConfig.isResponseCols()) {
col -= col - delta;
}
if (exportConfig.isPointCol()) {
col++;
}
if (exportConfig.isCommentCol()) {
col++;
}
if (exportConfig.isTimeCols()) {
col += anonymizerCallback != null ? 1 : 2;
}
} else if (numOfSections > 1 && info instanceof SectionInfos) {
SectionInfos section = (SectionInfos) info;
if (!section.getItemInfos().isEmpty()) {
String sectionTitle = translator.translate("archive.table.header.section", new String[] { section.getAssessmentSection().getTitle() });
header1Row.addCell(col++, sectionTitle, headerStyle);
}
}
}
}
use of org.olat.course.nodes.AssessableCourseNode in project openolat by klemens.
the class QTI21ArchiveFormat method writeHeaders_2.
private void writeHeaders_2(OpenXMLWorksheet exportSheet, OpenXMLWorkbook workbook) {
CellStyle headerStyle = workbook.getStyles().getHeaderStyle();
// second header
// reset column counter
int col = 0;
Row header2Row = exportSheet.newRow();
String sequentialNumber = translator.translate("column.header.seqnum");
header2Row.addCell(col++, sequentialNumber, headerStyle);
if (anonymizerCallback != null) {
col++;
} else {
for (UserPropertyHandler userPropertyHandler : userPropertyHandlers) {
if (userPropertyHandler == null) {
continue;
}
String header = translator.translate(userPropertyHandler.i18nFormElementLabelKey());
header2Row.addCell(col++, header, headerStyle);
}
// add other user and session information
header2Row.addCell(col++, translator.translate("column.header.homepage"), headerStyle);
}
// course node points and passed
if (courseNode instanceof AssessableCourseNode) {
AssessableCourseNode assessableCourseNode = (AssessableCourseNode) courseNode;
if (assessableCourseNode.hasScoreConfigured()) {
header2Row.addCell(col++, translator.translate("archive.table.header.node.points"), headerStyle);
}
if (assessableCourseNode.hasPassedConfigured()) {
header2Row.addCell(col++, translator.translate("archive.table.header.node.passed"), headerStyle);
}
}
header2Row.addCell(col++, translator.translate("archive.table.header.points"), headerStyle);
header2Row.addCell(col++, translator.translate("archive.table.header.manual.points"), headerStyle);
header2Row.addCell(col++, translator.translate("archive.table.header.final.points"), headerStyle);
header2Row.addCell(col++, translator.translate("column.header.passed"), headerStyle);
if (anonymizerCallback == null) {
header2Row.addCell(col++, translator.translate("column.header.date"), headerStyle);
}
header2Row.addCell(col++, translator.translate("column.header.duration"), headerStyle);
List<AbstractInfos> infos = getItemInfos();
for (int i = 0; i < infos.size(); i++) {
AbstractInfos info = infos.get(i);
if (info instanceof ItemInfos) {
ItemInfos item = (ItemInfos) info;
if (exportConfig.isResponseCols()) {
List<Interaction> interactions = item.getInteractions();
for (int j = 0; j < interactions.size(); j++) {
Interaction interaction = interactions.get(j);
col = interactionArchiveMap.get(interaction.getQtiClassName()).writeHeader2(item.getAssessmentItem(), interaction, i, j, header2Row, col, workbook);
}
}
if (exportConfig.isPointCol()) {
header2Row.addCell(col++, translator.translate("item.score"), headerStyle);
}
if (exportConfig.isCommentCol()) {
header2Row.addCell(col++, translator.translate("item.comment"), headerStyle);
}
if (exportConfig.isTimeCols()) {
if (anonymizerCallback == null) {
header2Row.addCell(col++, translator.translate("item.start"), headerStyle);
}
header2Row.addCell(col++, translator.translate("item.duration"), headerStyle);
}
} else if (numOfSections > 1 && info instanceof SectionInfos) {
SectionInfos section = (SectionInfos) info;
if (!section.getItemInfos().isEmpty()) {
header2Row.addCell(col++, translator.translate("archive.table.header.points"), headerStyle);
}
}
}
}
use of org.olat.course.nodes.AssessableCourseNode in project openolat by klemens.
the class ScoreAccounting method evaluateAll.
public boolean evaluateAll(boolean update) {
Identity identity = userCourseEnvironment.getIdentityEnvironment().getIdentity();
List<AssessmentEntry> entries = userCourseEnvironment.getCourseEnvironment().getAssessmentManager().getAssessmentEntries(identity);
AssessableTreeVisitor visitor = new AssessableTreeVisitor(entries, update);
// collect all assessable nodes and eval 'em
CourseNode root = userCourseEnvironment.getCourseEnvironment().getRunStructure().getRootNode();
// breadth first traversal gives an easier order of evaluation for debugging
// however, for live it is absolutely mandatory to use depth first since using breadth first
// the score accoutings local cache hash map will never be used. this can slow down things like
// crazy (course with 10 tests, 300 users and some crazy score and passed calculations will have
// 10 time performance differences)
cachedScoreEvals.clear();
for (AssessmentEntry entry : entries) {
String nodeIdent = entry.getSubIdent();
CourseNode courseNode = userCourseEnvironment.getCourseEnvironment().getRunStructure().getNode(nodeIdent);
if (courseNode instanceof AssessableCourseNode) {
AssessableCourseNode acn = (AssessableCourseNode) courseNode;
AssessmentEvaluation se = AssessmentEvaluation.toAssessmentEvalutation(entry, acn);
cachedScoreEvals.put(acn, se);
}
}
// true=depth first
TreeVisitor tv = new TreeVisitor(visitor, root, true);
tv.visitAll();
return visitor.hasChanges();
}
use of org.olat.course.nodes.AssessableCourseNode in project openolat by klemens.
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;
}
Aggregations