Search in sources :

Example 16 with DueDate

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

the class GTACoachController method backToSubmission.

private void backToSubmission(Task assignedTask) {
    if (config.getBooleanSafe(GTACourseNode.GTASK_SUBMIT) && assignedTask != null) {
        Date now = new Date();
        DueDate dueDate = getSubmissionDueDate(assignedTask);
        if (!coachCourseEnv.isCourseReadOnly() && (dueDate == null || dueDate.getDueDate() == null || now.before(dueDate.getDueDate()))) {
            backToSubmissionLink = LinkFactory.createButton("coach.back.to.submission", mainVC, this);
            backToSubmissionLink.setUserObject(assignedTask);
        }
    }
}
Also used : DueDate(org.olat.course.nodes.gta.model.DueDate) Date(java.util.Date) DueDate(org.olat.course.nodes.gta.model.DueDate)

Example 17 with DueDate

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

the class GTACoachController method collect.

private void collect(Task assignedTask) {
    DueDate dueDate = getSubmissionDueDate(assignedTask);
    if (!coachCourseEnv.isCourseReadOnly() && (dueDate == null || dueDate.getDueDate() == null)) {
        collectSubmissionsLink = LinkFactory.createButton("coach.collect.task", mainVC, this);
        collectSubmissionsLink.setUserObject(assignedTask);
    }
}
Also used : DueDate(org.olat.course.nodes.gta.model.DueDate)

Example 18 with DueDate

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

the class GTAAbstractController method stepSubmit.

protected Task stepSubmit(@SuppressWarnings("unused") UserRequest ureq, Task assignedTask) {
    DueDate dueDate = getSubmissionDueDate(assignedTask);
    if (dueDate != null) {
        if (dueDate.getDueDate() != null) {
            Date date = dueDate.getDueDate();
            String dateAsString = formatDueDate(dueDate, true);
            mainVC.contextPut("submitDueDate", dateAsString);
            mainVC.contextRemove("submitDueDateMsg");
            if (assignedTask != null && assignedTask.getTaskStatus() == TaskProcess.submit && date.compareTo(new Date()) < 0) {
                // push to the next step
                int numOfDocs = getNumberOfSubmittedDocuments();
                assignedTask = gtaManager.submitTask(assignedTask, gtaNode, numOfDocs, Role.auto);
                doUpdateAttempts();
            }
        } else if (dueDate.getMessageKey() != null) {
            mainVC.contextPut("submitDueDateMsg", translate(dueDate.getMessageKey(), dueDate.getMessageArg()));
            mainVC.contextRemove("submitDueDate");
        }
    }
    return assignedTask;
}
Also used : DueDate(org.olat.course.nodes.gta.model.DueDate) Date(java.util.Date) DueDate(org.olat.course.nodes.gta.model.DueDate)

Example 19 with DueDate

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

the class GTAAbstractController method stepSolution.

protected Task stepSolution(@SuppressWarnings("unused") UserRequest ureq, Task assignedTask) {
    DueDate availableDate = getSolutionDueDate(assignedTask);
    if (availableDate != null) {
        if (availableDate.getDueDate() != null) {
            String date = formatDueDate(availableDate, false);
            mainVC.contextPut("solutionAvailableDate", date);
            mainVC.contextRemove("solutionAvailableDateMsg");
        } else if (availableDate.getMessageKey() != null) {
            mainVC.contextPut("solutionAvailableDateMsg", translate(availableDate.getMessageKey(), availableDate.getMessageArg()));
            mainVC.contextRemove("solutionAvailableDate");
        }
    }
    return assignedTask;
}
Also used : DueDate(org.olat.course.nodes.gta.model.DueDate)

Example 20 with DueDate

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

the class GTAParticipantController method setSolutions.

private void setSolutions(UserRequest ureq, Task assignedTask) {
    DueDate availableDate = getSolutionDueDate(assignedTask);
    boolean visible = availableDate == null || (availableDate.getDueDate() != null && availableDate.getDueDate().compareTo(new Date()) <= 0);
    if (visible) {
        File documentsDir = gtaManager.getSolutionsDirectory(courseEnv, gtaNode);
        VFSContainer documentsContainer = gtaManager.getSolutionsContainer(courseEnv, gtaNode);
        if ((availableDate != null && !availableDate.isRelative() && gtaNode.getModuleConfiguration().getBooleanSafe(GTACourseNode.GTASK_SAMPLE_SOLUTION_VISIBLE_ALL, false)) || TaskHelper.hasDocuments(documentsDir)) {
            solutionsCtrl = new DirectoryController(ureq, getWindowControl(), documentsDir, documentsContainer, "run.solutions.description", "bulk.solutions", "solutions");
            listenTo(solutionsCtrl);
            mainVC.put("solutions", solutionsCtrl.getInitialComponent());
        }
    } else {
        VelocityContainer waitVC = createVelocityContainer("wait_for_solutions");
        mainVC.put("solutions", waitVC);
    }
}
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) VelocityContainer(org.olat.core.gui.components.velocity.VelocityContainer)

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