<?php
if(!isset($_SERVER['HTTP_REFERER'])){
    // redirect them to your desired location
    header('location:../index.php');
    exit;
}
?>
<?php include_once('head.php'); ?>
<?php include_once('header_student.php'); ?>
<?php include_once('sidebar1.php'); ?>

<style>

body { 
	overflow-y:scroll;
}
.modal-content1 {
   position: absolute;
   left: 125px; 
}
@media only screen and (max-width: 500px) {

	.modal-content1 {
   		
		position:static;
   
	}
}

.form-control-feedback {
  
   pointer-events: auto;
  
}

.set-width-tooltip + .tooltip > .tooltip-inner { 
  
     min-width:180px;
}
.set-color-tooltip + .tooltip > .tooltip-inner { 
  
     min-width:180px;
	 background-color:red;
}

.msk-fade{  
      
    -webkit-animation-name: animatetop;
    -webkit-animation-duration: 0.4s;
    animation-name: animatetop;
    animation-duration: 0.4s

}

/* Add Animation */
@-webkit-keyframes animatetop {
    from {top:-300px; opacity:0} 
    to {top:0; opacity:1}
}

@keyframes animatetop {
    from {top:-300px; opacity:0}
    to {top:0; opacity:1}
}

</style>

<!-- Content Wrapper. Contains page content -->
<div class="content-wrapper">
	<!-- Content Header (Page header) -->
    <section class="content-header">
    	<h1>
        	Module
            <small>Aperçu</small>
        </h1>
        <ol class="breadcrumb">
        	<li><a href="#"><i class="fa fa-dashboard"></i> Accueil</a></li>
            <li><a href="#">Module</a></li>
            <li><a href="#">Mon modules</a></li>
        </ol>
	</section>
 
	<!-- table for view all records -->
	<section class="content" > <!-- Start of table section -->
    	<div class="row" id="table1"><!--MSK-000132-1-->
        	<div class="col-md-10">
            	<div class="box">
                	<div class="box-header">
                 		
                  		<h3 class="box-title">Mon modules</h3>
                	</div><!-- /.box-header -->
                	<div class="box-body table-responsive">
                    	<!-- MSK-00093-->
                		<table id="example1" class="table table-bordered table-striped">
                            <thead>
                                <th class="col-md-1" style="text-align:center;">N°</th>
                                <th class="col-md-3">Module</th>
								<th class="col-md-1">Coefficient</th>
                                <th class="col-md-3">Enseignant</th>
                                <th class="col-md-3">E-mail</th>
                            </thead>
                        	<tbody>
<?php
include_once('../controller/config.php');
$index=$_SESSION["index_number"];
$sql="select etudiants.nins as ninsetu,affectation_module.id as sr_id,affectation_module.fee as s_fee,affectation_module.anneeId as g_name,modules.Designation as s_name,modules.coeff as s_coef,teacher.i_name as t_name
,teacher.email as t_email
	  from affectation_module 
      inner join modules
      on affectation_module.moduleId=modules.moduleId
      inner join teacher
      on affectation_module.ensignaintId=teacher.id 
	  inner join etudiants
	  on affectation_module.anneeId=etudiants.anneeId 
	  WHERE etudiants.nins='$index' ORDER BY s_name ASC";
$result=mysqli_query($conn,$sql);
$count = 0;
if(mysqli_num_rows($result) > 0) {
	while($row=mysqli_fetch_assoc($result)){
		$count++;
?>   
                                <tr>
                                  <td class="col-md-1" style="text-align:center;"><?php echo $count; ?></td>
                                  <td class="col-md-3" id="td2_<?php echo $row['sr_id']; ?>"><?php echo $row['s_name']; ?></td>
								  <td class="col-md-1" id="td2_<?php echo $row['sr_id']; ?>" style="text-align:center;"><?php echo $row['s_coef']; ?></td>
			                      <td class="col-md-3" id="td3_<?php echo $row['sr_id']; ?>"><?php echo $row['t_name']; ?></td>
                                  <td class="col-md-3" id="td4_<?php echo $row['sr_id']; ?>"><?php echo $row['t_email']; ?></td>
                            	</tr>
<?php } } ?>
                        	</tbody>
                    	</table>
                	</div><!-- ./box-body -->
            	</div><!-- ./box -->
        	</div> 
    	</div><!-- ./row -->
	</section> <!-- End of table section --> 
    
<!--redirect your own url when clicking browser back button -->
<script>
(function(window, location) {
history.replaceState(null, document.title, location.pathname+"#!/history");
history.pushState(null, document.title, location.pathname);

window.addEventListener("popstate", function() {
  if(location.hash === "#!/history") {
    history.replaceState(null, document.title, location.pathname);
    setTimeout(function(){
      location.replace("../index.php");//path to when click back button
    },0);
  }
}, false);
}(window, location));
</script>
 	 	
</div><!-- /.content-wrapper -->  
                             
<?php include_once('footer.php');?>