<?php require_once("../includes/initialize.php");
if (!$session->is_logged_in()) {
    redirect_to("index.php");
}
$id = $session->user_id;
$user_data = Userdata::find_by_id($session->user_id);


    if ((substr($user_data->formno,2,2)!=18) and ((substr($user_data->formno,2,2)!=19))){
      
      //echo "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';
      }
      
      
       $biodata = Biodata2::find_by_id($table, $user_data->formno, $user_data->email);
       
      
        $new_dp = DEPARTMENTCLASS::new_admin_dept($biodata->formno);
        
          if (!isset($new_dp->department)){
           $biodata->courses ='Nil';   
          }else{
        $biodata->courses = $new_dp->department;
          }
       $biodata->programme = $biodata->level;
  
        // $pixf = substr($biodata->passport, 10);
       $dp = DEPARTMENTCLASS::department_authenticate($biodata->department);
       $pix = "http://admission.oscotechesaoke.edu.ng/passport22/".trim($biodata->passport);
        $biodata->session='2020/2021';
     
    
       
  }else{




$biodata = Biodata::find_by_id($user_data->formno, $user_data->email);
}
//$transact_feedback = Transaction::authenticate($biodata->formno, $biodata->email);

$transact_feedback = Transaction::findacceptance($biodata->formno, $biodata->email);

// Please activate back after completion of the work

//Change it back to !

