Search in sources :

Example 1 with AssessableCourseNode

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);
}
Also used : ChatLogHelper(org.olat.instantMessaging.manager.ChatLogHelper) TreeVisitor(org.olat.core.util.tree.TreeVisitor) Visitor(org.olat.core.util.tree.Visitor) ZipOutputStream(java.util.zip.ZipOutputStream) FileOutputStream(java.io.FileOutputStream) OutputStream(java.io.OutputStream) IOException(java.io.IOException) TreeVisitor(org.olat.core.util.tree.TreeVisitor) AssessableCourseNode(org.olat.course.nodes.AssessableCourseNode) ZipOutputStream(java.util.zip.ZipOutputStream) FileOutputStream(java.io.FileOutputStream) Identity(org.olat.core.id.Identity) File(java.io.File)

Example 2 with AssessableCourseNode

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);
}
Also used : AssessableCourseNode(org.olat.course.nodes.AssessableCourseNode) ZipOutputStream(java.util.zip.ZipOutputStream) OutputStream(java.io.OutputStream) ZipOutputStream(java.util.zip.ZipOutputStream) FileOutputStream(java.io.FileOutputStream) FileOutputStream(java.io.FileOutputStream) ICourse(org.olat.course.ICourse) IOException(java.io.IOException) Identity(org.olat.core.id.Identity) File(java.io.File)

Example 3 with AssessableCourseNode

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;
}
Also used : AssessableCourseNode(org.olat.course.nodes.AssessableCourseNode) ArrayList(java.util.ArrayList) CourseNode(org.olat.course.nodes.CourseNode) STCourseNode(org.olat.course.nodes.STCourseNode) AssessableCourseNode(org.olat.course.nodes.AssessableCourseNode) ScormCourseNode(org.olat.course.nodes.ScormCourseNode) Structure(org.olat.course.Structure)

Example 4 with AssessableCourseNode

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;
}
Also used : AssessableCourseNode(org.olat.course.nodes.AssessableCourseNode) ICourse(org.olat.course.ICourse) CourseNode(org.olat.course.nodes.CourseNode) TACourseNode(org.olat.course.nodes.TACourseNode) GTACourseNode(org.olat.course.nodes.GTACourseNode) MSCourseNode(org.olat.course.nodes.MSCourseNode) AssessableCourseNode(org.olat.course.nodes.AssessableCourseNode) ProjectBrokerCourseNode(org.olat.course.nodes.ProjectBrokerCourseNode)

Example 5 with AssessableCourseNode

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);
}
Also used : AssessableCourseNode(org.olat.course.nodes.AssessableCourseNode) FlexiTableColumnModel(org.olat.core.gui.components.form.flexible.impl.elements.table.FlexiTableColumnModel) BulkAssessmentSettings(org.olat.course.assessment.model.BulkAssessmentSettings) DefaultFlexiColumnModel(org.olat.core.gui.components.form.flexible.impl.elements.table.DefaultFlexiColumnModel)

Aggregations

AssessableCourseNode (org.olat.course.nodes.AssessableCourseNode)118 CourseNode (org.olat.course.nodes.CourseNode)48 ICourse (org.olat.course.ICourse)40 Identity (org.olat.core.id.Identity)32 UserCourseEnvironment (org.olat.course.run.userview.UserCourseEnvironment)28 ScoreEvaluation (org.olat.course.run.scoring.ScoreEvaluation)26 IdentityEnvironment (org.olat.core.id.IdentityEnvironment)22 UserCourseEnvironmentImpl (org.olat.course.run.userview.UserCourseEnvironmentImpl)22 Date (java.util.Date)20 IQTESTCourseNode (org.olat.course.nodes.IQTESTCourseNode)18 STCourseNode (org.olat.course.nodes.STCourseNode)18 ArrayList (java.util.ArrayList)16 AssessmentEntry (org.olat.modules.assessment.AssessmentEntry)16 CalculatedAssessableCourseNode (org.olat.course.nodes.CalculatedAssessableCourseNode)14 GTACourseNode (org.olat.course.nodes.GTACourseNode)12 File (java.io.File)10 IOException (java.io.IOException)10 WindowControl (org.olat.core.gui.control.WindowControl)10 MSCourseNode (org.olat.course.nodes.MSCourseNode)10 PersistentAssessableCourseNode (org.olat.course.nodes.PersistentAssessableCourseNode)10