Viewing file: v_grpShowGradeByCourse.php (3.44 KB) -rwxr-xr-x Select action/file-type: (+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
<?php
$categories = '';
foreach($result->result() as $j){
$categories .= "'".$j->crsCode."',";
}
$typeGrade = array('A'=>'rdANum','B+'=>'rdBpNum','B'=>'rdBNum','C+'=>'rdCpNum'
,'C'=>'rdCNum','D+'=>'rdDpNum','D'=>'rdDNum','F'=>'rdFNum','W'=>'rdWNum');
?>
<script type="text/javascript" src="<?php echo base_url();?>libraries/Highcharts/js/highcharts.js"></script>
<script type="text/javascript" src="<?php echo base_url();?>libraries/Highcharts/js/modules/exporting.src.js"></script>
<table border="0" width="740" align="center">
<?php echo form_open($this->config->item("rg_folder").'regist2pieis/showGradeByCourse'); ?>
<tr><th>ปีการศึกษา/ภาคการศึกษา <?php echo form_dropdown('year', $opt_acY,$year); ?>
<?php echo form_dropdown('term', $opt_tm,$term); ?>
ชั้นปี <?php echo form_dropdown('sy', $opt_sy,$sy); ?>
<input type="submit" name="search" id="search" value="ค้นหา" style="height:25px; width:35px">
</th></tr>
<tr><td><div id="container2"></div></td></tr>
<tr><td>
<table class="headCol">
<tr>
<th colspan="2" rowspan="2">วิชา</th>
<th colspan="<?php echo count($typeGrade);?>">จำนวนนักศึกษา (คน)</th>
</tr>
<tr>
<?php foreach($typeGrade as $k => $v){
echo "<th>$k</th>";
}
//echo "<th>รวม</th>";
?>
</tr>
<?php
$i=0;
foreach($result->result() as $v){
$i++;
echo "<tr>";
echo "<td align='center'>$i</td>";
echo "<td> ".$v->crsCode.' '.$v->crsName."</td>";
$sum = 0;
foreach($typeGrade as $type => $field){
echo "<td align='center'>".$v->$field."</td>";
$sum += $v->$field;
}
//echo "<td align='center'>".$sum."</td>";
echo "</tr>";
}
?>
</table></td></tr>
<script type="text/javascript">
function test() {
chart = new Highcharts.Chart({
chart: {
renderTo: 'container2',
type: 'column'
},
data: {
table: document.getElementById('datatable')
},
title: {
text: 'รายงานสรุปผลการศึกษารายวิชาเป็นภาคการศึกษาหรือชั้นปี'
},
subtitle: {
text: 'ปีการศึกษา <?php echo $year.' '.$opt_tm[$term];?> ชั้นปีที่ <?php echo $sy;?>'
},
xAxis: {
categories: [<?php echo $categories;?>],
},
yAxis: {
min: 0,
title: {
text: 'จำนวน(คน)'
}
},
tooltip: {
headerFormat: '<span style="font-size:10px">{point.key}</span><table>',
},
plotOptions: {
column: {
pointPadding: 0.2,
borderWidth: 0
}
},
series: [
<?php
foreach($typeGrade as $type => $field){
echo "{name: '$type',";
echo "data: [";
foreach($result->result() as $v){
echo $v->$field.",";
}
echo "]},";
}
?>
]
});
}
</script>
<script type="text/javascript">
$(function () {
var chart;
test();
//columnDrilldown(); // ฟังชันผมสร้างไว้ใน js ใน myCreate ค๊าบบบบ
});
</script>
|