Search in sources :

Example 36 with DueDate

use of org.olat.course.nodes.gta.model.DueDate in project OpenOLAT by OpenOLAT.

the class GTAManagerImpl method getSubmissionDueDate.

@Override
public DueDate getSubmissionDueDate(TaskRef assignedTask, IdentityRef assessedIdentity, BusinessGroup assessedGroup, GTACourseNode cNode, RepositoryEntry courseEntry, boolean withIndividualDueDate) {
    DueDate submissionDueDate = null;
    Date dueDate = cNode.getModuleConfiguration().getDateValue(GTACourseNode.GTASK_SUBMIT_DEADLINE);
    boolean relativeDate = cNode.getModuleConfiguration().getBooleanSafe(GTACourseNode.GTASK_RELATIVE_DATES);
    if ((relativeDate || dueDate != null) && withIndividualDueDate && assignedTask != null && assignedTask.getSubmissionDueDate() != null) {
        submissionDueDate = new DueDate(false, assignedTask.getSubmissionDueDate());
    } else if (relativeDate) {
        int numOfDays = cNode.getModuleConfiguration().getIntegerSafe(GTACourseNode.GTASK_SUBMIT_DEADLINE_RELATIVE, -1);
        String relativeTo = cNode.getModuleConfiguration().getStringValue(GTACourseNode.GTASK_SUBMIT_DEADLINE_RELATIVE_TO);
        if (numOfDays >= 0 && StringHelper.containsNonWhitespace(relativeTo)) {
            submissionDueDate = getReferenceDate(numOfDays, relativeTo, assignedTask, assessedIdentity, assessedGroup, courseEntry);
        }
    } else if (dueDate != null) {
        submissionDueDate = new DueDate(false, dueDate);
    }
    return submissionDueDate;
}
Also used : TaskDueDate(org.olat.course.nodes.gta.TaskDueDate) DueDate(org.olat.course.nodes.gta.model.DueDate) Date(java.util.Date) TaskDueDate(org.olat.course.nodes.gta.TaskDueDate) TaskRevisionDate(org.olat.course.nodes.gta.TaskRevisionDate) DueDate(org.olat.course.nodes.gta.model.DueDate)

Example 37 with DueDate

use of org.olat.course.nodes.gta.model.DueDate in project OpenOLAT by OpenOLAT.

the class EditMultipleDueDatesController method initForm.

@Override
protected void initForm(FormItemContainer formLayout, Controller listener, UserRequest ureq) {
    ModuleConfiguration config = gtaNode.getModuleConfiguration();
    assignmentDueDateEl = uifactory.addDateChooser("assignment.duedate", null, formLayout);
    assignmentDueDateEl.setDateChooserTimeEnabled(true);
    DueDate standardAssignmentDueDate = gtaManager.getAssignmentDueDate(null, null, null, gtaNode, courseEntry, false);
    setDueDateExplanation(assignmentDueDateEl, standardAssignmentDueDate);
    assignmentDueDateEl.setVisible(config.getBooleanSafe(GTACourseNode.GTASK_ASSIGNMENT));
    submissionDueDateEl = uifactory.addDateChooser("submission.duedate", null, formLayout);
    submissionDueDateEl.setDateChooserTimeEnabled(true);
    DueDate standardSubmissionDueDate = gtaManager.getSubmissionDueDate(null, null, null, gtaNode, courseEntry, false);
    setDueDateExplanation(submissionDueDateEl, standardSubmissionDueDate);
    boolean submissionDeadline = config.getBooleanSafe(GTACourseNode.GTASK_SUBMIT);
    submissionDueDateEl.setVisible(submissionDeadline);
    if (submissionDeadline) {
        for (Task task : tasks) {
            if (task.getTaskStatus().ordinal() > TaskProcess.submit.ordinal()) {
                StaticTextElement warningReopenEl = uifactory.addStaticTextElement("reopen", translate("warning.reopen"), formLayout);
                warningReopenEl.setElementCssClass("o_gta_reopen_warning");
                warningReopenEl.setLabel(null, null);
                break;
            }
        }
    }
    revisionDueDateEl = uifactory.addDateChooser("revisions.duedate", null, formLayout);
    revisionDueDateEl.setDateChooserTimeEnabled(true);
    revisionDueDateEl.setVisible(config.getBooleanSafe(GTACourseNode.GTASK_REVISION_PERIOD));
    solutionDueDateEl = uifactory.addDateChooser("solution.duedate", null, formLayout);
    solutionDueDateEl.setDateChooserTimeEnabled(true);
    DueDate standardSolutionDueDate = gtaManager.getSolutionDueDate(null, null, null, gtaNode, courseEntry, false);
    setDueDateExplanation(solutionDueDateEl, standardSolutionDueDate);
    solutionDueDateEl.setVisible(config.getBooleanSafe(GTACourseNode.GTASK_SAMPLE_SOLUTION));
    FormLayoutContainer buttonsCont = FormLayoutContainer.createButtonLayout("buttons", getTranslator());
    formLayout.add(buttonsCont);
    uifactory.addFormCancelButton("cancel", buttonsCont, ureq, getWindowControl());
    uifactory.addFormSubmitButton("save", buttonsCont);
}
Also used : Task(org.olat.course.nodes.gta.Task) ModuleConfiguration(org.olat.modules.ModuleConfiguration) FormLayoutContainer(org.olat.core.gui.components.form.flexible.impl.FormLayoutContainer) StaticTextElement(org.olat.core.gui.components.form.flexible.elements.StaticTextElement) DueDate(org.olat.course.nodes.gta.model.DueDate) TaskDueDate(org.olat.course.nodes.gta.TaskDueDate)

