<?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_admin.php');
	
	if($_GET['msg'] == "refered"){
		$msg = "<h5 class='alert alert-success'>Refered successfully</h5>";
	}else if($_GET['msg'] == "failed"){
		$msg = "<h5 class='alert alert-warning'>Something went wrong, please try again</h5>";
	}
?>
<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="utf-8">
  <link rel="icon" 
      type="image/png" 
      href="https://rportal.lahs.com.ng/admin/sch_logo.png">
  <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 LEARNER'S COLLEGE: Student Details And Student Profile Uploads</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">
  
  <!-- 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;
}
.GG1 {
	color: #09F;
}
.style1 {color: #000000}
.style2 {color: #CCCCCC; }
</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">
  
<?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: LIME'><b>BRITISH LEARNER'S COLLEGE: ADMIN Dashboard</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" name="exampleAccordion">
        <li class="nav-item" data-toggle="tooltip" data-placement="right" title="Dashboard">
          <a class="nav-link" href="main.php">
            <i class="fa fa-fw fa-dashboard" style="color: red"></i>
            <span class="nav-link-text" style="color: white">Admin Centre</span>
          </a>
        </li>
        <li class="nav-item" data-toggle="tooltip" data-placement="right" title="Charts">
          <a class="nav-link" href="post_session.php">
            <i class="fa fa-fw fa-clock-o" style="color: red"></i>
            <span class="nav-link-text" style="color: white">School Year/Session</span>
          </a>
        </li>
        <li class="nav-item" data-toggle="tooltip" data-placement="right" title="Charts">
          <a class="nav-link" href="post_classes.php">
            <i class="fa fa-fw fa-building" style="color: red"></i>
            <span class="nav-link-text" style="color: white">Create Classes</span>
          </a>
        </li>
        <li class="nav-item" data-toggle="tooltip" data-placement="right" title="Charts">
          <a class="nav-link" href="add_students.php">
            <i class="fa fa-fw fa-building" style="color: red"></i>
            <span class="nav-link-text" style="color: white">Register New Student</span>
          </a>
        </li>
        <li class="nav-item" data-toggle="tooltip" data-placement="right" title="Charts">
          <a class="nav-link" href="post_subjects.php">
            <i class="fa fa-fw fa-book" style="color: red"></i>
            <span class="nav-link-text" style="color: white">Create Subjects</span>
          </a>
        </li>
        <li class="nav-item" data-toggle="tooltip" data-placement="right" title="Charts">
          <a class="nav-link" href="teachers.php">
            <i class="fa fa-fw fa-user-o" style="color: red"></i>
            <span class="nav-link-text" style="color: white">Manage Teachers</span>
          </a>
        </li>
        <li class="nav-item" data-toggle="tooltip" data-placement="right" title="Charts">
          <a class="nav-link" href="students.php">
            <i class="fa fa-fw fa-user-o" style="color: red"></i>
            <span class="nav-link-text" style="color: white">Manage Students/Pupils</span>
          </a>
        </li>
        <li class="nav-item" data-toggle="tooltip" data-placement="right" title="Charts">
          <a class="nav-link" href="deactivate_students.php">
            <i class="fa fa-fw fa-user-o" style="color: yellow"></i>
            <span class="nav-link-text" style="color: Green">ACTIVATE</span><span class="nav-link-text" style="color: Orange">/INACTIVATE</span>
          </a>
        </li>
        <li class="nav-item" data-toggle="tooltip" data-placement="right" title="Tables">
          <a class="nav-link" href="logout.php">
            <i class="fa fa-fw fa-money" style="color: red"></i>
            <span class="nav-link-text" style="color: white">Logout</span>
          </a>
        </li>
      </ul>
      <ul class="navbar-nav ml-auto">
        <li class="nav-item">
          <span class="m-0"><a class="nav-link" data-toggle="modal" href="logout.php" style="color: white; font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol';">            Logout</a></span>
        </li>
      </ul>
    </div>
  </nav>
  
  <div class="content-wrapper">
    <div class="container-fluid">
      <!-- Breadcrumbs-->
      <ol class="breadcrumb" style="background: #126b3c">
        <li class="breadcrumb-item">
          <a href="main.php" style="color: WHITE; font-weight: bold">Back to Dashboard</a>        </li>
        <li class="breadcrumb-item active" style="color: WHITE">UPDATE STUDENT </li>
      </ol>
      <div class="row">
        <div class="col-lg-12">
          <!-- Example Bar Chart Card-->
      <ol class="breadcrumb"style="background: #126b3c">
                                    <h6 align="center" class="breadcrumb-item active" style="color: WHITE"><strong><big>STUDENT INFORMATION PORTAL</big></strong></h6>
          </ol>                                   
		<a href='add_students.php' style='float:right'>
									<button class='btn btn-success btn-xs'>Add Student<strong></button>
	  </a><br/>
								 Here, results of each class depending on the term you selected earlier can be viewed.<br>
								 <br>
	  To add Students/Pupils, pls click on &quot;Add Students&quot; above and <br>
	  fill up the Student uploading form<br/>
								 <br/><br/><br/><br/>
      <ol class="breadcrumb" style="background: sky blue; color: #39F;">
        <li class="breadcrumb-item">        </li>
        <li class="breadcrumb-item active" style="color: black">Click on a <span class="GG1">Student Folder</span> below to View Student Information</li>
      </ol>
                
      <div class="row" STYLE="COLOR:GREEN">
                
                <?php
                    //get records from database
                     
            	//AND status = ? "DONATED",
                $STH 			= $DBH->prepare("SELECT count(*) FROM tbl_student_results WHERE id >= ?");
            	$result 	   	= $STH->execute(array(1));
            	$count		  	= $STH->fetchColumn();
            	
            	if($count >= 1){
                           
		$rows = sql($DBH, "SELECT MIN(id) AS id, registration_no FROM tbl_student_results  WHERE class = ? AND term = ? AND year = ? GROUP BY registration_no", 
            	array($_GET['stclass'],$_GET['id'],$_GET['examyear']), "rows");
		foreach($rows as $row)
		{	
			$name	 		= $row['name'];
			$registration_no 		= $row['registration_no'];
			$test 			= $row['test'];
			$home_work 			= $row['home_work'];
			$project			= $row['project'];
			$exam			= $row['exam'];
			$t_total			= $row['total'];
			$t_grade			= $row['grade'];
			$position			= $row['position'];
			$t_subject			= $row['subject'];
			$t_class			= $row['class'];
			$t_year			= $row['year'];
			$t_term			= $row['term'];
            		
            		            
		$rows = sql($DBH, "SELECT name FROM tbl_student_results  WHERE registration_no = ?", 
            	array($registration_no), "rows");
		foreach($rows as $row)
		{	
			$g_name	 		= $row['name'];
		}
            		
            		$g_id = $_GET['id'];
            		$g_class = $_GET['stclass'];
            		$g_yr = $_GET['examyear'];
			
			echo"
			
                    <div1><a href='students_details.php?myreg=$registration_no&term=$g_id&myclass=$g_class&examyear=$g_yr' target='blank'><div class='a'>$g_name</div>$registration_no</a></div1>";
                    }
                    }else{
                    echo "
                    No Result(s) found.....";
                    }
                   
                    ?>
      </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="style1" STYLE="COLOR:WHITE">Copyright © 2021-2024 BRITISH LEARNER'S COLLEGE: All Rights Reserved! 
        <br> <a href="https://dataswift.com.ng"; STYLE="color:pink">| POWERED BY DATASWIFT PORTALS</a></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>
