예제 #1
0
def employerChangeDescription(iid):
    if escape(session['type']) == 'employer':
        cid = adb.get_cid(escape(session['uname']))

        if adb.check_ci_ids(cid, iid):
            if request.method == 'GET':
                if os.path.isfile(os.path.join(app.config['UPLOAD_FOLDER'],
                                                  "desc{}.txt".format(iid))):
                    txtfile = open(os.path.join(app.config['UPLOAD_FOLDER'],
                                              "desc{}.txt".format(iid)))

                    return render_template('employereditdescription.html',
                                           txt=txtfile.read())
                else:
                    return render_template('employeradddescription.html')


            if request.method == 'POST':
                #use the logged in uname(email) and position name
                #to create position in db module
                txtfile = request.files['txt_file']
                if txtfile and allowed_text(txtfile.filename):
                    fname = "desc{}.{}".format(iid, 'txt')
                    txtfile.save(os.path.join(app.config['UPLOAD_FOLDER'],
                                              fname))
                    flash("Successfully added your description!")
                    return redirect('/Employer/ViewInternships')

                else:
                    flash("Could not add your description.")
                    return redirect('/Employer/ViewInternships')

    return redirect('/Employer')
예제 #2
0
def employerDeleteInt(iid):
    if escape(session['type']) == 'employer':
        cid = adb.get_cid(escape(session['uname']))

        if adb.check_ci_ids(cid, iid) and adb.int_isactive(iid):
            adb.int_makeinactive(iid)
            flash("Deleted your internship.")
            return redirect('/Employer/ViewInternships')

    return redirect('/Employer')
예제 #3
0
def employerViewSpecificInt(iid):
    if escape(session['type']) == 'employer':
        cid = adb.get_cid(escape(session['uname']))

        if adb.check_ci_ids(cid, iid):
            studs = students_applied(iid)
            sname, iname = adb.get_name(iid=iid)

            return render_template('employerviewinternshipsiid.html', students=studs, iid=iid, posname=iname)

    return redirect('/Employer')
예제 #4
0
def employerViewInt():
    if escape(session['type']) == 'employer':
        sid = request.args.get('sid')
        iid = request.args.get('iid')

        cid = adb.get_cid(escape(session['uname']))
        if sid and iid:
            if adb.check_ci_ids(cid, iid):
                adb.student_seen(sid, iid)
                flash('Student has been removed.')
                return redirect('/Employer/ViewInternships/{}'.format(iid))

        internlist = []
        for r in adb.view_cjoini_t():
            if r[2] == cid and r[8]:
                internlist.append(r)

        return render_template('employerviewinternships.html', internlist=internlist)

    return 'employer'