Ejemplo n.º 1
0
def register(event_type, event_id):
    if request.method == 'GET':
        try:
            event = system.get_event(event_type, event_id)
            updated_event = system.update_attendees('register', event,
                                                    event_type,
                                                    current_user.email)

            if event_type == 'Course':
                return redirect(
                    url_for('display_event',
                            event_type=event_type,
                            event_id=event_id,
                            event_name=updated_event.name))
            else:
                #get the correspoding seminar of each session
                seminar_id = event.SeminarID
                Seminar = system.get_event("Seminar", seminar_id)
                return redirect(
                    url_for('display_event',
                            event_type="Seminar",
                            event_id=seminar_id,
                            event_name=Seminar.name))
        except Exception:
            return render_template("dashboard.html", system=system)
    return render_template("home.html", system=system)
Ejemplo n.º 2
0
def AfterRegisterSess(eventNum, SessNum):
    details = system.get_event(eventNum)
    details.registerFlag = 0
    foo = details.get_sess(SessNum)
    User = system.get_user(current_user.name)    
    print("eventNum: {}".format( details.eventNum))
    print("SessNum: {}".format( details.SessNum))
    return render_template('AfterReg.html', detail = details, foo = foo)
Ejemplo n.º 3
0
def deregisterSession(eventNum, SessNum):
    
    details = system.get_event(eventNum)
    foo = details.get_sess(SessNum)

    User = system.get_user(current_user.name)
    if User != None:
        User.remove_attend(foo)
    return render_template('home.html')
Ejemplo n.º 4
0
def RegistrationSuccessSession(eventNum, SessNum):
    
    details = system.get_event(eventNum)
    foo = details.get_sess(SessNum)

    User = system.get_user(current_user.name)
    if User:
        User.add_attend(foo)
    return render_template('RegistrationSuccess.html')
Ejemplo n.º 5
0
def ShowSeminar(eventNum):
    details = system.get_event(eventNum)
    convenor = False
    print(current_user.name)
    print(details.presenter)
    if current_user.name == details.presenter:
        convenor = True
    if request.method == 'POST':
        sessionTitle = request.form['title']
        presenter = request.form['presenter']
        startTime = request.form['startTime']
        endTime = request.form['endTime']
        date = request.form['date']
        description = request.form['description']
        details.addSession(sessionTitle, presenter, date, startTime, endTime, description)

    print("SessNum: {}".format( details.SessNum))
   
    return render_template('ShowSeminar.html', detail = details, convenor = convenor)
Ejemplo n.º 6
0
def ShowCourse(eventNum):
    details = system.get_event(eventNum)
    newUser = system.get_user(current_user.name)
    isStaff = 0
    if isinstance(newUser, Staff):
        myEvent = newUser.myEvent()
        for eve in myEvent:
            if int(eve.eventNum) == int(details.eventNum):
                isStaff = 1 

    else:
        myAttend = newUser.get_attend()
        for att in myAttend:
            if int(att.eventNum) == int(eventNum):
                isStaff = 1
    isStaff = 0
    if isStaff == 1:
        return render_template('404.html')
    else:
        return render_template('ShowCourse.html', detail = details)
Ejemplo n.º 7
0
def display_event(event_type, event_id, event_name):
    if request.method == 'GET':
        event = system.get_event(event_type, event_id)
        sessionList = []
        attendees_list = []
        registered_sessions = []
        fee = 0
        if event_type == 'Seminar':
            sessionList = system.sessionList(event_id)
            attendees_list = system.get_attendees(event_type, event_id)
            if current_user.is_authenticated:
                registered_sessions = system.sessionID(current_user.email)
        else:
            attendees_list = system.get_attendees(event_type, event_id)
        ableToCancel = 0
        ableToRegister = 0
        ableToDeregister = 0
        earlyBird = 0
        if datetime.now().strftime("%Y-%m-%dT%H:%M") < event.start_date:
            ableToCancel = 1
            ableToRegister = 1
        if datetime.now().strftime("%Y-%m-%dT%H:%M") < event.deregister:
            ableToDeregister = 1

        #has early bird discount or not
        if current_user.is_authenticated:
            fee = system.registration_rules(current_user, event)
        return render_template("info.html",
                               event_type=event_type,
                               event=event,
                               sessions=sessionList,
                               attendees_list=attendees_list,
                               ableToCancel=ableToCancel,
                               ableToRegister=ableToRegister,
                               ableToDeregister=ableToDeregister,
                               fee=fee,
                               registered_sessions=registered_sessions)
Ejemplo n.º 8
0
def update_status(event_type, event_id, status):
    if request.method == 'GET':
        system.update_status(event_type, event_id, status)
        event = system.get_event(event_type, event_id)
        return redirect(url_for("display_event", event_type=event_type, \
        event_id=event_id, event_name=event.name))
Ejemplo n.º 9
0
def RegistrationSuccess(eventNum):
    details = system.get_event(eventNum)
    User = system.get_user(current_user.name)
    if User:
        User.add_attend(details)
    return render_template('RegistrationSuccess.html')
Ejemplo n.º 10
0
def deregisterEvent(eventNum):
    details = system.get_event(eventNum)
    User = system.get_user(current_user.name)
    if User:
        User.remove_attend(details)
    return render_template('home.html')
Ejemplo n.º 11
0
def AfterRegister(eventNum):
    details = system.get_event(eventNum)
    User = system.get_user(current_user.name)
    #if User:
    #    User.remove_attend(details)
    return render_template('AfterReg.html', detail = details)