<?php require_once("includes/initialize.php");
$tag = "";

error_reporting(0);
ini_set('display_errors', 0);

if (isset($_GET['rsemester'])){
    $rsemester=$_GET['rsemester'];
}

if ((isset($_GET['type'])))
   $tag = $_GET['type'];


if (!$session->is_logged_in()) {
    redirect_to("index.php");
}
//echo "My ID: ".$id = $session->user_id;



 
$user_data = User::find_by_id($session->user_id);

//echo "Process id ".$user_data->formno;
//echo "Student Process ID: ".$user_data->std_process_id;

 if ((substr($user_data->formno,2,2)!=18) and ((substr($user_data->formno,2,2)!=19))){
      
      //echo "<br>All new table: ".substr($user_data->formno,2,2);
      
      Switch(substr($user_data->formno,2,2))
      {
          case '20':$table='form_data';
          break;
          
          case '21': $table='form_data21';
          break;
          
          case '22': $table='form_data22';
          
          case '23': $table='form_data23';
         
      }
      
      //echo $table.' '. $user_data->formno.' '. $user_data->email;
       $biodata = Biodata2::find_by_id($table, $user_data->formno, $user_data->email);
       
      
        $new_dp = DEPARTMENTCLASS::new_admin_dept($biodata->formno);
        
       //echo "My dept: ".$new_dp->department;
        
          if (!isset($new_dp->department)){
           $biodata->courses ='Nil';   
          }else{
           
           $biodata->courses = $new_dp->department;
          
              
          }
            $biodata->programme = $biodata->level;
       
    
       $dp = DEPARTMENTCLASS::department_authenticate($new_dp->department);
       $pix = "https://admission.oscotechesaoke.edu.ng/passport22/".trim($biodata->passport);
    
     
    
       
  }else{
     
     //echo "Testing";
    //echo "DPPPP: ".$user_data->formno.' '.$user_data->email;
     $biodata = Biodata::find_by_id($user_data->formno, $user_data->email); 
  }


//echo $user_data->formno.' '.$user_data->email;
$accept_check = Transaction::confirmacceptance($user_data->formno, $user_data->email);

if ($accept_check){

$schoolfees_check = Schoolfees::confirmschoolfees($user_data->formno, $user_data->email);

 
}

if ($schoolfees_check){
$schoolfees_check2 = Schoolfees::confirmschoolfees2($user_data->formno, $user_data->email);


}

 

 $pixf = substr($biodata->pix, 11);













 //$session='',$semester=''



$session_class = SESSIONCLASS::session_authenticate('2022/2023','First');









if (substr($user_data->formno,2,2) =='19'){

//echo "dtdd: ".$user_data->formno;

 $new_dp = DEPARTMENTCLASS::new_admin_dept($user_data->formno);
 //echo $new_dp->department;
 $biodata->courses = $new_dp->department;
  $biodata->programme = $biodata->level; 
  
$dp = DEPARTMENTCLASS::department_authenticate($biodata->department);
   
  $pix = "../application_account/passport/".$pixf;
   
   
   
   
   
   
   
   
   
}elseif (substr($user_data->formno,2,2)=='18') {
    
   
          
          if ($biodata->courses=='Microbiology (Option)'){
      $biodata->courses= $biodata->department=$dept='Applied Science (Microbiology Option)'; 
      
      Schoolfees::updateDepartments('admitted_student_details',$biodata->formno, $dept);
       
    }else if ($biodata->courses=='Environmental Biology (Option)'){
      $biodata->courses= $biodata->department=$dept='Applied Science (Environmental Biology Option)'; 
      
      Schoolfees::updateDepartments('admitted_student_details',$user_data->formno, $dept);
       
    }else if ($biodata->courses=='Physics with Electronics (Option)'){
     $biodata->courses= $biodata->department=$dept='Applied Science (Physics with Electronics Option)'; 
      
      Schoolfees::updateDepartments('admitted_student_details',$user_data->formno, $dept);
       
    }else if ($biodata->courses=='Chemistry (Option)'){
     $biodata->courses= $biodata->department=$dept='Applied Science (Chemistry Option)'; 
      
      Schoolfees::updateDepartments('admitted_student_details', $user_data->formno, $dept);
       
    }else if  ($biodata->courses=='Electronic/Telecommunication (Option)'){
       $biodata->courses= $biodata->department=$dept= 'Electronics/Telecommunication (Option)';
       
        Schoolfees::updateDepartments('admitted_student_details', $user_data->formno, $dept);
       
    }else{
       $dept= $biodata->courses;
          }
    
    
    
    
    
    
    
    
    
    
    
    
    
   $semester_fin = find_semester($user_data->std_process_id);
   
   
   
   
   //echo "My ID: " .$user_data->std_process_id;
   
   
   
   
   
   
  // echo "Dept: ".$biodata->courses;

$dp = DEPARTMENTCLASS::department_authenticate($biodata->courses);
$display_course = COURSECLASS::fetch_all_course($biodata->courses, $clevel, $semester_fin);
$alldp = DEPARTMENTCLASS::find_all($dp->faculty);
$pix = "../Oscotech-Wallet/passport/".$pixf;

}
$dept = $biodata->courses;
$level = $biodata->programme;


