<!-- call datable with export -->
<script  src="js/call_datatable_with_exports.js"></script>

<?php

	
			  
	  //collect the passed
	  if(isset($_GET['pt']))
	  {
		 $pt =  $_GET['pt'];
		 if ($pt == 1) {
		 	$type = 'PRE-NCE';
		 }else{
		 	$type = 'NCE';
		 }
	  }else{
	    header('location: gateway.php?act=view_admission_reports_landing');
	  }
	 
    
	   //collect the session
	 if(isset($_GET['ses']))
	  {
		 $ses =  $_GET['ses'];
	 }else{
	  	 $ses = 0;
	 }


	 $uname = get_security_id($user_id);



 	$msg = '';

	
 	//reject clearance
	if (isset($_POST['reject_btn'])) {
		
		$id = $_POST['app_id'];
		$clr_msg = '';

        $clear_status = 0;
       
       if(reject_applicant_nce_olevel($id,$clr_msg,$clear_status,$uname)){
       		$msg = '<h4 class="alert alert-success">Clearance Rejected</h4>';
       }else{
       		$msg = '<h4 class="alert alert-danger">Clearance Not Rejected</h4>';

       }
       
        
	}
	//revoke admission
	if (isset($_POST['revoke_btn'])) {
		
		$id = $_POST['app_id'];
		$clr_msg = '';

        $clear_status = 0;
       
       if(revoke_applicant_admission($id,$clr_msg,$clear_status,$uname)){

       		$msg = '<h4 class="alert alert-success">Admission Revoked</h4>';
       }else{
       		$msg = '<h4 class="alert alert-danger">Admission Not Revoked</h4>';

       }
       
        
	}

	//convert from PRE to NCE
	if (isset($_POST['swap_prog_btn'])) {
		
		$id = $_POST['app_id'];
		$s_id = $_POST['swap_prog_id'];

       //when Qualified
        
       if(convert_applicant_nce_to_prence($ptt = 2,$s_id ,$sess = 4,$id,$uname)){
       		$msg = '<h4 class="alert alert-success">Conversion to NCE Successful</h4>';
       }else{
       		$msg = '<h4 class="alert alert-danger">Conversion to NCE Not Successful</h4>';

       }
      
       
        
	}
	//convert from  NCE to PRENCE
	if (isset($_POST['swap_prog_btn_nce'])) {
		
		$id = $_POST['app_id'];
		$s_id = $_POST['swap_prog_id'];
		
       //when Qualified
        
       if(convert_applicant_nce_to_prence($ptt = 1,$s_id ,$sess = 4,$id,$uname)){
       		$msg = '<h4 class="alert alert-success">Conversion to PRENCE Successful</h4>';
       }else{
       		$msg = '<h4 class="alert alert-danger">Conversion to PRENCE Not Successful</h4>';

       }
      
       
        
	}

?>
    
<ul class="breadcrumb">
     
       <li><a href="gateway.php?act=view_admission_reports">  Admission Manager</a> <span class="divider"></span></li>
     
        <li class="active"> <?php echo $type; ?> Cleared Applicants </li>
            
</ul>


<div class="well">
	<?php 

		if(isset($msg) && $msg !='')
		  {
				echo $msg;
		    
		  }



	 ?>	

      <ul class="tabs"> 
        
        <li><a href="#view1">Cleared Applicants Listings</a></li> 
       
       </ul> 
      <div class="tabcontents"> 
       
        
        <div id="view1">
        
        		
             <?php 
			  
			  
				  
			  
     			/*echo $p;
     			exit();*/

     			//if ($pt == 1) {
     		
	               echo view_cleared_applicants_list($pt, $ses ); // pt programm type , p programme  

     			//}

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

</form>