//echo $transact_feedback->formno;
if (!$transact_feedback){
redirect_to ("http://eportal.oscotechesaoke.edu.ng/student_portal/dashboard.php");
}else { 
if ($user_data->std_process_id < 3) {
    $level = $user_data->std_process_id + 1;
    $update_process = Userdata::update($id, $level);
}


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

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

 $new_dp = DEPARTMENTCLASS::new_admin_dept($user_data->formno);
  $biodata->courses = $new_dp->department;
  
  //echo "Tesssss: ".$new_dp->status;
  $biodata->programme = $biodata->level; 
  
  $dp = DEPARTMENTCLASS::department_authenticate($biodata->courses);
    $pix = "../../application_account/passport/".$pixf;
   
}else if (substr($user_data->formno,2,2)=='18'){

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


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

$regex = "/F+/";
if (preg_match($regex, $biodata->formno)) {
    $programmeType = "FULL-TIME PROGRAMME";
} else {
    $programmeType = "PART-TIME PROGRAMME";
}
$programmeType = strtolower($programmeType);
// concessionary

if (strtoupper($new_dp->status) == 'C')
{
    $adm_type = 'concessionary';
}
elseif (strtoupper($new_dp->status) == 'P')
{
    $adm_type= 'provisional';
}




      
      
      
      
      
      
      
      
      
      
  class PDF extends FPDF
{

    function Header()
    {

    global $biodata;
    global $user_data;
    global $adm_type;
    global $new_dp;
    global $pix;
       $this->SetFont('Arial', 'B', 16);

  
        $this->Image('../images/new_head.jpg', -1, 0, 210, 50);
     

        $this->Ln(40);
         $this->SetFont('Arial', 'B', 12);
        $this->Cell(30, 10, 'Admitted on:',0, 0, 'L');
        
        $this->SetFont('Arial', '', 12);
        $this->Cell(189,10, date("jS \of F, Y", strtotime($user_data->adm_date)), 0, 1, 'L'); //true
        
        
          $this->SetFont('Arial', 'B', 12);
          
       $this->Cell(30, 9, 'Form No:',0,0);
       
           $this->SetFont('Arial', '', 12);
           
       $this->Cell(50,9, $biodata->formno, 0, 1); //true
       
           $this->SetFont('Arial', 'B', 12);
           
        $this->Cell(30, 9, 'Full Name: ',0,0);
        
         $this->SetFont('Arial', '', 12);
        $this->Cell(189,10, strtoupper($biodata->surname . " " .$biodata->othernames), 0, 1, 'L');//true
        $this->Image($pix, 160, 53, 20, 20);


       // $this->Cell(189, 5, "", 0, 1);

    }

    function Footer()
    {
        $this->Ln(1);//end of line
       
        
        $this->SetFont('Arial', 'B', 12);
        $this->Cell(189, 8, 'Please accept my congratulations', 0, 1);
        
         $this->SetFont('Arial', '', 11);
         
        $this->Image('../images/registrar.png',10, 270, 34, 8);
        $this->Ln(4);
        $this->Cell(189,10,'Mr S.O. Popoola',0, 1,'L');
        $this->Cell(189,2,'Registrar',0,1,'L');
        //$this->Image('../images/footer.jpg', 0, 280, 200, 10);
     
    }

    function Footer2()
    {
       
    }

}

//require('force_justify.php');

$pdf = new PDF('p', 'mm', 'A4');

$pdf->AddPage();


// $pdf->Image('images/img2.png', 70, 35, 80, 80);
// $pdf->Cell(189, 5, '', 0, 1);

$pdf->SetFont('Arial', 'B', 12);

//$pdf->Cell(30, 5, 'Form no: ', 0, 0);
$pdf->Cell(189, 10, 'OFFER OF '.strtoupper($adm_type).' ADMISSION INTO HIGHER NATIONAL DIPLOMA',0,1,'C');
$pdf->Cell(189,5, strtoupper($programmeType).' FOR '.$user_data->start_session.' SESSION', 0, 1,'C');

//To be used later $biodata->session

$pdf->SetFont('Arial', '', 10);

$pdf->MultiCell(189, 7,'I am pleased to inform you that you have been offered a '. $adm_type.' admission into the '.ucwords($programmeType). ' of Osun State College of Technology, Esa-Oke for Higher National Diploma in the Department of '. strtoupper($new_dp->department).' with effect from '.$user_data->start_session. ' Session.',0,1); //end of line

$pdf->MultiCell(189,7,'Please note that the programme will run for minimum of Six (6) consecutive semesters as stipulated by National Board for Technical Education.');

//$biodata->session
//$pdf->Cell(80 ,5,'',0,0);


$pdf->MultiCell(189, 7, 'a) For you to be considered registrable for the course, you must fulfill all requirements as advertised  for admission into the '.$biodata->level .' programme of Osun State College of Technology, Esa-Oke.', 0,1);
            
            
$pdf->MultiCell(189, 7, 'b) You will present, at the time of registration, the originals of the credentials listed in your application form for scrutiny along with six recent passport size photograph. If the original certificates have not been issued, the result slips alone will be accepted in the interim. However you shall be required to confirm through the College, the original certificate(s) or result slips, as the case may be, from the appropriate examining bodies as part of registration.', 0, 1);//end of line


$pdf->Cell(189, 7, 'c) You are equally required to produce the following documents for registration: ', 0, 1);


$pdf->Cell(189, 7, 'i. Original and photocopy of Tax Clearance Certificate of your Parent/Guardian.',0,1);
$pdf->Cell(189,7,'ii. Original and photocopy of your birth certificate or sworn declaration of age.',0,1);
$pdf->Cell(189,7,'iii. Original and photocopy of Development Levy Receipt of your Parent/Guardian', 0, 1);

//$pdf->MultiCell(189, 7, 'd) This offer of '. $adm_type.' admission is subject to the condition that you rectify the subject deficiencies so conceded before you graduate, otherwise the '.strtoupper($new_level).' result will not be issued to you until the entry requirements are met.', 0, 1);//end of line

 $pdf->MultiCell(189, 7,'d) If at any time, even after your registration, it is discovered that you do not possess the entry requirements on which this offer is based, or that any of the qualifications you claimed to have is not genuine or is forged, you will be required to withdraw from the institution forthwith and be handed over to the Police.',0,1);
 

 $pdf->MultiCell(189, 7,'e) The names by which you are hereby admitted and by which you will be registered are the ones which will appear on the certificate that the Institution will issue to you on the successful completion of your course except the change of name is for the purpose of marriage.',0,1);
        
        
$pdf->MultiCell(189, 7, 'f) Please note that you are not recognized as a student of this Institution until you have completed all registration processes online within the  stipulated time. ', 0,1);
        
        
        
$pdf->MultiCell(189, 7,'2. All fees are to be paid within the specified period and any fees paid are non-refundable.' , 0, 1);//end of line



$pdf->Output('OSCOTECH_ADMISSION_LETTER.pdf','I');

}
?>          
    
    
<!--  $pdf->Cell(189, 10,'I am pleased to inform you that you have been offered an '. $adm_type.' admission into the Full Time programme',0,1); -->
<!--$pdf->Cell(189,5,'of Osun State College of Technology, Esa-Oke for a 2-year Higher National Diploma in the',0,1);-->
           
