ajout de MdPAdmin

master
Antoine PEREDERII 2 years ago
parent 2463b1ac4c
commit 4d5eee160b

@ -50,8 +50,8 @@ void afficherCandidatsRefuses(Etudiant *tetud[], int nbCandidats);
void afficherCandidatsAttente(Etudiant *tetud[], int nbCandidats);
Etudiant moyenneCandidat(Etudiant mEtudiant);
Etudiant *moyenneCandidats(Etudiant *tetud[], int nbCandiats);
Etudiant modifStatueCandidat(Etudiant *tetud[], int nbCandidats, float noteMin[]);
int statueCandidat(Etudiant *tetud[], int nbCandidats);
Etudiant modifStatueCandidat(Etudiant *tetud[], int nbCandidats, float noteMin[], VilleIUT *tiut[], int nbIUT, char respVille[30], char respDept[30]);
int statueCandidat(Etudiant *tetud[], int nbCandidats, Etudiant *tetudAdmis[], Etudiant *tetudAttente[], int nbEtudAdmis, int nbEtudAttente);
int nbCandidatsAdmis(Etudiant *tetud[], int nbCandidats);
int nbCandidatsRefuses(Etudiant *tetud[], int nbCandidats);
int nbCandidatsAttente(Etudiant *tetud[], int nbCandidats);
@ -83,4 +83,7 @@ void deptResp(VilleIUT *tiut[], int nbVilles, char respVille[], char respIUT[]);
int chargementRespDept(Etudiant *tetud[], int nbCand, char respVille[], char respIUT[], Etudiant *tetudResp[]);
void lancerAdmissions(Etudiant *tetudResp[], int nbCandResp, Etudiant *tetudAdmis[], int *nbEtudAdmis, Etudiant *tetudAttente[], int *nbEtudAttente, char ville[], char dept[]);
void sauvegardeAdmis(Etudiant *tetudAdmis[], int nbEtudAdmis);
void sauvegardeAttente(Etudiant *tetudAttente[], int nbEtudAttente);
void sauvegardeAttente(Etudiant *tetudAttente[], int nbEtudAttente);
void chargerMdPAdmin();
void modifierMdPAdmin();

@ -2,6 +2,7 @@
int main(void)
{
global();
// chargerMdPAdmin();
modifierMdPAdmin();
return 0;
}

@ -145,4 +145,37 @@ void stopperPhaseCandidature(bool *phaseCandidature, bool *phaseTraitement)
{
printf("La phase de candidature est déjà fermée.\n");
}
}
void chargerMdPAdmin()
{
FILE *flot;
flot = fopen("mdpAdmin.bin", "rb");
if (flot == NULL)
{
printf("Erreur lors de l'ouverture du fichier mdpAdmin.bin\n");
exit(1);
}
char mdp[30];
fread(mdp, sizeof(char), 30, flot);
printf("Le mot de passe de l'administrateur est : %s\n", mdp);
fclose(flot);
}
void modifierMdPAdmin()
{
char mdp[30];
FILE *flot;
flot = fopen("mdpAdmin.bin", "wb");
if (flot == NULL)
{
printf("Erreur lors de l'ouverture du fichier mdpAdmin.txt\n");
return;
}
printf("Entrez le nouveau mot de passe de l'administrateur :\n> ");
fgets(mdp, 30, stdin);
mdp[strlen(mdp) - 1] = '\0';
fwrite(mdp, sizeof(char), strlen(mdp) + 1, flot);
fprintf(flot, "\n");
fclose(flot);
}

Binary file not shown.

