def saveCV(request):
    username = request.session
    gests = dbUsers()
    idprof = gests.returnOne(username['idsession'])
    if 'idsession' not in request.session:
        return redirect("/")
    now = datetime.datetime.now()
    nom = request.GET['nom']
    prenom = request.GET['prenom']
    sexe = request.GET['sexe']
    cin = request.GET['cin']
    telephone = request.GET['telephone']
    email = request.GET['email']
    formation = request.GET['formation']
    etude = request.GET['etude']
    experience = request.GET['experience']
    langue = request.GET['langue']
    reference = request.GET['reference']

    etab = dbProfesseur()
    idprof = etab.returnOne(idprof)
    ecole = CVprof(idprof=idprof,nom=nom,prenom=prenom,cin=cin,sexe=sexe,telephone=telephone,email=email,formation=formation,etude=etude,experience=experience,langue=langue,reference=reference,date=now)

    if(not etab.isCVExist(idprof=idprof,nom=nom,prenom=prenom,cin=cin,sexe=sexe,telephone=telephone,email=email,formation=formation,etude=etude,experience=experience,langue=langue,reference=reference)):
        if(not etab.saveCV(ecole)):
            message = "CV ajouter !"
        else:
            message = "CV non ajouter."
    else:
        message = "le CV du professeur {} {} existe deja.".format(prenom,nom)
    return render(request, 'prof/saveCV.html',{'etab':ecole,'message': message,'username':username['idsession']})
def index(request):
    username = request.session
    if 'idsession' not in request.session:
        return redirect("/")
    gest = dbProfesseur()
    schools = gest.returnAll()
    return render(request, 'professeur/lister.html', {'school': schools,'username':username['idsession']})
Beispiel #3
0
def create(request):
    username = request.session
    if 'idsession' not in request.session:
            return redirect("/")
    gest = dbProfesseur()
    schools = gest.returnAll()
    return render(request, 'index/create.html',{'prof':schools,'username':username['idsession']})
def supprimer(request,id):
    username = request.session
    if 'idsession' not in request.session:
        return redirect("/")
    gest = dbProfesseur()
    etab = gest.returnOne(id)
    return render(request, 'professeur/supprimer.html',{'etab':etab})
def modifier(request,id):
    username = request.session
    if 'idsession' not in request.session:
        return redirect("/")
    gest = dbProfesseur()
    etab = gest.returnOne(id)
    return render(request, 'professeur/modifier.html',{'etab':etab,'username':username['idsession']})
def savemodification(request,id):
    username = request.session
    if 'idsession' not in request.session:
        return redirect("/")
    now = datetime.datetime.now()

    cod = request.GET['idcours']
    code = dbIdcours()
    idcours = code.returnID(codecours=cod)
    p = request.GET['professeur']
    pro = dbProfesseur()
    prof = pro.returnOne(id=p)
    nomab = request.GET['etablissement']
    tab = dbEtablissement()
    etablissement = tab.returnOne(id=nomab)
    titre = request.GET['titre']
    creditECTS = request.GET['creditECTS']
    public = request.GET['public']
    objectif = request.GET['objectif']
    description = request.GET['description']
    formatcours = request.GET['formatcours']
    prerequis = request.GET['prerequis']
    ressources = request.GET['ressources']
    evaluation = request.GET['evaluation']
    plan = request.GET['plan']

    etab = dbCours()
    if(etab.modify(id=id,idcours=idcours,professeur=prof,etablissement=etablissement,titre=titre,creditECTS=creditECTS,public=public,objectif=objectif,description=description,plan=plan,formatcours=formatcours,prerequis=prerequis,ressources=ressources,evaluation=evaluation,date=now)):
        message = "Code cours non modifier !"
    else:
        message = "Code cours modifier."
    return render(request, 'cours/savemodification.html',{'message':message,'username':username['idsession']})
def addcv(request,id):
    username = request.session
    if 'idsession' not in request.session:
        return redirect("/")
    gest = dbProfesseur()
    prof = gest.returnOne(id)
    cv = gest.returnCV(id)
    return render(request,'professeur/ajouterCV.html',{'etab':prof,'cv':cv,'username':username['idsession']})
def savesuppression(request,id):
    username = request.session
    if 'idsession' not in request.session:
        return redirect("/")
    gest = dbProfesseur()
    if(not gest.delete(id=id)):
        message = "professeur effacee."
    else:
        message = "professeur non effacee."
    return render(request, 'professeur/savesuppression.html',{'message':message,'username':username['idsession']})
def modifier(request,id):
    username = request.session
    if 'idsession' not in request.session:
        return redirect("/")
    idcours = dbCours()
    cours = idcours.returnOne(id)
    gest = dbEtablissement()
    etab = gest.returnAll()
    prof = dbProfesseur()
    mr = prof.returnAll()
    return render(request, 'cours/modifier.html',{'etab':cours,'school':etab,'prof':mr,'username':username['idsession']})
def viewCV(request,id):
    username = request.session
    if 'idsession' not in request.session:
        return redirect("/")
    gest = dbProfesseur()
    prof = gest.returnOne(id)
    cv = gest.returnCV(id)
    if(not cv==None):
        message = ""
        find = True
    else:
        message = "le professeur {} {} n'a pas de CV.".format(prof.prenom,prof.nom)
        find = False
    return render(request,'professeur/cv.html',{'cv':cv, 'prof':prof,'message':message,'find':find,'username':username['idsession']})
