|
|
|
@ -17,7 +17,7 @@
|
|
|
|
|
#include "../II/deux.c"
|
|
|
|
|
|
|
|
|
|
void identificationCandidat(int* id, ListeCandidats* listePointer, int* nbCandidats) {
|
|
|
|
|
char connexion;
|
|
|
|
|
char connexion, poubelle;
|
|
|
|
|
int verif;
|
|
|
|
|
|
|
|
|
|
printf("\nÊtes-vous déjà enregistré (O/N) ? : ");
|
|
|
|
@ -30,14 +30,13 @@ void identificationCandidat(int* id, ListeCandidats* listePointer, int* nbCandid
|
|
|
|
|
|
|
|
|
|
if(scanf("%d", id) == 0) {
|
|
|
|
|
*id = 0;
|
|
|
|
|
fprintf(stderr, "\n\e[0;91mErreur : cet ID n'existe pas !\n\n\e[0m");
|
|
|
|
|
fprintf(stderr, "\e[0;91mErreur : cet ID n'existe pas !\n\n\e[0m");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(*id > *nbCandidats) {
|
|
|
|
|
*id = 0;
|
|
|
|
|
fprintf(stderr, "\n\e[0;91mErreur : cet ID n'existe pas !\n\n\e[0m");
|
|
|
|
|
fprintf(stderr, "\e[0;91mErreur : cet ID n'existe pas !\n\n\e[0m");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -54,6 +53,7 @@ void identificationCandidat(int* id, ListeCandidats* listePointer, int* nbCandid
|
|
|
|
|
(*listePointer)[*id-1]->prenom, (*listePointer)[*id-1]->nom);
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
if(connexion == 'n' || connexion == 'N') {
|
|
|
|
|
printf("\nTrès bien, nous allons donc précéder à votre enregistrement.\n\n");
|
|
|
|
|
|
|
|
|
|
Candidat* candidat = creerCandidat(); // malloc
|
|
|
|
@ -74,21 +74,21 @@ void identificationCandidat(int* id, ListeCandidats* listePointer, int* nbCandid
|
|
|
|
|
printf("Moyenne de français : ");
|
|
|
|
|
verif = scanf("%f", &candidat->moyenneFrancais);
|
|
|
|
|
while((candidat->moyenneFrancais) < 0 || (candidat->moyenneFrancais) > 20 || verif == 0) {
|
|
|
|
|
fprintf(stderr, "\e[0;91mLa moyenne entrée est incorrecte\n\e[0mEntrez votre moyenne de Français de l'année de terminale : ");
|
|
|
|
|
fprintf(stderr, "\e[0;91mLa moyenne entrée est incorrecte\n\e[0mEntrez votre moyenne de français de l'année de terminale : ");
|
|
|
|
|
verif = scanf("%*c%f", &candidat->moyenneFrancais);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
printf("Moyenne de anglais : ");
|
|
|
|
|
verif = scanf("%f", &candidat->moyenneAnglais);
|
|
|
|
|
while((candidat->moyenneAnglais) < 0 || (candidat->moyenneAnglais) > 20 || verif == 0) {
|
|
|
|
|
fprintf(stderr, "\e[0;91mLa moyenne entrée est incorrecte\n\e[0mEntrez votre moyenne de mathématiques de l'année de terminale : ");
|
|
|
|
|
fprintf(stderr, "\e[0;91mLa moyenne entrée est incorrecte\n\e[0mEntrez votre moyenne de anglais de l'année de terminale : ");
|
|
|
|
|
verif = scanf("%*c%f", &candidat->moyenneAnglais);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
printf("Moyenne de spécialité : ");
|
|
|
|
|
verif = scanf("%f", &candidat->moyenneSpecialite);
|
|
|
|
|
while((candidat->moyenneSpecialite) < 0 || (candidat->moyenneSpecialite) > 20 || verif == 0) {
|
|
|
|
|
fprintf(stderr, "\e[0;91mLa moyenne entrée est incorrecte\n\e[0mEntrez votre moyenne de mathématiques de l'année de terminale : ");
|
|
|
|
|
fprintf(stderr, "\e[0;91mLa moyenne entrée est incorrecte\n\e[0mEntrez votre moyenne de spécialité de l'année de terminale : ");
|
|
|
|
|
verif = scanf("%*c%f", &candidat->moyenneSpecialite);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -98,6 +98,10 @@ void identificationCandidat(int* id, ListeCandidats* listePointer, int* nbCandid
|
|
|
|
|
printf("\n\n\e[1mParfait ! Votre ID est \e[1;32m%d\e[0m\e[1m, ne le perdez pas, "
|
|
|
|
|
"il vous suivera tout le long de vos candidatures !\n\e[1;91m"
|
|
|
|
|
"N'oubliez pas de revenir au menu principal pour vous déconnecter à la fin de votre session !\n\n\e[0m", candidat->id);
|
|
|
|
|
} else {
|
|
|
|
|
while ((poubelle = getchar()) != '\n' && poubelle != EOF);
|
|
|
|
|
fprintf(stderr, "\n\e[0;91mLa valeur entrée est incorrecte. Merci de réessayer plus tard.\e[0m\n");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -123,6 +127,9 @@ void menuCandidat(VilleIUT*** tiutPointer, ListeCandidats* listePointer, int* nb
|
|
|
|
|
|
|
|
|
|
if(connexion == 'O')
|
|
|
|
|
identificationCandidat(&id, listePointer, nbCandidats);
|
|
|
|
|
else
|
|
|
|
|
if(connexion != 'n' && connexion != 'N')
|
|
|
|
|
while ((poubelle = getchar()) != '\n' && poubelle != EOF);
|
|
|
|
|
|
|
|
|
|
if(id != 0) {
|
|
|
|
|
candidat = (*listePointer)[id-1];
|
|
|
|
@ -161,7 +168,7 @@ void menuCandidat(VilleIUT*** tiutPointer, ListeCandidats* listePointer, int* nb
|
|
|
|
|
printf("Saisissez le nom de la ville recherchée (tapez q pour annuler) : ");
|
|
|
|
|
|
|
|
|
|
char searchIUT[LEN_MAX];
|
|
|
|
|
scanf("%s", searchIUT);
|
|
|
|
|
scanf("%[^\n]", searchIUT);
|
|
|
|
|
|
|
|
|
|
if(strcasecmp(searchIUT, "q") == 0)
|
|
|
|
|
break;
|
|
|
|
@ -246,7 +253,7 @@ void menuResponsable(VilleIUT*** tiutPointer, ListeCandidats* listePointer, int*
|
|
|
|
|
|
|
|
|
|
printf("Merci d'entrer le mot de passe administrateur : ");
|
|
|
|
|
system("stty -echo");
|
|
|
|
|
scanf("%s", pass);
|
|
|
|
|
scanf("%[^\n]", pass);
|
|
|
|
|
system("stty echo");
|
|
|
|
|
|
|
|
|
|
if(strcmp(pass, "resp2023") != 0) {
|
|
|
|
@ -313,7 +320,7 @@ void menuAdmin(VilleIUT*** tiutPointer, ListeCandidats* listePointer, int* nbVil
|
|
|
|
|
|
|
|
|
|
printf("Merci d'entrer le mot de passe administrateur : ");
|
|
|
|
|
system("stty -echo");
|
|
|
|
|
scanf("%s", pass);
|
|
|
|
|
scanf("%[^\n]", pass);
|
|
|
|
|
system("stty echo");
|
|
|
|
|
|
|
|
|
|
if(strcmp(pass, "admin2023") != 0) {
|
|
|
|
@ -515,8 +522,8 @@ void menuPrincipal(/* TODO: prise en compte des status actuels du recrutement */
|
|
|
|
|
|
|
|
|
|
void menuResponsable_traiterCandidatures(VilleIUT** tiut, int nbVilles, ListeCandidats liste, int nbCandidats) {
|
|
|
|
|
char dept[LEN_MAX], ville[LEN_MAX], choix;
|
|
|
|
|
int nbCandidatsAccept;
|
|
|
|
|
float noteMini;
|
|
|
|
|
int nbCandidatsAccept, pos, verif;
|
|
|
|
|
ListeDept ldept;
|
|
|
|
|
|
|
|
|
|
strcpy(dept, "Informatique");
|
|
|
|
|
strcpy(ville, "Clermont-Ferrand");
|
|
|
|
@ -530,17 +537,30 @@ void menuResponsable_traiterCandidatures(VilleIUT** tiut, int nbVilles, ListeCan
|
|
|
|
|
printf("Combien de candidats souhaitez-vous accepter ? : ");
|
|
|
|
|
scanf("%d", &nbCandidatsAccept);
|
|
|
|
|
|
|
|
|
|
pos = rechercherVille(tiut, nbVilles, ville);
|
|
|
|
|
|
|
|
|
|
ldept = tiut[pos]->ldept;
|
|
|
|
|
|
|
|
|
|
while(ldept != NULL && strcmp(ldept->departement, dept) != 0)
|
|
|
|
|
ldept = ldept->suiv;
|
|
|
|
|
|
|
|
|
|
if(ldept->noteMinimale != -1) {
|
|
|
|
|
printf("\nQuelle est la note minimale pour l'acception du candidat ? : ");
|
|
|
|
|
scanf("%f", ¬eMini);
|
|
|
|
|
verif = scanf("%f", &ldept->noteMinimale);
|
|
|
|
|
while((ldept->noteMinimale) < 0 || (ldept->noteMinimale) > 20 || verif == 0) {
|
|
|
|
|
fprintf(stderr, "\e[0;91mLa note entrée est incorrecte\n\e[0mEntrez une note minimale entre 0 et 20 : ");
|
|
|
|
|
verif = scanf("%f", &ldept->noteMinimale);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
printf("\nMerci de confirmer : Il faut accepter %d candidat avec une note minimale de %.2f (O/N) ? : ", nbCandidatsAccept, noteMini);
|
|
|
|
|
printf("\nMerci de confirmer : Il faut accepter %d candidat avec une note minimale de %.2f (O/N) ? : ", nbCandidatsAccept, ldept->noteMinimale);
|
|
|
|
|
|
|
|
|
|
scanf("%*c%c", &choix);
|
|
|
|
|
|
|
|
|
|
if(choix == 'n' || choix == 'N')
|
|
|
|
|
menuResponsable_traiterCandidatures(tiut, nbVilles, liste, nbCandidats);
|
|
|
|
|
|
|
|
|
|
traiterCandidatures(tiut, nbVilles, liste, nbCandidats, nbCandidatsAccept, noteMini);
|
|
|
|
|
traiterCandidatures(tiut, nbVilles, liste, nbCandidats, nbCandidatsAccept, ldept->noteMinimale);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// FONCTIONS MENU ADMIN
|
|
|
|
@ -549,7 +569,7 @@ void menuAdmin_modifierPlaces(VilleIUT** tiut, int nbVilles) {
|
|
|
|
|
int nbPlaces;
|
|
|
|
|
char searchIUT[LEN_MAX], searchDept[LEN_MAX];
|
|
|
|
|
printf("Entrez une ville (tapez q pour annuler) : ");
|
|
|
|
|
scanf("%s", searchIUT);
|
|
|
|
|
scanf("%[^\n]", searchIUT);
|
|
|
|
|
|
|
|
|
|
if(strcasecmp(searchIUT, "q") == 0)
|
|
|
|
|
return;
|
|
|
|
@ -558,7 +578,7 @@ void menuAdmin_modifierPlaces(VilleIUT** tiut, int nbVilles) {
|
|
|
|
|
|
|
|
|
|
if(code != -1) {
|
|
|
|
|
printf("Quel département souhaitez-vous modifier ? : ");
|
|
|
|
|
scanf("%s", searchDept);
|
|
|
|
|
scanf("%[^\n]", searchDept);
|
|
|
|
|
printf("Entrez le nouveau nombre de places pour le département '%s' : ", searchDept);
|
|
|
|
|
scanf("%d", &nbPlaces);
|
|
|
|
|
|
|
|
|
@ -569,7 +589,7 @@ void menuAdmin_modifierPlaces(VilleIUT** tiut, int nbVilles) {
|
|
|
|
|
void menuAdmin_creerIUT(VilleIUT*** tiutPointer, int* nbVilles) {
|
|
|
|
|
char nameIUT[LEN_MAX];
|
|
|
|
|
printf("Entrez le nom de la ville (tapez q pour annuler) : ");
|
|
|
|
|
scanf("%s", nameIUT);
|
|
|
|
|
scanf("%[^\n]", nameIUT);
|
|
|
|
|
|
|
|
|
|
if(strcasecmp(nameIUT, "q") == 0)
|
|
|
|
|
return;
|
|
|
|
@ -591,7 +611,7 @@ void menuAdmin_creerDepartement(VilleIUT** tiut, int nbVilles) {
|
|
|
|
|
MaillonDept* dept;
|
|
|
|
|
|
|
|
|
|
printf("Entrez la ville dans laquelle vous souhaitez ajouter un département (tapez q pour annuler) : ");
|
|
|
|
|
scanf("%s", searchIUT);
|
|
|
|
|
scanf("%[^\n]", searchIUT);
|
|
|
|
|
|
|
|
|
|
if(strcasecmp(searchIUT, "q") == 0)
|
|
|
|
|
return;
|
|
|
|
@ -645,7 +665,7 @@ void menuAdmin_supprimerDepartement(VilleIUT** tiut, int nbVilles) {
|
|
|
|
|
VilleIUT* ville;
|
|
|
|
|
|
|
|
|
|
printf("Entrez la ville dans laquelle vous souhaitez supprimer un département (tapez q pour annuler) : ");
|
|
|
|
|
scanf("%s", searchIUT);
|
|
|
|
|
scanf("%[^\n]", searchIUT);
|
|
|
|
|
|
|
|
|
|
if(strcasecmp(searchIUT, "q") == 0)
|
|
|
|
|
return;
|
|
|
|
@ -674,7 +694,7 @@ void menuAdmin_modifierResponsable(VilleIUT** tiut, int nbVilles) {
|
|
|
|
|
char searchIUT[LEN_MAX], searchDept[LEN_MAX], nom[LEN_MAX];
|
|
|
|
|
|
|
|
|
|
printf("Dans quel IUT souhaitez-vous faire une modification ? (tapez q pour annuler) : ");
|
|
|
|
|
scanf("%s", searchIUT);
|
|
|
|
|
scanf("%[^\n]", searchIUT);
|
|
|
|
|
|
|
|
|
|
if(strcasecmp(searchIUT, "q") == 0)
|
|
|
|
|
return;
|
|
|
|
@ -683,7 +703,7 @@ void menuAdmin_modifierResponsable(VilleIUT** tiut, int nbVilles) {
|
|
|
|
|
|
|
|
|
|
if(code != -1) {
|
|
|
|
|
printf("Quel département souhaitez-vous modifier ? : ");
|
|
|
|
|
scanf("%s", searchDept);
|
|
|
|
|
scanf("%[^\n]", searchDept);
|
|
|
|
|
|
|
|
|
|
printf("Quel est le nom du nouveau responsable : ");
|
|
|
|
|
scanf("%*c%[^\n]", nom);
|
|
|
|
@ -1068,100 +1088,3 @@ void saveStatus(int status) {
|
|
|
|
|
|
|
|
|
|
fclose(fe);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void test(void) {
|
|
|
|
|
/*
|
|
|
|
|
Ajout des premières données
|
|
|
|
|
*/
|
|
|
|
|
VilleIUT** tiut = (VilleIUT**) malloc(sizeof(VilleIUT*));
|
|
|
|
|
|
|
|
|
|
if(tiut == NULL) {
|
|
|
|
|
perror("malloc");
|
|
|
|
|
exit(errno);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int nbVilles = 0;
|
|
|
|
|
|
|
|
|
|
VilleIUT* clermont = creerVille();
|
|
|
|
|
strcpy(clermont->ville, "Clermont-Ferrand");
|
|
|
|
|
|
|
|
|
|
ajouterVille(&tiut, clermont, &nbVilles);
|
|
|
|
|
|
|
|
|
|
//afficherListeDepartement(*clermont);
|
|
|
|
|
|
|
|
|
|
MaillonDept* departement = creerDepartement("Informatique", 136, "Simon Carine");
|
|
|
|
|
tiut[0]->ldept = ajouterDepartement(tiut[0]->ldept, departement);
|
|
|
|
|
|
|
|
|
|
departement = creerDepartement("Biologie", 120, "IDK");
|
|
|
|
|
tiut[0]->ldept = ajouterDepartement(tiut[0]->ldept, departement);
|
|
|
|
|
|
|
|
|
|
departement = creerDepartement("Testeuuu", 1337, "IDK");
|
|
|
|
|
tiut[0]->ldept = ajouterDepartement(tiut[0]->ldept, departement);
|
|
|
|
|
|
|
|
|
|
//afficherListeDepartement(*clermont);
|
|
|
|
|
|
|
|
|
|
saveVilles(tiut, nbVilles);
|
|
|
|
|
|
|
|
|
|
// BINAIRE
|
|
|
|
|
|
|
|
|
|
VilleIUT** tiut2;
|
|
|
|
|
int nbVilles2;
|
|
|
|
|
|
|
|
|
|
tiut2 = readVilles(&nbVilles2);
|
|
|
|
|
|
|
|
|
|
//afficherListeDepartement(*tiut2[0]);
|
|
|
|
|
|
|
|
|
|
VilleIUT* grenoble = creerVille();
|
|
|
|
|
strcpy(grenoble->ville, "Grenoble");
|
|
|
|
|
|
|
|
|
|
ajouterVille(&tiut2, grenoble, &nbVilles2);
|
|
|
|
|
|
|
|
|
|
departement = creerDepartement("Informatique", 1426, "Simonette Caro");
|
|
|
|
|
|
|
|
|
|
tiut2[1]->ldept = ajouterDepartement(tiut2[1]->ldept, departement);
|
|
|
|
|
|
|
|
|
|
afficherListeVilles(tiut2, nbVilles2);
|
|
|
|
|
|
|
|
|
|
afficherDepartement(tiut2, nbVilles2, "CACA");
|
|
|
|
|
|
|
|
|
|
tiut2[0]->ldept = supprimerDepartement(tiut2[0]->ldept, "Testeuuu");
|
|
|
|
|
|
|
|
|
|
//afficherListeDepartement(*tiut2[0]);
|
|
|
|
|
|
|
|
|
|
modifierNbPlaces(tiut2, nbVilles2, "Clermond Ft", "Informatique", 140);
|
|
|
|
|
|
|
|
|
|
//afficherListeDepartement(*tiut2[1]);
|
|
|
|
|
|
|
|
|
|
//modifierNomResponsable(tiut2, nbVilles2);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
int chargementDonnees (VilleIUT *tiut[]){
|
|
|
|
|
int i=0;
|
|
|
|
|
FILE *fe;
|
|
|
|
|
if ((fe = fopen("iut.don","r"))==NULL){
|
|
|
|
|
fprintf(stderr, "Impossible d'ouvrir le fichier");
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
tiut[i] = (VilleIUT *)malloc(20*sizeof(VilleIUT));
|
|
|
|
|
if (tiut == NULL){
|
|
|
|
|
printf("\n Pb sur malloc\n");
|
|
|
|
|
exit(1);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
fscanf(fe, "%s", tiut[i]->ville);
|
|
|
|
|
fscanf(fe, "%d", tiut[i]->nbDep);
|
|
|
|
|
ListDept *l = creerListe();
|
|
|
|
|
MaillonDept maillon = (MaillonDept)malloc(sizeof(MaillonDept))
|
|
|
|
|
fscanf(fe, "%s\t%d\t%s", maillon -> departement, &maillon -> nbP, maillon -> responsable);
|
|
|
|
|
maillon -> suivant = NULL;
|
|
|
|
|
if (l->premier != NULL){
|
|
|
|
|
MaillonDept dep = l->premier;
|
|
|
|
|
while (dep -> suivant != NULL){
|
|
|
|
|
dep = dep->suivant;
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return i;
|
|
|
|
|
}*/
|
|
|
|
|