Esempio n. 1
0
def namelist_student(search):
    student = Student.get_full_info_by_id(current_user.id)
    page = request.args.get(get_page_parameter(), type=int, default=1)
    per_page = 10
    offset = (page - 1) * per_page
    namelist = models.get_namelist_by_hid(student.house_id, per_page, offset)

    pagination = Pagination(
        page=page,
        total=models.get_namelist_count(student.house_id),
        search=search,
        record_name='namelist',
        per_page=per_page,
        show_single_page=True,
        link='<li><a class="pgn__num" href="{0}">{1}</a></li>')

    pagination.current_page_fmt = '<li><span class="pgn__num current">{0}</span></li>'
    pagination.prev_page_fmt = '<li><a class="pgn__prev" href="{0}">{1}</a></li>'
    pagination.next_page_fmt = '<li><a class="pgn__next" href="{0}">{1}</a></li>'
    pagination.gap_marker_fmt = '<li><span class="pgn__num dots">…</span></li>'
    pagination.link = '<li><a class="pgn__num" href="{0}">{1}</a></li>'
    pagination.link_css_fmt = '<div class="{0}{1}"><ul>'
    pagination.prev_disabled_page_fmt = ''
    pagination.next_disabled_page_fmt = ''

    return render_template('module/namelist_student.html',
                           request_owner_list=namelist,
                           pagination=pagination)
Esempio n. 2
0
def request_page_teacher(search):
    f = request.args.get("filter")
    house = House.get_house_by_housekeeper(current_user.id)
    page = request.args.get(get_page_parameter(), type=int, default=1)
    per_page = 10
    offset = (page - 1) * per_page

    if f is None or 0:
        request_owner_list = models.get_request_owner_list_by_hid_filter(
            house.house_id, 0, per_page, offset)
        total = models.get_request_owner_list_count_by_status(
            house.house_id, 0)
    else:
        request_owner_list = models.get_request_owner_list_by_hid_filter(
            house.house_id, f, per_page, offset)
        total = models.get_request_owner_list_count_by_status(
            house.house_id, f)

    pagination = Pagination(
        page=page,
        total=total,
        search=search,
        record_name='request_owner_list',
        per_page=per_page,
        show_single_page=True,
        link='<li><a class="pgn__num" href="{0}">{1}</a></li>')

    pagination.current_page_fmt = '<li><span class="pgn__num current">{0}</span></li>'
    pagination.prev_page_fmt = '<li><a class="pgn__prev" href="{0}">{1}</a></li>'
    pagination.next_page_fmt = '<li><a class="pgn__next" href="{0}">{1}</a></li>'
    pagination.gap_marker_fmt = '<li><span class="pgn__num dots">…</span></li>'
    pagination.link = '<li><a class="pgn__num" href="{0}">{1}</a></li>'
    pagination.link_css_fmt = '<div class="{0}{1}"><ul>'
    pagination.prev_disabled_page_fmt = ''
    pagination.next_disabled_page_fmt = ''

    return render_template('notification/request_teacher.html',
                           request_owner_list=request_owner_list,
                           pagination=pagination,
                           filter=f)