Location: PHPKode > projects > DarkCity > controleur.php
<?php
/**
 * controleur.php : Controleur de navigation de DarkCity
 *
 * Date    : 06/06/2009
 * Auteur  : Philippe Bousquet
 * Version : 1.1
 * Contact : <hide@address.com>
 *
 * révision le 06/06/2009 
 *     Auteur  : Philippe Bousquet
 *     Version : 1.1
 *     Raison  : FS#147 - [Nouveauté 1.1] - La prise de notes 
 * 	 
 * Copyright (c) 2008-2009 Philippe & Thierry Bousquet.
 *
 * Ce logiciel est distribué selon les termes de la GNU General Public License v2.
 */  
 
  include("databean/FicheAdversaireDataBean.php");
  include("databean/CompetenceDataBean.php");
  include("databean/MiniFicheDataBean.php");
  include("databean/MetiersDataBean.php");
  include("databean/ActivitesDataBean.php");

  include("includes/Chrono.php");
  $chrono = new Chrono;
  $chrono->start();

  // On positionne l'error reporting
  error_reporting('E_ERROR');
  
  // On charge les d�pendances n�cessaires
  include("includes/config.php");
  include("includes/SessionManager.php");
  include("includes/UserManager.php");
  include("dao/Datasource.php");
  include("includes/ErrorManager.php");
  include("includes/InfoManager.php");
  include("includes/LogManager.php");
  include("includes/DateManager.php");
  include("includes/SystemeDes.php");
  include("databean/MenuDataBean.php");
  
  // On Cr�e les diff�rents Managers
  $logManager = new LogManager;
  $logManager->setActive($FALSE);
  $logManager->setActivePerf($FALSE);
  $logManager->message("controlleur : Creation des managers");
  $sessionManager = new SessionManager;
  $userManager = new UserManager;
  $errorManager = new ErrorManager;
  $infoManager = new InfoManager;
  $infoManager->razMessage();
  $dateManager = new DateManager;
  $systemeDes = new SystemeDes($XP_MULTIPLIEUR);

  // Connection � la base de donn�es
  $datasource = new Datasource($dbHost, $dbName, $dbuser, $dbpasswd);
  $logManager->message("controlleur : Connection a base de donnees");

  // fichiers necessaires au MessageManager
  $logManager->message("controlleur : MessageManager");
  include("dao/objets/Darkcity_message.php");
  include("dao/accesseurs/Darkcity_messageDao.php");
  include("includes/MessageManager.php");
  $messageManager = new MessageManager($datasource, $sessionManager);
  
  // Une action est elle demand�e
