@ -5,37 +5,58 @@
void MenuAdministrateur ( VilleIUT * tiut [ ] , int n ) {
char departement [ 30 ] , respon [ 30 ] , Vmodif [ 31 ] , tVille [ 31 ] , tdepartemnt [ 30 ] , AouD ;
int choix , nbp , i , j , co mp , Mnbp , good = 0 , reussi = 0 ;
int choix = 1 , nbp , i , j , co deRet , Mnbp , good = 0 , reussi = 0 ;
VilleIUT V ;
printf ( " \n 0-Revenir au menu \n 1-Modifier place \n 2-Creer un departement \n 3-supprimer un département \n 4-Lancer et Arreter la phase de canditature \n 5-modifier nom responsable : " ) ;
scanf ( " \n %d " , & choix ) ;
while ( choix > 0 & & choix < 6 ) {
printf ( " \n >--------------------------------------------------------< \n " ) ;
printf ( " \n \t 0 - Revenir au menu " ) ;
printf ( " \n \t 1 - Modifier une place " ) ;
printf ( " \n \t 2 - Créer un département " ) ;
printf ( " \n \t 3 - Supprimer un département " ) ;
printf ( " \n \t 4 - Lancer et arrêter la phase de canditature " ) ;
printf ( " \n \t 5 - Modifier le nom d'un responsable " ) ;
printf ( " \n \t 6 - Afficher différents tableaux, FONCTION DE DEV UNIQUEMENT, A SUPPRIMER \n " ) ;
printf ( " \n >--------------------------------------------------------< \n " ) ;
printf ( " \n \t Votre choix : " ) ;
scanf ( " \n %d " , & choix ) ;
system ( " cls " ) ;
system ( " clear " ) ;
if ( choix = = 1 ) {
printf ( " \n Ville où se situe le departement à modifier : " ) ;
scanf ( " %s " , Vmodif ) ;
printf ( " \n departement à modifier: " ) ;
scanf ( " %s " , departement ) ;
for ( i = 0 ; i < n ; i + + ) {
comp = strcmp ( tiut [ i ] - > ville , Vmodif ) ;
if ( comp = = 0 ) {
for ( j = 0 ; j < tiut [ i ] - > nbDep ; j + + ) {
if ( strcmp ( tiut [ i ] - > ldept - > departement , departement ) = = 0 & & tiut [ i ] - > ldept - > AouD = = ' D ' ) {
printf ( " %c " , tiut [ i ] - > ldept - > AouD ) ;
printf ( " pb departement arret phase de candidature \n " ) ;
good = 1 ;
}
}
if ( good = = 0 ) {
printf ( " \n nombre de place apres modification : " ) ;
scanf ( " %d " , & Mnbp ) ;
tiut [ i ] - > ldept = ModifinbP ( tiut [ i ] - > ldept , departement , Mnbp , n ) ;
reussi = 1 ;
}
char rech [ 31 ] ;
int trouve = 0 ;
printf ( " \n Entrez le nom d'une ville ou d'un IUT : " ) ;
scanf ( " %s%*c " , & rech ) ;
for ( i = 0 ; i < n & & trouve ! = 1 ; i + + ) {
if ( strcmp ( tiut [ i ] - > ville , rech ) = = 0 ) {
printf ( " \n IUT trouvé à %s ! \n " , rech ) ;
trouve = 1 ;
codeRet = 0 ;
}
else if ( i = = n - 1 ) {
printf ( " \n Il n'y pas d'IUT dans votre ville. \n " ) ;
codeRet = 1 ;
}
}
if ( reussi = = 0 )
printf ( " pb erreur syntaxe \n " ) ;
//BUG CODE ICI -> RECHERCHE NON FONCTIONNELLE AVEC DEPARTEMENT, VOIR LIEN AVEC VILLE POUR TROUVER...
if ( codeRet = = 0 ) {
printf ( " \n Département à modifier : " ) ;
scanf ( " %s " , departement ) ;
for ( j = 0 ; j < tiut [ i ] - > nbDep ; j + + ) {
if ( strcmp ( tiut [ i ] - > ldept - > departement , departement ) = = 0 & & tiut [ i ] - > ldept - > AouD = = ' D ' ) {
printf ( " %c " , tiut [ i ] - > ldept - > AouD ) ;
printf ( " Problème, phase de candidature à l'arrêt pour ce département. \n " ) ;
good = 1 ;
}
}
if ( good = = 0 ) {
printf ( " \n Nombre de place après modification : " ) ;
scanf ( " %d " , & Mnbp ) ;
tiut [ i ] - > ldept = ModifinbP ( tiut [ i ] - > ldept , departement , Mnbp , n ) ;
reussi = 1 ;
}
if ( reussi = = 0 )
printf ( " \n Problème, erreur de syntaxe \n " ) ;
}
}
if ( choix = = 2 ) {
//creer departemement
@ -48,8 +69,7 @@ void MenuAdministrateur(VilleIUT *tiut[],int n){
printf ( " \n nom du responsable : " ) ;
scanf ( " %s " , respon ) ;
for ( i = 0 ; i < n ; i + + ) {
comp = strcmp ( tiut [ i ] - > ville , Vmodif ) ;
if ( comp = = 0 ) {
if ( strcmp ( tiut [ i ] - > ville , Vmodif ) ) {
tiut [ i ] - > ldept = Enfiler ( tiut [ i ] - > ldept , departement , nbp , respon ) ;
tiut [ i ] - > nbDep = tiut [ i ] - > nbDep + 1 ;
reussi = 1 ;
@ -65,8 +85,7 @@ void MenuAdministrateur(VilleIUT *tiut[],int n){
printf ( " \n departement : " ) ;
scanf ( " %s " , departement ) ;
for ( i = 0 ; i < n ; i + + ) {
comp = strcmp ( tiut [ i ] - > ville , Vmodif ) ;
if ( comp = = 0 ) {
if ( strcmp ( tiut [ i ] - > ville , Vmodif ) ) {
tiut [ i ] - > ldept = suppression ( tiut [ i ] - > ldept , departement ) ;
tiut [ i ] - > nbDep = tiut [ i ] - > nbDep - 1 ;
reussi = 1 ;
@ -84,8 +103,7 @@ void MenuAdministrateur(VilleIUT *tiut[],int n){
printf ( " \n Pour Activer taper A pour desactiver taper D : " ) ;
scanf ( " %c%*c " , & AouD ) ;
for ( i = 0 ; i < n ; i + + ) {
comp = strcmp ( tiut [ i ] - > ville , Vmodif ) ;
if ( comp = = 0 ) {
if ( strcmp ( tiut [ i ] - > ville , Vmodif ) ) {
tiut [ i ] - > ldept = ModifiAouD ( tiut [ i ] - > ldept , departement , AouD , n ) ;
reussi = 1 ;
}
@ -102,18 +120,20 @@ void MenuAdministrateur(VilleIUT *tiut[],int n){
printf ( " \n nom du responsable : " ) ;
scanf ( " %s " , respon ) ;
for ( i = 0 ; i < n ; i + + ) {
comp = strcmp ( tiut [ i ] - > ville , Vmodif ) ;
if ( comp = = 0 ) {
if ( strcmp ( tiut [ i ] - > ville , Vmodif ) ) {
tiut [ i ] - > ldept = ModifiRespon ( tiut [ i ] - > ldept , departement , respon , n ) ;
reussi = 1 ;
}
}
}
if ( reussi = = 0 )
printf ( " pb erreur syntaxe \n " ) ;
}
affichage ( tiut , n ) ;
printf ( " \n Voulez-vous choisir une autre fonction ? Sinon taper 0 pour valider : " ) ;
scanf ( " %d%*c " , & choix ) ;
if ( choix = = 6 ) {
//Fonction servant au développement du programme, fonction de test uniquement, à supprimer peut-être.
affichage ( tiut , n ) ;
char a [ 50 ] ;
scanf ( " %c%*c " , a ) ;
}
}
}