use of org.olat.course.nodes.AssessableCourseNode in project OpenOLAT by OpenOLAT.
the class ModifyCourseEvent method archiveCourse.
/**
* visit all nodes in the specified course and make them archiving any data
* into the identity's export directory.
*
* @param res
* @param charset
* @param locale
* @param identity
*/
public static void archiveCourse(Identity archiveOnBehalfOf, ICourse course, String charset, Locale locale, File exportDirectory, boolean isOLATAdmin, boolean... oresRights) {
// archive course results overview
List<Identity> users = ScoreAccountingHelper.loadUsers(course.getCourseEnvironment());
List<AssessableCourseNode> nodes = ScoreAccountingHelper.loadAssessableNodes(course.getCourseEnvironment());
String fileName = ExportUtil.createFileNameWithTimeStamp(course.getCourseTitle(), "zip");
try (OutputStream out = new FileOutputStream(new File(exportDirectory, fileName));
ZipOutputStream zout = new ZipOutputStream(out)) {
ScoreAccountingHelper.createCourseResultsOverview(users, nodes, course, locale, zout);
} catch (IOException e) {
log.error("", e);
}
// archive all nodes content
Visitor archiveV = new NodeArchiveVisitor(locale, course, exportDirectory, charset);
TreeVisitor tv = new TreeVisitor(archiveV, course.getRunStructure().getRootNode(), true);
tv.visitAll();
// archive all course log files
// OLATadmin gets all logfiles independent of the visibility configuration
boolean isOresOwner = (oresRights.length > 0) ? oresRights[0] : false;
boolean isOresInstitutionalManager = (oresRights.length > 1) ? oresRights[1] : false;
boolean aLogV = isOresOwner || isOresInstitutionalManager || isOLATAdmin;
boolean uLogV = isOLATAdmin;
boolean sLogV = isOresOwner || isOresInstitutionalManager || isOLATAdmin;
// make an intermediate commit here to make sure long running course log export doesn't
// cause db connection timeout to be triggered
// @TODO transactions/backgroundjob:
// rework when backgroundjob infrastructure exists
DBFactory.getInstance().intermediateCommit();
AsyncExportManager.getInstance().asyncArchiveCourseLogFiles(archiveOnBehalfOf, new Runnable() {
@Override
public void run() {
// that's fine, I dont need to do anything here
}
}, course.getResourceableId(), exportDirectory.getPath(), null, null, aLogV, uLogV, sLogV, charset, null, null);
course.getCourseEnvironment().getCourseGroupManager().archiveCourseGroups(exportDirectory);
CoreSpringFactory.getImpl(ChatLogHelper.class).archive(course, exportDirectory);
}
use of org.olat.course.nodes.AssessableCourseNode in project OpenOLAT by OpenOLAT.
the class ScoreAccountingArchiveController method doStartExport.
private void doStartExport() {
ICourse course = CourseFactory.loadCourse(ores);
List<Identity> users = ScoreAccountingHelper.loadUsers(course.getCourseEnvironment());
List<AssessableCourseNode> nodes = ScoreAccountingHelper.loadAssessableNodes(course.getCourseEnvironment());
String courseTitle = course.getCourseTitle();
String fileName = ExportUtil.createFileNameWithTimeStamp(courseTitle, "zip");
// location for data export
File exportDirectory = CourseFactory.getOrCreateDataExportDirectory(getIdentity(), courseTitle);
File downloadFile = new File(exportDirectory, fileName);
try (OutputStream fOut = new FileOutputStream(downloadFile);
ZipOutputStream zout = new ZipOutputStream(fOut)) {
ScoreAccountingHelper.createCourseResultsOverview(users, nodes, course, getLocale(), zout);
} catch (IOException e) {
logError("", e);
}
vcFeedback = createVelocityContainer("feedback");
vcFeedback.contextPut("body", translate("course.res.feedback", new String[] { downloadFile.getName() }));
downloadButton = LinkFactory.createButtonSmall("cmd.download", vcFeedback, this);
downloadButton.setUserObject(downloadFile);
myPanel.setContent(vcFeedback);
}
use of org.olat.course.nodes.AssessableCourseNode in project OpenOLAT by OpenOLAT.
the class AssessmentNotificationsHandler method getCourseTestNodes.
/**
* Utility method.<br>
* Build (recursively) the list of all test nodes belonging to the specified
* <code>ICourse</code>.<br>
* The returned <code>List</code> is empty if course has no
* AssessableCourseNode. Structure course node are excluded from the list.<br>
* <br>
* <b>PRE CONDITIONS</b>
* <ul>
* <li> <code>course != null</code>
* </ul>
* <br>
* <b>POST CONDITIONS</b>
* <ul>
* <li> The returned list, if not empty, contains ONLY instances of type
* <code>AssessableCourseNode</code>
* </ul>
*/
private List<AssessableCourseNode> getCourseTestNodes(ICourse course) {
List<AssessableCourseNode> assessableNodes = new ArrayList<AssessableCourseNode>();
Structure courseStruct = course.getRunStructure();
CourseNode rootNode = courseStruct.getRootNode();
getCourseTestNodes(rootNode, assessableNodes);
return assessableNodes;
}
use of org.olat.course.nodes.AssessableCourseNode in project OpenOLAT by OpenOLAT.
the class BulkAssessmentTask method getCourseNode.
private AssessableCourseNode getCourseNode() {
ICourse course = CourseFactory.loadCourse(courseRes);
CourseNode node = course.getRunStructure().getNode(courseNodeIdent);
if (node instanceof AssessableCourseNode) {
return (AssessableCourseNode) node;
}
return null;
}
use of org.olat.course.nodes.AssessableCourseNode in project OpenOLAT by OpenOLAT.
the class ValidationStepForm method initForm.
@Override
protected void initForm(FormItemContainer formLayout, Controller listener, UserRequest ureq) {
AssessableCourseNode courseNode = (AssessableCourseNode) getFromRunContext("courseNode");
BulkAssessmentSettings settings = new BulkAssessmentSettings(courseNode);
FlexiTableColumnModel tableColumnModel = FlexiTableDataModelFactory.createFlexiTableColumnModel();
tableColumnModel.addFlexiColumnModel(new DefaultFlexiColumnModel("table.header.identifier", Cols.identifier.ordinal()));
tableColumnModel.addFlexiColumnModel(new DefaultFlexiColumnModel("table.header.lastName", Cols.lastName.ordinal()));
tableColumnModel.addFlexiColumnModel(new DefaultFlexiColumnModel("table.header.firstName", Cols.firstName.ordinal()));
if (settings.isHasScore()) {
tableColumnModel.addFlexiColumnModel(new DefaultFlexiColumnModel("table.header.score", Cols.score.ordinal(), new ScoreCellRenderer(settings)));
}
if (settings.isHasPassed() && settings.getCut() == null) {
tableColumnModel.addFlexiColumnModel(new DefaultFlexiColumnModel("table.header.passed", Cols.passed.ordinal(), new PassedCellRenderer()));
}
if (settings.isHasUserComment()) {
tableColumnModel.addFlexiColumnModel(new DefaultFlexiColumnModel("table.header.comment", Cols.comment.ordinal()));
}
if (settings.isHasReturnFiles()) {
tableColumnModel.addFlexiColumnModel(new DefaultFlexiColumnModel("table.header.numOfReturnFiles", Cols.numOfReturnFiles.ordinal()));
}
validModel = new ValidDataModel(Collections.<UserData>emptyList());
validModel.setTableColumnModel(tableColumnModel);
validTableEl = uifactory.addTableElement(getWindowControl(), "validList", validModel, getTranslator(), formLayout);
validTableEl.setCustomizeColumns(false);
invalidModel = new ValidDataModel(Collections.<UserData>emptyList());
invalidModel.setTableColumnModel(tableColumnModel);
invalidTableEl = uifactory.addTableElement(getWindowControl(), "notFoundList", invalidModel, getTranslator(), formLayout);
invalidTableEl.setCustomizeColumns(false);
flc.contextPut("settings", settings);
}
Aggregations