Modif menus et ajout de fonctions de listes / gererAdmission / ...

master
Maël DAIM 2 years ago
parent 5640994c23
commit 69de74a317

167
Msae.c

@ -563,7 +563,7 @@ void lancerPhaseCandidature(int *phaseCandidature)
clearpage();
}
/*autre*/
int comptClermont(tCand,int tMax)
int comptClermont(Candidat *tCand[],int tMax)
{
int i=0,compt=0,j=0;
for(i=0;i<tMax;i++)
@ -667,7 +667,7 @@ int login(Candidat *tCand[],int *tMax,int *pos) /* Affiche un menu de connexion
}
}
void menuAdmin(VilleIUT *tiut[], int *tLog, int tMax,int *phaseCandidature,FileCand *f,ListeCand *ladmis) /* Affiche un menu de choix adaptés pour un administrateur et appelle les fonctions en conséquence */
void menuAdmin(VilleIUT *tiut[], int *tLog, int tMax,Candidat *tCand[],int tMaxC,int *phaseCandidature,FileCand *f,ListeCand *ladmis)/* Affiche un menu de choix adaptés pour un administrateur et appelle les fonctions en conséquence */
{
int select, pos;
int trouve,nbClfd;
@ -771,15 +771,15 @@ void menuAdmin(VilleIUT *tiut[], int *tLog, int tMax,int *phaseCandidature,FileC
lancerPhaseCandidature(phaseCandidature);
if (*phaseCandidature==2)
{
nbClfd=comptClermont(tCand,tMax);
nbClfd=comptClermont(tCand,tMaxC);
tIntermediaire=(Candidat **)malloc(nbClfd*sizeof(Candidat*));
if(tIntermediaire==NULL)
{
printf("Problème d'allocation\n");
exit(1);
}
tIntermediaire=remplirCandCl(tCand,tIntermediaire,tMax,nbClfd);
*f=insertFile(tIntermediaire,tMax);
tIntermediaire=remplirCandCl(tCand,tIntermediaire,tMaxC,nbClfd);
*f=insertFile(tIntermediaire,nbClfd);
}
}
printf("__________________________________________________________\n");
@ -800,11 +800,12 @@ void menuAdmin(VilleIUT *tiut[], int *tLog, int tMax,int *phaseCandidature,FileC
}
}
void menuCandidat(VilleIUT *tiut[], int *tLog, int tMax,Candidat *tCand[],int tMaxC,int posC,int phaseCandidature,FileCand *f,ListeCand *ladmis)
void menuCandidat(VilleIUT *tiut[], int *tLog, int tMax,Candidat *tCand[],int tMaxC,int posC,int phaseCandidature,FileCand *f,ListeCand *ladmis,float mini)
{
int select, pos,i,retour,majChoix,j=0;
char ville[31], dept[31];
int trouve;
ListeCand suppr;
MaillonDept *m;
system("clear");
printf("______________________________________________________________\n");
@ -936,7 +937,17 @@ void menuCandidat(VilleIUT *tiut[], int *tLog, int tMax,Candidat *tCand[],int tM
}
if(retour==-1)
{
while (j<tCand[pos]->nombreChoix)
{
if(strcmp(tCand[pos]->tChoix[j]->ville, "Clermont-Ferrand") == 0 && strcmp(tCand[pos]->tChoix[j]->dep, "Informatique") == 0)
{
tCand[pos]->tChoix[j]->decisionCand=-1;
break;
}
}
suppr=rechercherCandListe(*ladmis,tCand[pos]->numeroC,&trouve);
*ladmis=supprimerCand(*ladmis,tCand[pos]);
*f=fileToAdmis(*f,ladmis,1,mini);
}
}
}
@ -964,53 +975,104 @@ void menuCandidat(VilleIUT *tiut[], int *tLog, int tMax,Candidat *tCand[],int tM
}
void menuResp(Candidat *tCand[],int tMax,int phaseCandidature,FileCand *f,ListeCand *ladmis)
void menuResp(Candidat *tCand[],int tMax,int phaseCandidature,FileCand *f,ListeCand *ladmis,float *mini)
{
int admis,deci,trouve,pos,posC,i;
float mini;
system("clear");
printf("Quel est le nombre de candidat admis ?\t");
scanf("%d%*c",&admis);
printf("\nQuelle moyenne minimale les candidats doivent avoir ?\t");
scanf("%f",&mini);
printf("\n\nVoici les candidats ayant sélectionner votre département :\t");
afficher(*f);
printf("Voulez-vous en refuser ? (insérer son numéro ou 0 pour quitter)\t");
scanf("%d%*c",&deci);
while (deci!=0)
int select=0;
while(select!=9)
{
pos=rechercherCandidat(tCand,tMax,deci, &trouve);
if(trouve==1)
system("clear");
printf("___________________________________________________________\n");
printf("| Menu Responsable |\n");
printf("|---------------------------------------------------------|\n");
printf("| 1 Déclarez une moyenne minimale (obligatoire) |\n");
printf("| 2 Gérer les admissions |\n");
printf("| 3 Afficher la liste des admissions ou la file d'attente |\n");
printf("| 9 Quitter |\n");
printf("|_________________________________________________________|\n");
printf("\nSaisie :\t");
scanf("%d%*c",&select);
if(select==1)
{
printf("Quelle est la moyenne minimale pour entrer dans votre département?\t");
scanf("%f",mini);
}
if(select==2)
{
posC=rechercherChoix(tCand[pos]->tChoix,tCand[pos]->nombreChoix,"Clermont-Ferrand","Informatique",&trouve);
tCand[pos]->tChoix[posC]->decisionResp=-1;
gererAdmis(f,ladmis,*mini);
}
if(select==3)
{
afficherCandidatsParCategorie(*f,*ladmis);
}
else printf("Mauvais numéro. Taper 0 pour quitter\n");
printf("Voulez-vous en refuser ? (insérer son numéro ou 0 pour quitter)\t");
scanf("%d%*c",&deci);
}
*ladmis=listeCandNouv();
*f=fileToAdmis(*f,ladmis,admis);
printf("Voi");
clearpage();
}
void gererAdmis(FileCand *f, ListeCand *l,float mini)
{
int select=0,admis,i=0;
char choix;
Candidat *c;
while (select!=9)
{
system("clear");
printf("1 Accepter des candidats\n");
printf("2 Refuser des candidats\n");
printf("9 Quitter\n");
scanf("%d%*c",&select);
if(select==1)
{
afficher(*f);
printf("\nCombien de candidats voulez vous accepter?\t");
scanf("%d%*c",&admis);
*f=fileToAdmis(*f,l,admis,mini);
afficherListeCand(*l);
}
if(select==2)
{
c=tete(*f);
afficherCandidat(c);
printf("Refuser le candidat?(o/n)");
scanf("%c",&choix);
if(choix=='o'||choix=='O')
{
*f=supt(*f);
while(i<c->nombreChoix)
{
if (strcmp(c->tChoix[i]->ville, "Clermont-Ferrand") == 0 && strcmp(c->tChoix[i]->dep, "Informatique") == 0)
{
c->tChoix[i]->decisionResp=-1;
}
i++;
}
}
}
}
clearpage();
}
FileCand fileToAdmis(FileCand f, ListeCand *l, int nbAdmis)
FileCand fileToAdmis(FileCand f, ListeCand *l, int nbAdmis,float mini)
{
int j;
Candidat *c;
while(nbAdmis!=0)
{
c=f.t->c;
f=supt(f);
*l=insererCandEntete(*l,c);
for(j = 0; j < c->nombreChoix; j++)
if(f.t->c->moyenne>=mini)
{
if(strcmp(c->tChoix[j]->ville, "Clermont-Ferrand") == 0 && strcmp(c->tChoix[j]->dep, "Informatique") == 0)
c=f.t->c;
f=supt(f);
*l=insererCandEntete(*l,c);
for(j = 0; j < c->nombreChoix; j++)
{
c->tChoix[j]->decisionResp = 1;
if(strcmp(c->tChoix[j]->ville, "Clermont-Ferrand") == 0 && strcmp(c->tChoix[j]->dep, "Informatique") == 0)
{
c->tChoix[j]->decisionResp = 1;
}
}
nbAdmis--;
}
nbAdmis--;
else f=supt(f);
}
return f;
}
@ -1059,6 +1121,7 @@ void clearpage(void) /* Permet de demander à l'utilisateur pour continuer à la
void globale(void) /* Permet l'initialisation du tableau, le chargement de celui-ci et l'appel des fonctions login, menus et enregistrement */
{
int tLog, retour,tMax,numC,phaseCandidature=0,pos;
float mini;
Candidat **tCand;
VilleIUT *tiut[100]; /* Déclaration du tableau de pointeurs tiut */
FileCand f;
@ -1083,16 +1146,16 @@ void globale(void) /* Permet l'initialisation du tableau, le chargement de celui
{
if(retour == 1)
{
menuAdmin(tiut, &tLog, 100,&phaseCandidature);
menuAdmin(tiut, &tLog, 100,tCand,tMax,&phaseCandidature,&f,&ladmis);
}
if(retour == 0)
{
menuCandidat(tiut, &tLog, 100,tCand,tMax,pos,phaseCandidature);
menuCandidat(tiut, &tLog, 100,tCand,tMax,pos,phaseCandidature,&f,&ladmis,mini);
}
retour = login(tCand,&tMax,&pos);
if(retour==3)
{
menuResp(tCand,tMax;phaseCandidature);
menuResp(tCand,tMax,phaseCandidature,&f,&ladmis,&mini);
}
}
enregistrement(tiut, tLog);
@ -1884,7 +1947,7 @@ Candidat** remplirCandCl(Candidat *tCand[], Candidat *tempC[], int tMax, int nbC
{
for(j = 0; j < tCand[i]->nombreChoix; j++)
{
if(strcmp(tCand[i]->tChoix[j]->ville, "Clermont-Ferrand") == 0 && strcmp(tCand[i]->tChoix[j].dep, "Informatique") == 0)
if(strcmp(tCand[i]->tChoix[j]->ville, "Clermont-Ferrand") == 0 && strcmp(tCand[i]->tChoix[j]->dep, "Informatique") == 0)
{
tempC[k] = tCand[i];
k = k + 1;
@ -1918,3 +1981,23 @@ int plusGrandCandTemp(Candidat *tCand[], int nbCl) /* Fonction permettant de tro
}
return maxi;
}
void afficherCandidatsParCategorie(FileCand f,ListeCand l)
{
int categ, i, pos, trouve;
printf("Quelle catégorie de candidats souhaitez-vous afficher ? (admis = 1 / attente = 2)\nSaisie : ");
scanf("%d%*c", &categ);
printf("\n");
if(categ==1)
{
afficherListeCand(l);
}
}
void afficherListeCand(ListeCand l)
{
while(l->suiv!=NULL)
{
afficherCandidat(l->c);
}
}
Loading…
Cancel
Save