历史互动题目统计
commit
f7edf7cec6
@ -0,0 +1,40 @@
|
|||||||
|
<?php
|
||||||
|
if (!defined('BASEPATH'))
|
||||||
|
exit('No direct script access allowed');
|
||||||
|
|
||||||
|
class Statistics extends CI_Controller
|
||||||
|
{
|
||||||
|
function __construct()
|
||||||
|
{
|
||||||
|
parent::__construct();
|
||||||
|
$this->permission->is_admin();
|
||||||
|
$this->load->model('Chinese_history_model');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function Chinese_history_log()
|
||||||
|
{
|
||||||
|
$data['log_action'] = $this->input->post('log_action') ? $this->input->post('log_action') : 0;
|
||||||
|
$data['start_date'] = $this->input->post('start_date') ? $this->input->post('start_date') : date('Y-m-01');
|
||||||
|
$data['end_date'] = $this->input->post('end_date') ? $this->input->post('end_date') : date('Y-m-d',strtotime('+1 day'));
|
||||||
|
$order = $this->input->post('order') ? $this->input->post('order') : 'Created_On';
|
||||||
|
$order_field = " ORDER BY ".$order." DESC ";
|
||||||
|
|
||||||
|
$data['ret'] = $this->Chinese_history_model->get_log($data['log_action'],$data['start_date'],$data['end_date']);
|
||||||
|
foreach ($data['ret'] as $key => &$value) {
|
||||||
|
$value->action_text = $this->Chinese_history_log_type()[$value->LOG_Action];
|
||||||
|
}
|
||||||
|
$this->load->view('statistics/Chinese_history_log',$data);
|
||||||
|
}
|
||||||
|
public function Chinese_history_log_type()
|
||||||
|
{
|
||||||
|
return array(
|
||||||
|
0 => '',
|
||||||
|
1 => '进了封面的图片进入测试',
|
||||||
|
2 => '完成了前3题',
|
||||||
|
3 => '完成了10题拿到成绩单',
|
||||||
|
4 => '点击了try again!'
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,35 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
class Chinese_history_model extends CI_Model {
|
||||||
|
|
||||||
|
function __construct() {
|
||||||
|
parent::__construct();
|
||||||
|
$this->INFO = $this->load->database('INFO', TRUE);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* [LOG_Action]
|
||||||
|
* 1; // 进了封面的图片进入测试
|
||||||
|
* 2; // 完成了前3题
|
||||||
|
* 3; // 完成了10题拿到成绩单
|
||||||
|
* 4; // 点击了try again
|
||||||
|
*/
|
||||||
|
|
||||||
|
function get_log($log_action = '0',$start_date = null,$end_date = null,$order_field = null)
|
||||||
|
{
|
||||||
|
$sql = "SELECT COUNT(1) ret,LOG_Action FROM ChineseHistoryLog WHERE 1=1 ";
|
||||||
|
if ($log_action != '0') {
|
||||||
|
$sql .= " AND LOG_Action=" . $this->INFO->escape($log_action);
|
||||||
|
}
|
||||||
|
if ($start_date !== null) {
|
||||||
|
$sql .= " AND Created_On BETWEEN " . $this->INFO->escape($start_date) ." AND ". $this->INFO->escape($end_date);
|
||||||
|
}
|
||||||
|
if ($order_field !== null) {
|
||||||
|
$sql .= $order_field;
|
||||||
|
}
|
||||||
|
$sql .= " GROUP BY LOG_Action ";
|
||||||
|
$query = $this->INFO->query($sql);
|
||||||
|
return $query->result();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,81 @@
|
|||||||
|
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<title>信息平台</title>
|
||||||
|
<link rel="stylesheet" href="/css/information-system3.css" type="text/css" />
|
||||||
|
<link rel="stylesheet" href="/css/bootstrap-datetimepicker.min.css" type="text/css" />
|
||||||
|
<script type="text/javascript" src="/js/jquery.js"></script>
|
||||||
|
<script type="text/javascript" src="/js/bootstrap.min.js"></script>
|
||||||
|
<script type="text/javascript" src="/js/bootstrap-datetimepicker.min.js"></script>
|
||||||
|
<script type="text/javascript">
|
||||||
|
$(function() {
|
||||||
|
$('#start_date').datetimepicker({
|
||||||
|
format: "yyyy-mm-dd",
|
||||||
|
minView : 2,
|
||||||
|
autoclose:true
|
||||||
|
});
|
||||||
|
$('#end_date').datetimepicker({
|
||||||
|
format: "yyyy-mm-dd",
|
||||||
|
minView : 2,
|
||||||
|
autoclose:true
|
||||||
|
});
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
<style type="text/css">
|
||||||
|
.show-grid {padding: 15px; background: #efefef; border-radius: 5px;}
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
<div class="container-fluid">
|
||||||
|
<div class="show-grid row">
|
||||||
|
<form role="form" class="form-inline center-block" action="/info.php/Statistics/Chinese_history_log" id="log" name="log" method="post">
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="log_action">类别</label>
|
||||||
|
<select class="form-control" name="log_action">
|
||||||
|
<option value="0"
|
||||||
|
<?php if($log_action == 0){?> selected <?php }?>>全部</option>
|
||||||
|
<option value="1"
|
||||||
|
<?php if($log_action == 1){?> selected <?php }?>>点进了封面的图片进入测试</option>
|
||||||
|
<option value="2"
|
||||||
|
<?php if($log_action == 2){?> selected <?php }?>>完成了前3题</option>
|
||||||
|
<option value="3"
|
||||||
|
<?php if($log_action == 3){?> selected <?php }?>>完成了10道题目拿到了成绩单</option>
|
||||||
|
<option value="4"
|
||||||
|
<?php if($log_action == 4){?> selected <?php }?>>点击了try again!</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="start_date">时间</label>
|
||||||
|
<input type="text" class="form-control" id="start_date" name="start_date"
|
||||||
|
value="<?php echo $start_date;?>" > 至
|
||||||
|
<input type="text" class="form-control" id="end_date" name="end_date"
|
||||||
|
value="<?php echo $end_date;?>">
|
||||||
|
</div>
|
||||||
|
<button type="submit" class="btn btn-default">查询</button>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
<div class="row">
|
||||||
|
<table class="table table-hover">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th width="50%">类别</th>
|
||||||
|
<th width="50%">人数</th>
|
||||||
|
<!-- <th width="6%">时间</th> -->
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody class="data_group">
|
||||||
|
<?php foreach($ret as $key=>$it) { ?>
|
||||||
|
<tr class="data">
|
||||||
|
<td title=""><?php echo($it->action_text);?></td>
|
||||||
|
<td title=""><?php echo($it->ret);?></td>
|
||||||
|
</tr>
|
||||||
|
<?php } ?>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
</body>
|
||||||
|
</html>
|
Loading…
Reference in New Issue