def viewCV(request):
    username = request.session
    if 'idsession' not in request.session:
        return redirect("/")
    gest = dbProfesseur()
    gests = dbUsers()
    idprof = gests.returnOne(username['idsession'])
    prof = gest.returnOne(idprof.id)
    cv = gest.returnCV(idprof.id)
    if(not cv==None):
        message = ""
        find = True
    else:
        message = "Vous n'avez pas encore enregistrer votre CV. "
        find = False
    return render(request,'prof/cv.html',{'cv':cv, 'prof':prof,'message':message,'find':find,'username':username['idsession']})
def ajouter(request):
    username = request.session
    if 'idsession' not in request.session:
        return redirect("/")
    now = datetime.datetime.now()
    id = dbIdcours()
    idcours = id.returnAll()
    dico = {}
    for ele in idcours:
        dico = {ele.id:ele.nomcours}
    gest = dbEtablissement()
    etab = gest.returnAll()
    dbprof = dbProfesseur()
    prof = dbprof.returnAll()
    t = get_template('cours/ajouter.html')
    html = t.render(Context({'current_date': now,'idcours':idcours,'prof':prof,'etab':etab,'dico':dico,'username':username['idsession']}))
    return HttpResponse(html)
def savemodification(request,id):
    username = request.session
    if 'idsession' not in request.session:
        return redirect("/")
    now = datetime.datetime.now()
    nom = request.GET['nom']
    prenom = request.GET['prenom']
    sexe = request.GET['sexe']
    cin = request.GET['cin']
    telephone = request.GET['telephone']
    email = request.GET['email']
    gest = dbProfesseur()
    etab = Professeur(nom=nom,prenom=prenom,cin=cin,sexe=sexe,telephone=telephone,email=email,date=now)
    if(gest.modify(id=id,nom=nom,prenom=prenom,cin=cin,sexe=sexe,telephone=telephone,email=email,date=now)):
        message = "professeur non modifier !"
    else:
        message = "professeur modifier."
    return render(request, 'professeur/savemodification.html',{'message':message,'etab':etab,'username':username['idsession']})
def sauvegarder(request):
    username = request.session
    if 'idsession' not in request.session:
        return redirect("/")
    now = datetime.datetime.now()
    nom = request.GET['nom']
    prenom = request.GET['prenom']
    sexe = request.GET['sexe']
    cin = request.GET['cin']
    telephone = request.GET['telephone']
    email = request.GET['email']
    etab = dbProfesseur()
    ecole = Professeur(nom=nom,prenom=prenom,cin=cin,sexe=sexe,telephone=telephone,email=email,date=now)

    if(not etab.isExist(nom=nom,prenom=prenom,cin=cin,sexe=sexe,telephone=telephone,email=email)):
        if(not etab.save(ecole)):
            message = "professeur ajouter !"
        else:
            message = "professeur non ajouter."
    else:
        message = "le professeur {} {} existe deja.".format(prenom,nom)
    return render(request, 'professeur/ajouter.html',{'etab':ecole,'message': message,'username':username['idsession']})
def sauvegarder(request):
    username = request.session
    if 'idsession' not in request.session:
        return redirect("/")
    now = datetime.datetime.now()

    idcours = request.GET['idcours']
    prof = request.GET['professeur']
    nometab = request.GET['etablissement']
    titre = request.GET['titre']
    creditECTS = request.GET['creditECTS']
    public = request.GET['public']
    objectif = request.GET['objectif']
    description = request.GET['description']
    formatcours = request.GET['formatcours']
    prerequis = request.GET['prerequis']
    ressources = request.GET['ressources']
    evaluation = request.GET['evaluation']
    plan = request.GET['plan']

    id = dbIdcours()
    cours = id.returnAll()
    gest = dbEtablissement()
    etabli = gest.returnAll()
    dbprof = dbProfesseur()
    professeur = dbprof.returnAll()

    etab = dbCours()
    ecole = Cours(idcours=id.returnOne(id=idcours),professeur=dbprof.returnOne(id=prof),etablissement=gest.returnOne(id=nometab),titre=titre,creditECTS=creditECTS,public=public,objectif=objectif,description=description,plan=plan,formatcours=formatcours,prerequis=prerequis,ressources=ressources,evaluation=evaluation,date=now)

    if(not etab.isExist(idcours=id.returnOne(id=idcours),professeur=dbprof.returnOne(id=prof),etablissement=gest.returnOne(id=nometab),titre=titre)):
        if(not etab.save(ecole)):
            message = "Code cours ajouter !"
        else:
            message = "Code cours non ajouter."
    else:
        message = "le cours {} existe deja.".format(ecole.titre)
    return render(request, 'cours/ajouter.html',{'message': message,'idcours':cours,'prof':professeur,'etab':etabli,'username':username['idsession']})
Beispiel #16
0
def sauvegarder(request):
    user = request.session
    if 'idsession' not in request.session:
        return redirect("/")
    now = datetime.datetime.now()
    users = dbUsers()
    gest = dbProfesseur()
    idprof = request.POST['idprof']
    username = request.POST['username']
    password = request.POST['password']
    type = request.POST['type']

    utilisateur = Users(professeur=gest.returnOne(idprof),username=username,password=password,type=type,date=now)

    if(not users.isExist(username=username)):
        if(not users.save(utilisateur)):
            message = "Le compte a ete cree !"
        else:
            message = "Compte non cree."
    else:
        message = "le compte {} existe deja.".format(username)

    return render(request, 'index/create.html',{'message':message,'username':user['idsession']})