<?php
session_start();
error_reporting(0);
require_once('TCPDF-main/tcpdf.php');
include 'includes/database.php';
include 'includes/functions.php';

$conn = new Functions();
$redirect = $conn->base_url();
if(isset($_GET['name']) AND isset($_GET['exam']) AND isset($_GET['session'])
    AND isset($_GET['class']) AND isset($_GET['section'])) {
    $name = str_replace('-', ' ', $_GET['name']);
    $exam = str_replace('-', ' ', $_GET['exam']);
    $class =str_replace('-', ' ', $_GET['class']);
    $section = str_replace('-', ' ', $_GET['section']);
    $year = str_replace('-', '/', $_GET['session']);
    $zero = 0;
    $admin_url = $conn->base_url();

    /*
     * We will include the relevant terminal report generator based on the selected term
     */

    $first_term = "1st term";
    $second_term = "2nd term";
    $third_term = "3rd term";

    //check selected term
    if($exam == $first_term){
        include_once '1st_term_report.php';
    }elseif ($exam == $second_term){
        include_once "2nd_term_report.php";
    }else{
        include_once "3rd_term_report.php";
    }


    //end  adding of 1st, 2nd and 3rd term report details

}else{
    //return back to index page

    header("location: $redirect");
}
// ---------------------------------------------------------

// close and output PDF document
$pdf->Output('terminal_report.pdf', 'I');

//============================================================+
// END OF FILE
//============================================================+
