| Server IP : 172.67.187.206 / Your IP : 172.71.28.156 Web Server : Apache/2.4.25 (Win32) OpenSSL/1.0.2j PHP/5.6.30 System : Windows NT WIN-ECQAAA40806 6.2 build 9200 (Windows Server 2012 Standard Edition) i586 User : SYSTEM ( 0) PHP Version : 5.6.30 Disable Function : NONE MySQL : ON | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : E:/Inetpub/www/news/edu2018/admin/ |
Upload File : |
<?php
include "header.php";
$id=$_SESSION['sess_id'];
?>
<?php if($userlevel=="admin") { ?>
<link rel="stylesheet" href="../dist/css/AdminLTE.min.css">
<link rel="stylesheet" href="../bower_components/Ionicons/css/ionicons.min.css">
<link rel="stylesheet" href="../bower_components/font-awesome/css/font-awesome.min.css">
<link rel="stylesheet" href="../dist/css/skins/_all-skins.min.css">
<!-- Main content -->
<div class="container">
<div class="wrapper">
<div class="col-lg-4 col-xs-6">
<!-- small box -->
<div class="small-box bg-aqua">
<div class="inner">
<?php
$sql= $mysqli->query("SELECT * FROM student where active='yes'");
$total=mysqli_num_rows($sql);
?>
<h3><?=$total;?> คน</h3>
<p>นักเรียนทั้งหมด</p>
</div>
<div class="icon">
<i class="ion-stats-bars"></i>
</div>
<a href="#" class="small-box-footer">More info <i class="fa fa-arrow-circle-right"></i></a>
</div>
</div>
<div class="col-lg-4 col-xs-6">
<!-- small box -->
<div class="small-box bg-yellow">
<div class="inner">
<?php
$sql1= $mysqli->query("SELECT * FROM student where prefix='เด็กชาย' OR prefix='นาย' AND active='yes'");
$total1=mysqli_num_rows($sql1);
?>
<h3><?=$total1;?> คน</h3>
<p>นักเรียนชาย</p>
</div>
<div class="icon">
<i class="ion ion-person"></i>
</div>
<a href="#" class="small-box-footer">More info <i class="fa fa-arrow-circle-right"></i></a>
</div>
</div>
<div class="col-lg-4 col-xs-6">
<!-- small box -->
<div class="small-box bg-green">
<div class="inner">
<?php
$sql2= $mysqli->query("SELECT * FROM student where prefix='เด็กหญิง' OR prefix='นางสาว' AND active='yes'");
$total2=mysqli_num_rows($sql2);
?>
<h3><?=$total2;?> คน</h3>
<p>นักเรียนหญิง</p>
</div>
<div class="icon">
<i class="ion ion-person"></i>
</div>
<a href="#" class="small-box-footer">More info <i class="fa fa-arrow-circle-right"></i></a>
</div>
</div>
<section class="content">
<div class="row">
<div class="col-md-6">
<div class="box box-success">
<div class="box-header with-border">
<h3 class="box-title">จำนวนนักเรียน</h3>
<div class="box-tools pull-right">
<button type="button" class="btn btn-box-tool" data-widget="collapse"><i class="fa fa-minus"></i>
</button>
<button type="button" class="btn btn-box-tool" data-widget="remove"><i class="fa fa-times"></i></button>
</div>
</div>
<div class="box-body">
<div class="chart">
<canvas id="barChart" style="height:230px"></canvas>
</div>
</div>
</div>
</div>
<div class="col-md-2">
<div class="col-md-12"><img src="../img/M.png" width="30" height="22"> เพศชาย</div>
<div class="col-md-12"><img src="../img/F.png" width="30" height="22"> เพศหญิง</div>
</div>
<div class="col-md-4">
<div class="box box-success">
<div class="box-header with-border">
<h3 class="box-title">นักเรียนหอพัก</h3>
<div class="box-tools pull-right">
<button type="button" class="btn btn-box-tool" data-widget="collapse"><i class="fa fa-minus"></i>
</button>
<button type="button" class="btn btn-box-tool" data-widget="remove"><i class="fa fa-times"></i></button>
</div>
</div>
<div class="box-body">
<table class="table">
<tr>
<td></td>
<td align="center">อยู่หอพัก</td>
<td align="center">กลับบ้าน</td>
</tr>
<?php
$SQLin= $mysqli->query("SELECT * FROM `student` GROUP BY `student`.`rsroom`");
while($Rowin=mysqli_fetch_array($SQLin)) {
?>
<tr>
<td><?=$Rowin['rsroom'];?></td>
<?php
$inroom= $mysqli->query("SELECT * FROM student where rsroom='$Rowin[rsroom]' and status='in' AND active='yes'");
$in1=mysqli_num_rows($inroom);
$outroom= $mysqli->query("SELECT * FROM student where rsroom='$Rowin[rsroom]' and status='out' AND active='yes'");
$out1=mysqli_num_rows($outroom);
?>
<td align="center"><?=$in1;?> คน</td>
<td align="center"><?=$out1;?> คน</td>
</tr>
<?php } ?>
</table>
</div>
</div>
</div>
</div>
</section>
</div>
</div>
<!-- ChartJS -->
<script src="../bower_components/chart.js/Chart.js"></script>
<?php
$x1= $mysqli->query("SELECT * FROM student where class='ปวช1' AND active='yes' AND prefix='เด็กชาย' OR prefix='นาย'");
$r1=mysqli_num_rows($x1);
$x2= $mysqli->query("SELECT * FROM student where class='ปวช2' AND active='yes' AND prefix='เด็กชาย' OR prefix='นาย'");
$r2=mysqli_num_rows($x2);
$x3= $mysqli->query("SELECT * FROM student where class='ปวช3' AND active='yes' AND prefix='เด็กชาย' OR prefix='นาย'");
$r3=mysqli_num_rows($x3);
$m1= $mysqli->query("SELECT * FROM student where class='ปวช1' AND active='yes' AND prefix='เด็กหญิง' OR prefix='นางสาว'");
$f1=mysqli_num_rows($m1);
$m2= $mysqli->query("SELECT * FROM student where class='ปวช2' AND active='yes' AND prefix='เด็กหญิง' OR prefix='นางสาว'");
$f2=mysqli_num_rows($m2);
$m3= $mysqli->query("SELECT * FROM student where class='ปวช3' AND active='yes' AND prefix='เด็กหญิง' OR prefix='นางสาว'");
$f3=mysqli_num_rows($m3);
?>
<script>
$(function () {
var areaChartData = {
labels : ['ปวช1', 'ปวช2', 'ปวช3'],
datasets: [
{
label : 'ชาย',
fillColor : 'rgba(200, 190, 190, 1)',
strokeColor : 'rgba(249, 247, 26, 1)',
pointColor : 'rgba(255, 140, 26, 1)',
pointStrokeColor : '#c1c7d1',
pointHighlightFill : '#45b53e',
pointHighlightStroke: 'rgba(220,220,220,1)',
data : [<?=$r1;?>, <?=$r2;?>, <?=$r3;?>]
},
{
label : 'หญิง',
fillColor : 'rgba(50,50,50,0.9)',
strokeColor : 'rgba(255,141,188,0.8)',
pointColor : '#3b8bba',
pointStrokeColor : 'rgba(60,141,188,1)',
pointHighlightFill : '#fff',
pointHighlightStroke: 'rgba(60,141,188,1)',
data : [<?=$f1;?>, <?=$f2;?>, <?=$f3;?>]
}
]
}
//-------------
//- BAR CHART -
//-------------
var barChartCanvas = $('#barChart').get(0).getContext('2d')
var barChart = new Chart(barChartCanvas)
var barChartData = areaChartData
barChartData.datasets[1].fillColor = '#00cc00'
barChartData.datasets[1].strokeColor = '#eef687'
barChartData.datasets[1].pointColor = '#00cc00'
var barChartOptions = {
//Boolean - Whether the scale should start at zero, or an order of magnitude down from the lowest value
scaleBeginAtZero : true,
//Boolean - Whether grid lines are shown across the chart
scaleShowGridLines : true,
//String - Colour of the grid lines
scaleGridLineColor : 'rgba(161,18,61,5)',
//Number - Width of the grid lines
scaleGridLineWidth : 1,
//Boolean - Whether to show horizontal lines (except X axis)
scaleShowHorizontalLines: true,
//Boolean - Whether to show vertical lines (except Y axis)
scaleShowVerticalLines : true,
//Boolean - If there is a stroke on each bar
barShowStroke : true,
//Number - Pixel width of the bar stroke
barStrokeWidth : 2,
//Number - Spacing between each of the X value sets
barValueSpacing : 30,
//Number - Spacing between data sets within X values
barDatasetSpacing : 5,
//String - A legend template
legendTemplate : '<ul class="<%=name.toLowerCase()%>-legend"><% for (var i=0; i<datasets.length; i++){%><li><span style="background-color:<%=datasets[i].fillColor%>"></span><%if(datasets[i].label){%><%=datasets[i].label%><%}%></li><%}%></ul>',
//Boolean - whether to make the chart responsive
responsive : true,
maintainAspectRatio : true
}
barChartOptions.datasetFill = false
barChart.Bar(barChartData, barChartOptions)
})
</script>
<?php
require 'popup.php';
require '../footer.php';
?>
<?php } ?>
</body>
</html>