<!--$pdf->Cell(189,5,' Department of '. strtoupper($new_dp->department).' with effect from '. $biodata->session. ' Session.',0,1); //end of line-->

<!--//$pdf->Cell(80 ,5,'',0,0);-->
<!--$pdf->Cell(189, 10, 'a) For you to be considered registrable for the course, you must fulfill all requirements for admission into the '.$biodata->level,0,1);-->
<!--$pdf->Cell(189,5,'programme of Osun State College of Technology, Esa-Oke.', 0,1);-->
            
            
<!--$pdf->Cell(189, 10, 'b) You will present, at the time of registration, the originals of the credentials listed in your application form for ',0,1);-->
<!--$pdf->Cell(189,5,'scrutiny along with six recent passport size photograph. If the original certificates have not been issued, ',0,1);-->

<!--$pdf->Cell(189,5,' the result slips alone will be accepted in the interim. However you shall be required to confirm through the College, the original certificate(s) or result ',0,1);-->
<!--$pdf->Cell(189,5,'slips, as the case may be, from the appropriate examining bodies as part of registration.', 0, 1);//end of line-->


<!--$pdf->Cell(189, 10, 'c) You are equally required to produce the following documents for registration: ', 0, 1);-->


<!--$pdf->Cell(189, 10, 'i. Original and photocopy of Tax Clearance Certificate of your Parent/Guardian.',0,1);-->
<!--$pdf->Cell(189,10,'ii. Original and photocopy of your birth certificate or sworn declaration of age.',0,1);-->
<!--$pdf->Cell(189,10,'iii. Original and photocopy of Development Levy Receipt of your Parent/Guardian', 0, 1);-->

<!--$pdf->Cell(189, 10, 'd) If at any time, even after your registration, it is discovered that you do not satisfy the minimum entry requirements, or',0,1);-->

<!--$pdf->Cell(189,5,' that any of the qualifications you claimed to have is not genuine or is forged, you will be required to withdraw from the',0,1);-->
<!--$pdf->Cell(189,5,' institution forthwith and be handed over to the Police.', 0, 1);//end of line-->


<!-- $pdf->Cell(189, 10,'e) The names by which you are hereby admitted and by which you will be registered are the ones which will appear on the',0,1);-->
 
<!-- $pdf->Cell(189,5,' certificate that the Institution will issue to you on the successful completion of your course except the change of name is',0,1);-->
 
<!-- $pdf->Cell(189,5,' for the purpose of marriage.',0,1);-->
        
        
<!--$pdf->Cell(189, 10, 'f) Please note that you are not recognized as a student of this Institution until you have completed all registration',0,1);-->
<!--$pdf->Cell(189,5,' processes online within the  stipulated time. ', 0,1);-->
        
        
        
<!--$pdf->Cell(189, 10,'2. All fees are to be paid within the specified period and on no condition will any fees paid be refunded.' , 0, 1);//end of line-->
  
  