$semester = $session_class->semester;
//echo "Bio: ".$pix;
//echo $level;
if ($level=='Adv. Cert.'){
    
}else if ($level=='ND I'){
  $level = 'ND II';
  
}else if ($level=='HND I'){
  $level = 'HND II';
  
}else {
$level = $level . " " . "I";
}
//echo "dtdd: ".$level;
?>
<?php //require("template/header.php");
include_layout_template('header.php'); ?>


<!-- Main content area of the student portal-->

 
<div class="art-content-layout-row">
    <div class="art-layout-cell layout-item-0" style="width: 100%">
        <div class="image-caption-wrapper" style="float: right;

       
                text-transform:uppercase; color:#030; font-size:22px; font-weight:bolder; text-align: center; font-stretch:extra-expanded
                ">
            
          
            <img 
                 style="margin: 0 auto; text-align: center; height:120px; width:120px" alt=""
                 
                       class="art-lightbox" src="<?php echo $pix ?>">
                       
                   
            <p text-transform:uppercase; color:#030; font-size:22px; font-weight:bolder; font-stretch:extra-expanded
            "><?php 
             if ($user_data->matricno!=0){echo "MATRIC NO: ".$user_data->matricno;}else{
             echo "FORM NO: " . $biodata->formno;}


            ?></p>


        </div>
        <p style=" text-transform:uppercase; color:#030; font-size:22px; font-weight:bolder; font-stretch:extra-expanded"><?php echo $biodata->surname . ", " . $biodata->othernames; ?></p>
        <p style="text-transform:uppercase; color:#033; font-size:14px; font-weight:bolder; font-stretch:expanded">
            Current level : <strong style="color:#030;"><?php echo $level; ?>
            </strong></p>
        <p style="text-transform:uppercase; color:#033; font-size:14px; font-weight:bolder; font-stretch:expanded">
            Department : <strong style="color:#030; margin-left:20px"><?php echo $biodata->courses; ?></strong></p>


        <p style="text-transform:uppercase; color:#033; font-size:14px; font-weight:bolder; font-stretch:expanded">
            Faculty: <strong style="color:#030; margin-left:58px"><?php echo $dp->faculty; ?></strong></p>
    </div>
</div>
</div>


<?php

//echo "<br>DTEEE: ".$tag." STD: ".$user_data->std_process_id;
//echo $accept_check->responsecode;
if ($tag == "")
    include_once('pages/stu_biodata.php');
// elseif ($tag == "acceptance" && $user_data->std_process_id == 1)
//     include_once('pages/acceptance_payment.php'); //Interswitch acceptance page link


    
elseif ($tag == "acceptance" && $user_data->std_process_id == 1)
    include_once('pages/remitaAcceptancePayment.php'); //Remita acceptance page link 
    
elseif ($tag == "duplicate_attempt")
    include_once('pages/remitaDuplicateAcceptancePayment.php'); //Remita acceptance page link 
    
elseif ($tag == "checkacceptance")
    include_once('pages/acceptancePageSelector.php'); //Remita acceptance page link 
    
elseif ($tag == "validatebank")
    include_once('pages/validate-bank.html'); //Remita acceptance page
    
    
 
elseif ($tag == "transissues")
    include_once('pages/requerypage.php');
elseif ($tag == "gateway")
    include_once('pages/site_redirect_url.php'); //@todo: fix :: interswitch response
elseif ($tag=='remitadetails')
 include_once('pages/online-payment1.php');
 
 elseif ($tag=='remitadetailsrrr')
 include_once('pages/online-payment.html');
 
elseif ($tag == "invoicedetails")
    include_once('pages/confirmation.php'); //@todo: fix :: interswitch bridge
    
