<?php
   //Activer l'affichage des erreurs
   error_reporting(E_WARNING);
   ini_set('display_errors', 'off');

   //Autres conf essentiel
   date_default_timezone_set("Europe/Paris");

   //Fichiers contenant des fonctions utiles
   include_once 'functions.php';

   //Gestion de la langue dans un cookie
   if(isset($_GET['lang']) && !empty($_GET['lang'])) {
   setcookie ('lang', $_GET['lang']);
   $_COOKIE['lang'] = $_GET['lang'];
   }
   //Ici on inclue le fichier de lang, avec par défaut l'anglais
   if(isset($_COOKIE['lang']) && !empty($_COOKIE['lang']) && file_exists('i10n/'.$_COOKIE['lang'].'.php'))
   include 'i10n/'.$_COOKIE['lang'].'.php';
   else
   include 'i10n/eng.php';

   //Gestion de la page à afficher dans le bloc contenu
   //  Si l'utilisateur demande une page précise et qu'elle existe, alors ok
   //  sinon on affiche la page d'accueil
   if(isset($_GET['p']) && !empty($_GET['p']) && file_exists('pages/'.$_GET['p'].'.php')) {
   $include = 'pages/'.$_GET['p'].'.php';
   $title = constant('PAGE_TIT_'.strtoupper($_GET['p']));
   }
   else {
   $include = 'pages/greetings.php';
   $_GET['p'] = 'greetings';
   $title = PAGE_TIT_GREETINGS;
   }

   ?>

<!DOCTYPE html>
<html>
  <head>
    <title>Jules Brochard - <?= $title ?></title>
    
    <!--<link rel="stylesheet" href="style.css" />-->
    
    <meta name="author" content="Jules Brochard" />
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
    
    <!-- Bootstrap core CSS -->
    <link href="css/bootstrap.css" rel="stylesheet">
    <link href="css/perso.css" rel="stylesheet">

  </head>
  <body>
    <div id="page">
      

      <div class="container">
	<div class="header">
	  <!-- Fixed navbar -->
	  <div class="navbar navbar-default navbar-fixed-top" role="navigation">
	    <div class="container">
	      <div class="navbar-header">
		<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
		  <span class="sr-only">Toggle navigation</span>
		  <span class="icon-bar"></span>
		  <span class="icon-bar"></span>
		  <span class="icon-bar"></span>
		</button>

		<a class="navbar-brand" href="greetings"><?= MEN_HOME?></a>
		

		<div class="btn-group">
		  <a href="#" class="navbar-brand" data-toggle="dropdown"><?=MEN_CON ?><b class="caret"></b></a>
		  <ul class="dropdown-menu">
		    <li><a href="contacts"><?=MEN_CON_ME?></a></li> 
		    <li><a href="references"><?=MEN_CON_REF?></a></li>
		  </ul>
		</div>

		<div class="btn-group">
		  <a href="#" class="navbar-brand" data-toggle="dropdown"><?= MEN_PROJ ?><b class="caret" ></b></a>
		  <ul class="dropdown-menu">
		    <li><a href="proj_current_list"><?= MEN_PROJ_CUR?></a></li>
		    <li><a href="proj_finished_list"><?= MEN_PROJ_FIN?></a></li>
		    <li><a href="proj_future_list"><?= MEN_PROJ_FUTU?></a></li>
		  </ul>
		</div>

		<div class="btn-group">
		  <a href="#" class="navbar-brand" data-toggle="dropdown"><?= MEN_CV ?><b class="caret"></b></a>
		  <ul class="dropdown-menu">
		    <li><a href="resume"><?= MEN_CV_INBRI?></a></li>
		    <li><a href="education"><?= MEN_CV_EDUC?></a></li>
		    <li><a href="work_experience"><?= MEN_CV_WORK?></a></li>
		    <li><a href="publications"><?= MEN_CV_PUBLI?></a></li>
		  </ul>
		</div>

		<div class="btn-group">
		  <a href="#" class="navbar-brand" data-toggle="dropdown"><?= MEN_PERSO ?><b class="caret"></b></a>
		  <ul class="dropdown-menu">
		    <li><a href="current_post"><?= MEN_PERSO_CURPOS?></a></li>
		    <li><a href="hobbies"><?= MEN_PERSO_HOBB?></a></li>
		  </ul>
		</div>

		<a href="<?= (isset($_GET['p'])) ? $_GET['p'] : '.' ?>?lang=eng"><img src="img/eng.png" alt="Eng" width="20px" class="icon" /></a>
		<a href="soon"><img src="img/fr.png" alt="Fr" width="20px" class="icon" /></a>
		<!--  <a href="<?= (isset($_GET['p'])) ? $_GET['p'] : '.' ?>?lang=fr"><img src="img/fr.png" alt="Fr" width="20px" class="icon" /></a>
		  -->

		
		
	      </div>
	      
  </div
     </div>
	    </div>
	  </div>


        <div id="container">
            <div id="content">
<?php 
//inclusion du contenu

include $include; 
?>
            </div>
        </div>
       



<!-- Bootstrap core JavaScript
    ================================================== -->
    <!-- Placed at the end of the document so the pages load faster -->
    <script src="js/jquery-1.js"></script>
   <script src="js/bootstrap.js"></script>


</body>
</html>
