modif menus login et lancerCandidature

master
Maël DAIM 2 years ago
parent 13a9d34ad0
commit 268b2f3ec4

157
Msae.c

@ -532,7 +532,10 @@ void lancerPhaseCandidature(int *phaseCandidature)
{
char choix;
system("clear");
printf("Êtes-vous sur de lancer la phase de candidature?(o/n)");
if (*phaseCandidature==0)
{
printf("La phase de candidature n'a pas été lancée.\n");
printf("\nÊtes-vous sur de lancer la phase de candidature?(o/n)\t");
scanf("%c",&choix);
if(choix!='O' && choix!='o')
{
@ -543,6 +546,23 @@ void lancerPhaseCandidature(int *phaseCandidature)
}
*phaseCandidature=1;
printf("\nLa phase de candidature a été lancée.\n");
}
if(*phaseCandidature==1)
{
printf("La phase de candidature est en court.\n");
printf("\nÊtes-vous sur d'arrêter la phase de candidature?(o/n)\t");
scanf("%c",&choix);
if(choix!='O' && choix!='o')
{
printf("La phase de candidature n'a pas été arrêtée.\n");
scanf("%c",&choix);
clearpage();
return;
}
*phaseCandidature=2;
printf("\nLa phase de candidature a été arrêtée.\n");
}
clearpage();
}
@ -628,8 +648,6 @@ int login(Candidat *tCand[],int *tMax,int *pos) /* Affiche un menu de connexion
}
}
void menuAdmin(VilleIUT *tiut[], int *tLog, int tMax,int *phaseCandidature) /* Affiche un menu de choix adaptés pour un administrateur et appelle les fonctions en conséquence */
{
int select, pos;
@ -677,6 +695,8 @@ void menuAdmin(VilleIUT *tiut[], int *tLog, int tMax,int *phaseCandidature) /* A
{
creerDept(tiut, *tLog);
}
if(*phaseCandidature==0)
{
if(select == 4)
{
retirerDept(tiut, *tLog);
@ -725,6 +745,8 @@ void menuAdmin(VilleIUT *tiut[], int *tLog, int tMax,int *phaseCandidature) /* A
}
}
}
}
if(select==8)
{
lancerPhaseCandidature(phaseCandidature);
@ -823,6 +845,8 @@ void menuCandidat(VilleIUT *tiut[], int *tLog, int tMax,Candidat *tCand[],int tM
{
afficheDeptDesIUT(tiut,*tLog);
}
if(phaseCandidature==1)
{
if(select == 5)
{
for(i = 0; i < tCand[pos]->nombreChoix; i++)
@ -848,10 +872,14 @@ void menuCandidat(VilleIUT *tiut[], int *tLog, int tMax,Candidat *tCand[],int tM
}
clearpage();
}
}
if(phaseCandidature=2)
{
if(select == 8)
{
miseAJourChoixCand(tCand[pos]->tChoix, tCand[pos]->nombreChoix);
}
}
printf("______________________________________________________________\n");
printf("| MENU CANDIDAT |\n");
printf("|------------------------------------------------------------|\n");
@ -1527,3 +1555,126 @@ int rechercherCandidat(Candidat *tCand[], int tMax, int numeroC, int *trouve) /*
return inf;
}
/**************************************** File d'attente ****************************************************/
/************************************************************************************************************/
/************************************************************************************************************/
FileCand filenouv(void)
{
FileCand f;
f.t = NULL;
f.q = NULL;
return f;
}
FileCand adjq(FileCand f, Candidat *c)
{
MaillonCandidat *m;
m = (MaillonCandidat *)malloc(sizeof(MaillonCandidat));
if(m == NULL)
{
printf("Erreur de malloc pour la file d'attente\n");
exit(1);
}
m->c = c;
m->suiv = NULL;
if(videFile(f))
{
f.t = m;
f.q = m;
return f;
}
f.q->suiv = m;
f.q = m;
return f;
}
FileCand supt(FileCand f)
{
MaillonCandidat *aux;
if(videFile(f))
{
printf("Opération interdite\n");
exit(1);
}
if(f.t == f.q)
{
free(f.t);
return filenouv();
}
aux = f.t;
f.t = f.t->suiv;
free(aux);
return f;
}
FileCand supCand(FileCand f, int numeroC)
{
}
Candidat * tete(FileCand f)
{
if(videFile(f))
{
printf("File d'attente vide\n");
exit(1);
}
return f.t->c;
}
int longueur(FileCand f)
{
int i = 0;
while(f.t != NULL)
{
f.t = f.t->suiv;
i++;
}
return i;
}
int positionFileAttente(FileCand f, int numeroC)
{
int i = 0;
while(f.t != NULL)
{
if(numeroC == f.t->c->numeroC)
{
return i;
}
f.t = f.t->suiv;
i++;
}
return i;
}
bool vide(FileCand f)
{
if(f.t == NULL && f.q == NULL)
return true;
return false;
}
void afficher(FileCand f)
{
printf("|----------------------------------------------------------------------------|\n");
printf("| Liste d'attente |\n");
printf("|----------------------------------------------------------------------------|\n");
while(f.t != NULL)
{
printf("| %-4d | %-32s | %-32s |\n",f.t->c->numeroC, f.t->c->nom, f.t->c->prenom);
printf("|----------------------------------------------------------------------------|\n");
f.t = f.t->suiv;
}
printf("\n");
}
bool videFile(FileCand f)
{
if(f.t==f.q)
{
return true;
}
return false;
}
Loading…
Cancel
Save