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); void afficherCandidatsAttente(Etudiant *tetud[], int nbCandidats);
Etudiant moyenneCandidat(Etudiant mEtudiant); Etudiant moyenneCandidat(Etudiant mEtudiant);
Etudiant *moyenneCandidats(Etudiant *tetud[], int nbCandiats); Etudiant *moyenneCandidats(Etudiant *tetud[], int nbCandiats);
Etudiant modifStatueCandidat(Etudiant *tetud[], int nbCandidats, float noteMin[]); Etudiant modifStatueCandidat(Etudiant *tetud[], int nbCandidats, float noteMin[], VilleIUT *tiut[], int nbIUT, char respVille[30], char respDept[30]);
int statueCandidat(Etudiant *tetud[], int nbCandidats); int statueCandidat(Etudiant *tetud[], int nbCandidats, Etudiant *tetudAdmis[], Etudiant *tetudAttente[], int nbEtudAdmis, int nbEtudAttente);
int nbCandidatsAdmis(Etudiant *tetud[], int nbCandidats); int nbCandidatsAdmis(Etudiant *tetud[], int nbCandidats);
int nbCandidatsRefuses(Etudiant *tetud[], int nbCandidats); int nbCandidatsRefuses(Etudiant *tetud[], int nbCandidats);
int nbCandidatsAttente(Etudiant *tetud[], int nbCandidats); int nbCandidatsAttente(Etudiant *tetud[], int nbCandidats);
@ -84,3 +84,6 @@ int chargementRespDept(Etudiant *tetud[], int nbCand, char respVille[], char res
void lancerAdmissions(Etudiant *tetudResp[], int nbCandResp, Etudiant *tetudAdmis[], int *nbEtudAdmis, Etudiant *tetudAttente[], int *nbEtudAttente, char ville[], char dept[]); 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 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) int main(void)
{ {
global(); // chargerMdPAdmin();
modifierMdPAdmin();
return 0; return 0;
} }

@ -146,3 +146,36 @@ void stopperPhaseCandidature(bool *phaseCandidature, bool *phaseTraitement)
printf("La phase de candidature est déjà fermée.\n"); 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) switch (choix)
{ {
case 1: 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); menuAdministrateur(tiut, nbIUT, tetud, nbCandidats, phaseCandidatures, phaseTraitement);
break; break;
case 2: case 2:
@ -64,9 +78,9 @@ void menu(VilleIUT *tiut[], int *nbIUT, Etudiant *tetud[], int *nbCandidats, boo
case 4: case 4:
menuResponsable(tetud, *nbCandidats, tiut, nbIUT, tetudAdmis, *nbEtudAdmis, tetudAttente, *nbEtudAttente); menuResponsable(tetud, *nbCandidats, tiut, nbIUT, tetudAdmis, *nbEtudAdmis, tetudAttente, *nbEtudAttente);
break; break;
case 5: // case 5:
menuPostCandidat(); // menuPostCandidat();
break; // break;
case 9: case 9:
c = true; c = true;
return; return;
@ -289,16 +303,16 @@ void menuResponsable(Etudiant *tetud[], int nbCandidats, VilleIUT *tiut[], int *
case 2: case 2:
modificationNbPDeptResp(tiut, *nbIUT, respVille, respDept); modificationNbPDeptResp(tiut, *nbIUT, respVille, respDept);
break; break;
case 3: // case 3:
//*noteMin = modifNoteMin(noteMin); // //*noteMin = modifNoteMin(noteMin);
// ? Note min stocké où ? ==> dans le fichier informationsIUT.txt // // ? Note min stocké où ? ==> dans le fichier informationsIUT.txt
break; //! A revoir segment fault // break; //! A revoir segment fault
case 4: // case 4:
modifStatueCandidat(tetudResp, nbCandidatsDept, noteMin, tiut, *nbIUT, respVille, respDept); //! Mettre dans l'admin et dire que c'est lui qui lance tt // 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); // // lancerAdmissions(tetudResp, nbCandidats, tetudAdmis, nbEtudAdmis, tetudAttente, nbEtudAttente, respVille, respDept);
//! Qd finis enregistrer dans tblAdmis et tblAttente puis sauv dans fichier // //! Qd finis enregistrer dans tblAdmis et tblAttente puis sauv dans fichier
statueCandidat(tetud, nbCandidats, tetudAdmis, tetudAttente, nbEtudAdmis, nbEtudAttente); // statueCandidat(tetud, nbCandidats, tetudAdmis, tetudAttente, nbEtudAdmis, nbEtudAttente);
break; // break;
case 9: case 9:
c = true; c = true;
return; return;
@ -372,33 +386,33 @@ void menuAffichage(Etudiant *tetudResp[], int nbCandidatsDept)
} }
} }
void menuPostCandidat() // void menuPostCandidat()
{ // {
int choix; // int choix;
bool c = false; // bool c = false;
while (c == false) // while (c == false)
{ // {
printf("\n\nMenu des Affichages Responsable de Departement : Que voulez-vous faire ?\n"); // printf("\n\nMenu des Affichages Responsable de Departement : Que voulez-vous faire ?\n");
printf("\t1 - Afficher les informations sur mes voeus\n"); // printf("\t1 - Afficher les informations sur mes voeus\n");
printf("\t2 - Validation d'un voeux (et refus des autres)\n"); // printf("\t2 - Validation d'un voeux (et refus des autres)\n");
printf("\t9 - Quitter\n"); // printf("\t9 - Quitter\n");
printf("\nEntrez votre choix :\n> "); // printf("\nEntrez votre choix :\n> ");
scanf("%d%*c", &choix); // scanf("%d%*c", &choix);
switch (choix) // switch (choix)
{ // {
case 1: // case 1:
afficherCandidat(tetud, *nbCandidats); // afficherCandidat(tetud, *nbCandidats);
break; // break;
case 2: // case 2:
ValidationCandidature();//** Valide une candidature et rejette ttes les autres ==> enregistre dans tblAdmis et tblAttente // ValidationCandidature();//** Valide une candidature et rejette ttes les autres ==> enregistre dans tblAdmis et tblAttente
MiseAJourAdmission();//** relance l'admission // MiseAJourAdmission();//** relance l'admission
break; // break;
case 9: // case 9:
c = true; // c = true;
return; // return;
default: // default:
printf("Option non reconnue. Veuillez recommencer.\n"); // printf("Option non reconnue. Veuillez recommencer.\n");
break; // break;
} // }
} // }
} // }

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

Loading…
Cancel
Save