Beispiel #1
0
def viewProfile():
    id = session['userId']
    model = CourseModel()

    userData = model.getUserData(userId=id)
    courses = model.getUserCourses(userId=id)

    return render_template("profile.html", userData=userData[0], courses=courses)
Beispiel #2
0
def courses():
    if "email" in session:
        model = CourseModel()
        result = model.getNewestCourse()
        types = model.getCourseTypes()
        return render_template("courses.html", types=types, newUrl=result["url"], newTitle=result['title'], searchResults={})

    return redirect(url_for('login'))
Beispiel #3
0
def openCourse():
    id = request.args.get("id")
    title = request.args.get("title")
    model = CourseModel()
    result = model.getCourse(courseId=id)
    descr = model.getDescription(courseId=id)

    return render_template('/loadCourse.html', courseData=result, id=id, title=title, description=descr[0])
Beispiel #4
0
def createCourse():
    course_id = int(request.args.get('courseId'))
    count = int(request.args.get('count'))

    model = CourseModel()
    model.createCourse(courseId=course_id, count=count)

    return redirect(url_for("courses"))
Beispiel #5
0
def createCourse():
    course_id = int(request.args.get('courseId'))
    count = int(request.args.get('count'))

    model = CourseModel()
    model.createCourse(courseId=course_id, count=count)

    return redirect(url_for("courses"))
Beispiel #6
0
def viewProfile():
    id = session['userId']
    model = CourseModel()

    userData = model.getUserData(userId=id)
    courses = model.getUserCourses(userId=id)

    return render_template("profile.html",
                           userData=userData[0],
                           courses=courses)
Beispiel #7
0
def courses():
    if "email" in session:
        model = CourseModel()
        result = model.getNewestCourse()
        types = model.getCourseTypes()
        return render_template("courses.html",
                               types=types,
                               newUrl=result["url"],
                               newTitle=result['title'],
                               searchResults={})

    return redirect(url_for('login'))
Beispiel #8
0
def openCourse():
    id = request.args.get("id")
    title = request.args.get("title")
    model = CourseModel()
    result = model.getCourse(courseId=id)
    descr = model.getDescription(courseId=id)

    return render_template('/loadCourse.html',
                           courseData=result,
                           id=id,
                           title=title,
                           description=descr[0])
Beispiel #9
0
def startCreateCourses():
    model = CourseModel()

    if request.form.get('searchType', False):
        courseType = request.form['searchType']
        results = model.searchCourses(courseType=courseType)

        result = model.getNewestCourse()
        types = model.getCourseTypes()
        return render_template("courses.html", types=types, newUrl=result["url"], newTitle=result['title'], searchResults=results)
    else:
        name = request.form['name']
        count = request.form['questions']
        courseType = request.form['type']

        id = model.addCourse(userId=session['userId'], title=name, type=courseType)

        if name and count and courseType:
            return redirect(url_for("openCreateCourseForm", name=name, count=count, id=id))
Beispiel #10
0
def startCreateCourses():
    model = CourseModel()

    if request.form.get('searchType', False):
        courseType = request.form['searchType']
        results = model.searchCourses(courseType=courseType)

        result = model.getNewestCourse()
        types = model.getCourseTypes()
        return render_template("courses.html",
                               types=types,
                               newUrl=result["url"],
                               newTitle=result['title'],
                               searchResults=results)
    else:
        name = request.form['name']
        count = request.form['questions']
        courseType = request.form['type']

        id = model.addCourse(userId=session['userId'],
                             title=name,
                             type=courseType)

        if name and count and courseType:
            return redirect(
                url_for("openCreateCourseForm", name=name, count=count, id=id))
Beispiel #11
0
def finishCourse():
    model = CourseModel()
    courseId = request.args.get('id')
    model.finishCourse(session['userId'], courseId)

    return redirect(url_for('courses'))
Beispiel #12
0
def finishCourse():
    model = CourseModel()
    courseId = request.args.get('id')
    model.finishCourse(session['userId'], courseId)

    return redirect(url_for('courses'))