westdc-zf1/application/admin/controllers/StatController.php

115 lines
3.7 KiB
PHP
Raw Normal View History

<?php
class Admin_StatController extends Zend_Controller_Action
{
function preDispatch()
{
$this->db=Zend_Registry::get('db');
$this->view->config = Zend_Registry::get('config');
$this->messenger=$this->_helper->getHelper('FlashMessenger');
$this->view->messages = $this->messenger->getMessages();
}
function postDispatch()
{
$this->view->messages = $this->messenger->getMessages();
}
function indexAction()
{
2011-09-21 02:37:56 +00:00
}//indexAction 首页
function awstatswebAction()
{
}//awstats web 统计
function awstatsftpAction()
{
}//awstats ftp 统计
function webalizerAction()
{
}//webalizer 统计
2011-09-21 02:37:56 +00:00
function waterAction()
{
$sql="select count(k.keyword) as num,k.keyword from dataorder d join metadata m on d.uuid=m.uuid
left join keyword k on m.id=k.id
where (d.status=5 or d.status=-1) and m.source!=''
and (k.keyword='航空遥感' or k.keyword='卫星遥感' or k.keyword='气象水文' or k.keyword='上游寒区水文试验区' or k.keyword='森林水文试验区' or k.keyword='中游干旱区水文试验区')
group by k.keyword order by num desc";
$re =$this->db->query($sql);
$type =$re->fetchAll();//按分类
$this->view->type = $type;
$sql="select count(extract(month from o.ts_created)) as c,extract(month from o.ts_created) as m,extract(year from o.ts_created) as y
from offlineapp o left join dataorder d on d.offlineappid=o.id left join metadata m on m.uuid=d.uuid
where m.source='0595169a-279e-4b95-819f-129d0ba4280d' and (d.status=3 or d.status=5 or d.status=-1)
group by extract(month from o.ts_created),extract(year from o.ts_created)
order by extract(year from o.ts_created),extract(month from o.ts_created)";
$re=$this->db->query($sql);
$month=$re->fetchAll();
$this->view->month = $month;
$sql = "select count(extract(month from o.ts_created)) as c,extract(month from o.ts_created) as m,extract(year from o.ts_created) as y
from
(select distinct(o.id),o.ts_created
from offlineapp o left join dataorder d on d.offlineappid=o.id left join metadata m on m.uuid=d.uuid
where m.source='0595169a-279e-4b95-819f-129d0ba4280d' and (d.status=3 or d.status=5 or d.status=-1)
) as o
group by extract(month from o.ts_created),extract(year from o.ts_created)
order by extract(year from o.ts_created),extract(month from o.ts_created)";
$re=$this->db->query($sql);
$order=$re->fetchAll();
$this->view->order = $order;
$sql = "select (sum(m.filesize)/1024) as n from dataorder d left join metadata m on d.uuid=m.uuid
where d.status=5 and m.source='0595169a-279e-4b95-819f-129d0ba4280d'";
$re=$this->db->query($sql);
$num=$re->fetchAll();
$this->view->num=$num;
$sql = "select count(lower(o.unit)) as c,lower(o.unit) as u
from offlineapp o left join dataorder d on d.offlineappid=o.id left join metadata m on m.uuid=d.uuid
where m.source='0595169a-279e-4b95-819f-129d0ba4280d' and (d.status=5)
group by lower(o.unit)
order by lower(o.unit)";
$re=$this->db->query($sql);
$units=$re->fetchAll();
$this->view->units=$units;
$sql = "select count(t.unit) as c,t.unit from
(select distinct(o.id),o.unit
from offlineapp o left join dataorder d on d.offlineappid=o.id left join metadata m on m.uuid=d.uuid
where m.source='0595169a-279e-4b95-819f-129d0ba4280d' and (d.status=5)
) as t
group by t.unit";
$re = $this->db->query($sql);
$ounit= $re->fetchAll();
$this->view->ounit = $ounit;
}//WATER项目
}