diff --git a/application/admin/controllers/DataController.php b/application/admin/controllers/DataController.php index e74caa6f..2b8ad926 100755 --- a/application/admin/controllers/DataController.php +++ b/application/admin/controllers/DataController.php @@ -1,6 +1,9 @@ view->q = trim($this->_getParam('q')); $order = $this->view->search_order = trim($this->_getParam('order')); $sort = $this->view->search_sort = trim($this->_getParam('sort')); + $field = $this->view->search_field = $this->_getParam('field'); $reference = new Reference(); @@ -1134,6 +1138,11 @@ class Admin_DataController extends Zend_Controller_Action $reference->keyword = $keyword; } + if(!empty($field)) + { + $reference->field = $field; + } + if(!empty($order)) { $reference->order = $order; @@ -1144,19 +1153,40 @@ class Admin_DataController extends Zend_Controller_Action $reference->sort = $sort; } + $this->view->reference = $reference; + $this->view->page = $this->_getParam('page'); + $this->view->pagelimit = 12; + //文献首页 if(empty($ac)) { - $this->view->referenceType = $reference->referenceType(); - view::addPaginator($reference->fetchReferences(),$this,12); + $this->view->referenceType = $reference->referenceType(); + view::addPaginator($reference->fetchReferences(),$this, $this->view->pagelimit); + $this->view->years = $reference->countByYear(); return true; } else if ($ac == "water") { $this->view->referenceType = $reference->referenceType(); - view::addPaginator($reference->fetchThemeReferences('water'),$this,10); + view::addPaginator($reference->fetchThemeReferences('water'),$this,$this->view->pagelimit); return true; } + else if ($ac == "westdc") + { + $this->view->referenceType = $reference->referenceType(); + view::addPaginator($reference->fetchWestdcReferences(),$this,$this->view->pagelimit); + return true; + } + else if ($ac == "todo") + { + $this->view->referenceType = $reference->referenceType(); + view::addPaginator($reference->fetchTodoReferences(),$this,$this->view->pagelimit); + return true; + } + + unset($this->view->reference); + unset($this->view->page); + unset($this->view->pagelimit); //添加 if($ac == "add") @@ -1326,6 +1356,81 @@ class Admin_DataController extends Zend_Controller_Action } } + //ris更新单篇 + if($ac == "singleris") + { + $this->_helper->viewRenderer('ref-singleris'); + $id = (int)$this->_getParam('id'); + $this->view->ristext = $this->_getParam('ristext'); + + if($id < 1) + { + view::Post($this,"参数错误!",-1); + return true; + } + + $this->view->referenceData = $reference->getOneReferenceData($id); + + if(!empty($submit)) + { + $ris = new Ris(); + $data = $ris->loadout(); + + if(count($data) < 1) + { + view::Post($this,"输入的RIS信息有误".'查看详细',-1); + return true; + } + + if($ris->updateWithRis($id,$data[0]) === true) + { + view::Post($this,"编辑成功!".'查看详细',-2); + return true; + }else{ + view::Post($this,"编辑失败!".'查看详细',-1); + return true; + } + } + + return true; + }//ris单篇更新 + + //ris导出 + if($ac == "risoutput") + { + $this->_helper->viewRenderer('ref-risoutput'); + $this->view->years = $reference->countByYear(); + + if(!empty($submit)) + { + $mode = $this->_getParam('mode'); + + $risOutput = new RisOutput(); + $preData = $risOutput->preRead($mode); + + $risData = $risOutput->processArrayDataToRisData($preData); + + $risText = $risOutput->output($risData); + + echo "
";
+				echo $risText;
+				echo "
"; + } + }//ris output + + if($ac == "ristest") + { + $this->_helper->viewRenderer('ref-ris'); + $submit = $this->_getParam('submit'); + + if(!empty($submit)) + { + $ris = new \Reference\Ris(); + view::Dump($ris->processRis(NULL,$this->_getParam('ristext')),false); + } + } + + }//文献管理 refAction() /* @@ -1788,8 +1893,8 @@ class Admin_DataController extends Zend_Controller_Action $id = $this->_getParam('attupdate'); - $files=new files(); - $msg = $files -> upload($this->view->config->upload,$_FILES['Filedata'],empty($uuid)?'file':'md'); + $files=new Files(); + $msg = $files -> upload($_FILES['Filedata'],empty($uuid)?'file/':'md/',true); if(empty($msg['error'])) { @@ -1797,7 +1902,7 @@ class Admin_DataController extends Zend_Controller_Action $filename = $msg['db_path']; $filesize = $msg['file_size']; $filedesc = $this->_request->getParam('filedesc'); - $filetype = $msg['file_type']; + $filetype = 'md'; $realname = $msg['realname']; @@ -2116,8 +2221,8 @@ class Admin_DataController extends Zend_Controller_Action exit(); } - $files=new files(); - $msg = $files -> upload($this->view->config->upload,$_FILES['Filedata'],empty($uuid)?'file':'md'); + $files=new Files(); + $msg = $files -> upload($_FILES['Filedata'],empty($uuid)?'file/':'md/',true); if(empty($msg['error'])) { @@ -2125,7 +2230,7 @@ class Admin_DataController extends Zend_Controller_Action $filename = $msg['db_path']; $filesize = $msg['file_size']; $filedesc = $this->_request->getParam('filedesc'); - $filetype = $msg['file_type']; + $filetype = 'md'; $realname = $msg['realname']; @@ -2184,10 +2289,6 @@ class Admin_DataController extends Zend_Controller_Action $rs = $this->db->query($sql); $atts = $rs->fetchAll(); - foreach($atts as $k=>$v) - { - $atts[$k]['html']= $v['realname'].'['. round($v['filesize']/1024,2) .' kb]
'; - } echo Zend_Json::encode($atts); exit(); }else @@ -3899,6 +4000,11 @@ class Admin_DataController extends Zend_Controller_Action }else{ $this->view->data['doi'] = $metadata['doi']; $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{ $this->view->data = $doi->view($uuid); diff --git a/application/admin/controllers/DownController.php b/application/admin/controllers/DownController.php index 2061905d..bb8072c9 100644 --- a/application/admin/controllers/DownController.php +++ b/application/admin/controllers/DownController.php @@ -4,6 +4,7 @@ use Files\Files; use Files\Output; use Files\Listener\FileListener; use Order\Manager\Offlineapp; +use Order\Manager\Application; use data\DataService; use Mail\Mail; @@ -374,8 +375,8 @@ class Admin_DownController extends Zend_Controller_Action $mail->setSubject($mailtp->getSubject()); $addrs=array(); $addrs[] = 'nztong@lzb.ac.cn'; - $addrs[] = 'wjian@lzb.ac.cn'; - $addrs[] = 'lixin@lzb.ac.cn'; + $addrs[] = 'wangliangxu@lzb.ac.cn'; + $addrs[] = 'wulizong@lzb.ac.cn'; $mail->addTo($addrs); $mail->addCc($this->view->config->service->email,'西部数据中心服务组'); $mail->createAttachment($filecontent,'application/octet-stream',Zend_Mime::DISPOSITION_ATTACHMENT, Zend_Mime::ENCODING_BASE64, 'offlineapp.pdf'); @@ -874,8 +875,10 @@ class Admin_DownController extends Zend_Controller_Action if ($form->isValid($formdata)) { $uploadedData = $form->getValues(); $pdf = basename($form->pdf->getFileName()); - $sql="insert into offlineapp (username,email,unit,phone,address,postcode,project,pdflink,datalist,ts_created,ts_approved) values(?,?,?,?,?,?,?,?,?,?,now())"; - $this->db->query($sql,array($formdata['username'],$formdata['email'],$formdata['unit'],$formdata['phone'],$formdata['address'],$formdata['postcode'],$formdata['project'],$pdf,$formdata['datalist'],$formdata['ts_approved'])); + $sql="insert into offlineapp (username,email,unit,phone,address,postcode,project,pdflink,datalist,ts_created,ts_approved,project_id,project_title,project_type) values(?,?,?,?,?,?,?,?,?,?,?,?,?,?)"; + $this->db->query($sql,array($formdata['username'],$formdata['email'],$formdata['unit'],$formdata['phone'],$formdata['address'],$formdata['postcode'], + $formdata['project'],$pdf,$formdata['datalist'],$formdata['ts_approved']),$formdata['ts_approved'], + $formdata['project_id'],$formdata['project_title'],$formdata['project_type']); $this->messenger->addMessage('提示信息:您已经成功添加该离线服务记录。'); $this->_redirect('/admin/down/offline'); } else { @@ -896,11 +899,14 @@ class Admin_DownController extends Zend_Controller_Action $pdf = basename($form->pdf->getFileName()); $sql="update offlineapp set username=?,email=?,unit=?,phone=?,address=?,postcode=?,project=?,"; if ($form->pdf->isUploaded()) $sql.="pdflink=?,"; - $sql.="datalist=?,ts_approved=? where id=?"; + $sql.="datalist=?,ts_approved=?,project_id=?,project_title=?,project_type=? where id=?"; $param=array($formdata['username'],$formdata['email'],$formdata['unit'],$formdata['phone'],$formdata['address'],$formdata['postcode'],$formdata['project']); if ($form->pdf->isUploaded()) $param[]=$pdf; $param[]=$formdata['datalist']; $param[]=$formdata['ts_approved']; + $param[]=$formdata['project_id']; + $param[]=$formdata['project_title']; + $param[]=$formdata['project_type']; $param[]=$edit; $this->db->query($sql,$param); $this->messenger->addMessage('提示信息:您已经编辑添加该记录。'); @@ -1049,9 +1055,15 @@ class Admin_DownController extends Zend_Controller_Action //设置当前活动sheet的名称 $objActSheet->setTitle('离线服务记录'); + if (date('m')==1) + { + $ym=(date('Y')-1).'-12-1'; + } else { + $ym=date('Y-').(date('m')-1).'-1'; + } $sql="select o.username,o.unit,o.phone,o.address,o.postcode,o.project,regexp_replace(o.datalist,'\(.+?MB\)','','g') as datalist,date(o.ts_approved) as date,o.email,o.project_id,o.project_type,o.project_title,sum(m.filesize) as filesize from offlineapp o left join dataorder d on o.id=d.offlineappid left join metadata m on d.uuid=m.uuid - where o.ts_approved>='".date('Y-').(date('m')-1)."-1' and o.ts_approved<'".date('Y-m')."-1' and o.pdflink is not null and o.ts_approved is not null and d.status=5 group by o.id order by o. ts_approved + where o.ts_approved>='".$ym."' and o.ts_approved<'".date('Y-m')."-1' and o.pdflink is not null and o.ts_approved is not null and d.status=5 group by o.id order by o. ts_approved "; $re = $this->db->query($sql); $rows = $re->fetchAll(); @@ -1080,7 +1092,7 @@ class Admin_DownController extends Zend_Controller_Action $objActSheet->setTitle('在线服务记录'); $sql="select o.username,o.unit,o.phone,o.address,o.postcode,o.project,date(o.ts_created) as date,o.email,o.project_id,o.project_type,o.project_title,m.filesize,m.title from onlineapp o left join dataorder d on o.id=d.onlineappid left join metadata m on d.uuid=m.uuid - where o.ts_created>='".date('Y-').(date('m')-1)."-1' and o.ts_created<'".date('Y-m')."-1' and d.status=0 order by o. ts_created + where o.ts_created>='".$ym."' and o.ts_created<'".date('Y-m')."-1' and d.status=0 order by o. ts_created "; $re = $this->db->query($sql); $rows = $re->fetchAll(); @@ -1137,16 +1149,15 @@ class Admin_DownController extends Zend_Controller_Action ->setBody($objWriter->save('php://output'));*/ } - $select=$this->db->select(); - $select->from('offlineapp')->where('ts_approved is not null')->where('pdflink is not null')->where('status>=0')->order('ts_created desc'); - $paginator = Zend_Paginator::factory($select); - $paginator->setCurrentPageNumber($this->_getParam('page')); - $paginator->setItemCountPerPage($this->view->config->page->max); - $paginator->setView($this->view); - Zend_View_Helper_PaginationControl::setDefaultViewPartial('pagination.phtml'); - $this->view->paginator=$paginator; - $this->view->page = $this->_getParam('page'); + + $application = new Application(); + + $this->view->q = $application->keyword = $this->_getParam('q'); + $application->filter = $this->_getParam('filter'); + view::addPaginator($application->passed(),$this,20); + + return true; } //在线数据下载情况,仅针对onlineapp表,自2011-9-8开始记录。 function onlineAction() @@ -1364,7 +1375,7 @@ class Admin_DownController extends Zend_Controller_Action $sql = "select distinct u.email from dataorder d LEFT JOIN users u on d.userid = u.id - WHERE u.email IS NOT NULL + WHERE u.email IS NOT NULL and d.status in (0,5) and d.ts_approved is not null AND d.uuid=? GROUP BY u.email"; diff --git a/application/admin/controllers/ReviewController.php b/application/admin/controllers/ReviewController.php index 001217bf..632e7eb6 100644 --- a/application/admin/controllers/ReviewController.php +++ b/application/admin/controllers/ReviewController.php @@ -761,7 +761,7 @@ class Admin_ReviewController extends Zend_Controller_Action if (is_numeric($ids)) { $sql="select distinct u.email,m.title,m.uuid from mdstatus s left join metadata m on s.uuid=m.uuid - left join mdauthor a on s.uuid=a.uuid left join users u on a.userid=u.id where s.id=? order by u.email"; + right join mdauthor a on s.uuid=a.uuid left join users u on a.userid=u.id where s.id=? order by u.email"; $rs=$this->db->query($sql,array($ids)); $rows=$rs->fetchAll(); if ($rows) @@ -805,9 +805,10 @@ class Admin_ReviewController extends Zend_Controller_Action $this->view->keyword = $keyword; } - $sql = "select m.id,md.title,md.uuid,u.username,u.realname,m.status,m.ts_created from mdstatus m + $sql = "select m.id,md.title,md.uuid,u.username,u.realname,m.status,m.ts_created,gn.id as gnid from mdstatus m right join metadata md on md.uuid=m.uuid left join users u on u.id=m.userid + left join geonetworkmetadata gn on m.uuid=gn.uuid where status=0 $searchjoin order by m.ts_created desc"; $re = $this->db->query($sql); @@ -909,7 +910,7 @@ class Admin_ReviewController extends Zend_Controller_Action $sql = "select m.id,md.title,md.uuid,u.username,u.realname,m.status,m.ts_finished from mdstatus m right join metadata md on md.uuid=m.uuid left join users u on u.id=m.userid - where status=5 $searchjoin"; + where status=5 $searchjoin order by m.ts_finished desc"; $re = $this->db->query($sql); $rows = $re->fetchAll(); diff --git a/application/admin/controllers/StatController.php b/application/admin/controllers/StatController.php index 5df02b1c..9d93243b 100644 --- a/application/admin/controllers/StatController.php +++ b/application/admin/controllers/StatController.php @@ -1,437 +1,462 @@ -db=Zend_Registry::get('db'); - $this->view->config = Zend_Registry::get('config'); - $this->messenger=$this->_helper->getHelper('FlashMessenger'); - $this->view->messages = $this->messenger->getMessages(); - $this->view->theme = new Theme(); - $this->_helper->layout->setLayout('administry'); - } - function postDispatch() - { - $this->view->messages = $this->messenger->getMessages(); - } - function indexAction() - { - $sql="select (select count(id) from users) as alluser, - (select count(id) from normalmetadata) as alldata, - (select count(id) as num from dataorder where status=0) as onlinedown, - (select count(id) as num from dataorder where status=5) as offlinedown, - (select count(id) as num from offlineapp where ts_approved is not null) as offlinepass, - (select count(id) as num from offlineapp where ts_approved is null) as offlineunfinished, - (select count(id) as num from dataorder where offlineappid>0 and status=-1) as offlinedenied, - (select count(id) as num from onlineapp) as onlineapp"; - $this->view->stat=$this->db->fetchRow($sql); - - //下载量统计 - $sql = "select sum(num) as num from (select m.filesize/1024 as num,m.title,d.userid from dataorder d left join metadata m on d.uuid=m.uuid where (d.status=0 or d.status=5) and m.filesize>0 group by m.title,d.userid,m.filesize) as t"; - $res = $this->db->query($sql); - $allsize = $res->fetch(); - $this->view->allsize = $allsize; - - $sql = "select sum(num) as num from (select m.filesize/1024 as num,m.title,d.userid from dataorder d left join metadata m on d.uuid=m.uuid where d.status=5 and m.filesize>0 group by m.title,d.userid,m.filesize) as t"; - $res = $this->db->query($sql); - $offlinesize = $res->fetch(); - $this->view->offlinesize = $offlinesize; - - $sql = "select sum(num) as num from (select m.filesize/1024 as num,m.title,d.userid from dataorder d left join metadata m on d.uuid=m.uuid where d.status=0 and m.filesize>0 group by m.title,d.userid,m.filesize) as t"; - $res = $this->db->query($sql); - $onlinesize = $res->fetch(); - $this->view->onlinesize = $onlinesize; - - $sql="select sum(configvalue::real)/1024/1024/1024 as num from g6ftpusersettings where userid in (select id from g6ftpusers where name like 'westdc%' or name='newwestdc') and configname='StatsDownloaded'"; - $res = $this->db->query($sql); - $onlinesize = $res->fetch(); - $this->view->onlineg6size = $onlinesize; - - - }//indexAction 首页 - - function unitAction() - { - $ac = $this->_getParam('ac'); - $y = (int)$this->_request->getParam('y'); - - if(!empty($y)) - { - $n = date("Y",time()); - if($y<2004 || $y>$n) - { - $y=$n; - } - } - $this->view->y = $y; - - //各单位下载情况,统计的离线申请数据条数,需要有对应的dataorder记录 - /*$sql = "select count(d.id) as num,o.unit from dataorder d - left join offlineapp o on o.id=d.offlineappid - where d.offlineappid>0 and o.unit is not null and d.status>4";*/ - //各单位下载情况,统计的离线申请数据次数 - $sql = "select count(o.id) as num,o.unit from offlineapp o - where o.unit is not null "; - if ($y) - $sql.=" and extract(year from o.ts_created)='$y'"; - $sql.=" group by o.unit"; - $fe = $this->db->query($sql); - $unitoffline = $fe->fetchAll(); - - //各单位在线下载情况 - $sql = "select count(d.id) as num,o.unit from dataorder d - left join onlineapp o on o.id=d.onlineappid - where d.onlineappid>0 and o.unit is not null"; - if ($y) - $sql.=" and extract(year from o.ts_created)='$y'"; - $sql.=" group by o.unit"; - $fe = $this->db->query($sql); - $unitonline = $fe->fetchAll(); - - $units = array(); - - foreach($unitonline as $k=>$v) - { - if(isset($v['num'])) - { - $units[$v['unit']]['online'] = $v['num']; - } - } - - foreach($unitoffline as $k=>$v) - { - if(isset($v['num'])) - { - $units[$v['unit']]['offline'] = $v['num']; - } - } - - $index = 1; - - foreach($units as $k=>$v) - { - if(!isset($v['online'])) - { - $units[$k]['online'] = 0; - } - - if(!isset($v['offline'])) - { - $units[$k]['offline'] = 0; - } - - $units[$k]['total'] = $units[$k]['online'] + $units[$k]['offline']; - - $units[$k]['index'] = $index++; - } - - if($ac == "out") - { - $type = $this->_getParam('type'); - - if(empty($type) || $type == "csv") - { - $this->_helper->layout->disableLayout(); - $this->_helper->viewRenderer->setNoRender(); - - include_once("Stat.php"); - $stat = new Stat($this->db); - - $head = array("id","单位名称","离线申请次数","在线申请次数","总申请次数"); - - $content = array(); - - foreach($units as $k=>$v) - { - $content[] = array( - $v['index'], - $k, - $v['offline'], - $v['online'], - $v['total'] - ); - unset($units[$k]); - } - - array_unshift($content,$head); - - $stat->Download("westdc-download-status.csv",$content,"csv"); - exit(); - } - - if($type == "json") - { - $this->_helper->layout->disableLayout(); - $this->_helper->viewRenderer->setNoRender(); - - include_once("Stat.php"); - $stat = new Stat($this->db); - - $content = array(); - - foreach($units as $k=>$v) - { - $content[] = array( - 'index'=>$v['index'], - 'unit'=>$k, - 'offline'=>$v['offline'], - 'online'=>$v['online'], - 'total'=>$v['total'] - ); - unset($units[$k]); - } - - $stat->Download("westdc-download-status.json",$content,"json"); - exit(); - } - - } - - $this->view->units = $units; - - - }//分单位统计 - - //按用户统计 - function userAction(){ - - $ac = $this->_getParam('ac'); - - if($ac == "get") - { - $this->_helper->layout->disableLayout(); - $this->_helper->viewRenderer->setNoRender(); - - include_once("Stat.php"); - $stat = new Stat($this->db); - - $rows = $stat->UserDataorder(); - - $down = $this->_getParam('down'); - if(empty($down)) - { - $this->jsonexit(array("aaData"=>$rows)); - return true; - } - - if($down == "csv") - { - - $this->_helper->layout->disableLayout(); - $this->_helper->viewRenderer->setNoRender(); - - $head = array("id","姓名","离线申请次数","在线申请次数","总申请次数"); - - array_unshift($rows,$head); - - $stat->Download("westdc-download-status.csv",$rows,"csv"); - exit(); - - } - - if($down == "json") - { - - $this->_helper->layout->disableLayout(); - $this->_helper->viewRenderer->setNoRender(); - - /* - $head = array("id","姓名","离线申请次数","在线申请次数","总申请次数"); - - array_unshift($rows,$head); - */ - - $stat->Download("westdc-download-status.json",$rows,"json"); - exit(); - } - - } - - }//userAction() - - function monthAction(){ - - $y = (int)$this->_request->getParam('y'); - - if(!empty($y)) - { - $n = date("Y",time()); - if($y<2004 || $y>$n) - { - $y=$n; - } - } - $this->view->y = $y; - $sql = "select count(extract(month from ts_created)) as c,extract(month from ts_created) as m,extract(year from ts_created) as y from onlineapp - where id in (select distinct(onlineappid) from dataorder)"; - if ($y) - $sql.=" and extract(year from ts_created)='$y' "; - $sql.=" group by extract(month from ts_created),extract(year from ts_created) - order by extract(year from ts_created),extract(month from ts_created)"; - $rs = $this->db->query($sql); - $rows = $rs->fetchAll(); - - $this->view->data = $rows; - - $sql = "select count(extract(month from ts_created)) as c,extract(month from ts_created) as m,extract(year from ts_created) as y from dataorder - where status=0"; - if ($y) - $sql.=" and extract(year from ts_created)='$y' "; - $sql.=" group by extract(month from ts_created),extract(year from ts_created) - order by extract(year from ts_created),extract(month from ts_created)"; - $rs = $this->db->query($sql); - $rows = $rs->fetchAll(); - $this->view->online = $rows; - - $sql = "select count(extract(month from ts_created)) as c,extract(month from ts_created) as m,extract(year from ts_created) as y from offlineapp - where ts_approved is not null"; - if ($y) - $sql.=" and extract(year from ts_created)='$y' "; - $sql.=" group by extract(month from ts_created),extract(year from ts_created) - order by extract(year from ts_created),extract(month from ts_created)"; - $rs = $this->db->query($sql); - $rows = $rs->fetchAll(); - - if(count($rows)<=0) - { - $this->view->offline=""; - } - - $this->view->offline = $rows; - - $sql = "select count(extract(month from ts_created)) as c,extract(month from ts_created) as m,extract(year from ts_created) as y from users"; - if ($y) - $sql.=" where extract(year from ts_created)='$y' "; - $sql.=" group by extract(month from ts_created),extract(year from ts_created) - order by extract(year from ts_created),extract(month from ts_created)"; - $rs = $this->db->query($sql); - $rows = $rs->fetchAll(); - if(count($rows)<=0) - { - $this->view->newuser=""; - } - - $this->view->newuser = $rows; - - - - }//按月份统计 - - function awstatswebAction() - { - - }//awstats web 统计 - - function awstatsweb2Action() - { - - }//awstats web 统计 - - function awstatsftpAction() - { - - }//awstats ftp 统计 - - function awstatsftp2Action() - { - - }//awstats ftp 统计 - - function webalizerAction() - { - - }//webalizer 统计 - - function waterAction() - { - - $sql="select count(k.keyword) as num,d.status,k.keyword from dataorder d left 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='0595169a-279e-4b95-819f-129d0ba4280d' - and (k.keyword='航空遥感' or k.keyword='卫星遥感' or k.keyword='气象水文' or k.keyword='上游寒区水文试验区' or k.keyword='森林水文试验区' or k.keyword='中游干旱区水文试验区') - group by k.keyword,d.status order by k.keyword desc,d.status 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 - extract(year from o.ts_created) as y,extract(month from o.ts_created) as m, - count(extract(month from o.ts_created)) as c - from - (select distinct(o.id),o.ts_created - from offlineapp o where o.datalist like '%黑河综合遥感联合试验%') 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 项目按月统计下载量 - $sql = "select (sum(m.filesize)/1024) as n,extract(month from d.ts_created) as m,extract(year from d.ts_created) as y from dataorder d left join metadata m on d.uuid=m.uuid - where d.status=5 and m.source='0595169a-279e-4b95-819f-129d0ba4280d' - group by extract(month from d.ts_created),extract(year from d.ts_created) - order by extract(year from d.ts_created),extract(month from d.ts_created)"; - - $re = $this->db->query($sql); - $dm = $re->fetchAll(); - - $this->view->dm = $dm; - - - }//WATER项目 - - public function jsonexit($data){ - $this->getResponse()->setHeader('Content-Type', 'application/json')->appendBody(json_encode($data,JSON_NUMERIC_CHECK)); - return true; - }//jsonexit() 退出并返回json数据 - -} - +db=Zend_Registry::get('db'); + $this->view->config = Zend_Registry::get('config'); + $this->messenger=$this->_helper->getHelper('FlashMessenger'); + $this->view->messages = $this->messenger->getMessages(); + $this->view->theme = new Theme(); + $this->_helper->layout->setLayout('administry'); + } + function postDispatch() + { + $this->view->messages = $this->messenger->getMessages(); + } + function indexAction() + { + $sql="select (select count(id) from users) as alluser, + (select count(id) from normalmetadata) as alldata, + (select count(id) as num from dataorder where status=0) as onlinedown, + (select count(id) as num from dataorder where status=5) as offlinedown, + (select count(id) as num from offlineapp where ts_approved is not null) as offlinepass, + (select count(id) as num from offlineapp where ts_approved is null) as offlineunfinished, + (select count(id) as num from dataorder where offlineappid>0 and status=-1) as offlinedenied, + (select count(id) as num from onlineapp) as onlineapp"; + $this->view->stat=$this->db->fetchRow($sql); + + //下载量统计 + $sql = "select sum(num) as num from (select m.filesize/1024 as num,m.title,d.userid from dataorder d left join metadata m on d.uuid=m.uuid where (d.status=0 or d.status=5) and m.filesize>0 group by m.title,d.userid,m.filesize) as t"; + $res = $this->db->query($sql); + $allsize = $res->fetch(); + $this->view->allsize = $allsize; + + $sql = "select sum(num) as num from (select m.filesize/1024 as num,m.title,d.userid from dataorder d left join metadata m on d.uuid=m.uuid where d.status=5 and m.filesize>0 group by m.title,d.userid,m.filesize) as t"; + $res = $this->db->query($sql); + $offlinesize = $res->fetch(); + $this->view->offlinesize = $offlinesize; + + $sql = "select sum(num) as num from (select m.filesize/1024 as num,m.title,d.userid from dataorder d left join metadata m on d.uuid=m.uuid where d.status=0 and m.filesize>0 group by m.title,d.userid,m.filesize) as t"; + $res = $this->db->query($sql); + $onlinesize = $res->fetch(); + $this->view->onlinesize = $onlinesize; + + $sql="select sum(configvalue::real)/1024/1024/1024 as num from g6ftpusersettings where userid in (select id from g6ftpusers where name like 'westdc%' or name='newwestdc') and configname='StatsDownloaded'"; + $res = $this->db->query($sql); + $onlinesize = $res->fetch(); + $this->view->onlineg6size = $onlinesize; + + + }//indexAction 首页 + + function unitAction() + { + $ac = $this->_getParam('ac'); + $y = (int)$this->_request->getParam('y'); + + if(!empty($y)) + { + $n = date("Y",time()); + if($y<2004 || $y>$n) + { + $y=$n; + } + } + $this->view->y = $y; + + //各单位下载情况,统计的离线申请数据条数,需要有对应的dataorder记录 + /*$sql = "select count(d.id) as num,o.unit from dataorder d + left join offlineapp o on o.id=d.offlineappid + where d.offlineappid>0 and o.unit is not null and d.status>4";*/ + //各单位下载情况,统计的离线申请数据次数 + $sql = "select count(o.id) as num,o.unit from offlineapp o + where o.unit is not null "; + if ($y) + $sql.=" and extract(year from o.ts_created)='$y'"; + $sql.=" group by o.unit"; + $fe = $this->db->query($sql); + $unitoffline = $fe->fetchAll(); + + //各单位在线下载情况 + $sql = "select count(d.id) as num,o.unit from dataorder d + left join onlineapp o on o.id=d.onlineappid + where d.onlineappid>0 and o.unit is not null"; + if ($y) + $sql.=" and extract(year from o.ts_created)='$y'"; + $sql.=" group by o.unit"; + $fe = $this->db->query($sql); + $unitonline = $fe->fetchAll(); + + $units = array(); + + foreach($unitonline as $k=>$v) + { + if(isset($v['num'])) + { + $units[$v['unit']]['online'] = $v['num']; + } + } + + foreach($unitoffline as $k=>$v) + { + if(isset($v['num'])) + { + $units[$v['unit']]['offline'] = $v['num']; + } + } + + $index = 1; + + foreach($units as $k=>$v) + { + if(!isset($v['online'])) + { + $units[$k]['online'] = 0; + } + + if(!isset($v['offline'])) + { + $units[$k]['offline'] = 0; + } + + $units[$k]['total'] = $units[$k]['online'] + $units[$k]['offline']; + + $units[$k]['index'] = $index++; + } + + if($ac == "out") + { + $type = $this->_getParam('type'); + + if(empty($type) || $type == "csv") + { + $this->_helper->layout->disableLayout(); + $this->_helper->viewRenderer->setNoRender(); + + include_once("Stat.php"); + $stat = new Stat($this->db); + + $head = array("id","单位名称","离线申请次数","在线申请次数","总申请次数"); + + $content = array(); + + foreach($units as $k=>$v) + { + $content[] = array( + $v['index'], + $k, + $v['offline'], + $v['online'], + $v['total'] + ); + unset($units[$k]); + } + + array_unshift($content,$head); + + $stat->Download("westdc-download-status.csv",$content,"csv"); + exit(); + } + + if($type == "json") + { + $this->_helper->layout->disableLayout(); + $this->_helper->viewRenderer->setNoRender(); + + include_once("Stat.php"); + $stat = new Stat($this->db); + + $content = array(); + + foreach($units as $k=>$v) + { + $content[] = array( + 'index'=>$v['index'], + 'unit'=>$k, + 'offline'=>$v['offline'], + 'online'=>$v['online'], + 'total'=>$v['total'] + ); + unset($units[$k]); + } + + $stat->Download("westdc-download-status.json",$content,"json"); + exit(); + } + + } + + $this->view->units = $units; + + + }//分单位统计 + + //按用户统计 + function userAction(){ + + $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") + { + $this->_helper->layout->disableLayout(); + $this->_helper->viewRenderer->setNoRender(); + + include_once("Stat.php"); + $stat = new Stat($this->db); + + $rows = $stat->UserDataorder(); + + $down = $this->_getParam('down'); + if(empty($down)) + { + $this->jsonexit(array("aaData"=>$rows)); + return true; + } + + if($down == "csv") + { + + $this->_helper->layout->disableLayout(); + $this->_helper->viewRenderer->setNoRender(); + + $head = array("id","姓名","离线申请次数","在线申请次数","总申请次数"); + + array_unshift($rows,$head); + + $stat->Download("westdc-download-status.csv",$rows,"csv"); + exit(); + + } + + if($down == "json") + { + + $this->_helper->layout->disableLayout(); + $this->_helper->viewRenderer->setNoRender(); + + /* + $head = array("id","姓名","离线申请次数","在线申请次数","总申请次数"); + + array_unshift($rows,$head); + */ + + $stat->Download("westdc-download-status.json",$rows,"json"); + exit(); + } + + } + + }//userAction() + + function monthAction(){ + + $y = (int)$this->_request->getParam('y'); + + if(!empty($y)) + { + $n = date("Y",time()); + if($y<2004 || $y>$n) + { + $y=$n; + } + } + $this->view->y = $y; + $sql = "select count(extract(month from ts_created)) as c,extract(month from ts_created) as m,extract(year from ts_created) as y from onlineapp + where id in (select distinct(onlineappid) from dataorder)"; + if ($y) + $sql.=" and extract(year from ts_created)='$y' "; + $sql.=" group by extract(month from ts_created),extract(year from ts_created) + order by extract(year from ts_created),extract(month from ts_created)"; + $rs = $this->db->query($sql); + $rows = $rs->fetchAll(); + + $this->view->data = $rows; + + $sql = "select count(extract(month from ts_created)) as c,extract(month from ts_created) as m,extract(year from ts_created) as y from dataorder + where status=0"; + if ($y) + $sql.=" and extract(year from ts_created)='$y' "; + $sql.=" group by extract(month from ts_created),extract(year from ts_created) + order by extract(year from ts_created),extract(month from ts_created)"; + $rs = $this->db->query($sql); + $rows = $rs->fetchAll(); + $this->view->online = $rows; + + $sql = "select count(extract(month from ts_created)) as c,extract(month from ts_created) as m,extract(year from ts_created) as y from offlineapp + where ts_approved is not null"; + if ($y) + $sql.=" and extract(year from ts_created)='$y' "; + $sql.=" group by extract(month from ts_created),extract(year from ts_created) + order by extract(year from ts_created),extract(month from ts_created)"; + $rs = $this->db->query($sql); + $rows = $rs->fetchAll(); + + if(count($rows)<=0) + { + $this->view->offline=""; + } + + $this->view->offline = $rows; + + $sql = "select count(extract(month from ts_created)) as c,extract(month from ts_created) as m,extract(year from ts_created) as y from users"; + if ($y) + $sql.=" where extract(year from ts_created)='$y' "; + $sql.=" group by extract(month from ts_created),extract(year from ts_created) + order by extract(year from ts_created),extract(month from ts_created)"; + $rs = $this->db->query($sql); + $rows = $rs->fetchAll(); + if(count($rows)<=0) + { + $this->view->newuser=""; + } + + $this->view->newuser = $rows; + + + + }//按月份统计 + + function awstatswebAction() + { + + }//awstats web 统计 + + function awstatsweb2Action() + { + + }//awstats web 统计 + + function awstatsftpAction() + { + + }//awstats ftp 统计 + + function awstatsftp2Action() + { + + }//awstats ftp 统计 + + function webalizerAction() + { + + }//webalizer 统计 + + function waterAction() + { + + $sql="select count(k.keyword) as num,d.status,k.keyword from dataorder d left 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='0595169a-279e-4b95-819f-129d0ba4280d' + and (k.keyword='航空遥感' or k.keyword='卫星遥感' or k.keyword='气象水文' or k.keyword='上游寒区水文试验区' or k.keyword='森林水文试验区' or k.keyword='中游干旱区水文试验区') + group by k.keyword,d.status order by k.keyword desc,d.status 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 + extract(year from o.ts_created) as y,extract(month from o.ts_created) as m, + count(extract(month from o.ts_created)) as c + from + (select distinct(o.id),o.ts_created + from offlineapp o where o.datalist like '%黑河综合遥感联合试验%') 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 项目按月统计下载量 + $sql = "select (sum(m.filesize)/1024) as n,extract(month from d.ts_created) as m,extract(year from d.ts_created) as y from dataorder d left join metadata m on d.uuid=m.uuid + where d.status=5 and m.source='0595169a-279e-4b95-819f-129d0ba4280d' + group by extract(month from d.ts_created),extract(year from d.ts_created) + order by extract(year from d.ts_created),extract(month from d.ts_created)"; + + $re = $this->db->query($sql); + $dm = $re->fetchAll(); + + $this->view->dm = $dm; + + + }//WATER项目 + + public function jsonexit($data){ + $this->getResponse()->setHeader('Content-Type', 'application/json')->appendBody(json_encode($data,JSON_NUMERIC_CHECK)); + return true; + }//jsonexit() 退出并返回json数据 + +} + diff --git a/application/admin/views/scripts/data/attachmentsadd.phtml b/application/admin/views/scripts/data/attachmentsadd.phtml index c6a37c0a..3c7c33f4 100644 --- a/application/admin/views/scripts/data/attachmentsadd.phtml +++ b/application/admin/views/scripts/data/attachmentsadd.phtml @@ -7,12 +7,7 @@ $this->breadcrumb('后台首页'); $this->breadcrumb('数据管理'); $this->breadcrumb()->setSeparator(' > '); - $this->headLink()->appendStylesheet('/static/js/uploadify/uploadify.css'); - $this->headScript()->appendFile('/static/js/jquery-1.7.2.min.js'); - $this->headScript()->appendFile('/js/jquery.colorbox-min.js'); - $this->headLink()->appendStylesheet('/css/colorbox.css'); - $this->headScript()->appendFile('/static/js/uploadify/swfobject.js'); - $this->headScript()->appendFile('/static/js/uploadify/jquery.uploadify.v2.1.4.min.js'); + $this->theme->AppendPlus($this,"uploadify"); ?>
partial('data/left.phtml'); ?> @@ -21,7 +16,7 @@
返回元数据附件列表 -查看元数据 +查看元数据 返回附件管理
@@ -30,73 +25,87 @@

