<?php
	require_once('source/session.php');
	require_once('source/error.php');
	require_once('source/dbconfig.php');
	require_once('source/function.php');
	require_once('source/restrict_user.php');
	
	
	if($_SESSION['msg'] == "email" || $_SESSION['msg'] == "phone" || $_SESSION['msg'] == "reg" || $_SESSION['msg'] == "bitcoin wallet" || $_SESSION['msg'] == "account number")
	{
		$msg = "<h5 class='alert alert-warning text-center'>".($_SESSION['msg'])." already exists, please try another</h5>";
		
	}            
	else if($_SESSION['msg'] == "signup")
	{
		$msg = "<h5 class='alert alert-success text-center'>Registration is successful, student can login now!<a 
		class='btn btn-default' href='sign_in.php'>here</a></h5>";
	}            
	else if($_SESSION['msg'] == "captcha")
	{
		$msg = "<h5 class='alert alert-warning text-center'>Something went wrong, please check captcha</h5>";
	}            
	else if($_SESSION['msg'] == "samp")
	{
		$msg = "<h5 class='alert alert-warning text-center'>Samp request found, please try again</h5>";
	}            
	else if($_SESSION['msg'] == "incorrect")
	{
		$msg = "<h5 class='alert alert-danger text-center'>Incorrect Passwords! Kindly Insert Correct Password for Both.</h5>";
	}          
	else if($_SESSION['msg'] == "forget")
	{
		$msg = "<h5 class='alert alert-success text-center'>New password has been sent to your verified email</h5>";
	} else if($_SESSION['msg'] == "no_ref")
	{
		$msg = "<h5 class='alert alert-danger text-center'>Invalid Referrence Email</h5>";
	} else if($_SESSION['msg'] == "no_pro")
	{
		$msg = "<h5 class='alert alert-danger text-center'>Invalid Promoter/Consultant Email</h5>";
	} 

		unset($_SESSION['msg']);
?>

<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="utf-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
  <meta name="description" content="">
  <meta name="author" content="">
  <title>BRITISH LEARNERS COLLEGE, OWERRI, IMO STATE: TAECHER DASHBOARD</title>
  <!-- Bootstrap core CSS-->
  <link href="vendor/bootstrap/css/bootstrap.min.css" rel="stylesheet">
  <!-- Custom fonts for this template-->
  <link href="vendor/font-awesome/css/font-awesome.min.css" rel="stylesheet" type="text/css">
  <!-- Page level plugin CSS-->
  <link href="vendor/datatables/dataTables.bootstrap4.css" rel="stylesheet">
  <!-- Custom styles for this template-->
  <link href="css/sb-admin.css" rel="stylesheet">
  <link href="css/folder.css" rel="stylesheet">
  <link href="css/user_profile.css" rel="stylesheet">
  
  <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
  <script src="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
  <!-- select-->
  <link rel="stylesheet" href="https://www.w3schools.com/w3css/4/w3.css">
  
<style> 
div.a {
    white-space: nowrap; 
    width: 100px; 
    overflow: hidden;
    text-overflow:ellipsis;
    border: 0px solid #000000;
    padding-left: 25px;
}

