<?php
if(!isset($_SERVER['HTTP_REFERER'])){
    // redirect them to your desired location
    header('location:../index.php');
    exit;
}
?>
<!-- //MSK-000119-1  modalInsertform -->  
<div class="modal msk-fade" id="modalInsertform" tabindex="-1" role="dialog" aria-labelledby="modalInsertform" aria-hidden="true">  
  	<div class="modal-dialog ">
    	<div class="container modal-content1 "><!--modal-content --> 
      		<div class="row ">	
           		<div class="col-md-3 ">
            		<div class="panel panel-primary">
        				<div class="panel-heading">               
        					<button type="button" class="close" data-dismiss="modal" aria-hidden="true"><span class="glyphicon glyphicon-remove" aria-hidden="true"></span></button>
          					<h3 class="panel-title">Ajouter  </h3>
   						</div>
            			 <form role="form" action="../index.php" method="post">
            				<div class="panel-body"> <!-- Start of modal body--> 
               					<div class="form-group" id="divDay">
                					<label for="" >Jour</label>
        							<select class="form-control"  id="day" name="day">			
     									<option >Sélectionnez le jour</option>
                                        <option value="Sunday">Dimanche</option>
                                        <option value="Monday">Lundi</option>
                                        <option value="Tuesday">Mardi</option>
                                        <option value="Wednesday">Mercredi</option>
                                        <option value="Thursday">Jeudi</option>
                                        <option value="Friday">Vendredi</option>
                                        <option value="Saturday">Samedi</option>
									</select>
        						</div>
                                <div class="form-group" id="divSubject">
                					<label for="" >Module</label>
        							<select class="form-control"  id="subject" name="subject_id"><!--MSK-000116-subject-->		
     									<option>Sélectionner un module</option>
<?php
include_once('../controller/config.php');

$id=$_GET['grade'];
//$grade_groupe=$_GET['grade_groupe'];
	  
$sql="select DISTINCT grade.name as g_id,modules.moduleId as s_id,modules.Designation as s_name,modules.moduleId as s_type
      from grade
      inner join modules
      on grade.name=modules.anneeId  
      where grade.id=$id";
                
$result=mysqli_query($conn,$sql);
if(mysqli_num_rows($result) > 0){
	while($row=mysqli_fetch_assoc($result)){
?> 


     									<option value="<?php echo $row["s_id"]; ?>"><?php echo $row['s_name']; ?></option>
<?php }} ?> 	           
									</select>
        						</div> 
								
								
								
								<div class="form-type" id="divsubject_type">
                					<label for="" >Type de module</label>
        							<select class="form-control"  id="subject" name="subject_type">			
										   <option value="CM">CM</option>
                                           <option value="TD">TD</option>
                                           <option value="TP">TP</option>
									</select>
        						</div>
								
								<div class="form-type" id="divGender1">
                					<label for="" >Groupe</label>
        							<select class="form-control"  id="grade_groupe" name="grade_groupe">
                                    <option>Sélectionner un groupe</option>
<?php
include_once('../controller/config.php');

$id=$_GET['grade'];
//$grade_groupe=$_GET['grade_groupe'];
	  
$sql="SELECT * FROM grade,groupes where  grade.name=groupes.anneeId and grade.id = '$id' ORDER BY groupes.anneeId ASC";
                
$result=mysqli_query($conn,$sql);
if(mysqli_num_rows($result) > 0){
	while($row=mysqli_fetch_assoc($result)){
?> 


     								<option value="<?php echo $row['groupeId']; ?>"><?php echo $row['designation']; ?></option>
<?php }} ?> 	           
									</select>
        						</div>

                                <div class="form-group" id="divTeacher">
                					<label for="" >Enseignants </label>
        							<select class="form-control"  id="teacher" name="teacher_id"><!--MSK-000124-teacher-->		
     								<option>Sélectionnez l'enseignant</option>
									</select>
        						</div> 							
                                <div class="form-group" id="divClassroom">
                					<label for="" >Salle</label>
        							<select class="form-control"  id="classroom" name="classroom_id"><!--MSK-000116-classroom-->			
     									<option>Sélectionnez la salle</option>
<?php
include_once('../controller/config.php');
$sql="SELECT * FROM class_room";
$result=mysqli_query($conn,$sql);
if(mysqli_num_rows($result) > 0){
	while($row=mysqli_fetch_assoc($result)){
?> 
     									<option value="<?php echo $row["id"]; ?>"><?php echo $row['name']; ?></option>
<?php }} ?> 	           
									</select>
									
									
        						</div> 
                                <div class="form-group" id="divStartTime">
                					<label for="" >Heure de début</label>
        							<input type="text" class="form-control" id="start_time" name="start_time"  placeholder="Enter start time" autocomplete="off"/>
        						</div>  
                                 <div class="form-group" id="divEndTime">
                					<label for="" >Heure de fin</label>
        							<input type="text" class="form-control" id="end_time" name="end_time"  placeholder="Enter end time" autocomplete="off"/>
        						</div>  
            				</div><!--/.modal body-->
							
							
							
            				<div class="panel-footer bg-blue-active">
								<input type="hidden" id="grade_id" name="grade_id" value="<?php echo $id; ?>"  />
            					<input type="hidden" name="do" value="add_timetable"/>
                                <input type="hidden" name="do1" value="add_timetable1"  />
                    			<button type="submit" class="btn btn-info " id="btnSubmit" style="width:100%;">Afficher</button><!--MSK-000125-->
             				</div><!--/.panel-footer-->
							
							
							
							
             			</form>       
      				</div><!--/.panel-->
         		</div><!--/.col-md-3 --> 
            </div><!--/.row-->      
        </div><!-- /.modal-content -->  		 
  	</div><!-- /.modal-dialog -->   
</div><!--/.Modal-Add form -->