Example 38 with DueDate

use of org.olat.course.nodes.gta.model.DueDate in project openolat by klemens.

the class GTAParticipantController method setSubmitController.

private void setSubmitController(UserRequest ureq, Task task) {
    File documentsDir;
    VFSContainer documentsContainer;
    if (GTAType.group.name().equals(config.getStringValue(GTACourseNode.GTASK_TYPE))) {
        documentsDir = gtaManager.getSubmitDirectory(courseEnv, gtaNode, assessedGroup);
        documentsContainer = gtaManager.getSubmitContainer(courseEnv, gtaNode, assessedGroup);
    } else {
        documentsDir = gtaManager.getSubmitDirectory(courseEnv, gtaNode, getIdentity());
        documentsContainer = gtaManager.getSubmitContainer(courseEnv, gtaNode, getIdentity());
    }
    DueDate dueDate = getSubmissionDueDate(task);
    Date deadline = dueDate == null ? null : dueDate.getDueDate();
    int maxDocs = config.getIntegerSafe(GTACourseNode.GTASK_MAX_SUBMITTED_DOCS, -1);
    submitDocCtrl = new SubmitDocumentsController(ureq, getWindowControl(), task, documentsDir, documentsContainer, maxDocs, gtaNode, courseEnv, userCourseEnv.isCourseReadOnly(), deadline, "document");
    listenTo(submitDocCtrl);
    mainVC.put("submitDocs", submitDocCtrl.getInitialComponent());
    submitButton = LinkFactory.createCustomLink("run.submit.button", "submit", "run.submit.button", Link.BUTTON, mainVC, this);
    submitButton.setElementCssClass("o_sel_course_gta_submit_docs");
    submitButton.setCustomEnabledLinkCSS(submitDocCtrl.hasUploadDocuments() ? "btn btn-primary" : "btn btn-default");
    submitButton.setIconLeftCSS("o_icon o_icon_submit");
    submitButton.setVisible(!userCourseEnv.isCourseReadOnly());
}
Also used : VFSContainer(org.olat.core.util.vfs.VFSContainer) DueDate(org.olat.course.nodes.gta.model.DueDate) File(java.io.File) Date(java.util.Date) DueDate(org.olat.course.nodes.gta.model.DueDate)

Example 39 with DueDate

use of org.olat.course.nodes.gta.model.DueDate in project openolat by klemens.

the class GTANotifications method checkSubmitStep.

private Task checkSubmitStep(Identity assessedIdentity, BusinessGroup assessedGroup, Task task) {
    if (task != null && task.getTaskStatus() == TaskProcess.submit) {
        RepositoryEntry re = courseEnv.getCourseGroupManager().getCourseEntry();
        DueDate dueDate = gtaManager.getSubmissionDueDate(task, assessedIdentity, assessedGroup, gtaNode, re, true);
        if (dueDate != null && dueDate.getDueDate() != null && dueDate.getDueDate().before(new Date())) {
            int numOfDocs = getNumberOfSubmittedDocuments(assessedIdentity, assessedGroup);
            task = gtaManager.submitTask(task, gtaNode, numOfDocs, Role.auto);
            doUpdateAttempts(assessedIdentity, assessedGroup);
        }
    }
    return task;
}
Also used : RepositoryEntry(org.olat.repository.RepositoryEntry) DueDate(org.olat.course.nodes.gta.model.DueDate) Date(java.util.Date) TaskRevisionDate(org.olat.course.nodes.gta.TaskRevisionDate) DueDate(org.olat.course.nodes.gta.model.DueDate)

Example 40 with DueDate

use of org.olat.course.nodes.gta.model.DueDate in project openolat by klemens.

the class EditDueDatesController method initForm.