@ -48,6 +48,20 @@ void menu(VilleIUT *tiut[], int *nbIUT, Etudiant *tetud[], int *nbCandidats, boo
switch (choix)
{
case 1:
char mdp[30], MdPAdmin[30];
int i = 0;
strcpy(MdPAdmin, chargerMdPAdmin());
printf("Veuillez entrer le mot de passe administrateur :\n> ");
while(mdp != MdPAdmin)
{
if(i == 3)
{
printf("Vous avez entré 3 fois le mauvais mot de passe, veuillez réessayer plus tard.\n");
}
printf("Veuillez entrer le mot de passe administrateur :\n> ");
scanf("%s%*c", mdp);
i++;
}
menuAdministrateur(tiut, nbIUT, tetud, nbCandidats, phaseCandidatures, phaseTraitement);
break;
case 2:
@ -64,9 +78,9 @@ void menu(VilleIUT *tiut[], int *nbIUT, Etudiant *tetud[], int *nbCandidats, boo
case 4:
menuResponsable(tetud, *nbCandidats, tiut, nbIUT, tetudAdmis, *nbEtudAdmis, tetudAttente, *nbEtudAttente);
break;
case 5:
menuPostCandidat();
break;
// case 5:
// menuPostCandidat();
// break;
case 9:
c = true;
return;
@ -289,16 +303,16 @@ void menuResponsable(Etudiant *tetud[], int nbCandidats, VilleIUT *tiut[], int *
case 2:
modificationNbPDeptResp(tiut, *nbIUT, respVille, respDept);
break;
case 3:
//*noteMin = modifNoteMin(noteMin);
// ? Note min stocké où ? ==> dans le fichier informationsIUT.txt
break; //! A revoir segment fault
case 4:
modifStatueCandidat(tetudResp, nbCandidatsDept, noteMin, tiut, *nbIUT, respVille, respDept); //! Mettre dans l'admin et dire que c'est lui qui lance tt
// lancerAdmissions(tetudResp, nbCandidats, tetudAdmis, nbEtudAdmis, tetudAttente, nbEtudAttente, respVille, respDept);
//! Qd finis enregistrer dans tblAdmis et tblAttente puis sauv dans fichier
statueCandidat(tetud, nbCandidats, tetudAdmis, tetudAttente, nbEtudAdmis, nbEtudAttente);
break;
// case 3:
// //*noteMin = modifNoteMin(noteMin);
// // ? Note min stocké où ? ==> dans le fichier informationsIUT.txt
// break; //! A revoir segment fault
// case 4:
// modifStatueCandidat(tetudResp, nbCandidatsDept, noteMin, tiut, *nbIUT, respVille, respDept); //! Mettre dans l'admin et dire que c'est lui qui lance tt
// // lancerAdmissions(tetudResp, nbCandidats, tetudAdmis, nbEtudAdmis, tetudAttente, nbEtudAttente, respVille, respDept);
// //! Qd finis enregistrer dans tblAdmis et tblAttente puis sauv dans fichier
// statueCandidat(tetud, nbCandidats, tetudAdmis, tetudAttente, nbEtudAdmis, nbEtudAttente);
// break;
case 9:
c = true;
return;
@ -372,33 +386,33 @@ void menuAffichage(Etudiant *tetudResp[], int nbCandidatsDept)
}
}
void menuPostCandidat()
{
int choix;
bool c = false;
while (c == false)
{
printf("\n\nMenu des Affichages Responsable de Departement : Que voulez-vous faire ?\n");
printf("\t1 - Afficher les informations sur mes voeus\n");
printf("\t2 - Validation d'un voeux (et refus des autres)\n");
printf("\t9 - Quitter\n");
printf("\nEntrez votre choix :\n> ");
scanf("%d%*c", &choix);
switch (choix)
{
case 1:
afficherCandidat(tetud, *nbCandidats);
break;
case 2:
ValidationCandidature();//** Valide une candidature et rejette ttes les autres ==> enregistre dans tblAdmis et tblAttente
MiseAJourAdmission();//** relance l'admission
break;
case 9:
c = true;
return;
default:
printf("Option non reconnue. Veuillez recommencer.\n");
break;
}
}
}
// void menuPostCandidat()
// {
// int choix;
// bool c = false;
// while (c == false)
// {
// printf("\n\nMenu des Affichages Responsable de Departement : Que voulez-vous faire ?\n");
// printf("\t1 - Afficher les informations sur mes voeus\n");
// printf("\t2 - Validation d'un voeux (et refus des autres)\n");
// printf("\t9 - Quitter\n");
// printf("\nEntrez votre choix :\n> ");
// scanf("%d%*c", &choix);
// switch (choix)
// {
// case 1:
// afficherCandidat(tetud, *nbCandidats);
// break;
// case 2:
// ValidationCandidature();//** Valide une candidature et rejette ttes les autres ==> enregistre dans tblAdmis et tblAttente
// MiseAJourAdmission();//** relance l'admission
// break;
// case 9:
// c = true;
// return;
// default:
// printf("Option non reconnue. Veuillez recommencer.\n");
// break;
// }
// }
// }

@ -70,13 +70,13 @@ Etudiant modifStatueCandidat(Etudiant *tetud[], int nbCandidats, float noteMin[]
if (trouve == false)
{
printf("L'IUT de ce responsable n'existe pas. Veuillez réessayer en changeant de responsable.\n");
return;
return **tetud;
}
posDept = rechercheDept(tiut[posIUT]->ldept, respDept, &trouve);
if (trouve == false)
{
printf("Le departement de ce responsable n'existe pas. Veuillez réessayer en changeant de responsable.\n");
return;
return **tetud;
}
for (int i = 0; i < nbCandidats; i++)
{
@ -114,20 +114,20 @@ int statueCandidat(Etudiant *tetud[], int nbCandidats, Etudiant *tetudAdmis[], E
}
}
Etudiant ValidationCandidature()
{
int i;
char choix[30];
printf("Quel voeu souhaitez-vous valider ?\n")
scanf("%s", &choix);
for (i = 0; i < nbCandidats; i++)
{
if (tetud[i]->lChoix->choix.decisionAdmission == 1)
{
tetud[i]->lChoix->choix.decisionAdmission = 0;
}
}
}
// Etudiant ValidationCandidature()
// {
// int i;
// char choix[30];
// printf("Quel voeu souhaitez-vous valider ?\n");
// scanf("%s", &choix);
// for (i = 0; i < nbCandidats; i++)
// {
// if (tetud[i]->lChoix->choix.decisionAdmission == 1)
// {
// tetud[i]->lChoix->choix.decisionAdmission = 0;
// }
// }
// }
int nbCandidatsAdmis(Etudiant *tetud[], int nbCandidats)
{

Loading…
Cancel
Save