//  $action = (isset($_POST["action"]) ? $_POST["action"] :(isset($_GET["action"]) && ($_GET["action"]=="activate" || $_GET["action"]=="accueil" || $_GET["action"]=="news" || $_GET["action"]=="images" || $_GET["action"]=="crédits" || $_GET["action"]=="soutien" || $_GET["action"]=="oubli" || $_GET["action"]=="desinscrire") ? $_GET["action"] : ""));
  $action = (isset($_POST["action"]) ? $_POST["action"] :(isset($_GET["action"]) && ($_GET["action"]=="activate" || $_GET["action"]=="accueil" || $_GET["action"]=="news" || $_GET["action"]=="images" || $_GET["action"]=="crédits" || $_GET["action"]=="soutien" || $_GET["action"]=="oubli" || $_GET["action"]=="desinscrire" || $_GET["action"]=="contacts") ? $_GET["action"] : ""));
  $pageCourante = (isset($_POST["pageCourante"])?$_POST["pageCourante"]:"");

  $logManager->message("controleur : pageCourante=".$pageCourante." action=".$action);

  /**
   * Mise à jour des paramètres journaliers
   */
  //include("metier/maj_paramjour.php");
  
  /**
   * Actions sur le premier menu
   */
  if ($action == "accueil") {
    include("metier/init_news.php");
    include("metier/init_login.php");
    include("vue/login.php");
    exit;
  } 
  else if ($action == "news") {
    include("metier/init_news.php");
    include("vue/news.php");
    exit;
  }
  else if ($action == "images") {
    include("vue/screenshots.php");
    exit;
  }
  else if ($action == "crédits") {
    include("vue/credits.php");
    exit;
  }
  else if ($action == "soutien") {
    include("vue/soutiens.php");
    exit;
  }
  else if ($action == "contacts") {
    include("vue/contact.php");
    exit;
  } 
  else if ($action == "oubli") {
    include("vue/oubli.php");
    exit;
  } 
  else if ($action == "desinscrire") {
    include("vue/desinscrire.php");
    exit;
  } 
  
  /**
   * action activer ?
   */
  if ($action == "activate") {
    include("metier/activer.php");
    if ($continuer) {
         include("metier/maj_session.php"); 	
         $menuDataBean = new MenuDataBean;
         $menuDataBean->activeTous();
         $pageCourante = "fichePerso";
         include("metier/init_fichePerso.php");
         include("vue/fichePerso.php");
    }
    else {
         include("metier/init_news.php");
         include("metier/init_login.php");
         include("vue/login.php");
    }
    exit;
  }

  /**
   * Mot de passe oublié
   */
  if ($pageCourante == "oubli" && $action == "regénérer") {
    include("metier/action_oubli.php");
    if ($continuer) {
       include("metier/init_news.php");
       include("metier/init_login.php");
       include("vue/login.php");
       exit;
     }
     else {
       include("vue/oubli.php");
       exit;
     }
  } 
   
  /**
   * Desinscrire le joueur ?
   */
  if ($pageCourante == "desinscrire" && $action == "désinscrire") {
    include("metier/action_desinscrire.php");
    if ($continuer) {
       include("metier/init_news.php");
       include("metier/init_login.php");
       include("vue/login.php");
       exit;
     }
     else {
       include("vue/desinscrire.php");
       exit;
     }
  } 
    
  $datePrec = $sessionManager->load("date");
  $date = (isset($_GET["date"])?$_GET["date"]:"");
  $sessionManager->save("date",$date);
  if ($date == $datePrec) {
    $logManager->message("ACTUALISER demandé, on bloque [".$date."][".$datePrec."]");
    $action = "";
  }
  
  // Action sp�cifique via URL
  if ($_GET["pageCourante"]=="ville") {
    $action = (isset($_GET["action"])?$_GET["action"]:"");
    $pageCourante =(isset($_GET["pageCourante"])?$_GET["pageCourante"]:"");
  }

  // On chare la session
  $connecte = $userManager->isValid($sessionManager);

  // On continue le traitement 
  $continuer = $TRUE;
   
  /**
   * Actions sur la page Login
   */
  if ($pageCourante == "login") {
    $logManager->message("controlleur : login");
    // On se connecte
    if ($action == "connecter") {
      include("metier/connecter.php");
      if (!$errorManager->isError()) {
    $logManager->message("controlleur : majSession");
         include("metier/maj_session.php"); 	
         $menuDataBean = new MenuDataBean;
         $menuDataBean->activeTous();
    $logManager->message("controlleur : initFicherPerso");
         include("metier/init_fichePerso.php");
    $logManager->message("controlleur : vueFicherPerso");
         $pageCourante = "fichePerso";
         include("vue/fichePerso.php");
         exit;
      }
    }
    // On se cree un nouveau perso
    if ($action == "nouveau") {
      include("vue/conditions.php");
      exit;
    }
  }
  /**
   * Actions sur la page Conditions
   */
  else if ($pageCourante == "conditions") {
    if ($action == "continuer") {
      include("metier/controle_cdt.php");
      if ($continuer) {
        include("vue/creation.php");
      } 
      else {
        include("vue/conditions.php");
      }
      exit;
    }
  }
  /**
   * Actions sur la page Creation
   */
  else if ($pageCourante == "creation") {
    $logManager->message("controlleur : creation");
    // On cree le perso
    if ($action == "créer") {
      include("metier/enregistrer_user.php");
      if (!$errorManager->isError()) {
/*      	
         include("metier/maj_session.php"); 	
         $menuDataBean = new MenuDataBean;
         $menuDataBean->activeTous();
         include("metier/init_fichePerso.php");
         include("vue/fichePerso.php");
*/         
         include("metier/init_news.php");
         include("metier/init_login.php");         
         include("vue/login.php");
         exit;
      }  
      include("vue/creation.php");
      exit;
    }
    // On revient sur la page login
    if ($action == "retour") {
      include("metier/init_news.php");
      include("metier/init_login.php");
      include("vue/login.php");
      exit;
    }
  }
  /**
   * Le joueur est hautentifi�
   */
  else if ($connecte) {
    $logManager->message("controleur : minifiche");
    include("metier/maj_session.php"); 	
    $menuDataBean = new MenuDataBean;
    $menuDataBean->activeTous();
    include("metier/init_menu.php");
    include("metier/init_minifiche.php");
    
    /**
     * Actions communes
     */
    $logManager->message("controlleur : action communes");
    // on affiche la fiche
    if ($action == "fiche") {
      include("metier/init_fichePerso.php");
      $pageCourante = "fichePerso";
      include("vue/fichePerso.php");
      exit;
    }
    // on affiche la messagerie
    if ($action == "messages") {
      include("metier/init_messages.php")	;
      $pageCourante = "messages";
      include("vue/messages.php")	;
      exit;
    }
    // on affiche la planque
    if ($action == "planque") {
      include("metier/init_planque.php")	;
      $pageCourante = "planque";
      include("vue/planque.php")	;
      exit;
    }
   if (!$menuDataBean->isOccupe()) {
    // on affiche la ville
    if ($action == "ville") {
      $pageCourante = "ville";
      include("vue/ville.php")	;
      exit;
    }
   } 
    // on affiche les higscores
    if ($action == "high-score") {
      include("metier/init_highscore.php")	;
      $pageCourante = "highscore";
      include("vue/highscore.php")	;
      exit;
    }
    // on ferme la session et on retourne sur la page login
    if ($action == "quitter") {
      include("metier/fin_session.php"); 	
      include("metier/init_news.php");
      include("metier/init_login.php");
      include("vue/login.php");
      exit;
    }
    if ($pageCourante == "fichePerso") {
        $logManager->message("controlleur : action fichePerso");
    	// On modifie la description
    	if ($action == "modifier") {
    	  include("metier/modifier_description.php");
        include("metier/init_fichePerso.php");
        $pageCourante = "fichePerso";
        include("vue/fichePerso.php");
        exit;
    	}
    }
    
   if ($pageCourante == "fichePerso") {
     // On jete un objet
     if ($action == "jeter") {
    	  include("metier/jeter_objet.php");
     }
   }

      if ($pageCourante == "planque") { 
        $logManager->message("controlleur : action planque quartier");
        if ($action == "regarder") {
            include("metier/init_planqueNews.php")	;
            include("vue/planque_tv.php")	;
            exit;
        }
        if ($action == "lire") {
            include("metier/init_notes.php")	;
            include("vue/notes.php")	;
            exit;
        }
      }

      if ($pageCourante == "planque_tv") { 
        $logManager->message("controlleur : action planque_tv");
        if ($action == "rafraichir") {
            include("metier/init_planqueNews.php")	;
            include("vue/planque_tv.php")	;
            exit;
        }
      }

      if ($pageCourante == "notes") { 
        $logManager->message("controlleur : action enregistrer notes");
        if ($action == "enregistrer") {
            include("metier/enregistrer_notes.php")	;
            include("metier/init_planque.php")	;
            include("vue/planque.php")	;
            exit;
        }
        if ($action == "retour") {
          include("metier/init_planque.php")	;
          $pageCourante = "planque";
          include("vue/planque.php")	;
          exit;
        }
      }
      
      
    /**
     * Action sur la page fichePerso
     */
   if (!$menuDataBean->isOccupe()) {
    $logManager->message("controleur : action fichePerso");
    if ($pageCourante == "fichePerso") {
        $logManager->message("controlleur : action fichePerso");
    	// On change le style de combat
    	if ($action == "changer") {
    	  include("metier/change_combat.php");
    	}
    	// On modifie la description
    	if ($action == "modifier") {
    	  include("metier/modifier_description.php");
    	}
    	// On active un objet
    	if ($action == "activer") {
    	  include("metier/active_objet.php");
    	}
    	// On active un objet
    	if ($action == "désactiver") {
    	  include("metier/desactive_objet.php");
    	}
    	// On jete un objet
    	if ($action == "soigner") {
    	  include("metier/action_soigner.php");
    	}
    	// On jete un objet
    	if ($action == "réparer") {
    	  include("metier/action_reparer.php");
    	}
      include("metier/init_fichePerso.php");
      $pageCourante = "fichePerso";
      include("vue/fichePerso.php");
      exit;
    }  
    }
    /**
     * Action sur la page message
     */
     $logManager->message("controlleur : action PageMessage");
     if ($_GET["pageCourante"]=="messages") {
       $action = (isset($_GET["action"])?$_GET["action"]:"");
       $pageCourante = (isset($_GET["pageCourante"])?$_GET["pageCourante"]:"");
     }
     if ($pageCourante == "messages") {
       // On lit un message
       if ($action == "lire") {
         include("metier/lire_message.php");
         include("vue/messages.php")	;
         exit;
       }
       // On lit un message
       if ($action == "supprimer") {
         include("metier/delete_message.php");
         include("metier/init_messages.php");
         include("vue/messages.php");
         exit;
       }
       if ($action == "nouveau") {
         include("metier/init_messages.php");
         include("metier/new_message.php");
         include("vue/messages.php");
         exit;
       }
       if ($action == "répondre") {
         include("metier/init_messages.php");
         include("metier/repondre_message.php");
         include("vue/messages.php");
         exit;
       }
       if ($action == "envoyer") {
         include("metier/create_message.php");
         if (!$errorManager->isError()) {
           include("metier/init_messages.php");
         }
         include("vue/messages.php");
         exit;
       }
       if ($action == "vider") {
         include("metier/vider_messages.php");
         include("metier/init_messages.php");
         include("vue/messages.php");
         exit;
       }
       if ($action == "tchatter") {
         include("metier/action_chat.php");
         include("vue/chat.php");
         exit;
       }
     }
     if ($pageCourante == "chat") {
         include("metier/action_chat.php");
         include("vue/chat.php");
         exit;
     }

   if (!$menuDataBean->isOccupe()) {

   /**
    * Actions sur la page Ville
    */
      if ($pageCourante == "ville") {
      $logManager->message("controlleur : action ville");
      // On va � l'h�pital
      // On va � l'h�pital
    	if ($action == "Hopital") {
          include("vue/hopital.php")	;
          exit;
        }
      // On va se bouurer la gueule
        if ($action == "Bar") {
          include("vue/bar.php")	;
          exit;
    	}
      // On va chez l'armurier
        if ($action == "Armurier") {
          include("metier/init_armurier_inventaire.php")	;
          include("vue/armurier_inventaire.php")	;
          exit;
    	}
      // On va chez le concessionnaire
        if ($action == "Concessionnaire") {
          include("metier/init_concessionnaire_inventaire.php");
          include("vue/concessionnaire_inventaire.php")	;
          exit;
    	}
      // On va a la mairie
        if ($action == "Mairie") {
          include("metier/init_user_admin.php");
          include("vue/mairie.php") ;
          exit;
      }
      // On va chez le marchand
        if ($action == "Marchand") {
          include("metier/init_marchand_inventaire.php")	;
          include("vue/marchand_inventaire.php")	;
          exit;
    	}
      // On va dans la zone d'affaire
        if ($action == "Zone d Affaires") {
          include("metier/init_zoneAffaires.php"); 
          include("vue/zoneAffaires.php")	;
          exit;
    	}
      // On va au centre de loisir
        if ($action == "Centre de Loisir") {
          include("metier/init_centreLoisir.php");
          include("vue/centreLoisir.php") ;
          exit;
      }
      // On va au poste de police
        if ($action == "Poste de Police") {
          include("metier/init_police.php")	;
          include("vue/police.php")	;
          exit;
    	}
      // On va au QG de la mafia
        if ($action == "QG de la Mafia") {
          include("vue/mafia.php")	;
          exit;
    	}
      // On part en vacances
        if ($action == "Aeroport") {
          include("vue/aeroport.php")	;
          exit;
    	}
      // On va chez le chirurgien
        if ($action == "Chirurgien") {
          include("metier/init_user_admin.php");
          include("vue/chirurgien.php") ;
          exit;
        }
      // On va au Casino
        if ($action == "Casino") {
          include("metier/action_casino.php");
          include("vue/casino.php") ;
          exit;
        }
      // On va dans la rue 
        if ($action == "Flâner") {
          include("metier/init_flanerRue.php");
          if ($continuer) {
            // On est dans un sc�nario
            if ($event_rue == 1) {
              include("metier/init_scenario_rue.php");
              include("vue/scenario_rue.php");
              exit;
            }
            // on fait une rencontre avec un PNJ
            else {
              include("metier/init_combat_rue.php");
              $sessionManager->save("pnj",$ficheAdvDataBean);
              include("vue/rue_combat.php");
              exit;
            }
          }
          else {
            include("vue/ville.php");
            exit;
          }
    	}
      }

   /**
    * Actions sur la page Bar
    */
      if ($pageCourante == "bar") {
        $logManager->message("controlleur : action bar");
        // On commande un verre
    	if ($action == "commander") {
          include("metier/boire_bar.php")	;
          if ($continuer) {
            include("metier/init_fichePerso.php");
            include("vue/fichePerso.php");
            exit;
          }
          else {
            include("vue/bar.php")	;
            exit;
          }
        }
        // On cherche la bagarre
    	if ($action == "provoquer") {
          include("metier/recherche_bar.php")	;
          if ($continuer) {
            include("vue/bar_combat.php");
            exit;
          }
          else {
            include("vue/bar.php")	;
            exit;
          }
        }
       if ($action == "tchatter") {
         include("metier/action_chat.php");
         include("vue/chat.php");
         exit;
       }
        // On retourne en ville
    	if ($action == "sortir") {
          include("vue/ville.php")	;
          exit;
        }
      }  
      if ($pageCourante == "bar_combat") {
        $logManager->message("controlleur : action bar_combat");
        // On commande un verre
    	if ($action == "bagarre") {
    	  include("metier/action_bagarre.php");	
    	  include("vue/bagarre_pnj_fin.php");	
        //  include("metier/init_fichePerso.php");
        //  include("vue/fichePerso.php");
          exit;
        }
        // On cherche la bagarre
    	if ($action == "abandon") {
    	  include("metier/abandon_cbt_bar.php");	
          include("metier/init_fichePerso.php");
          include("vue/fichePerso.php");
          exit;
        }
      }  

    /**
     * Actions sur la page hoptial
     */
      if ($pageCourante == "Hopital") {
      $logManager->message("controlleur : action Hopital");
      // On achete des soins
      if ($action == "Acheter") {
          include("metier/action_soins_hopital.php") ;
          if ($continuer) {
            include("metier/init_fichePerso.php");
            include("vue/fichePerso.php");
            exit;
          }
          else {
            include("vue/hopital.php");
            exit;
          }
        }
      // On sort de l'hopital
        if ($action == "Sortir") {
          include("vue/ville.php")	;
          exit;
    	}
      }

     /**
     * Actions sur la page concessionnaire
     */
      if ($pageCourante == "concessionnaire") {
      $logManager->message("controlleur : action Concessionnaire");
      // On sort du concessionnaire
        if ($action == "Sortir") {
          include("vue/ville.php")	;
          exit;
    	}
        if ($action == "Vos véhicules") {
          include("metier/init_concessionnaire_inventaire.php");
          include("vue/concessionnaire_inventaire.php")	;
          exit;
    	}
        if ($action == "Véhicules en vente") {
          include("metier/init_concessionnaire_envente.php");
          include("vue/concessionnaire_envente.php")	;
          exit;
    	}
        // On fait réparer
        if ($action == "Réparer") {
          if ($continuer) {
      	    include("metier/action_faire_reparer.php");
            include("metier/init_fichePerso.php");
            include("vue/fichePerso.php");
            exit;
          }
          else {
            include("metier/init_concessionnaire_inventaire.php");
            include("vue/concessionnaire_inventaire.php")	;
            exit;
          }
        }
        if ($action == "Vendre") {
    	  include("metier/action_vendre_objet.php");
          include("metier/init_concessionnaire_inventaire.php");
          include("vue/concessionnaire_inventaire.php")	;
          exit;
        }
        if ($action == "Acheter") {
          include("metier/action_acheter.php");
          include("metier/init_concessionnaire_envente.php");
          include("vue/concessionnaire_envente.php")	;
          exit;
        }
      }

     /**
     * Actions sur la page marchand
     */
      if ($pageCourante == "marchand") {
      $logManager->message("controlleur : action marchand");
      // On sort du marchand
        if ($action == "Sortir") {
          include("vue/ville.php")	;
          exit;
    	}
        if ($action == "Vos objets") {
          include("metier/init_marchand_inventaire.php")	;
          include("vue/marchand_inventaire.php")	;
          exit;
    	}
        if ($action == "Objets en vente") {
          include("metier/init_marchand_envente.php")	;
          include("vue/marchand_envente.php")	;
          exit;
    	}
        if ($action == "Vendre") {
    	  include("metier/action_vendre_objet.php");
          include("metier/init_marchand_inventaire.php")	;
          include("vue/marchand_inventaire.php")	;
          exit;
        }
        if ($action == "Acheter") {
  	  include("metier/action_acheter.php");
          include("metier/init_marchand_envente.php")	;
          include("vue/marchand_envente.php")	;
          exit;
        }
      }

     /**
     * Actions sur la page armurier
     */
      if ($pageCourante == "armurier") {
      $logManager->message("controlleur : action armurier");
      // On sort du marchand
        if ($action == "Sortir") {
          include("vue/ville.php")	;
          exit;
    	}
        if ($action == "Vos armes") {
          include("metier/init_armurier_inventaire.php")	;
          include("vue/armurier_inventaire.php")	;
          exit;
    	}
        if ($action == "Armes de mélée") {
          include("metier/init_armurier_melee.php")	;
          include("vue/armurier_melee.php")	;
          exit;
    	}
        if ($action == "Armes de tir") {
          include("metier/init_armurier_tir.php")	;
          include("vue/armurier_tir.php")	;
          exit;
    	}
        if ($action == "Armure") {
          include("metier/init_armurier_armure.php")	;
          include("vue/armurier_armure.php")	;
          exit;
    	}
        if ($action == "Vendre") {
    	  include("metier/action_vendre_objet.php");
          include("metier/init_armurier_inventaire.php")	;
          include("vue/armurier_inventaire.php")	;
          exit;
        }
        if ($action == "Acheter") {
    	  include("metier/action_acheter.php");
	  if ($cmp == "BGR") {
            include("metier/init_armurier_melee.php")	;
            include("vue/armurier_melee.php")	;
	  }
	  else if ($cmp == "TIR") {
            include("metier/init_armurier_tir.php")	;
            include("vue/armurier_tir.php")	;
	  }
	  else if ($cmp == "PHY") {
            include("metier/init_armurier_armure.php")	;
            include("vue/armurier_armure.php")	;
	  }
	  else {
            include("metier/init_armurier_inventaire.php")	;
            include("vue/armurier_inventaire.php")	;
          }
          exit;
        }
        // On fait réparer
        if ($action == "Réparer") {
    	  include("metier/action_faire_reparer.php");
          if ($continuer) { 
            include("metier/init_fichePerso.php");
            include("vue/fichePerso.php");
            exit;
          }
          else {
            include("metier/init_armurier_inventaire.php")	;
            include("vue/armurier_inventaire.php")	;
            exit;
          }
        }
      }

    /**
     * Actions sur la page zoneAffaires
     */
      if ($pageCourante == "zoneAffaires") {
      $logManager->message("controlleur : action armurier");
      // On sort du marchand
        if ($action == "Sortir") {
          include("vue/ville.php")	;
          exit;
    	}
        if ($action == "travailler") {
    	  include("metier/action_travailler.php");
          include("metier/init_fichePerso.php");
          include("vue/fichePerso.php");
          exit;
        }
      }

    /**
     * Actions sur la page police
     */
      if ($pageCourante == "police") {
      $logManager->message("controlleur : action armurier");
        if ($action == "sortir") {
          include("vue/ville.php")	;
          exit;
    	}
        if ($action == "payer") {
    	  include("metier/payer_amende.php");
          include("metier/init_police.php");
          include("vue/police.php");
          exit;
        }
    	if ($action == "recherche") {
    	  $autre_recherche = $TRUE;	
          include("metier/liste_avis.php")	;
          if ($continuer) {
            include("vue/avis_recherche.php");
            exit;
          }
          else {
            include("metier/init_police.php");
            include("vue/police.php");
            exit;
          }
        }        
      }
      if ($pageCourante == "avis_recherche") {
    	if ($action == "tir" || $action == "bagarre") {
          include("metier/action_contrat_police.php")	;
          include("vue/bagarre_pnj_fin.php");
          //include("metier/init_fichePerso.php");
          //include("vue/fichePerso.php");
          exit;
        }        
    	if ($action == "recherche") {
    	  $autre_recherche = $TRUE;	
          include("metier/liste_avis.php")	;
          if ($continuer) {
            include("vue/avis_recherche.php");
            exit;
          }
          else {
            include("metier/init_police.php");
            include("vue/police.php");
            exit;
          }
        }        
        if ($action == "abandon") {
            include("metier/init_police.php");
            include("vue/police.php");
            exit;
        }
      }

    /**
     * Actions sur la page mafia
     */
      if ($pageCourante == "mafia") {
      $logManager->message("controlleur : action armurier");
        if ($action == "sortir") {
          include("vue/ville.php")	;
          exit;
    	}
    	if ($action == "recherche") {
    	  $autre_recherche = $FALSE;	
          include("metier/liste_contrats.php")	;
          if ($continuer) {
            include("vue/contrat_mafia.php");
            exit;
          }
          else {
            include("vue/mafia.php");
            exit;
          }
        }        
      }
      if ($pageCourante == "contrat_mafia") {
    	if ($action == "tir" || $action == "bagarre") {
          include("metier/action_contrat_mafia.php")	;
          include("vue/bagarre_pnj_fin.php");
          //include("metier/init_fichePerso.php");
          //include("vue/fichePerso.php");
          exit;
        }        
    	if ($action == "recherche") {
    	  $autre_recherche = $TRUE;	
          include("metier/liste_contrats.php")	;
          if ($continuer) {
            include("vue/contrat_mafia.php");
            exit;
          }
          else {
            include("vue/mafia.php");
            exit;
          }
        }        
        if ($action == "abandon") {
            include("vue/mafia.php");
            exit;
        }
      }

    /**
     * Actions sur la page aeroport
     */
      if ($pageCourante == "Aeroport") {
      $logManager->message("controlleur : action Aeroport");
      // On achete des soins
      if ($action == "Acheter") {
          include("metier/action_voyage.php") ;
          if ($continuer) {
            include("metier/init_fichePerso.php");
            include("vue/fichePerso.php");
            exit;
          }
          else {
            include("vue/aeroport.php");
            exit;
          }
        }
      // On sort de l'aeroport
        if ($action == "Sortir") {
          include("vue/ville.php")	;
          exit;
    	}
      }

      /**
      * Actions sur la page chirurgien
      */
      if ($pageCourante == "chirurgien") {
      $logManager->message("controlleur : action chirurgien");
      // On sort du chérurgien
        if ($action == "Sortir") {
          include("vue/ville.php")  ;
          exit;
        }
        if ($action == "Changer") {
        include("metier/modifier_joueur.php");
          if (!$errorManager->isError() and $continuer) {
            include("metier/init_fichePerso.php");
            include("vue/fichePerso.php");
            exit;
          }
          include("metier/init_user_admin.php");
          include("vue/chirurgien.php") ;
          exit;
        }
      }
      
    /**
     * Actions sur la page Flan�r dans la rue
     */
      if ($pageCourante == "scenario_rue") {
        $logManager->message("controleur : action Rue");
        // On achete des soins
        if ($action == "Action") {
          include("metier/action_scenario_rue.php") ;
          include("vue/scenario_fin_rue.php");
          exit;
        }
      }
      if ($pageCourante == "rue_combat") {
        $logManager->message("controleur : action Fuir Combat");
        if ($action == "bagarre") {
          $logManager->message("controleur : action Combattre Rue");
          include("metier/action_bagarre_pnj.php") ;
          $logManager->message("controleur : action Combattre Rue");
          include("vue/bagarre_pnj_fin.php") ;
//          $logManager->message("controleur : vue init Fiche");
//          include("metier/init_fichePerso.php");
//          include("vue/fichePerso.php");
          exit;
        }
        if ($action == "tir") {
          include("metier/action_tir_pnj.php") ;
          if ($continuer) {
            include("vue/bagarre_pnj_fin.php") ;
            exit;
          }
          else {
            $menuDataBean->desactiveTous();
            $menuDataBean->desactiveQuitter();
            $menuDataBean->setOccupe($FALSE);
            include("vue/rue_combat.php");
            exit;
          }
        }
        // On fuit le combat
        if ($action == "fuir") {
          $logManager->message("controleur : action Fuir Combat Rue");
          include("metier/fuir_combat_rue.php") ;
          $logManager->message("controleur : vue init Fiche");
          include("metier/init_fichePerso.php");
          include("vue/fichePerso.php");
          exit;
        }
      }

     /**
      * Actions sur la page Centre de loisir
      */
      if ($pageCourante == "centreLoisir") {
      $logManager->message("controlleur : action centreLoisir");
      // On sort du centre de Loisir
        if ($action == "Sortir") {
          include("vue/ville.php")  ;
          exit;
        }
        if ($action == "entrainer") {
    	  include("metier/action_loisir.php");
          if ($continuer) {
            include("metier/init_fichePerso.php");
            include("vue/fichePerso.php");
            exit;
          }
          else {
            include("metier/init_centreLoisir.php"); 
            include("vue/centreLoisir.php")	;
            exit;
          }
        }
      }
      
      
      /**
       * Actions dans la planque
       */
      if ($pageCourante == "planque_confort") { 
        $logManager->message("controlleur : action planque confort");
        if ($action == "augmenter") {
          include("metier/aug_confort.php")	;
          if ($OK) {
            include("metier/init_fichePerso.php");
            include("vue/fichePerso.php");
          } 
          else {
            include("metier/init_planque.php")	;
            include("vue/planque.php")	;
          }
          exit;
        }
        if ($action == "diminuer") {
          include("metier/dim_confort.php")	;
          if ($OK) {
            include("metier/init_fichePerso.php");
            include("vue/fichePerso.php");
          } 
          else {
            include("metier/init_planque.php")	;
            include("vue/planque.php")	;
          }
          exit;
        }
      }
      if ($pageCourante == "planque_securite") { 
        $logManager->message("controlleur : action planque securite");
        if ($action == "augmenter") {
          include("metier/aug_securite.php")	;
          if ($OK) {
            include("metier/init_fichePerso.php");
            include("vue/fichePerso.php");
          } 
          else {
            include("metier/init_planque.php")	;
            include("vue/planque.php")	;
          }
          exit;
        }
        if ($action == "diminuer") {
          include("metier/dim_securite.php")	;
          if ($OK) {
            include("metier/init_fichePerso.php");
            include("vue/fichePerso.php");
          } 
          else {
            include("metier/init_planque.php")	;
            include("vue/planque.php")	;
          }
          exit;
        }
      }
      if ($pageCourante == "planque") { 
        $logManager->message("controlleur : action planque quartier");
        if ($action == "déménager") {
          include("metier/change_quartier.php")	;
          if ($OK) {
            include("metier/init_fichePerso.php");
            include("vue/fichePerso.php");
          } 
          else {
            include("metier/init_planque.php")	;
            include("vue/planque.php")	;
          }
          exit;
        }
      }


     /**
      * Actions sur la page Mairie
      */
      if ($pageCourante == "mairie") {
      $logManager->message("controlleur : action mairie");
      // On sort de la maire
        if ($action == "Administratif") {
          include("metier/init_user_admin.php");
          include("vue/mairie.php") ;
          exit;
        }
        if ($action == "Contacts") {
          include("vue/mairie_contact.php") ;
          exit;
        }
        if ($action == "Sortir") {
          include("vue/ville.php")  ;
          exit;
        }
        if ($action == "Changer") {
        include("metier/modifier_joueur.php");
          if (!$errorManager->isError()) {
            include("metier/init_fichePerso.php");
            include("vue/fichePerso.php");
            exit;
          }
          include("metier/init_user_admin.php");
          include("vue/mairie.php") ;
          exit;
        }
      }

     /**
      * Actions sur la page Casino
      */
      if ($pageCourante == "casino") {
      $logManager->message("controlleur : action casino");
        if ($action == "Sortir") {
          include("vue/ville.php")  ;
          exit;
        }
        if ($action == "Parier") {
          include("metier/init_fichePerso.php");
          include("metier/action_casino.php");
          include("vue/casino.php") ;
          exit;
        }
      }
      
    }
    /**
     * Par defaut afficher la  fichePerso
     */
    $logManager->message("controlleur : fichePerso defaut");
    include("metier/init_fichePerso.php");
    include("vue/fichePerso.php");
    exit;
  }

  // Si le joueur n'est pas connect� aller sur la page login
  $logManager->message("controlleur : pas de user => redirection vers login");
  include("metier/init_news.php");
  include("metier/init_login.php");
  include("vue/login.php");
?>
Return current item: DarkCity