<? include("../settings.php"); ?>
<? include("session.php"); ?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>SP Admin Panel</title>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">

    <!-- Include all CSS/JS -->
        <!-- Bootstrap -->
    <link href="css/bootstrap.css" rel="stylesheet">
    <link href="css/jquery.dataTables.css" rel="stylesheet">
    <link href="http://cdn.datatables.net/responsive/1.0.1/css/dataTables.responsive.css" rel="stylesheet">
    

    <!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
    <!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
    <!--[if lt IE 9]>
      <script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
      <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
    <![endif]-->
    <!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->
    <script src="js/jquery-2.1.1.min.js"></script>
    <!-- Include all compiled plugins (below), or include individual files as needed -->
    <script src="js/bootstrap.min.js"></script>
    <script src="js/jquery.dataTables.min.js"></script>
    <script src="http://cdn.datatables.net/responsive/1.0.1/js/dataTables.responsive.js"></script>

    <!-- End of all CSS/JS -->
   </head>
<body>


<? include("nav_menu.php"); ?>
      <div class="well">
<div class="content" bgcolor="#FFFFD0">
<div class="col-12 feature">
<div class="panelCheck">
    <div class="panel-heading">
        <h3 class "panel-title"><strong>SP Admin Panel</strong></h3>
    </div>

    
    <div class="well well-lg">
        
        <?
            $results = $db->select("tbl_registrant");
            $count = count($results);

            $bind = array(
                ":search1" => date("Y-m-d")
            );

            $results = $db->select("tbl_registrant", "registrant_datetime = :search1", $bind);  
            $count2 = count($results);
        ?>
        <b><u>Statistics</u></b></br>
        Total number captured in database : <?=$count;?></br>
        Total registered today : <?=$count2;?></br></br></br></br>
        <u>Breakdown by assigned roles</u><br/>
        <?
        	$results = $db->select("tbl_role");
        	foreach ($results as $result){
        		$count = $db->run("select * from tbl_registrant where role_id='".$result['role_id']."'");
        		echo $result['role_name']." - ".count($count)."</br>";
        	}
        	
        ?>
        </br></br></br></br>
        <a href='download.php'>Click here to download csv file</a></br></br>      
        
    </div>
    
<!-- /.modal -->
</div>
</div>
</div>
</div>
</body>
</html>
