<?php include("inc/inc/db.php"); 
ob_start();
?>
<!DOCTYPE html>
<html lang="en">

    <!-- Basic -->
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">   
   
    <!-- Mobile Metas -->
    <meta name="viewport" content="width=device-width, initial-scale=1">
 
     <!-- Site Metas -->
    <title>Student Portal</title>  
    <meta name="keywords" content="">
    <meta name="description" content="">
    <meta name="author" content="">
    
    <!-- Site Icons -->
    <link rel="shortcut icon" href="images/cisn-logo.png" type="image/x-icon" />
    <link rel="apple-touch-icon" href="images/cisn-logo.png">

    <!-- Bootstrap CSS -->
    <link rel="stylesheet" href="css/bootstrap.min.css">
    <!-- Site CSS -->
    <link rel="stylesheet" href="style.css">
    <!-- ALL VERSION CSS -->
    <link rel="stylesheet" href="css/versions.css">
    <!-- Responsive CSS -->
    <link rel="stylesheet" href="css/responsive.css">
    <!-- Custom CSS -->
    <link rel="stylesheet" href="css/custom.css">

    <!-- Modernizer for Portfolio -->
    <script src="js/modernizer.js"></script>

    <!--[if lt IE 9]>
      <script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
      <script src="https://oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js"></script>
    <![endif]-->

</head>
<body class="host_version"> 

	<?php include("inc/menu.php"); ?>
    <div class="container " style="margin-top:50px;">
        <div class="row">
            <div class="col-md-4">
                <div class="container" >
                    <div class="container matric-section" style="text-align:center;">
                    <?php
                            session_start();


                                            if(!isset($_SESSION['sname'])){
                                header("location:validation/index.php");
                                exit();
                            }


                            $sname = $_SESSION["sname"];
                            $squery = "SELECT sname FROM portal WHERE sname = '$sname'";
                            $query_result = $db->query($squery);

                            
                            
                            // SQL Query with JOIN to include passport from bio_data
                            $query = "
                                SELECT 
                                    student_table.fname, 
                                    student_table.sname, 
                                    student_table.Program_Courses, 
                                    student_table.mode,
                                    bio_data.passport
                                FROM 
                                    student_table
                                LEFT JOIN 
                                    bio_data 
                                ON 
                                    student_table.sname = bio_data.sname
                                WHERE 
                                    student_table.sname = '$sname'
                            ";

                            $query_result = $db->query($query);

                            if($query_result->num_rows == 1){
                                $row = $query_result->fetch_assoc();
                            } else {
                                die("No record found for the student.");
                            }
                        ?>

                        <!-- Display student passport -->
                        <img src="uploads/<?php echo htmlspecialchars($row['passport']); ?>" alt="Image" style="max-width: 100px; max-height: 100px;">

                        <div class="container fullname-section">
                            <h5><?php echo htmlspecialchars($row['sname']); ?> 
                                <span style="color:#0f0505;"><?php echo htmlspecialchars($row['fname']); ?></span>
                            </h5>
                            <p style="text-transform:uppercase;color:#0f0505;">
                                <?php echo htmlspecialchars($row['Program_Courses']); ?> 
                                <span style=" color:#0f0505;">(<?php echo htmlspecialchars($row['mode']); ?>)</span>
                            </p>
                        </div>
                    </div>
                </div>
            </div>
            <div class="col-md-8 content">
                <?php
                    if(isset($_GET['env'])){
                        $env = $_GET['env'];
                    }else{
                        $env = '';
                    }

                    switch($env){
                        case 'dashboard';
                        include 'inc/dashboard.php';
                        break;
                        case 'student_screening_form';
                        include 'inc/student_screening_form.php';
                        break;
                        case 'bio_data';
                        include 'inc/bio_data.php';
                        break;
                        case 'Guarantor_Form';
                        include 'inc/Guarantor_Form.php';
                        break;
                        case 'waec_result';
                        include 'inc/waec_result.php';
                        break;
                        case 'Jamb';
                        include 'inc/Jamb.php';
                        break;
                        case 'State_origin';
                        include 'inc/State_origin.php';
                        break;
                        case 'Medical_report';
                        include 'inc/Medical_report.php';
                        break;
                        case 'passport';
                        include 'inc/passport.php';
                        break;
                        case 'carryover-courses';
                        include 'inc/carryover-course.php';
                        break;
                        case 'print-courses-registered';
                        include 'inc/print-courses-registered.php';
                        break;
                        case 'print-carryover-courses-registered';
                        include 'inc/print-carryover-courses-registered.php';
                        break;
                        case 'hostellist';
                        include 'inc/hostellist.php';
                        break;
                        case 'Upload_biodata_form';
                        include 'inc/Upload_biodata_form.php';
                        break;
                        case 'print-biodata';
                        include 'inc/print-biodata.php';
                        break;
                        case 'print-guarantor_form';
                        include 'inc/print-guarantor_form.php';
                        break;
                        case 'upload-guarantor_form';
                        include 'inc/upload-guarantor_form.php';
                        break;
                        case 'upload-jamb_form';
                        include 'inc/upload-jamb_form.php';
                        break;
                        case 'print-jamb_form';
                        include 'inc/print-jamb_form.php';
                        break;
                        case 'upload-medical_report';
                        include 'inc/upload-medical_report.php';
                        break;
                        case 'print-medical_report';
                        include 'inc/print-medical_report.php';
                        break;
                        case 'upload-waec_result';
                        include 'inc/upload-waec_result.php';
                        break;
                        case 'print-waec_result';
                        include 'inc/print-waec_result.php';
                        break;
                        case 'upload-state_of_origin';
                        include 'inc/upload-state_of_origin.php';
                        break;
                        case 'print-state_of_origin';
                        include 'inc/print-state_of_origin.php';
                        break;
                    }
                ?>
            </div>
        </div>
    </div>
</body>
<script src="js/all.js"></script>
    <!-- ALL PLUGINS -->
    <script src="js/custom.js"></script>
	<script src="js/timeline.min.js"></script>
	<script>
		timeline(document.querySelectorAll('.timeline'), {
			forceVerticalMode: 700,
			mode: 'horizontal',
			verticalStartPosition: 'left',
			visibleItems: 4
		});
	</script>
</html>

