merge heihedata branch from r4187 to r4192
This commit is contained in:
parent
ddeb9e4970
commit
0d5ce7a19f
|
@ -4000,6 +4000,11 @@ class Admin_DataController extends Zend_Controller_Action
|
||||||
}else{
|
}else{
|
||||||
$this->view->data['doi'] = $metadata['doi'];
|
$this->view->data['doi'] = $metadata['doi'];
|
||||||
$this->view->data['info'] = $doi->data_process_out($this->view->data);
|
$this->view->data['info'] = $doi->data_process_out($this->view->data);
|
||||||
|
if(empty($this->view->data['ts_published']))
|
||||||
|
{
|
||||||
|
$this->view->data['title'] = $metadata['title'];
|
||||||
|
$this->view->data['title_en'] = $metadata['title_en'];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}else{
|
}else{
|
||||||
$this->view->data = $doi->view($uuid);
|
$this->view->data = $doi->view($uuid);
|
||||||
|
|
|
@ -195,7 +195,32 @@ class Admin_StatController extends Zend_Controller_Action
|
||||||
//按用户统计
|
//按用户统计
|
||||||
function userAction(){
|
function userAction(){
|
||||||
|
|
||||||
$ac = $this->_getParam('ac');
|
$this->view->ac = $ac = $this->_getParam('ac');
|
||||||
|
|
||||||
|
if($ac == "new")
|
||||||
|
{
|
||||||
|
$this->_helper->viewRenderer('user-new');
|
||||||
|
$this->view->year = $year = !empty($this->_getParam('year')) ? $this->_getParam('year'):date("Y");
|
||||||
|
$this->view->by = $by = !empty($this->_getParam('by')) ? $this->_getParam('by'):"month";
|
||||||
|
$userStatistics = new \Statistics\User();
|
||||||
|
|
||||||
|
if($by == "month")
|
||||||
|
{
|
||||||
|
$this->view->data = $userStatistics->getNewUsersByMonth($year);
|
||||||
|
}
|
||||||
|
|
||||||
|
if($by == "year")
|
||||||
|
{
|
||||||
|
$this->view->data = $userStatistics->getNewUsersByYear($year);
|
||||||
|
}
|
||||||
|
|
||||||
|
if($by == "monthavg")
|
||||||
|
{
|
||||||
|
$this->view->data = $userStatistics->getAverageSingupByMonth($year);
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
if($ac == "get")
|
if($ac == "get")
|
||||||
{
|
{
|
||||||
|
|
|
@ -29,41 +29,47 @@ $this->theme->AppendPlus($this,'colorbox');
|
||||||
<?php if(!empty($this->msg)) { ?>
|
<?php if(!empty($this->msg)) { ?>
|
||||||
<?= $this->msg ?>
|
<?= $this->msg ?>
|
||||||
<?php } else{ ?>
|
<?php } else{ ?>
|
||||||
|
<div class="alert alert-info">
|
||||||
|
<button type="button" class="close" data-dismiss="alert">×</button>
|
||||||
|
<h4>提示</h4>
|
||||||
|
如果元数据中标题发生了变更,在DOI中也需要变更时需要在这里点击“提交”按钮才能生效
|
||||||
|
</div>
|
||||||
<form class="form-horizontal" method="post">
|
<form class="form-horizontal" method="post">
|
||||||
<div class="control-group">
|
<div class="control-group">
|
||||||
<label class="control-label" for="doi">doi</label>
|
<label class="control-label" for="doi">doi</label>
|
||||||
<div class="controls">
|
<div class="controls">
|
||||||
<input type="text" id="doi" name="doi" readonly="readonly" value="<?= (isset($this->data['doi'])&&!empty($this->data['doi'])) ? $this->data['doi']:"doi:10.3972/westdc.x.2013.db" ?>" />
|
<input type="text" id="doi" name="doi" readonly="readonly" class="input-block-level"
|
||||||
|
value="<?= (isset($this->data['doi'])&&!empty($this->data['doi'])) ? $this->data['doi']:"doi:10.3972/westdc.x.2013.db" ?>" />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="control-group">
|
<div class="control-group">
|
||||||
<label class="control-label" for="uuid">uuid</label>
|
<label class="control-label" for="uuid">uuid</label>
|
||||||
<div class="controls">
|
<div class="controls">
|
||||||
<input type="text" id="uuid" name="uuid" readonly="readonly" value="<?= isset($this->data['uuid']) ? $this->data['uuid']:"" ?>" />
|
<input type="text" id="uuid" name="uuid" readonly="readonly" value="<?= isset($this->data['uuid']) ? $this->data['uuid']:"" ?>" class="input-block-level" />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="control-group">
|
<div class="control-group">
|
||||||
<label class="control-label" for="publisher">发布者</label>
|
<label class="control-label" for="publisher">发布者</label>
|
||||||
<div class="controls">
|
<div class="controls">
|
||||||
<input type="text" id="publisher" name="publisher" value="<?= isset($this->data['publisher']) ? $this->data['publisher']:"" ?>" />
|
<input type="text" id="publisher" name="publisher" value="<?= isset($this->data['publisher']) ? $this->data['publisher']:"" ?>" class="input-block-level" />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="control-group">
|
<div class="control-group">
|
||||||
<label class="control-label" for="url">url</label>
|
<label class="control-label" for="url">url</label>
|
||||||
<div class="controls">
|
<div class="controls">
|
||||||
<input type="text" id="url" name="url" value="<?= isset($this->data['url']) ? $this->data['url']:"" ?>" />
|
<input type="text" id="url" name="url" value="<?= isset($this->data['url']) ? $this->data['url']:"" ?>" class="input-block-level"/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="control-group">
|
<div class="control-group">
|
||||||
<label class="control-label" for="title">标题</label>
|
<label class="control-label" for="title">标题</label>
|
||||||
<div class="controls">
|
<div class="controls">
|
||||||
<input type="text" id="title" name="title" readonly="readonly" value="<?= isset($this->data['title']) ? $this->data['title']:"" ?>" />
|
<input type="text" id="title" name="title" readonly="readonly" value="<?= isset($this->data['title']) ? $this->data['title']:"" ?>" class="input-block-level"/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="control-group">
|
<div class="control-group">
|
||||||
<label class="control-label" for="title_en">英文标题</label>
|
<label class="control-label" for="title_en">英文标题</label>
|
||||||
<div class="controls">
|
<div class="controls">
|
||||||
<input type="text" id="title_en" name="title_en" readonly="readonly" value="<?= isset($this->data['title_en']) ? $this->data['title_en']:"" ?>" />
|
<input type="text" id="title_en" name="title_en" readonly="readonly" value="<?= isset($this->data['title_en']) ? $this->data['title_en']:"" ?>" class="input-block-level" />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="control-group">
|
<div class="control-group">
|
||||||
|
|
|
@ -0,0 +1,4 @@
|
||||||
|
<ul class="nav nav-tabs">
|
||||||
|
<li <?= empty($this->ac) ? 'class="active"':"" ?>><a href="/admin/stat/user">概况</a></li>
|
||||||
|
<li <?= $this->ac == "new" ? 'class="active"':"" ?>><a href="/admin/stat/user/ac/new">新用户</a></li>
|
||||||
|
</ul>
|
|
@ -0,0 +1,158 @@
|
||||||
|
<?php
|
||||||
|
$this->headTitle($this->config->title->site);
|
||||||
|
$this->headTitle('后台管理');
|
||||||
|
$this->headTitle()->setSeparator(' - ');
|
||||||
|
$this->theme->AppendPlus($this,'jquery');
|
||||||
|
$this->theme->AppendPlus($this,'colorbox');
|
||||||
|
$this->headLink()->appendStylesheet('/css/jquery.jqplot.css');
|
||||||
|
$this->breadcrumb('<a href="/">首页</a>');
|
||||||
|
$this->breadcrumb('<a href="/admin">后台首页</a>');
|
||||||
|
$this->breadcrumb()->setSeparator(' > ');
|
||||||
|
?>
|
||||||
|
<script language="javascript" type="text/javascript" src="/static/js/plot/jquery.jqplot.js"></script>
|
||||||
|
<script language="javascript" type="text/javascript" src="/static/js/plot/plugins/jqplot.barRenderer.js"></script>
|
||||||
|
<script language="javascript" type="text/javascript" src="/static/js/plot/plugins/jqplot.pieRenderer.js"></script>
|
||||||
|
<script language="javascript" type="text/javascript" src="/static/js/plot/plugins/jqplot.categoryAxisRenderer.js"></script>
|
||||||
|
<script language="javascript" type="text/javascript" src="/static/js/plot/plugins/jqplot.highlighter.js"></script>
|
||||||
|
<script language="javascript" type="text/javascript" src="/static/js/plot/plugins/jqplot.pointLabels.js"></script>
|
||||||
|
<div class="row-fluid">
|
||||||
|
<div class="span2">
|
||||||
|
<?= $this->partial('stat/left.phtml'); ?>
|
||||||
|
</div>
|
||||||
|
<div class="span10">
|
||||||
|
|
||||||
|
<?= $this->partial('stat/user-nav.phtml',array('ac'=>$this->ac)); ?>
|
||||||
|
|
||||||
|
<div class="cp">
|
||||||
|
方式:
|
||||||
|
<a href="/admin/stat/user/ac/new/by/month<?= $this->year ? "/year/".$this->year:"" ?>" class="btn btn-info <?= $this->by == "month" ? "disabled":"" ?>">按月</a>
|
||||||
|
<a href="/admin/stat/user/ac/new/by/year<?= $this->year ? "/year/".$this->year:"" ?>" class="btn btn-info <?= $this->by == "year" ? "disabled":"" ?>">按年</a>
|
||||||
|
<a href="/admin/stat/user/ac/new/by/monthavg<?= $this->year ? "/year/".$this->year:"" ?>" class="btn btn-info <?= $this->by == "monthavg" ? "disabled":"" ?>">月均值</a>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div>
|
||||||
|
年份:
|
||||||
|
<?php if(in_array($this->by,array("year","monthavg") )) {?><a href="/admin/stat/user/ac/new/by/<?= $this->by ?>/year/-1" class="btn btn-info">所有</a><?php } ?>
|
||||||
|
<?php for($i = (int)date("Y");$i>=2004 ;$i--)
|
||||||
|
{
|
||||||
|
$active = $this->year == $i ? "disabled":"";
|
||||||
|
echo '<a href="/admin/stat/user/ac/new/by/'.$this->by.'/year/'.$i.'" class="btn btn-info '.$active.'">'.$i.'</a>';
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<?php if($this->by == 'month' && !empty($this->data)){ ?>
|
||||||
|
|
||||||
|
<hr />
|
||||||
|
<h4><?= $this->year ?>的按月新用户注册量统计</h4>
|
||||||
|
<div class="row-fluid">
|
||||||
|
<div class="span3">
|
||||||
|
<table class="table table-bordered table-striped">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>月份</th>
|
||||||
|
<th>增量</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<?php foreach($this->data as $k=>$v) {?>
|
||||||
|
<tr><td><?= $v['date_part'] ?></td><td><?= $v['count'] ?></td></tr>
|
||||||
|
<?php } ?>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
<div class="span9">
|
||||||
|
<!-- 统计图表 -->
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<?php } ?>
|
||||||
|
|
||||||
|
<?php if($this->by == 'year' && !empty($this->data)){ ?>
|
||||||
|
|
||||||
|
<hr />
|
||||||
|
<h4><?= $this->year == -1 ? "所有":$this->year ?>的新用户注册量统计</h4>
|
||||||
|
<div class="row-fluid">
|
||||||
|
<div class="span3">
|
||||||
|
<table class="table table-bordered table-striped">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>年份</th>
|
||||||
|
<th>增量</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<?php foreach($this->data as $k=>$v) {?>
|
||||||
|
<tr><td><?= $v['date_part'] ?></td><td><?= $v['count'] ?></td></tr>
|
||||||
|
<?php } ?>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
<div class="span9">
|
||||||
|
<!-- 统计图表 -->
|
||||||
|
<script type="text/javascript">
|
||||||
|
$(function () {
|
||||||
|
<?php
|
||||||
|
$vars = array();
|
||||||
|
$month = array();
|
||||||
|
foreach ($this->data as $v)
|
||||||
|
{
|
||||||
|
$vars[] = $v['count'];
|
||||||
|
$month[]= "'".$v['date_part']."'";
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
var s1 = [<?php echo join(',',$vars); ?>];
|
||||||
|
var ticks = [<?php echo join(',',$month); ?>];
|
||||||
|
|
||||||
|
plot1 = $.jqplot('chart_div_year_seq', [s1], {
|
||||||
|
seriesDefaults:{
|
||||||
|
renderer:$.jqplot.BarRenderer,
|
||||||
|
pointLabels: { show: true }
|
||||||
|
},
|
||||||
|
axes: {
|
||||||
|
xaxis: {
|
||||||
|
renderer: $.jqplot.CategoryAxisRenderer,
|
||||||
|
ticks: ticks
|
||||||
|
}
|
||||||
|
},
|
||||||
|
highlighter: { show: false }
|
||||||
|
});
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<div class="content" id="chart_div_year_seq"></div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<?php } ?>
|
||||||
|
|
||||||
|
<?php if($this->by == 'monthavg' && !empty($this->data)){ ?>
|
||||||
|
|
||||||
|
<hr />
|
||||||
|
<h4><?= $this->year ?>的月均用户注册量</h4>
|
||||||
|
<div class="row-fluid">
|
||||||
|
<div class="span3">
|
||||||
|
<table class="table table-bordered table-striped">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>年份</th>
|
||||||
|
<th>月均</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<?php foreach($this->data as $k=>$v) {?>
|
||||||
|
<tr><td><?= $v['date_part'] ?></td><td><?= $v['count'] ?></td></tr>
|
||||||
|
<?php } ?>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
<div class="span9">
|
||||||
|
<!-- 统计图表 -->
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<?php } ?>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
|
@ -10,28 +10,17 @@
|
||||||
$this->breadcrumb('<a href="/admin">后台首页</a>');
|
$this->breadcrumb('<a href="/admin">后台首页</a>');
|
||||||
$this->breadcrumb()->setSeparator(' > ');
|
$this->breadcrumb()->setSeparator(' > ');
|
||||||
?>
|
?>
|
||||||
<style>
|
<div class="row-fluid">
|
||||||
.charts{margin:30px 0px;}
|
<div class="span2">
|
||||||
.charts .title{color:#003366;}
|
|
||||||
.cp {line-height:24px;}
|
|
||||||
.cp ul li{float:left;margin:0px 0px;}
|
|
||||||
.cp a{color:#4bb2c5;line-height:24px;padding:5px;}
|
|
||||||
.cp a.active,.cp a:hover{color:#FFF;background:#4bb2c5;}
|
|
||||||
</style>
|
|
||||||
<div id="leftPanel">
|
|
||||||
<?= $this->partial('stat/left.phtml'); ?>
|
<?= $this->partial('stat/left.phtml'); ?>
|
||||||
</div>
|
</div>
|
||||||
<div id="rightPanel">
|
<div class="span10">
|
||||||
|
|
||||||
|
<?= $this->partial('stat/user-nav.phtml',array('ac'=>$this->ac)); ?>
|
||||||
|
|
||||||
<div class="cp">
|
<div class="cp">
|
||||||
<ul>
|
<a href="/admin/stat/user/ac/get/down/csv" class="btn btn-info">导出csv格式</a>
|
||||||
<li>
|
<a href="/admin/stat/user/ac/get/down/json" class="btn btn-info">导出JSON格式</a>
|
||||||
<a href="/admin/stat/user/ac/get/down/csv">导出csv格式</a>
|
|
||||||
</li>
|
|
||||||
<li>
|
|
||||||
<a href="/admin/stat/user/ac/get/down/json">导出JSON格式</a>
|
|
||||||
</li>
|
|
||||||
</ul>
|
|
||||||
</div>
|
</div>
|
||||||
<div id="unitdata">
|
<div id="unitdata">
|
||||||
<b>点击列名进行排序</b>
|
<b>点击列名进行排序</b>
|
||||||
|
@ -54,6 +43,7 @@
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
<script>
|
<script>
|
||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
$('#datatable').dataTable( {
|
$('#datatable').dataTable( {
|
||||||
|
|
|
@ -31,9 +31,55 @@ class HaiheController extends DataController
|
||||||
$this->view->offset=$offset+1;
|
$this->view->offset=$offset+1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function daxingAction()
|
||||||
|
{
|
||||||
|
$this->getmd(array('大兴区'));
|
||||||
|
$this->_helper->viewRenderer('base');
|
||||||
|
}
|
||||||
|
|
||||||
|
function miyunAction()
|
||||||
|
{
|
||||||
|
$this->getmd(array('密云'));
|
||||||
|
$this->_helper->viewRenderer('base');
|
||||||
|
}
|
||||||
|
|
||||||
|
function guantaoAction()
|
||||||
|
{
|
||||||
|
$this->getmd(array('馆陶县'));
|
||||||
|
$this->_helper->viewRenderer('base');
|
||||||
|
}
|
||||||
|
|
||||||
function viewAction()
|
function viewAction()
|
||||||
{
|
{
|
||||||
parent::viewAction();
|
parent::viewAction();
|
||||||
$this->_helper->viewRenderer('haihe/view');
|
$this->_helper->viewRenderer('haihe/view');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private function getmd($keyword,$type='theme')
|
||||||
|
{
|
||||||
|
$page=(int)$this->_request->getParam('page');
|
||||||
|
if (empty($page)) $page=1;
|
||||||
|
$offset=$this->limit*($page-1);
|
||||||
|
if (!is_array($keyword))
|
||||||
|
{
|
||||||
|
$keyword=array($keyword);
|
||||||
|
}
|
||||||
|
$key="(";
|
||||||
|
foreach($keyword as $k)
|
||||||
|
{
|
||||||
|
$key.="'".$k."',";
|
||||||
|
}
|
||||||
|
$key=substr($key,0,-1);
|
||||||
|
$key.=")";
|
||||||
|
$keyword=$key;
|
||||||
|
|
||||||
|
$state=$this->db->query("select count(m.*) from normalmetadata m left join datasource d on m.uuid=d.uuid left join source s on d.sourceid=s.id where s.code='haihe' and m.id in (select id from keyword where keytype='".$type."' and keyword in ".$keyword.")");
|
||||||
|
$row=$state->fetchAll();
|
||||||
|
$sum=$row[0]['count'];
|
||||||
|
//@todo: add order with title
|
||||||
|
$sql="select uuid,title from normalmetadata where uuid in (select d.uuid from datasource d left join source s on d.sourceid=s.id where s.code='haihe') and id in (select id from keyword where keytype='".$type."' and keyword in ".$keyword.") order by title limit ? offset ?";
|
||||||
|
$this->view->metadata=$this->db->fetchAll($sql,array($this->limit,$offset));
|
||||||
|
$this->view->page=new Pagination($sum,$page,$this->limit);
|
||||||
|
$this->view->offset=$offset+1;
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -0,0 +1,30 @@
|
||||||
|
<?php
|
||||||
|
$this->headTitle($this->config->title->site);
|
||||||
|
$this->headTitle($this->config->title->data);
|
||||||
|
$this->headTitle()->setSeparator(' - ');
|
||||||
|
$this->headLink()->appendStylesheet('/css/water.css');
|
||||||
|
$this->nav[] = array('link'=>"/haihe",'title'=>'海河流域观测数据集');
|
||||||
|
?>
|
||||||
|
<?= $this->render('breadcrumbs.phtml'); ?>
|
||||||
|
<div class="row">
|
||||||
|
<div class="span2">
|
||||||
|
<?= $this->partial('haihe/navi.phtml'); ?>
|
||||||
|
</div>
|
||||||
|
<div class="span10">
|
||||||
|
<?php if ($this->info) : ?>
|
||||||
|
<div class="well">
|
||||||
|
<?php if(!empty($this->info['body'])) echo $this->info['body'];?>
|
||||||
|
</div>
|
||||||
|
<?php endif; ?>
|
||||||
|
<?php if ($this->metadata) : ?>
|
||||||
|
<?php echo $this->page->getNavigation(); ?>
|
||||||
|
<div id="mdlist">
|
||||||
|
<ol start="<?php echo $this->offset; ?>">
|
||||||
|
<?php foreach($this->metadata as $md) : ?>
|
||||||
|
<li><a href="/haihe/view/uuid/<?php echo $md['uuid']; ?>"><?php echo $md['title']; ?></a></li>
|
||||||
|
<?php endforeach; ?>
|
||||||
|
</ol>
|
||||||
|
</div>
|
||||||
|
<?php endif; ?>
|
||||||
|
</div>
|
||||||
|
</div>
|
|
@ -10,8 +10,11 @@ $this->nav[] = array('link'=>"/haihe",'title'=>'海河流域观测数据集');
|
||||||
?>
|
?>
|
||||||
<?= $this->render('breadcrumbs.phtml'); ?>
|
<?= $this->render('breadcrumbs.phtml'); ?>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="span12">
|
<div class="span2">
|
||||||
|
<?= $this->partial('haihe/navi.phtml'); ?>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="span10">
|
||||||
<h3>数据相关文献</h3>
|
<h3>数据相关文献</h3>
|
||||||
<?php if ($this->refs) : ?>
|
<?php if ($this->refs) : ?>
|
||||||
<?php echo $this->page->getNavigation(); ?>
|
<?php echo $this->page->getNavigation(); ?>
|
||||||
|
|
|
@ -7,7 +7,11 @@ $this->nav[] = array('link'=>"/haihe",'title'=>'海河流域观测数据集');
|
||||||
?>
|
?>
|
||||||
<?= $this->render('breadcrumbs.phtml'); ?>
|
<?= $this->render('breadcrumbs.phtml'); ?>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="span12">
|
<div class="span2">
|
||||||
|
<?= $this->partial('haihe/navi.phtml'); ?>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="span10">
|
||||||
<div id="intro">
|
<div id="intro">
|
||||||
<h1><?php if(!empty($this->info['title'])) echo $this->info['title']; ?></h1>
|
<h1><?php if(!empty($this->info['title'])) echo $this->info['title']; ?></h1>
|
||||||
<table>
|
<table>
|
||||||
|
|
|
@ -0,0 +1,38 @@
|
||||||
|
<div id="side_accordion" class="accordion">
|
||||||
|
<div class="accordion-group heihe-accordion-title">
|
||||||
|
<div class="accordion-heading" id="Nav-haihe-index">
|
||||||
|
<a class="accordion-toggle" href="/haihe/">
|
||||||
|
介绍
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="accordion-group heihe-accordion-title">
|
||||||
|
<div class="accordion-heading" id="Nav-haihe-daxing">
|
||||||
|
<a class="accordion-toggle" href="/haihe/daxing">
|
||||||
|
大兴站
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="accordion-group heihe-accordion-title">
|
||||||
|
<div class="accordion-heading" id="Nav-haihe-miyun">
|
||||||
|
<a class="accordion-toggle" href="/haihe/miyun">
|
||||||
|
密云站
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="accordion-group heihe-accordion-title">
|
||||||
|
<div class="accordion-heading" id="Nav-haihe-guantao">
|
||||||
|
<a class="accordion-toggle" href="/haihe/guantao">
|
||||||
|
馆陶站
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="accordion-group heihe-accordion-title">
|
||||||
|
<div class="accordion-heading" id="Nav-haihe-document">
|
||||||
|
<a class="accordion-toggle" href="/haihe/document">
|
||||||
|
数据文献
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
|
@ -0,0 +1,130 @@
|
||||||
|
<?php
|
||||||
|
namespace Statistics;
|
||||||
|
|
||||||
|
use \Helpers\View as view;
|
||||||
|
use \Helpers\dbh;
|
||||||
|
use \Files\Files;
|
||||||
|
|
||||||
|
class User
|
||||||
|
{
|
||||||
|
private $db; //传入PDO对象.
|
||||||
|
private $config; //站点设置
|
||||||
|
|
||||||
|
protected $events = NULL;
|
||||||
|
public $table;
|
||||||
|
public $keyword;
|
||||||
|
public $order;
|
||||||
|
public $sort = "DESC";
|
||||||
|
|
||||||
|
function __construct($db = NULL,$mail = NULL)
|
||||||
|
{
|
||||||
|
if(empty($db))
|
||||||
|
{
|
||||||
|
$this->db = \Zend_Registry::get('db');
|
||||||
|
}else{
|
||||||
|
$this->db = $db;
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->config = \Zend_Registry::get('config');
|
||||||
|
|
||||||
|
$this->table = new \Helpers\Table();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function ThisYear(){
|
||||||
|
return date("Y",time());
|
||||||
|
}
|
||||||
|
|
||||||
|
//按年统计新用户
|
||||||
|
public function getNewUsersByYear($year = 0)
|
||||||
|
{
|
||||||
|
if(empty($year))
|
||||||
|
{
|
||||||
|
$year = $this->ThisYear();
|
||||||
|
}
|
||||||
|
|
||||||
|
if($year == -1)
|
||||||
|
{
|
||||||
|
$sql = "select count(id),extract(year from ts_created)
|
||||||
|
from users
|
||||||
|
group by extract(year from ts_created)
|
||||||
|
order by date_part";
|
||||||
|
}else{
|
||||||
|
$sql = "select count(id),extract(year from ts_created)
|
||||||
|
from users
|
||||||
|
where extract(year from ts_created)='$year'
|
||||||
|
group by extract(year from ts_created)";
|
||||||
|
}
|
||||||
|
|
||||||
|
$rs = $this->db->query($sql);
|
||||||
|
$rows = $rs->fetchAll();
|
||||||
|
return $rows;
|
||||||
|
}
|
||||||
|
|
||||||
|
//按月统计新用户
|
||||||
|
public function getNewUsersByMonth($year = 0)
|
||||||
|
{
|
||||||
|
if(empty($year))
|
||||||
|
{
|
||||||
|
$year = $this->ThisYear();
|
||||||
|
}
|
||||||
|
|
||||||
|
$sql = "select count(id),extract(month from ts_created)
|
||||||
|
from users
|
||||||
|
where extract(year from ts_created)=$year
|
||||||
|
group by extract(month from ts_created)
|
||||||
|
order by date_part";
|
||||||
|
|
||||||
|
$rs = $this->db->query($sql);
|
||||||
|
$rows = $rs->fetchAll();
|
||||||
|
return $rows;
|
||||||
|
}
|
||||||
|
|
||||||
|
//月均注册量
|
||||||
|
public function getAverageSingupByMonth($year = 0)
|
||||||
|
{
|
||||||
|
if(empty($year))
|
||||||
|
{
|
||||||
|
$year = $this->ThisYear();
|
||||||
|
}
|
||||||
|
|
||||||
|
$sql = "select round(count(id)/12) as count,extract(year from ts_created)
|
||||||
|
from users
|
||||||
|
where extract(year from ts_created)='$year'
|
||||||
|
group by extract(year from ts_created)";
|
||||||
|
|
||||||
|
$rs = $this->db->query($sql);
|
||||||
|
$rows = $rs->fetchAll();
|
||||||
|
return $rows;
|
||||||
|
}
|
||||||
|
|
||||||
|
//总用户量
|
||||||
|
public function getTotal($year = 0)
|
||||||
|
{
|
||||||
|
if(empty($year))
|
||||||
|
{
|
||||||
|
$year = $this->ThisYear();
|
||||||
|
}
|
||||||
|
|
||||||
|
$sql = "";
|
||||||
|
|
||||||
|
$rs = $this->db->query($sql);
|
||||||
|
$rows = $rs->fetchAll();
|
||||||
|
return $rows;
|
||||||
|
}
|
||||||
|
|
||||||
|
//平均申请数
|
||||||
|
public function getAverageApplicationTimes($times = 1)
|
||||||
|
{
|
||||||
|
if(empty($year))
|
||||||
|
{
|
||||||
|
$times = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
$sql = "";
|
||||||
|
|
||||||
|
$rs = $this->db->query($sql);
|
||||||
|
$rows = $rs->fetchAll();
|
||||||
|
return $rows;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
Loading…
Reference in New Issue