elseif ($tag == "transhistory")
    include_once('pages/transHistory.php'); //@todo: fix :: interswitch bridge

elseif ($tag == "admission_letter" && $user_data->std_process_id >= 2 && (substr($user_data->formno,0,2)!='PU'))

    //echo "testhjhjhj";
    include_once('pages/admission_letter.php');
    

    
 elseif ($tag == "schoolfees" && ($user_data->std_process_id==3)&&($accept_check->responsecode=='00'))


/*$user_data->std_process_id==3 or $user_data->std_process_id==4)*/ 
  include_once('pages/schoolfees_payment.php'); 
    
    elseif ($tag == "transissues2")
    include_once('pages/requerypage2.php');
elseif ($tag == "gateway2")
    include_once('pages/site_redirect_url2.php'); //@todo: fix :: interswitch response
elseif ($tag == "invoicedetails2")
    include_once('pages/confirmation2.php'); //@todo: fix :: interswitch bridge
elseif ($tag == "transhistory2")
    include_once('pages/transHistory2.php');
    
elseif ($tag =="payhistory")    
     include_once('test_schoolfees.php');
    
// elseif ($tag == "first_sem" && $user_data->start_session == '2019/2020' && $user_data->std_process_id == 4)
//     include_once('pages/first_sem.php');



elseif ($tag == 1 && (($user_data->std_process_id==4) && ($schoolfees_check->responsecode=='00') && ($user_data->status!='closed'))  )
    include_once('pages/first_sem_new.php');
  

elseif ($tag == 1 && $user_data->std_process_id == 5 && $schoolfees_check->responsecode=='00' && $user_data->status!='closed')
    //include_once('pages/sem_second.php');

//echo "Got here";
     include_once('pages/second_sem_new.php');

elseif ($tag == "schoolfees" && $user_data->std_process_id == 6 && $schoolfees_check->responsecode=='00')
    include_once('pages/yr2schoolfees_payment.php');


elseif ($tag == 2 && $user_data->std_process_id ==7 && $user_data->matricno!=0 && $user_data->status!='closed')



    include_once('pages/first_sem_new.php');

 elseif ($tag == 2 && $user_data->std_process_id == 8 && $schoolfees_check2->responsecode=='00' && $user_data->matricno!=0 && $user_data->status!='closed')
//include_once('pages/sem_second.php');
  include_once('pages/second_sem_new.php');
  
//   elseif ((($tag <=6  and  $schoolfees_check->responsecode=='00') or ($tag <=9 and $schoolfees_check2->responsecode=='00')) && ($rsemester=='First') && ($user_data->status!='closed'))
  
//   include_once('pages/first_sem_result.php');
  
  
  
//   elseif ((($tag <=6  and  $schoolfees_check->responsecode=='00') or ($tag <=9 and $schoolfees_check2->responsecode=='00')) && ($rsemester=='Second') && ($user_data->status!='closed'))
  
//   include_once('pages/second_sem_result.php');
  
  
    elseif ($tag == "course_hist")
    include_once('pages/registration_history.php');
    //  elseif ($tag == "exampass")
    // include_once('pages/Exam_pass.php');
    
//result page comes here

elseif ($tag == "certificate" /*&& $user_data->std_process_id==11*/)
    include_once('pages/certificate_payment.php');
elseif ($tag == "testpass" && $user_data->std_process_id == 12)
//include_once('pages/transcript_payment.php');

{?>

 
    
    <a href="test_acceptance_receipt.php" target="_blank">Test acceptance payment</a>
     <script type="text/javascript">
     var toprint = <?php echo json_encode($tag);?>;
     if (toprint=='testpass'){
     
    window.open('Test_Pass.php');
    
      }
    
     </script>
    
<?php     include_once('pages/stu_biodata.php'); } 

elseif ($tag == "exampass" && $user_data->std_process_id == 13)

{?>

 
    
    <!--<a href="test_acceptance_receipt.php" target="_blank">Test acceptance payment</a>-->
     <script type="text/javascript">
     var toprint = <?php echo json_encode($tag);?>;
     if (toprint=='exampass'){
     
    window.open('Report_E.php');
    
      }
    
     </script>
    
<?php     include_once('pages/stu_biodata.php'); } else
    include_once('pages/stu_biodata.php');
?>


<?php require("template/menu.php"); ?>
<?php include_layout_template('footer.php'); ?>
      
      