@Override
protected void initForm(FormItemContainer formLayout, Controller listener, UserRequest ureq) {
    ModuleConfiguration config = gtaNode.getModuleConfiguration();
    Date assignmentDueDate = task.getAssignmentDueDate();
    assignmentDueDateEl = uifactory.addDateChooser("assignment.duedate", assignmentDueDate, formLayout);
    assignmentDueDateEl.setDateChooserTimeEnabled(true);
    DueDate standardAssignmentDueDate = gtaManager.getAssignmentDueDate(task, assessedIdentity, assessedGroup, gtaNode, courseEntry, false);
    setDueDateExplanation(assignmentDueDateEl, standardAssignmentDueDate);
    assignmentDueDateEl.setVisible(config.getBooleanSafe(GTACourseNode.GTASK_ASSIGNMENT));
    Date submissionDueDate = task.getSubmissionDueDate();
    submissionDueDateEl = uifactory.addDateChooser("submission.duedate", submissionDueDate, formLayout);
    submissionDueDateEl.setDateChooserTimeEnabled(true);
    DueDate standardSubmissionDueDate = gtaManager.getSubmissionDueDate(task, assessedIdentity, assessedGroup, gtaNode, courseEntry, false);
    setDueDateExplanation(submissionDueDateEl, standardSubmissionDueDate);
    boolean submissionDeadline = config.getBooleanSafe(GTACourseNode.GTASK_SUBMIT);
    submissionDueDateEl.setVisible(submissionDeadline);
    if (submissionDeadline && task.getTaskStatus().ordinal() > TaskProcess.submit.ordinal()) {
        StaticTextElement warningReopenEl = uifactory.addStaticTextElement("reopen", translate("warning.reopen"), formLayout);
        warningReopenEl.setElementCssClass("o_gta_reopen_warning");
        warningReopenEl.setLabel(null, null);
    }
    Date revisionsDueDate = task.getRevisionsDueDate();
    revisionDueDateEl = uifactory.addDateChooser("revisions.duedate", revisionsDueDate, formLayout);
    revisionDueDateEl.setDateChooserTimeEnabled(true);
    revisionDueDateEl.setVisible(config.getBooleanSafe(GTACourseNode.GTASK_REVISION_PERIOD));
    Date solutionDueDate = task.getSolutionDueDate();
    solutionDueDateEl = uifactory.addDateChooser("solution.duedate", solutionDueDate, formLayout);
    solutionDueDateEl.setDateChooserTimeEnabled(true);
    DueDate standardSolutionDueDate = gtaManager.getSolutionDueDate(task, assessedIdentity, assessedGroup, gtaNode, courseEntry, true);
    setDueDateExplanation(solutionDueDateEl, standardSolutionDueDate);
    solutionDueDateEl.setVisible(config.getBooleanSafe(GTACourseNode.GTASK_SAMPLE_SOLUTION));
    FormLayoutContainer buttonsCont = FormLayoutContainer.createButtonLayout("buttons", getTranslator());
    formLayout.add(buttonsCont);
    uifactory.addFormCancelButton("cancel", buttonsCont, ureq, getWindowControl());
    uifactory.addFormSubmitButton("save", buttonsCont);
}
Also used : ModuleConfiguration(org.olat.modules.ModuleConfiguration) FormLayoutContainer(org.olat.core.gui.components.form.flexible.impl.FormLayoutContainer) StaticTextElement(org.olat.core.gui.components.form.flexible.elements.StaticTextElement) DueDate(org.olat.course.nodes.gta.model.DueDate) TaskDueDate(org.olat.course.nodes.gta.TaskDueDate) Date(java.util.Date) DueDate(org.olat.course.nodes.gta.model.DueDate) TaskDueDate(org.olat.course.nodes.gta.TaskDueDate)

Aggregations

DueDate (org.olat.course.nodes.gta.model.DueDate)44 Date (java.util.Date)38 TaskRevisionDate (org.olat.course.nodes.gta.TaskRevisionDate)14 TaskDueDate (org.olat.course.nodes.gta.TaskDueDate)12 RepositoryEntry (org.olat.repository.RepositoryEntry)10 File (java.io.File)6 VFSContainer (org.olat.core.util.vfs.VFSContainer)6 ArrayList (java.util.ArrayList)4 Calendar (java.util.Calendar)4 HashMap (java.util.HashMap)4 StaticTextElement (org.olat.core.gui.components.form.flexible.elements.StaticTextElement)4 FormLayoutContainer (org.olat.core.gui.components.form.flexible.impl.FormLayoutContainer)4 TaskLight (org.olat.course.nodes.gta.TaskLight)4 ModuleConfiguration (org.olat.modules.ModuleConfiguration)4 BigDecimal (java.math.BigDecimal)2 List (java.util.List)2 IdentityRef (org.olat.basesecurity.IdentityRef)2 IdentityRefImpl (org.olat.basesecurity.model.IdentityRefImpl)2 FormLink (org.olat.core.gui.components.form.flexible.elements.FormLink)2 VelocityContainer (org.olat.core.gui.components.velocity.VelocityContainer)2