注:可选择多个文件
-

+
+
-

+ + + + + +
+
+ partial('stat/left.phtml'); ?> +
+
+ + partial('stat/user-nav.phtml',array('ac'=>$this->ac)); ?> + + + +
+ 年份: + by,array("year","monthavg") )) {?>所有 + =2004 ;$i--) + { + $active = $this->year == $i ? "disabled":""; + echo ''.$i.''; + } + ?> +
+ + by == 'month' && !empty($this->data)){ ?> + +
+

year ?>的按月新用户注册量统计

+
+
+ + + + + + + + + data as $k=>$v) {?> + + + +
月份增量
+
+
+ + + +
+ +
+
+ + + + by == 'year' && !empty($this->data)){ ?> + +
+

year == -1 ? "所有":$this->year ?>的新用户注册量统计

+
+
+ + + + + + + + + data as $k=>$v) {?> + + + +
年份增量
+
+
+ + + +
+
+
+ + + + by == 'monthavg' && !empty($this->data)){ ?> + +
+

year ?>的月均用户注册量

+
+
+ + + + + + + + + data as $k=>$v) {?> + + + +
年份月均
+
+
+ + +
+
+ + + +
+
\ No newline at end of file diff --git a/application/admin/views/scripts/stat/user.phtml b/application/admin/views/scripts/stat/user.phtml index b90b15d4..1b2adac8 100644 --- a/application/admin/views/scripts/stat/user.phtml +++ b/application/admin/views/scripts/stat/user.phtml @@ -1,72 +1,62 @@ -headTitle($this->config->title->site); - $this->headTitle('后台管理'); - $this->headTitle()->setSeparator(' - '); - $this->headLink()->appendStylesheet('/css/admin.css'); - $this->theme->AppendPlus($this,'jquery'); - $this->theme->AppendPlus($this,'colorbox'); - $this->theme->AppendPlus($this,'datatable'); - $this->breadcrumb('首页'); - $this->breadcrumb('后台首页'); - $this->breadcrumb()->setSeparator(' > '); -?> - -
-partial('stat/left.phtml'); ?> -
-
- -
- -
-
-点击列名进行排序 -
-
- - - - - - - - - - - - - -
ID用户离线申请次数在线申请次数总申请次数
-
- -
- \ No newline at end of file diff --git a/application/admin/views/scripts/sys/left.phtml b/application/admin/views/scripts/sys/left.phtml index 1f8044bc..4a912715 100644 --- a/application/admin/views/scripts/sys/left.phtml +++ b/application/admin/views/scripts/sys/left.phtml @@ -1,10 +1,10 @@ -