div.a:hover {
    overflow: visible;
}
.style1 {color: #FFFFFF}
.style2 {color: #000000}
</style>
</head>

<body class="fixed-nav sticky-footer bg-dark" id="page-top">
  <!-- Navigation-->
  <nav class="navbar navbar-expand-lg navbar-dark bg-dark fixed-top" id="mainNav">
<h4 style='color: LIME'><b>BRITISH LEARNERS COLLEGE, OWERRI, IMO STATE: TEACHER DASHBOARD </b></h4>  
<?php
            	
            	$rows = sql($DBH, "SELECT * FROM tbl_admin where status = ?", 
            	array("Active"), "rows");							
            	foreach($rows as $row)
            	{
            		$admin_name 		= $row['username'];
            	}
		
      if (isset($_SESSION['SESS_HASH_ADMIN'])) {
		$user_true 			 = "<h4 style='color: yellow'><!--<b>SCORE SHEET--></b></h4>";
		
}
		echo "$user_true ";
?>
    <button class="navbar-toggler navbar-toggler-right" type="button" data-toggle="collapse" data-target="#navbarResponsive" aria-controls="navbarResponsive" aria-expanded="false" aria-label="Toggle navigation">
      <span class="navbar-toggler-icon"></span>
    </button>
     <div class="collapse navbar-collapse" id="navbarResponsive">
<ul class="navbar-nav navbar-sidenav" id="exampleAccordion">
  <li class="nav-item" data-toggle="tooltip" data-placement="right" title="Dashboard">
    <a class="nav-link" href="main.php">
      <i class="fa fa-dashboard" style="color: #3498db"></i>
      <span class="nav-link-text" style="color: white">Teacher Dashboard</span>
    </a>
  </li>
  <!--<li class="nav-item" data-toggle="tooltip" data-placement="right" title="Generate Score Sheet">
    <a class="nav-link" href="students.php">
      <i class="fa fa-clock-o" style="color: #3498db"></i>
      <span class="nav-link-text" style="color: white">Generate Score Sheet</span>
    </a>
  </li> -->
  <li class="nav-item" data-toggle="tooltip" data-placement="right" title="Download Broadsheet">
    <a class="nav-link" href="download_broadsheet.php">
      <i class="fa fa-download" style="color: blue"></i>
      <span class="nav-link-text" style="color: white">Download Broadsheet</span>
    </a>
  </li>
  <!--<li class="nav-item" data-toggle="tooltip" data-placement="right" title="Fill Attendance Sheet">
    <a class="nav-link" href="fill_attendance_sheet.php">
      <i class="fa fa-download" style="color: red"></i>
      <span class="nav-link-text" style="color: white">Download Specimen Excel Sheets</span>
    </a>
  </li> -->
  <li class="nav-item" data-toggle="tooltip" data-placement="right" title="Upload Tests (CA 1, C.A.2, EXAM)">
    <a class="nav-link" href="upload_ca1.php">
      <i class="fa fa-upload" style="color: orange"></i>
      <span class="nav-link-text" style="color: white">Upload Tests (CA 1, CA 2, EXAM)</span>
    </a>
  </li>
    <!--<li class="nav-item" data-toggle="tooltip" data-placement="right" title="Upload Tests (CA 2)">
    <a class="nav-link" href="upload_ca2.php">
      <i class="fa fa-upload" style="color: orange"></i>
      <span class="nav-link-text" style="color: white">Upload Tests (CA 2)</span>
    </a>
  </li>
    <li class="nav-item" data-toggle="tooltip" data-placement="right" title="Upload Tests (CA 3)">
    <a class="nav-link" href="upload_ca3.php">
      <i class="fa fa-upload" style="color: orange"></i>
      <span class="nav-link-text" style="color: white">Upload Tests (CA 3)</span>
    </a>
  
    <li class="nav-item" data-toggle="tooltip" data-placement="right" title="Upload Exams">
    <a class="nav-link" href="upload_exam.php">
      <i class="fa fa-upload" style="color: orange"></i>
      <span class="nav-link-text" style="color: white">Upload Exam Scores</span>
    </a></li>-->
  </li>
  <li class="nav-item" data-toggle="tooltip" data-placement="right" title="Fill Attendance Sheet">
    <a class="nav-link" href="upload_attendance.php">
      <i class="fa fa-upload" style="color: red"></i>
      <span class="nav-link-text" style="color: white">Upload Attendance Scores</span>
    </a>
  </li>
  <!--<li class="nav-item" data-toggle="tooltip" data-placement="right" title="Fill Attendance Sheet">
    <a class="nav-link" href="fill_attendance_sheet.php">
      <i class="fa fa-upload" style="color: red"></i>
      <span class="nav-link-text" style="color: white">Upload Exam Scores</span>
    </a>
  </li> -->
  <li class="nav-item" data-toggle="tooltip" data-placement="right" title="Upload Skills, Psychomotor, and others">
    <a class="nav-link" href="upload_skills.php">
      <i class="fa fa-upload" style="color: purple"></i>
      <span class="nav-link-text" style="color: white">Upload Skills, Psychomotor, and others</span>
    </a>
  </li>
  <li class="nav-item" data-toggle="tooltip" data-placement="right" title="Logout">
    <a class="nav-link" href="logout.php">
      <i class="fa fa-sign-out" style="color: #3498db"></i>
      <span class="nav-link-text" style="color: white">Logout</span>
    </a>
  </li>
</ul>
    </div>
  </nav>
  
  <div class="content-wrapper">
    <div class="container-fluid">
      <!-- Breadcrumbs-->
      <ol class="breadcrumb" style="background: ac39ac">
        <li class="breadcrumb-item">
          <a href="index.php" style="color: black; font-weight: bold">Teacher's Board</a>
          
        </li>
        <li class="breadcrumb-item active" style="color: black">Class Student/Pupil's Profile</li>
      </ol>
    <?php if(!empty($statusMsg)){
        echo '<div class="alert '.$statusMsgClass.'">'.$statusMsg.'</div>';
    } ?>
      <div class="row">
        <div class="col-lg-12">
          <!-- Example Bar Chart Card-->
      <ol class="breadcrumb"style="background: #f9ecf9">
                                    <h6 align="center"><strong>Profile</strong></h6>
        
          </ol>                                   
<?php
	echo $msg;
?>   
		<?php           
		$rows = sql($DBH, "SELECT * FROM tbl_student_results  WHERE class = ? AND term = ? AND year = ? AND registration_no = ?", 
            	array($_GET['myclass'],$_GET['term'],$_GET['examyear'],$_GET['myreg']), "rows");
		foreach($rows as $row)
		{	
			$ov_reg 		= $row['registration_no'];
			$ov_sub 			= $row['subclass'];
		}
		         
		$rows = sql($DBH, "SELECT * FROM tbl_user  WHERE registration_no = ?", 
            	array($ov_reg), "rows");
		foreach($rows as $row)
		{	
			$ov_profile_pic		= $row['profile_pic'];
			$ov_name 		= $row['fullname'];
			$ov_email 		= $row['email'];
			$ov_phone 		= $row['phone'];
			$ov_gender 			= $row['gender'];
			$dob 			= $row['age'];
			
				
				//date in mm/dd/yyyy format; or it can be in other formats as well
  $birthDate = "$dob";
  //explode the date to get month, day and year
  $birthDate = explode("/", $birthDate);
  //get age from date or birthdate
  $age = (date("md", date("U", mktime(0, 0, 0, $birthDate[0], $birthDate[1], $birthDate[2]))) > date("md")
    ? ((date("Y") - $birthDate[2]) - 1)
    : (date("Y") - $birthDate[2]));
			
		}
		
            		if($ov_profile_pic == "default"){
            		$profile_pic = "<img width='100px' src='../admin/profile/profile.jpg'>";
			}else{						
			$profile_pic = "<img width='100px' src='../admin/profile_pic/$ov_profile_pic'>";
			}
		
		?>
            
                <hr>
                <marquee>
                <h4 style='color: blue'><span class="GG style2">Name:</span> <?php echo $ov_name; $ov_reg; ?>   <span class="GG">| <span class="style2">Admission Number:</span></span> <?php echo $ov_reg; ?><span class="GG"> | <span class="style2">Class:</span></span> <?php echo $_GET['myclass']; ?></h4>
                </marquee>
                <hr>
			<div class='row'>
			<div class='col-sm-6'>
			<?php echo $profile_pic; ?>
		</div>
		</div>
			<div class='row'>
			<div class='col-sm-6'>
			<label>Name:</label>
			<?php echo $ov_name; ?>
		</div>
			<div class='col-sm-6'>
			<label>User Email:</label>
			<?php echo $ov_email; ?>
		</div>
		</div>
			<div class='row'>
			<div class='col-sm-6'>
			<label>Phone:</label>
			<?php echo $ov_phone; ?>
		</div>
			<div class='col-sm-6'>
			<label>Gender:</label>
			<?php echo $ov_gender; ?>
		</div>
		</div>
			<div class='row'>
			<div class='col-sm-6'>
			<label>Class:</label>
			
			<?php echo $_GET['myclass']; ?>
		</div>
			<div class='col-sm-6'>
			<label>Class Title:</label>
			
			<?php echo $ov_sub; ?>
		</div>
		</div>
			<div class='row'>
			<div class='col-sm-6'>
			<label>Age:</label>
			<?php echo $age; ?>
		</div>
			<div class='col-sm-6'>
			<label>Registration No:</label>
			<?php echo $_GET['myreg']; ?>
		</div><br/>
		</div>
	
                              </div>
          </div>
    <!-- /.container-fluid-->
    <!-- /.content-wrapper-->
    <footer class="sticky-footer" style="background: GRAY">
      <div class="container">
        <div class="text-center"> <small><strong><span class="style2 style1">Copyright © 2023-2024 BRITISH LEARNERS COLLEGE, OWERRI, IMO STATE: All Rights Reserved!</span></strong></small> </div>
      </div>
    </footer>
    <!-- Scroll to Top Button-->
    <a class="scroll-to-top rounded" href="#page-top">
      <i class="fa fa-angle-up"></i>    </a>
    <!-- Logout Modal-->
    <div class="modal fade" id="exampleModal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
      <div class="modal-dialog" role="document">
        <div class="modal-content">
          <div class="modal-header">
            <h5 class="modal-title" id="exampleModalLabel">Ready to Leave?</h5>
            <button class="close" type="button" data-dismiss="modal" aria-label="Close">
              <span aria-hidden="true">×</span>            </button>
          </div>
          <div class="modal-body">Select "Logout" below if you are ready to end your current session.</div>
          <div class="modal-footer">
            <button class="btn btn-secondary" type="button" data-dismiss="modal">Cancel</button>
            <a class="btn btn-primary" href="Sign_in.php">Logout</a>          </div>
        </div>
      </div>
    </div>
    <!-- Bootstrap core JavaScript-->
    <script src="vendor/jquery/jquery.min.js"></script>
    <script src="vendor/bootstrap/js/bootstrap.bundle.min.js"></script>
    <!-- Core plugin JavaScript-->
    <script src="vendor/jquery-easing/jquery.easing.min.js"></script>
    <!-- Page level plugin JavaScript-->
    <script src="vendor/chart.js/Chart.min.js"></script>
    <script src="vendor/datatables/jquery.dataTables.js"></script>
    <script src="vendor/datatables/dataTables.bootstrap4.js"></script>
    <!-- Custom scripts for all pages-->
    <script src="js/sb-admin.min.js"></script>
    <!-- Custom scripts for this page-->
    <script src="js/sb-admin-datatables.min.js"></script>
    <script src="js/sb-admin-charts.min.js"></script>
     
        <script>
			$(document).ready(function(e){
				$(".pass_mismatch").hide();
				$("#signup").submit(function(e){
					var p1 = $("input[name='password']").val();
					var p2 = $("input[name='password2']").val();
					
					$("input[name='password']").css("border","1px solid #cccccc");
					$("input[name='password2']").css("border","1px solid #cccccc");
					$(".pass_mismatch").hide();
						
					if(p1 != p2){
						$("input[name='password']").css("border","1px solid #f00");
						$("input[name='password2']").css("border","1px solid #f00");
						window.location.hash = '#signup';
						$(".pass_mismatch").slideDown();
						e.preventDefault();
					}
				});
				
			});
			
		</script>
  </div>
</body>
</html>
