Search in sources :

Example 16 with ProjectEvent

use of org.olat.course.nodes.projectbroker.datamodel.ProjectEvent in project openolat by klemens.

the class ProjectBrokerManagerImpl method isEnrollmentDateOk.

private boolean isEnrollmentDateOk(Project project, ProjectBrokerModuleConfiguration moduleConfig) {
    if (moduleConfig.isProjectEventEnabled(EventType.ENROLLMENT_EVENT)) {
        ProjectEvent enrollmentEvent = project.getProjectEvent(EventType.ENROLLMENT_EVENT);
        Date now = new Date();
        if (enrollmentEvent.getStartDate() != null) {
            if (now.before(enrollmentEvent.getStartDate())) {
                return false;
            }
        }
        if (enrollmentEvent.getEndDate() != null) {
            if (now.after(enrollmentEvent.getEndDate())) {
                return false;
            }
        }
        if ((enrollmentEvent.getStartDate() == null) && (enrollmentEvent.getEndDate() == null)) {
            // no enrollment date define => access ok
            return true;
        }
    }
    return true;
}
Also used : Date(java.util.Date) ProjectEvent(org.olat.course.nodes.projectbroker.datamodel.ProjectEvent)

Aggregations

ProjectEvent (org.olat.course.nodes.projectbroker.datamodel.ProjectEvent)16 Date (java.util.Date)10 Project (org.olat.course.nodes.projectbroker.datamodel.Project)8 RichTextElement (org.olat.core.gui.components.form.flexible.elements.RichTextElement)4 SingleSelection (org.olat.core.gui.components.form.flexible.elements.SingleSelection)4 StaticTextElement (org.olat.core.gui.components.form.flexible.elements.StaticTextElement)4 TextElement (org.olat.core.gui.components.form.flexible.elements.TextElement)4 Identity (org.olat.core.id.Identity)4 File (java.io.File)2 ArrayList (java.util.ArrayList)2 Calendar (java.util.Calendar)2 StringTokenizer (java.util.StringTokenizer)2 Test (org.junit.Test)2 FormItem (org.olat.core.gui.components.form.flexible.FormItem)2 DateChooser (org.olat.core.gui.components.form.flexible.elements.DateChooser)2 FormLayoutContainer (org.olat.core.gui.components.form.flexible.impl.FormLayoutContainer)2 Translator (org.olat.core.gui.translator.Translator)2 AssertException (org.olat.core.logging.AssertException)2 CustomField (org.olat.course.nodes.projectbroker.datamodel.CustomField)2 ProjectBroker (org.olat.course.nodes.projectbroker.datamodel.ProjectBroker)2