<?php
error_reporting(0);
session_start();
include('functions.php');
require_once('class/class.batch.php');
require_once('class/class.course.php');
require_once('class/class.subjects.php');
require_once('class/class.employee_info.php');
$courseObj=new course;
$batchObj=new batch;
$subjectObj=new subjects;
$employeeObj=new employee_info;
if(isset($_GET['mode']))
{
	$dept=sanitize($_GET['dept']);
	$mode=sanitize($_GET['mode']);
}

if(isset($_GET['courseid']))
{
	$courseid=sanitize($_GET['courseid']);
	$batchid=sanitize($_GET['batchid']);
	$batchObj->select($batchid);
    

$batchlist=$batchObj->selectbatch($courseid);
 	?>
    				
                    <select name="batch" id="batch" class="form-control"   data-required="true">
                  	  <?php  if($courseid=='') {?><option value="" >Select Batch</option><?php } else { ?>
                  	  
                      <?php 
					  foreach($batchlist as $blist)
					  {
						  ?>
                      <option value="<?php echo $blist->id; ?>"><?php echo $blist->batch; ?></option>
                      <?php } }?>
                    </select> 
                    <?php } ?>   
<?php if(isset($_GET['id']))
{
 $course=$_GET['id']; 

$batchlist=$batchObj->selectbatch($course);
 	
    				?>
                    <select name="batch" id="batch" class="form-control"  onchange="get_subjecttime(this.value)" data-required="true">
                  	  <?php  if($course=='') {?><option value="" >Select Batch</option><?php } else { ?>
                  	  <option value="" >Select Batch</option>
                      <?php 
					  foreach($batchlist as $blist)
					  {
						  ?>
                      <option value="<?php echo $blist->id; ?>"><?php echo $blist->batch; ?></option>
                      <?php } }?>
                    </select>
<?php } ?>
<?php
if(isset($_GET['bid']))
{
 $batch=$_GET['bid']; 

$subjectlist=$subjectObj->selectsubject($batch);
 	?>
    				
                    
					
                    <select name="subject" id="subject" class="form-control" data-required="true">
                  	  <?php  if($batch=='') {?><option value="" >Select Subject</option><?php } else { ?>
                  	  <option value="" >Select Subject</option>
                      <?php 
					  foreach($subjectlist as $slist)
					  {
						  ?>
                      <option value="<?php echo $slist->id; ?>"><?php echo $slist->subject; ?></option>
                      <?php } }?>
                    </select> 
                    
                    <?php } ?>
			<!-- Edit Particular -->  
                  <?php
if(isset($_GET['type']))
{
 
 $type=$_GET['type'];

?>

 <?php
if($type==3)
{
	$batchlist=$batchObj->selectorgall();
	?>
        <div class="form-group">
                    <label class="col-sm-2 control-label req" >Batch </label>
                    <div class="col-sm-10 editable">
                     
                      <div class="">
                     <select name="batch" id="batch" class="form-control" data-required="true"  >
                      
                      
                      <?php  $batchlist=$batchObj->selectorgall();
					  foreach($batchlist as $blist){ 
						?>
                      <option value="<?php echo $blist->id; ?>"><?php $courseObj->select($blist->course_id); echo $blist->batch.'-'.$courseObj->course_name; ?></option>
                      <?php }?>
                    </select>
                      </div>
                    </div>
                  </div>              
	<?php } 
        
        if($type==2)
{     	   
?>       
                 <div class="form-group">
                    <label class="col-sm-2 control-label req" >Roll No </label>
                    <div class="col-sm-10 editable">
                     
                      <div class="">
                      <input type="text" name="adm_no" id="adm_no" value="" class="form-control" data-required="true" />
                      </div>
                    </div>
                  </div>
                  
                 <div class="form-group">
                    <label class="col-sm-2 control-label req" >Batch </label>
                    <div class="col-sm-10 editable">
                     
                      <div class="">
                       <select name="batch" id="batch" class="form-control" data-required="true"  >
                      
                      
                      <?php  $batchlist=$batchObj->selectorgall();
					  foreach($batchlist as $blist){ 
						?>
                      <option value="<?php echo $blist->id; ?>"><?php $courseObj->select($blist->course_id); echo $blist->batch.'-'.$courseObj->course_name; ?></option>
                      <?php }?>
                    </select>
                      </div>
                    </div>
                  </div>      
                    
	<?php } } ?>   
    <?php if($mode==3) { $emplist=$employeeObj->selectemployee($dept);?> 
    <div class="form_sep">
												<label for="reg_input_name" class="req">Employees</label>
												<select id="employee_id" name="employee_id" class="form-control" data-required="true" >
                                                 <?php foreach($emplist as $list){ ?>
													<option value="<?php echo $list->id; ?>"><?php echo $list->first_name.' '.$list->mid_name.' '.$list->last_name; ?></option>
                                                    <?php } ?>
                                               
                                                </select>
											</div>
    <?php } ?>        