diff --git a/application/admin/controllers/DataController.php b/application/admin/controllers/DataController.php index d6ebc21e..62fd58f8 100755 --- a/application/admin/controllers/DataController.php +++ b/application/admin/controllers/DataController.php @@ -4000,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 f11f46fc..7593d3ac 100644 --- a/application/admin/controllers/DownController.php +++ b/application/admin/controllers/DownController.php @@ -375,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'); @@ -875,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 { @@ -897,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('提示信息:您已经编辑添加该记录。'); @@ -1050,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(); @@ -1081,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(); @@ -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/NewsController.php b/application/admin/controllers/NewsController.php index 8b28ebf7..7bccf05b 100644 --- a/application/admin/controllers/NewsController.php +++ b/application/admin/controllers/NewsController.php @@ -119,6 +119,7 @@ class Admin_NewsController extends Zend_Controller_Action $data['code'] = $this->_request->getParam('code'); $data['fid'] = $this->_request->getParam('fid'); $data['ptype'] = $this->_request->getParam('ptype'); + $data['title_en'] = $this->_request->getParam('title_en'); $data['is_pub'] = 1; @@ -193,6 +194,7 @@ class Admin_NewsController extends Zend_Controller_Action $data['fid'] = $this->_request->getParam('fid'); $data['ptype'] = $this->_request->getParam('ptype'); $data['is_pub'] = $this->_request->getParam('is_pub'); + $data['title_en'] = $this->_request->getParam('title_en'); $this->view->info = $data; @@ -380,7 +382,8 @@ class Admin_NewsController extends Zend_Controller_Action 'pubtimer', 'pubtime', 'description', - 'keyword' + 'keyword', + 'language' ); foreach($_POST as $k=>$v) { @@ -435,7 +438,8 @@ class Admin_NewsController extends Zend_Controller_Action 'source' => $source, 'ts_published' => $pubtime, 'is_pub' => $pub, - 'body' => $body + 'body' => $body, + 'language' => $language ); $update = $this->_getParam('update'); 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/doi-add.phtml b/application/admin/views/scripts/data/doi-add.phtml index 39ed9c36..01ca5041 100644 --- a/application/admin/views/scripts/data/doi-add.phtml +++ b/application/admin/views/scripts/data/doi-add.phtml @@ -29,41 +29,47 @@ $this->theme->AppendPlus($this,'colorbox'); msg)) { ?> msg ?> +
+ +

提示

+ 如果元数据中标题发生了变更,在DOI中也需要变更时需要在这里点击“提交”按钮才能生效 +
- " /> + " />
- " /> + " class="input-block-level" />
- " /> + " class="input-block-level" />
- " /> + " class="input-block-level"/>
- " /> + " class="input-block-level"/>
- " /> + " class="input-block-level" />
diff --git a/application/admin/views/scripts/data/left.phtml b/application/admin/views/scripts/data/left.phtml index 5e4684a6..9f3d6c21 100644 --- a/application/admin/views/scripts/data/left.phtml +++ b/application/admin/views/scripts/data/left.phtml @@ -1,5 +1,5 @@ -
+ + + + +

Cannot find the metadata.

+ \ No newline at end of file diff --git a/application/default/views/scripts/glacier/base.phtml b/application/default/views/scripts/glacier/base.phtml new file mode 100644 index 00000000..23caa2c3 --- /dev/null +++ b/application/default/views/scripts/glacier/base.phtml @@ -0,0 +1,30 @@ +headTitle($this->config->title->site); +$this->headTitle($this->config->title->data); +$this->headTitle()->setSeparator(' - '); +$this->headLink()->appendStylesheet('/css/water.css'); +$this->nav[] = array('link'=>"/glacier",'title'=>$this->config->title->glacier); +?> +render('breadcrumbs.phtml'); ?> +
+
+ partial('glacier/navi.phtml'); ?> +
+
+ info) : ?> +
+ info['body'])) echo $this->info['body'];?> +
+ + metadata) : ?> + page->getNavigation(); ?> +
+
    + metadata as $md) : ?> +
  1. + +
+
+ +
+
\ No newline at end of file diff --git a/application/default/views/scripts/glacier/browse.phtml b/application/default/views/scripts/glacier/browse.phtml index 1825019c..3d2cb3b8 100755 --- a/application/default/views/scripts/glacier/browse.phtml +++ b/application/default/views/scripts/glacier/browse.phtml @@ -11,10 +11,10 @@ $this->breadcrumb('浏览'); $this->breadcrumb()->setSeparator(' > '); ?>
-
+
partial('glacier/navi.phtml'); ?>
-
+
page->getNavigation(); ?>
diff --git a/application/default/views/scripts/glacier/category.phtml b/application/default/views/scripts/glacier/category.phtml deleted file mode 100755 index e30bde12..00000000 --- a/application/default/views/scripts/glacier/category.phtml +++ /dev/null @@ -1,43 +0,0 @@ -headTitle($this->config->title->site); - $this->headTitle($this->config->title->data); -$this->headTitle('分类浏览'); -if (!empty($this->codename)) $this->headTitle($this->codename); -$this->headTitle()->setSeparator(' - '); -$this->headLink()->appendStylesheet('/css/water.css'); -$this->breadcrumb('首页'); -$this->breadcrumb(''.$this->config->title->data.''); -$this->breadcrumb(''.$this->config->title->glacier.''); -$this->breadcrumb('分类浏览:'.$this->codename); -$this->breadcrumb()->setSeparator(' > '); -?> -
-
- partial('glacier/navi.phtml'); ?> -
-
- - - metadata)) : ?> -
- page->getNavigation(); ?> -
-
-
    - metadata as $md) : ?> -
  1. - -
-
-
- page->getNavigation(); ?> -
- -
-
\ No newline at end of file diff --git a/application/default/views/scripts/glacier/everestnorth.phtml b/application/default/views/scripts/glacier/everestnorth.phtml deleted file mode 100644 index 1d531234..00000000 --- a/application/default/views/scripts/glacier/everestnorth.phtml +++ /dev/null @@ -1,33 +0,0 @@ -headTitle($this->config->title->site); -$this->headTitle($this->config->title->data); -$this->headTitle()->setSeparator(' - '); -$this->headLink()->appendStylesheet('/css/water.css'); -$this->breadcrumb('首页'); -$this->breadcrumb(''.$this->config->title->data.''); -$this->breadcrumb(''.$this->config->title->glacier.''); -$this->breadcrumb('珠穆朗玛峰北坡'); -$this->breadcrumb()->setSeparator(' > '); -?> - - - diff --git a/application/default/views/scripts/glacier/field.phtml b/application/default/views/scripts/glacier/field.phtml deleted file mode 100644 index 1f18f4de..00000000 --- a/application/default/views/scripts/glacier/field.phtml +++ /dev/null @@ -1,33 +0,0 @@ -headTitle($this->config->title->site); -$this->headTitle($this->config->title->data); -$this->headTitle()->setSeparator(' - '); -$this->headLink()->appendStylesheet('/css/water.css'); -$this->breadcrumb('首页'); -$this->breadcrumb(''.$this->config->title->data.''); -$this->breadcrumb(''.$this->config->title->glacier.''); -$this->breadcrumb('冰湖编目数据'); -$this->breadcrumb()->setSeparator(' > '); -?> -
-
- partial('glacier/navi.phtml'); ?> -
-
-
-

为了对冰川编目结果进行验证并获得更多的冰川环境信息,项目开展了大量的野外考察。考察范围包括:祁连山、昆仑山-唐古拉山、喜马拉雅山、青藏高原腹地冰川考察、黄河源-念青唐古拉山中段北坡-喜马拉雅山中段。考察内容包括GPS测量、冰川厚度测量、冰川区地形摄影测量、冰川物质平衡测量、冰川区气象水文要素测量、冰湖水位和温度测量等。

- -
-
- metadata) : ?> - page->getNavigation(); ?> -
-
    - metadata as $md) : ?> -
  1. - -
-
- -
-
\ No newline at end of file diff --git a/application/default/views/scripts/glacier/frozensoil.phtml b/application/default/views/scripts/glacier/frozensoil.phtml deleted file mode 100644 index 8a984fea..00000000 --- a/application/default/views/scripts/glacier/frozensoil.phtml +++ /dev/null @@ -1,33 +0,0 @@ -headTitle($this->config->title->site); -$this->headTitle($this->config->title->data); -$this->headTitle()->setSeparator(' - '); -$this->headLink()->appendStylesheet('/css/water.css'); -$this->breadcrumb('首页'); -$this->breadcrumb(''.$this->config->title->data.''); -$this->breadcrumb(''.$this->config->title->glacier.''); -$this->breadcrumb('冻土数据'); -$this->breadcrumb()->setSeparator(' > '); -?> -
-
- partial('glacier/navi.phtml'); ?> -
-
-
-

与多年冻土相关的测量数据,包括探地雷达测量的地下冰厚度、冻土层上限等。 -

-
-
- metadata) : ?> - page->getNavigation(); ?> -
-
    - metadata as $md) : ?> -
  1. - -
-
- -
-
\ No newline at end of file diff --git a/application/default/views/scripts/glacier/geobase.phtml b/application/default/views/scripts/glacier/geobase.phtml deleted file mode 100644 index 72369e3f..00000000 --- a/application/default/views/scripts/glacier/geobase.phtml +++ /dev/null @@ -1,34 +0,0 @@ -headTitle($this->config->title->site); -$this->headTitle($this->config->title->data); -$this->headTitle()->setSeparator(' - '); -$this->headLink()->appendStylesheet('/css/water.css'); -$this->breadcrumb('首页'); -$this->breadcrumb(''.$this->config->title->data.''); -$this->breadcrumb(''.$this->config->title->glacier.''); -$this->breadcrumb('基础数据'); -$this->breadcrumb()->setSeparator(' > '); -?> -
-
- partial('glacier/navi.phtml'); ?> -
-
-
-

基础数据是指用于开展冰川和冰湖编目的遥感影像、地形图和数字地形模型,由于地形图属国家保密数据,不在共享范围内。

-

地形图主要用来地第一次冰川编目数据进行校正,并辅助第二次冰川编目中冰川边界和山脊线的判断。冰川编目中使用和参考的地形图约1105幅,其中1:50,000地形图546幅(航摄制图512幅,陆地摄影测量成果15幅,平板仪测绘及其他地图19幅),1:100,000地形图572幅(航摄制图558幅,平板仪测绘及其他地图14幅),另外还参考了1975年左右的MSS遥感数据地形图7幅。

- -
-
- metadata) : ?> - page->getNavigation(); ?> -
-
    - metadata as $md) : ?> -
  1. - -
-
- -
-
\ No newline at end of file diff --git a/application/default/views/scripts/glacier/glacier.phtml b/application/default/views/scripts/glacier/glacier.phtml deleted file mode 100644 index b4c70c2c..00000000 --- a/application/default/views/scripts/glacier/glacier.phtml +++ /dev/null @@ -1,33 +0,0 @@ -headTitle($this->config->title->site); -$this->headTitle($this->config->title->data); -$this->headTitle()->setSeparator(' - '); -$this->headLink()->appendStylesheet('/css/water.css'); -$this->breadcrumb('首页'); -$this->breadcrumb(''.$this->config->title->data.''); -$this->breadcrumb(''.$this->config->title->glacier.''); -$this->breadcrumb('冰川编目数据'); -$this->breadcrumb()->setSeparator(' > '); -?> -
-
- partial('glacier/navi.phtml'); ?> -
-
-
-

冰川编目数据:基于遥感影像解译获得的反应我国2005年前后冰川现状的冰川分布图及其基本属性。除了包括中国全境的冰川编目数据外,还包括祁连山、天山、贡嘎山、纳木错流域、长江源区、年楚河流域和珠穆朗玛峰北坡等典型地区的多年代冰川分布数据。 -

-
-
- metadata) : ?> - page->getNavigation(); ?> -
-
    - metadata as $md) : ?> -
  1. - -
-
- -
-
\ No newline at end of file diff --git a/application/default/views/scripts/glacier/gongga.phtml b/application/default/views/scripts/glacier/gongga.phtml deleted file mode 100644 index 91f1585c..00000000 --- a/application/default/views/scripts/glacier/gongga.phtml +++ /dev/null @@ -1,33 +0,0 @@ -headTitle($this->config->title->site); -$this->headTitle($this->config->title->data); -$this->headTitle()->setSeparator(' - '); -$this->headLink()->appendStylesheet('/css/water.css'); -$this->breadcrumb('首页'); -$this->breadcrumb(''.$this->config->title->data.''); -$this->breadcrumb(''.$this->config->title->glacier.''); -$this->breadcrumb('贡嘎山'); -$this->breadcrumb()->setSeparator(' > '); -?> - - - diff --git a/application/default/views/scripts/glacier/gps.phtml b/application/default/views/scripts/glacier/gps.phtml deleted file mode 100644 index 9f86e3f2..00000000 --- a/application/default/views/scripts/glacier/gps.phtml +++ /dev/null @@ -1,33 +0,0 @@ -headTitle($this->config->title->site); -$this->headTitle($this->config->title->data); -$this->headTitle()->setSeparator(' - '); -$this->headLink()->appendStylesheet('/css/water.css'); -$this->breadcrumb('首页'); -$this->breadcrumb(''.$this->config->title->data.''); -$this->breadcrumb(''.$this->config->title->glacier.''); -$this->breadcrumb('GPS测量数据'); -$this->breadcrumb()->setSeparator(' > '); -?> -
-
- partial('glacier/navi.phtml'); ?> -
-
-
-

采用高精度GPS设备在冰川表面或周边地区测量获得的数据,可用来获得冰川高程信息,也可与以前的观测数据相比较获得冰川流动和物质平衡变化信息。

- -
-
- metadata) : ?> - page->getNavigation(); ?> -
-
    - metadata as $md) : ?> -
  1. - -
-
- -
-
\ No newline at end of file diff --git a/application/default/views/scripts/glacier/hydro.phtml b/application/default/views/scripts/glacier/hydro.phtml deleted file mode 100644 index 8e50adcd..00000000 --- a/application/default/views/scripts/glacier/hydro.phtml +++ /dev/null @@ -1,33 +0,0 @@ -headTitle($this->config->title->site); -$this->headTitle($this->config->title->data); -$this->headTitle()->setSeparator(' - '); -$this->headLink()->appendStylesheet('/css/water.css'); -$this->breadcrumb('首页'); -$this->breadcrumb(''.$this->config->title->data.''); -$this->breadcrumb(''.$this->config->title->glacier.''); -$this->breadcrumb('水文数据'); -$this->breadcrumb()->setSeparator(' > '); -?> -
-
- partial('glacier/navi.phtml'); ?> -
-
-
-

在冰川下游观测获得的水文数据,观测要素包括径流、水质和水文化学等,也包括部分冰湖的观测数据。

- -
-
- metadata) : ?> - page->getNavigation(); ?> -
-
    - metadata as $md) : ?> -
  1. - -
-
- -
-
\ No newline at end of file diff --git a/application/default/views/scripts/glacier/index.phtml b/application/default/views/scripts/glacier/index.phtml index 0592ae59..f6fe0be2 100755 --- a/application/default/views/scripts/glacier/index.phtml +++ b/application/default/views/scripts/glacier/index.phtml @@ -3,73 +3,20 @@ $this->headTitle($this->config->title->site); $this->headTitle($this->config->title->data); $this->headTitle()->setSeparator(' - '); $this->headLink()->appendStylesheet('/css/water.css'); -$this->breadcrumb('首页'); -$this->breadcrumb(''.$this->config->title->data.''); -$this->breadcrumb($this->config->title->glacier); -$this->breadcrumb()->setSeparator(' > '); +$this->nav[] = array('link'=>"/glacier",'title'=>$this->config->title->glacier); ?> +render('breadcrumbs.phtml'); ?>
-
- partial('glacier/navi.phtml'); ?> +
+ partial('glacier/navi.phtml'); ?>
-
+ +
-

“中国冰川资源及其变化调查”项目简介

-

- 冰川是最敏感、最直接、最易于辩识、长纪录、高分辨的气候变化信息指示器和储存体,冰川变化信息是全球变化中的重要基础性资源。我国是中、低纬度山 地冰川面积最多的国家(占52%),是两极冰盖之外最重要的冰川集结地,冰川变化信息的挖掘、调查、监测、编目是十分重要的基础性工作。 -

-

- 始于1978年的第一次冰川编目历时24年,查清了截止到第一次全国航空测量时(西部冰川区约为1960s-1980s)中国冰川资源的基本情况。第一次冰川清查工作在国际和国内产生了重大影响,被国际冰川学会主席誉为建立了一座“冰川和气候变化研究的金矿”。 - 本次冰川资源调查是在中国科技部和中国科学院的联合支持下开展的一次大规模冰川普查,其目标以第一次冰川编目为参考,以2005-2006年为现状 年,以高分辨率遥感数据与地理信息系统技术为基础,深入研究基于遥感的冰川制图方法,结合冰川野外考察考察,获取我国冰川的分布状况,对有观测历史的典型 冰川进行重点监测;并与第一次冰川编目数据进行比较,查明我国冰川资源变化情况;同时,以此调查数据为基础,综合定位监测与相关资料,评估冰川变化对水资 源的影响,为西部水资源开发利用提供决策依据 。 -

-

《中国冰川资源及其变化调查》主要研究内容

-
    -
  1. 第一次冰川编目的数字化:重点开展第一次冰川编目时期冰川及冰湖分布的数字化,为冰川遥感监测提供基础数据。
  2. -
  3. 现状年(2005-2006年)西北干旱区和其它典型区冰川(湖)分布遥感调查:重点开展现状年基于高分辨率遥感影像的冰川与冰湖分布调查,同时,开展研究区部分冰川表面高程和运动速度信息的提取。
  4. -
  5. 遥感冰川制图地面验证、典型冰川厚度测量与冰川变化野外调查:重点开展代表性区域野外调查和典型冰川定位观测,验证遥感解译结果,获取典型监测冰川过程观测数据;开展代表性冰川厚度的雷达测量。
  6. -
  7. 冰川变化对水资源的影响评估:以现有定位观测冰川和区域冰川变化遥感调查数据为基础,评估西北干旱区和其它典型区冰川变化特征及其对水资源的影响。
  8. -
  9. 冰川资源及其变化调查信息共享平台建设:建立冰川资源管理及共享信息系统,为资源共享服务。
  10. -
-

《西部冰川变化监测及其影响评估方法研究》主要研究内容

-
    -
  1. 各类冰川参数的遥感提取方法研究:针对西部三类冰川特点,综合运用现有卫星遥感数据,建立冰川几何尺寸、特征要素、物理特征、表面高程等信息的提取算法,为大范围冰川调查提供适合各类冰川下垫面状况和气候条件的参数提取方法集,提高遥感获取冰川信息的自动化程度。
  2. -
  3. 冰川储量估算与冰川参数遥感提取精度评估:研制或改进冰川厚度测量雷达,对不同类型典型冰川流域不同规模的代表性冰川进行冰川厚度测量,建立适 合不同规模冰川的储量计算公式;开展各典型监测冰川区遥感冰川制图的野外验证、控制点采集与冰川变化的调查,进行遥感提取参数的误差分析与方法验证研究。
  4. -
  5. 流域冰川融水径流估算方法研究:以典型监测冰川长期观测资料为基础,并进行加强观测,同时收集流域出山口径流长期水文气象观测数据,建立适合不同资料条件的简单和复杂冰川融水径流模型,在对比分析基础上,提出适合西部流域尺度的冰川融水径流计算方案。
  6. -
  7. 冰川变化对水资源影响的评估方法及其应用研究:分析典型冰川流域冰川变化的空间特征及其差异;以典型冰川融水径流过程和流域尺度冰川动力响应研 究为基础,研究不同融水径流计算方案、基于冰川动力响应和基于冰川几何尺度转换关系模型对于不同性质冰川流域融水径流年际变化的模拟能力;根据流域融水径 流模型集,剖析冰川变化对冰川径流临界转变的影响及其强度。
  8. -
+

info['title'])) echo $this->info['title']; ?>

+ + +
info['body'])) echo $this->info['body'];?>
-
- \ No newline at end of file diff --git a/application/default/views/scripts/glacier/inventory.phtml b/application/default/views/scripts/glacier/inventory.phtml deleted file mode 100644 index 96ad5eeb..00000000 --- a/application/default/views/scripts/glacier/inventory.phtml +++ /dev/null @@ -1,35 +0,0 @@ -headTitle($this->config->title->site); -$this->headTitle($this->config->title->data); -$this->headTitle()->setSeparator(' - '); -$this->headLink()->appendStylesheet('/css/water.css'); -$this->breadcrumb('首页'); -$this->breadcrumb(''.$this->config->title->data.''); -$this->breadcrumb(''.$this->config->title->glacier.''); -$this->breadcrumb('冰川冰湖编目数据'); -$this->breadcrumb()->setSeparator(' > '); -?> -
-
- partial('glacier/navi.phtml'); ?> -
-
-
-

冰川编目数据:基于遥感影像解译获得的反应我国2005年前后冰川现状的冰川分布图及其基本属性。除了包括中国全境的冰川编目数据外,还包括祁连山、天山、贡嘎山、纳木错流域、长江源区、年楚河流域和珠穆朗玛峰北坡等典型地区的多年代冰川分布数据。 -

-

冰湖编目数据: - 冰湖是指在冰川前端、表面或内部形成的湖泊。冰湖编目是指利用地形图和遥感数据等资料对位于冰川前端和表面的湖泊进行登记的调查行为。

-
-
- metadata) : ?> - page->getNavigation(); ?> -
-
    - metadata as $md) : ?> -
  1. - -
-
- -
-
\ No newline at end of file diff --git a/application/default/views/scripts/glacier/lake.phtml b/application/default/views/scripts/glacier/lake.phtml deleted file mode 100644 index 20156b61..00000000 --- a/application/default/views/scripts/glacier/lake.phtml +++ /dev/null @@ -1,34 +0,0 @@ -headTitle($this->config->title->site); -$this->headTitle($this->config->title->data); -$this->headTitle()->setSeparator(' - '); -$this->headLink()->appendStylesheet('/css/water.css'); -$this->breadcrumb('首页'); -$this->breadcrumb(''.$this->config->title->data.''); -$this->breadcrumb(''.$this->config->title->glacier.''); -$this->breadcrumb('冰湖编目数据'); -$this->breadcrumb()->setSeparator(' > '); -?> -
-
- partial('glacier/navi.phtml'); ?> -
-
-
-

冰湖编目数据: - 冰湖是指在冰川前端、表面或内部形成的湖泊。冰湖编目是指利用地形图和遥感数据等资料对位于冰川前端和表面的湖泊进行登记的调查行为。

- -
-
- metadata) : ?> - page->getNavigation(); ?> -
-
    - metadata as $md) : ?> -
  1. - -
-
- -
-
\ No newline at end of file diff --git a/application/default/views/scripts/glacier/lidar.phtml b/application/default/views/scripts/glacier/lidar.phtml deleted file mode 100644 index 4086d158..00000000 --- a/application/default/views/scripts/glacier/lidar.phtml +++ /dev/null @@ -1,35 +0,0 @@ -headTitle($this->config->title->site); -$this->headTitle($this->config->title->data); -$this->headTitle()->setSeparator(' - '); -$this->headLink()->appendStylesheet('/css/water.css'); -$this->breadcrumb('首页'); -$this->breadcrumb(''.$this->config->title->data.''); -$this->breadcrumb(''.$this->config->title->glacier.''); -$this->breadcrumb('雷达测厚数据'); -$this->breadcrumb()->setSeparator(' > '); -?> -
-
- partial('glacier/navi.phtml'); ?> -
-
-
-

- 利用冰川测厚雷达获得的反应冰川厚度和冰下地形的野外测量数据,可为冰川厚度分布图和冰下地形图等提供重要的基础资料。同时,利用这些测量资料可以估算冰川的冰储量,为冰川变化响应气候变化提供定量科学依据,而且可以为各种水文模型提供重要的冰下地形参数。 -

- -
-
- metadata) : ?> - page->getNavigation(); ?> -
-
    - metadata as $md) : ?> -
  1. - -
-
- -
-
\ No newline at end of file diff --git a/application/default/views/scripts/glacier/material.phtml b/application/default/views/scripts/glacier/material.phtml deleted file mode 100644 index 8b116cc2..00000000 --- a/application/default/views/scripts/glacier/material.phtml +++ /dev/null @@ -1,35 +0,0 @@ -headTitle($this->config->title->site); -$this->headTitle($this->config->title->data); -$this->headTitle()->setSeparator(' - '); -$this->headLink()->appendStylesheet('/css/water.css'); -$this->breadcrumb('首页'); -$this->breadcrumb(''.$this->config->title->data.''); -$this->breadcrumb(''.$this->config->title->glacier.''); -$this->breadcrumb('物质平衡观测数据'); -$this->breadcrumb()->setSeparator(' > '); -?> -
-
- partial('glacier/navi.phtml'); ?> -
-
-
-

- 冰川在一定时间内的物质变化即积累与消融之差。积累大于消融为正平衡,消融大于积累为负平衡。冰川物质平衡野外观测一般包括利用雪坑剖面观测冰川积累量和花杆观测冰川消融量。 -

- -
-
- metadata) : ?> - page->getNavigation(); ?> -
-
    - metadata as $md) : ?> -
  1. - -
-
- -
-
\ No newline at end of file diff --git a/application/default/views/scripts/glacier/meteo.phtml b/application/default/views/scripts/glacier/meteo.phtml deleted file mode 100644 index 9ff309a7..00000000 --- a/application/default/views/scripts/glacier/meteo.phtml +++ /dev/null @@ -1,33 +0,0 @@ -headTitle($this->config->title->site); -$this->headTitle($this->config->title->data); -$this->headTitle()->setSeparator(' - '); -$this->headLink()->appendStylesheet('/css/water.css'); -$this->breadcrumb('首页'); -$this->breadcrumb(''.$this->config->title->data.''); -$this->breadcrumb(''.$this->config->title->glacier.''); -$this->breadcrumb('气象数据'); -$this->breadcrumb()->setSeparator(' > '); -?> -
-
- partial('glacier/navi.phtml'); ?> -
-
-
-

在冰川区观测的气象数据,观测要素包括温度、风速、风向、降水等。受观测条件的限制,观测要素和观测时段不能保持完全一致。

- -
-
- metadata) : ?> - page->getNavigation(); ?> -
-
    - metadata as $md) : ?> -
  1. - -
-
- -
-
\ No newline at end of file diff --git a/application/default/views/scripts/glacier/movement.phtml b/application/default/views/scripts/glacier/movement.phtml deleted file mode 100644 index 4425b6bf..00000000 --- a/application/default/views/scripts/glacier/movement.phtml +++ /dev/null @@ -1,33 +0,0 @@ -headTitle($this->config->title->site); -$this->headTitle($this->config->title->data); -$this->headTitle()->setSeparator(' - '); -$this->headLink()->appendStylesheet('/css/water.css'); -$this->breadcrumb('首页'); -$this->breadcrumb(''.$this->config->title->data.''); -$this->breadcrumb(''.$this->config->title->glacier.''); -$this->breadcrumb('冰川运动数据'); -$this->breadcrumb()->setSeparator(' > '); -?> -
-
- partial('glacier/navi.phtml'); ?> -
-
-
-

冰川运动观测一般分为冰川表面运动观测和冰川内部运动观测。前者一般采用GPS和花杆等测量方法,后者一般采用挖坑法、冰隧道法和钻孔法。 -

-
-
- metadata) : ?> - page->getNavigation(); ?> -
-
    - metadata as $md) : ?> -
  1. - -
-
- -
-
\ No newline at end of file diff --git a/application/default/views/scripts/glacier/namco.phtml b/application/default/views/scripts/glacier/namco.phtml deleted file mode 100644 index b9c72707..00000000 --- a/application/default/views/scripts/glacier/namco.phtml +++ /dev/null @@ -1,33 +0,0 @@ -headTitle($this->config->title->site); -$this->headTitle($this->config->title->data); -$this->headTitle()->setSeparator(' - '); -$this->headLink()->appendStylesheet('/css/water.css'); -$this->breadcrumb('首页'); -$this->breadcrumb(''.$this->config->title->data.''); -$this->breadcrumb(''.$this->config->title->glacier.''); -$this->breadcrumb('纳木错流域'); -$this->breadcrumb()->setSeparator(' > '); -?> - - - diff --git a/application/default/views/scripts/glacier/navi.phtml b/application/default/views/scripts/glacier/navi.phtml index d0a577ee..24d80aeb 100644 --- a/application/default/views/scripts/glacier/navi.phtml +++ b/application/default/views/scripts/glacier/navi.phtml @@ -70,13 +70,6 @@
-
- \ No newline at end of file diff --git a/application/default/views/scripts/glacier/tianshan.phtml b/application/default/views/scripts/glacier/tianshan.phtml deleted file mode 100644 index 51b4b6f6..00000000 --- a/application/default/views/scripts/glacier/tianshan.phtml +++ /dev/null @@ -1,33 +0,0 @@ -headTitle($this->config->title->site); -$this->headTitle($this->config->title->data); -$this->headTitle()->setSeparator(' - '); -$this->headLink()->appendStylesheet('/css/water.css'); -$this->breadcrumb('首页'); -$this->breadcrumb(''.$this->config->title->data.''); -$this->breadcrumb(''.$this->config->title->glacier.''); -$this->breadcrumb('天山'); -$this->breadcrumb()->setSeparator(' > '); -?> - - - diff --git a/application/default/views/scripts/glacier/timeline.phtml b/application/default/views/scripts/glacier/timeline.phtml index aca2c805..89c7b4e8 100755 --- a/application/default/views/scripts/glacier/timeline.phtml +++ b/application/default/views/scripts/glacier/timeline.phtml @@ -12,12 +12,14 @@ $this->breadcrumb()->setSeparator(' > '); $this->headScript()->appendFile('/js/timeline_var.js'); $this->headScript()->appendFile('/js/timeline_js/timeline-api.js'); $this->headScript()->appendFile('/js/glaciertime.js'); +$this->nav[] = array('link'=>"/glacier/",'title'=>$this->config->title->glacier); +$this->nav[] = array('link'=>"/glacier/timeline",'title'=>'时间轴导航'); ?>
-
+
partial('glacier/navi.phtml'); ?>
-
+
\ No newline at end of file diff --git a/application/default/views/scripts/glacier/timemap.phtml b/application/default/views/scripts/glacier/timemap.phtml index 77c6ff2c..71a0e216 100644 --- a/application/default/views/scripts/glacier/timemap.phtml +++ b/application/default/views/scripts/glacier/timemap.phtml @@ -14,16 +14,18 @@ $this->theme->AppendPlus($this,'colorbox'); $this->headScript()->appendFile('/js/timeline_var.js'); $this->headScript()->appendFile('/js/timeline_js/timeline-api.js'); $this->headScript()->appendFile('/js/timemap.2.0.1/lib/mxn/mxn.js?(googlev3)'); -$this->headScript()->appendFile('/js/timemap.2.0.1/timemap.pack.js'); +$this->headScript()->appendFile('/js/timemap.2.0.1/timemap.pack.js'); +$this->nav[] = array('link'=>"/glacier/",'title'=>$this->config->title->glacier); +$this->nav[] = array('link'=>"/glaicer/timemap",'title'=>'时空导航'); ?>
-
+
partial('glacier/navi.phtml'); ?>
-
+
breadcrumb() ?>
diff --git a/application/default/views/scripts/glacier/vegetation.phtml b/application/default/views/scripts/glacier/vegetation.phtml deleted file mode 100644 index 3f2258e0..00000000 --- a/application/default/views/scripts/glacier/vegetation.phtml +++ /dev/null @@ -1,33 +0,0 @@ -headTitle($this->config->title->site); -$this->headTitle($this->config->title->data); -$this->headTitle()->setSeparator(' - '); -$this->headLink()->appendStylesheet('/css/water.css'); -$this->breadcrumb('首页'); -$this->breadcrumb(''.$this->config->title->data.''); -$this->breadcrumb(''.$this->config->title->glacier.''); -$this->breadcrumb('植被数据'); -$this->breadcrumb()->setSeparator(' > '); -?> -
-
- partial('glacier/navi.phtml'); ?> -
-
-
-

冰川区附近的植被分布情况调查 -

-
-
- metadata) : ?> - page->getNavigation(); ?> -
-
    - metadata as $md) : ?> -
  1. - -
-
- -
-
\ No newline at end of file diff --git a/application/default/views/scripts/glacier/view.phtml b/application/default/views/scripts/glacier/view.phtml index fc17c688..34d9053a 100755 --- a/application/default/views/scripts/glacier/view.phtml +++ b/application/default/views/scripts/glacier/view.phtml @@ -4,32 +4,34 @@ $this->headTitle($this->metadata->title); $this->headTitle()->setSeparator(' - '); $this->headLink()->appendStylesheet('/css/water.css'); - $this->breadcrumb('首页'); - $this->breadcrumb(''.$this->config->title->data.''); - $this->breadcrumb(''.$this->config->title->glacier.''); - $this->breadcrumb('查看元数据'); - $this->breadcrumb()->setSeparator(' > '); - $this->headLink()->appendStylesheet('/css/water.css'); $this->theme->AppendPlus($this,'google_map_v3'); $this->theme->AppendPlus($this,'colorbox'); -?> + if(!empty($this->dataService)) { + $this->theme->AppendModel($this,"dataservice"); + } + $this->nav[] = array('link'=>"/glacier/",'title'=>$this->config->title->glacier); + $this->nav[] = array('link'=>"",'title'=>'查看元数据'); +?> +render('breadcrumbs.phtml'); ?> metadata;if ($md):?>
-
+
partial('glacier/navi.phtml'); ?> -
-
-
breadcrumb() ?>
+
+

escape($md->title); if ($md->title_en) echo '
'.$this->escape($md->title_en);?>


- -
-
+ +
+

@@ -37,21 +39,11 @@ if ($md->title_en) echo '
'.$this->escape($md->title_en);?>

- citation) : ?> -
-

本数据引用方式数据引用帮助

-

datadoi) || !strpos($md->citation,$md->datadoi)) : ?>文章的引用 - escape($md->citation);?>

- datadoi) && !strpos($md->citation,$md->datadoi)) : ?> -

数据的引用authors,1,-1).'. '.$md->title.'. '.$md->publisher.', '.$md->publish_year.'. doi:'.$md->doi; - echo ' ['.substr($md->author_en,1,-1).'. '.$md->title_en.'. '.$md->publisher_en.', '.$md->publish_year.'. doi:'.$md->doi.']'; - ?> (下载引用:RIS格式 | RIS英文格式 | Bibtex格式 | Bibtex英文格式)

- ref) : ?> + mcitation) : ?>
-

建议参考文献

+

本数据要求的多篇文献引用

    - ref as $ref) : + mcitation as $ref) : if (empty($ref->link)) echo '
  1. '.$ref->reference.'
  2. '; else @@ -59,17 +51,78 @@ if ($md->title_en) echo '
    '.$this->escape($md->title_en);?> endforeach; ?>
- - userref) : ?> + + + citation) : ?>
-

数据用户发表文献

+

本数据引用方式数据引用帮助

+

datadoi) || !strpos($md->citation,$md->datadoi)) : ?>文章的引用 + escape($md->citation);if (strpos($md->citation,$md->datadoi)) : ?> + (下载引用:RIS格式 | RIS英文格式 | Bibtex格式 | Bibtex英文格式) + +

+ datadoi) && !strpos($md->citation,$md->datadoi)) : ?> +

数据的引用authors,1,-1).'. '.$md->title.'. '.$md->publisher.', '.(empty($md->ts_published)?$md->publish_year:date('Y',strtotime($md->ts_published))).'. doi:'.$md->doi; + echo ' ['.str_replace('"','',substr($md->author_en,1,-1)).'. '.$md->title_en.'. '.$md->publisher_en.', '.(empty($md->ts_published)?$md->publish_year:date('Y',strtotime($md->ts_published))).'. doi:'.$md->doi.']'; + ?> (下载引用:RIS格式 | RIS英文格式 | Bibtex格式 | Bibtex英文格式)

+ ref) : ?> +
+

相关文献(作者推荐)

+
    + ref as $ref) : + echo '
  1. '.$ref->reference; + echo '查看'; + if (empty($ref->link)) + { + if(!empty($ref->attid)) + echo '下载'; + }else{ + echo '下载'; + } + echo "
  2. "; + endforeach; + ?> +
+ themeref) :?> + +
+

专题文献

+
    + themeref as $ref) : + echo '
  1. '.$ref->reference; + echo '查看'; + if (empty($ref->link)) + { + if(!empty($ref->attid)) + echo ' | 下载'; + }else{ + echo ' | 下载'; + } + echo "
  2. "; + endforeach; + ?> +
+ userref) : ?> +
+

数据施引文献

    userref as $ref) : + echo '
  1. '.$ref->reference; + echo '查看'; if (empty($ref->link)) - echo '
  2. '.$ref->reference.'
  3. '; - else - echo '
  4. '.$ref->reference.' 下载
  5. '; + { + if(!empty($ref->attid)) + echo '下载'; + }else{ + echo '下载'; + } + echo ""; endforeach; + if (count($this->userref)==15) + { + echo '更多施引文献'; + } ?>
@@ -83,8 +136,8 @@ if ($md->title_en) echo '
'.$this->escape($md->title_en);?> ?>

为尊重知识产权、保障数据作者的权益、扩展数据中心的服务、评估数据的应用潜力,请数据使用者在使用数据所产生的研究成果中(包括公开发表的论文、论著、数据产品和未公开发表的研究报告、数据产品等成果),明确注明数据来源和数据作者。对于转载(二次或多次发布)的数据,作者还须注明原始数据来源。

-

中文发表的成果参考以下规范注明: 数据来源于国家自然科学基金委员会"中国西部环境与生态科学数据中心"(http://westdc.westgis.ac.cn)

-

英文发表的成果依据以下规范注明: The data set is provided by Environmental and Ecological Science Data Center for West China,National Natural Science Foundation of China (http://westdc.westgis.ac.cn)

+

中文发表的成果参考以下规范注明: 数据来源于黑河计划数据管理中心、寒区旱区科学数据中心(http://westdc.westgis.ac.cn)

+

英文发表的成果依据以下规范注明: The data set is provided by Cold and Arid Regions Sciences Data Center at Lanzhou (http://westdc.westgis.ac.cn)

data_archives){ ?> @@ -97,18 +150,18 @@ if ($md->title_en) echo '
'.$this->escape($md->title_en);?>
- suppinfo || $this->fund) : ?> -

资助项目

- fund)) : ?> -
    - fund as $k=>$v) : ?> -
  • (项目编号:) [(No. )]
  • - -
- suppinfo)) : ?> - '.str_replace(array("\r\n", "\n", "\r"),'

',$this->escape($md->suppinfo)).'

';?> - -
+ suppinfo || $this->fund) : ?> +

资助项目

+ fund)) : ?> +
    + fund as $k=>$v) : ?> +
  • (项目编号:) [(No. )]
  • + +
+ suppinfo)) : ?> + '.str_replace(array("\r\n", "\n", "\r"),'

',$this->escape($md->suppinfo)).'

';?> + +
resources) : ?>

相关资源

@@ -251,7 +304,7 @@ if ($md->title_en) echo '
'.$this->escape($md->title_en);?>
-
+
@@ -412,7 +476,7 @@ endforeach;
-
+
@@ -444,6 +508,9 @@ $(function() { googleSearch(''); } }); + $('#show-list').click(function(e) { + method.filelist.get($(this).attr('rel')); + }); }); //ajax literature function literature(page){ @@ -460,10 +527,6 @@ function recommend(page){ recommend_get(page,'uuid; ?>'); } -function getFileList(){ - getFileList_h('uuid;?>'); -} - function ajaxpage(page){ ajaxpage_get(page,'uuid; ?>'); } diff --git a/application/default/views/scripts/glacier/yangtze.phtml b/application/default/views/scripts/glacier/yangtze.phtml deleted file mode 100644 index ffdd5286..00000000 --- a/application/default/views/scripts/glacier/yangtze.phtml +++ /dev/null @@ -1,33 +0,0 @@ -headTitle($this->config->title->site); -$this->headTitle($this->config->title->data); -$this->headTitle()->setSeparator(' - '); -$this->headLink()->appendStylesheet('/css/water.css'); -$this->breadcrumb('首页'); -$this->breadcrumb(''.$this->config->title->data.''); -$this->breadcrumb(''.$this->config->title->glacier.''); -$this->breadcrumb('长江源区'); -$this->breadcrumb()->setSeparator(' > '); -?> - - - diff --git a/application/default/views/scripts/haihe/base.phtml b/application/default/views/scripts/haihe/base.phtml new file mode 100644 index 00000000..4c53ca20 --- /dev/null +++ b/application/default/views/scripts/haihe/base.phtml @@ -0,0 +1,30 @@ +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'=>'海河流域观测数据集'); +?> +render('breadcrumbs.phtml'); ?> +
+
+ partial('haihe/navi.phtml'); ?> +
+
+ info) : ?> +
+ info['body'])) echo $this->info['body'];?> +
+ + metadata) : ?> + page->getNavigation(); ?> +
+
    + metadata as $md) : ?> +
  1. + +
+
+ +
+
\ No newline at end of file diff --git a/application/default/views/scripts/haihe/document.phtml b/application/default/views/scripts/haihe/document.phtml new file mode 100644 index 00000000..370b05ff --- /dev/null +++ b/application/default/views/scripts/haihe/document.phtml @@ -0,0 +1,51 @@ +headTitle($this->config->title->site); +$this->headTitle($this->config->title->data); +$this->headTitle()->setSeparator(' - '); +$this->headLink()->appendStylesheet('/css/water.css'); +$this->breadcrumb('首页'); +$this->breadcrumb()->setSeparator(' > '); +$this->theme->AppendPlus($this,'colorbox'); +$this->nav[] = array('link'=>"/haihe",'title'=>'海河流域观测数据集'); +?> +render('breadcrumbs.phtml'); ?> +
+
+ partial('haihe/navi.phtml'); ?> +
+ +
+

数据相关文献

+ refs) : ?> + page->getNavigation(); ?> +
+
    + refs as $md) : ?> +
  1. 查看'; + if (!empty($md['link'])) : + echo ' 下载'; + else : + if (!empty($md['attid'])) echo ' 下载'; + endif; + ?> + 相关数据] +
  2. + +
+
+ +
+
+ \ No newline at end of file diff --git a/application/default/views/scripts/haihe/index.phtml b/application/default/views/scripts/haihe/index.phtml new file mode 100644 index 00000000..11407b57 --- /dev/null +++ b/application/default/views/scripts/haihe/index.phtml @@ -0,0 +1,22 @@ +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'=>'海河流域观测数据集'); +?> +render('breadcrumbs.phtml'); ?> +
+
+ partial('haihe/navi.phtml'); ?> +
+ +
+
+

info['title'])) echo $this->info['title']; ?>

+ + +
info['body'])) echo $this->info['body'];?>
+
+
+
diff --git a/application/default/views/scripts/haihe/navi.phtml b/application/default/views/scripts/haihe/navi.phtml new file mode 100644 index 00000000..ad49c1a3 --- /dev/null +++ b/application/default/views/scripts/haihe/navi.phtml @@ -0,0 +1,38 @@ + \ No newline at end of file diff --git a/application/default/views/scripts/haihe/view.phtml b/application/default/views/scripts/haihe/view.phtml new file mode 100755 index 00000000..3eff1e69 --- /dev/null +++ b/application/default/views/scripts/haihe/view.phtml @@ -0,0 +1,578 @@ +headTitle($this->config->title->site); + $this->headTitle($this->config->title->data); + $this->headTitle($this->metadata->title); + $this->headTitle()->setSeparator(' - '); + $this->breadcrumb('首页'); + $this->breadcrumb(''.$this->config->title->data.''); + $this->breadcrumb('查看元数据'); + $this->breadcrumb()->setSeparator(' > '); + $this->theme->AppendPlus($this,'google_map_v3'); + $this->theme->AppendPlus($this,'colorbox'); + if(!empty($this->dataService)) { + $this->theme->AppendModel($this,"dataservice"); + } + $this->nav[] = array('link'=>"/haihe",'title'=>'海河流域观测数据集'); +?> + +render('breadcrumbs.phtml'); ?> +metadata;if ($md):?> +

escape($md->title); +if ($md->title_en) echo '
'.$this->escape($md->title_en);?> +

+
+
+
+
+ +

+

',$md->description);?> +

+
+
+ mcitation) : ?> +
+

本数据要求的多篇文献引用

+
    + mcitation as $ref) : + echo '
  1. '.$ref->reference; + echo '查看'; + if (empty($ref->link)) + { + if(!empty($ref->attid)) + echo '下载'; + }else{ + echo '下载'; + } + echo "
  2. "; + endforeach; + ?> +
+ + citation) : ?> +
+

本数据引用方式数据引用帮助

+

datadoi) || !strpos($md->citation,$md->datadoi)) : ?>文章的引用 + escape($md->citation);if (strpos($md->citation,$md->datadoi)) : ?> + (下载引用:RIS格式 | RIS英文格式 | Bibtex格式 | Bibtex英文格式) + +

+ datadoi) && !strpos($md->citation,$md->datadoi)) : ?> +

数据的引用authors,1,-1).'. '.$md->title.'. '.$md->publisher.', '.(empty($md->ts_published)?$md->publish_year:date('Y',strtotime($md->ts_published))).'. doi:'.$md->doi; + echo ' ['.str_replace('"','',substr($md->author_en,1,-1)).'. '.$md->title_en.'. '.$md->publisher_en.', '.(empty($md->ts_published)?$md->publish_year:date('Y',strtotime($md->ts_published))).'. doi:'.$md->doi.']'; + ?> (下载引用:RIS格式 | RIS英文格式 | Bibtex格式 | Bibtex英文格式)

+ ref) : ?> +
+

相关文献(作者推荐)

+
    + ref as $ref) : + echo '
  1. '.$ref->reference; + echo '查看'; + if (empty($ref->link)) + { + if(!empty($ref->attid)) + echo '下载'; + }else{ + echo '下载'; + } + echo "
  2. "; + endforeach; + ?> +
+ themeref) :?> + +
+

专题文献

+
    + themeref as $ref) : + echo '
  1. '.$ref->reference; + echo '查看'; + if (empty($ref->link)) + { + if(!empty($ref->attid)) + echo ' | 下载'; + }else{ + echo ' | 下载'; + } + echo "
  2. "; + endforeach; + ?> +
+ userref) : ?> +
+

数据施引文献

+
    + userref as $ref) : + echo '
  1. '.$ref->reference; + echo '查看'; + if (empty($ref->link)) + { + if(!empty($ref->attid)) + echo '下载'; + }else{ + echo '下载'; + } + echo "
  2. "; + endforeach; + if (count($this->userref)==15) + { + echo '更多施引文献'; + } + ?> +
+ +
+

数据使用声明

+ uselimits) : + foreach($this->uselimits as $uselimit) : + echo '

'.str_replace(array("\r\n", "\n", "\r"),'

',$this->escape($uselimit->uselimit)).'

'; + endforeach; + ?> + +

为尊重知识产权、保障数据作者的权益、扩展数据中心的服务、评估数据的应用潜力,请数据使用者在使用数据所产生的研究成果中(包括公开发表的论文、论著、数据产品和未公开发表的研究报告、数据产品等成果),明确注明数据来源和数据作者。对于转载(二次或多次发布)的数据,作者还须注明原始数据来源。

+

中文发表的成果参考以下规范注明: 数据来源于黑河计划数据管理中心、寒区旱区科学数据中心(http://westdc.westgis.ac.cn)

+

英文发表的成果依据以下规范注明: The data set is provided by Cold and Arid Regions Sciences Data Center at Lanzhou (http://westdc.westgis.ac.cn)

+

+ + data_archives){ ?> +

数据相关新闻

+
    + data_archives as $v){?> +
  • + +
+
+ + suppinfo || $this->fund) : ?> +

资助项目

+ fund)) : ?> +
    + fund as $k=>$v) : ?> +
  • (项目编号:) [(No. )]
  • + +
+ suppinfo)) : ?> + '.str_replace(array("\r\n", "\n", "\r"),'

',$this->escape($md->suppinfo)).'

';?> + +
+ + resources) : ?> +

相关资源

+ +
+ +
+
+ keys as $cg){ + if($cg['keytype']=="theme") + $keywords[]=$cg['keyword']; + } + $ev = join(" ",$keywords); + ?> +
+ +
+ + +
+
    +
    +
    + downhistory) : ?> +

    最近10条服务记录如下:

    +
      + downhistory as $v){ + echo '
    1. '.date("Y-m-d",strtotime($v->ts_created))." ".$v->unit." ".$v->realname; + if (!empty($v->offlineproject)) + echo ' 用途:'.$v->offlineproject; + elseif (!empty($v->onlineproject)) + echo ' 用途:'.$v->onlineproject; + echo '
    2. '; + } + ?> +
    + + 暂时没有服务记录,欢迎您下载使用! + +
    +
    + +
    +
    +
    +
    +
    + status>0 and $md->status<5) : ?> +

    此数据还在评审过程中,我们真切地邀请您参加此数据的评审,以便我们能尽快发布此数据!评审

    + +

    数据评论

    +
    +
    评论加载中
    +
    + hasIdentity()) + { + $user = $auth->getIdentity(); + $name = $user->realname; + $email = $user->email; + }else + { + $name = ""; + $email = ""; + } + ?> +
    +
    + +
    + +
    +
    +
    + +
    + +
    +
    +
    + +
    + e.g. http://westdc.westgis.ac.cn/ +
    +
    +
    + +
    + +
    +
    +
    + +
    + +
    +
    +
    +
    + + + 提交 +
    +
    +
    +
    + +
    +
    +
    +
    + + '学科','place'=>'地点','theme'=>'主题','temporal'=>'时间词','stratum'=>'地层'); +$kt=''; +$i=0; +foreach($this->keys as $cg) : + if ($kt==$cg['keytype']) : + $i+=1; + else : + if (!empty($kt)) echo ''; + $kt=$cg['keytype']; + $i=0; + endif; + if ($i==0) { + ?> + + doi) : ?> +
    • 数据DOI:doi; ?>
    + +
    +
    +

    数据细节文件列表

    +
      + fileformat) : ?> +
    • 格式:fileformat; ?>
    • + +
    • 大小:filesize; ?>MB
    • + downloaded>9) :?> +
    • 下载:downloaded; ?>次
    • + +
    • 浏览:viewed; ?>次
    • + + timebegin)) : ?> +
    • 数据时间范围:timebegin));if (!empty($md->timeend)) echo " 至 ".date('Y-m-d',strtotime($md->timeend)); ?>
    • + + doc)) : ?> + + + attachments) : ?> +
    • 相关文档: + attachments as $k=>$a) : ?> + + + +
    • + +
    • 数据共享方式:datatype) print "离线"; else print "在线(可直接下载)";?>
    • +
    +
    + status>0 and $md->status<5) : ?> + 数据评审 + datatype) : ?> + + 在线下载 + + + dataService)) { ?> + theme->AppendPlus($this,'datepicker'); ?> + + + + + 放入数据篮 + + + + 收藏此数据 + +
    +
    +
    +

    空间位置

    +
    +
    +

    联系信息

    +
    +
      + '资源提供者','custodian'=>'维护者','owner'=>'拥有者','user'=>'用户','distributor'=>'数据服务联系人','originator'=>'创建者','pointOfContact'=>'联系人','principalInvestigator'=>'数据调查与处理者','processor'=>'处理者','publisher'=>'元数据发布者','author'=>'元数据作者'); + $r=''; + $i=0; + foreach($this->authors as $k=>$author) : + if ($author->role!=$r) + { + $r=$author->role; + $i=0; + if ($k>0) echo ''; + echo '
    • '.$party_zh[$author->role].':'; + } + if ($i>0) echo ','; + $i+=1; + if (!empty($author->email) && $r!='principalInvestigator') + echo ''; + echo ''; + if (!empty($author->individual)) + echo $author->individual; + else + echo $author->organisation; + echo ''; + if (!empty($author->email)) echo ''; + if ($k+1==count($this->authors)) echo '
    • '; + endforeach; + ?> +
    +
    +
      +
    • 元数据更新时间:ts_created)); ?>
    • +
    • 下载元数据: + Adobe PDF格式 + OpenOffice odt格式 + Word doc格式 + 查看XML源文件 +
    • + + version->c>0):?> +
    • 版本历史:version->c ?> 个
    • + +
    +
    + +
    +
    +
    分享到
    + +
    + + + + + + + + + +
    + +
    +
    +
    + + + +

    Cannot find the metadata.

    +

    没有找到对应的元数据。

    + + + diff --git a/application/default/views/scripts/heihe/view.phtml b/application/default/views/scripts/heihe/view.phtml index 23b3a51b..d93ac569 100755 --- a/application/default/views/scripts/heihe/view.phtml +++ b/application/default/views/scripts/heihe/view.phtml @@ -71,32 +71,61 @@ if ($md->title_en) echo '
    '.$this->escape($md->title_en);?> ?> (下载引用:RIS格式 | RIS英文格式 | Bibtex格式 | Bibtex英文格式)

    ref) : ?>
    -

    建议参考文献

    +

    相关文献(作者推荐)

      ref as $ref) : echo '
    1. '.$ref->reference; + echo '查看'; if (empty($ref->link)) { - if(!empty($ref->attid)) + if(!empty($ref->attid)) + echo '下载'; + }else{ + echo '下载'; + } + echo "
    2. "; + endforeach; + ?> +
    + themeref) :?> + +
    +

    专题文献

    +
      + themeref as $ref) : + echo '
    1. '.$ref->reference; + echo '查看'; + if (empty($ref->link)) + { + if(!empty($ref->attid)) + echo ' | 下载'; + }else{ + echo ' | 下载'; + } + echo "
    2. "; + endforeach; + ?> +
    + userref) : ?> +
    +

    数据施引文献

    +
      + userref as $ref) : + echo '
    1. '.$ref->reference; + echo '查看'; + if (empty($ref->link)) + { + if(!empty($ref->attid)) echo '下载'; }else{ echo '下载'; } echo "
    2. "; endforeach; - ?> -
    - - userref) : ?> -
    -

    数据用户发表文献

    -
      - userref as $ref) : - if (empty($ref->link)) - echo '
    1. '.$ref->reference.'
    2. '; - else - echo '
    3. '.$ref->reference.' 下载
    4. '; - endforeach; + if (count($this->userref)==15) + { + echo '更多施引文献'; + } ?>
    @@ -129,7 +158,7 @@ if ($md->title_en) echo '
    '.$this->escape($md->title_en);?> fund)) : ?>
      fund as $k=>$v) : ?> -
    • (项目编号:) [(No. )]
    • +
    • (项目编号:) [(No. )]
    suppinfo)) : ?> @@ -450,7 +479,7 @@ endforeach;
    -
    +
    @@ -525,4 +554,4 @@ var bound = {

    没有找到对应的元数据。

    - \ No newline at end of file + \ No newline at end of file diff --git a/application/default/views/scripts/hiwater/list.phtml b/application/default/views/scripts/hiwater/list.phtml index f2e67d7b..8f25ebdb 100644 --- a/application/default/views/scripts/hiwater/list.phtml +++ b/application/default/views/scripts/hiwater/list.phtml @@ -5,16 +5,16 @@ $this->headTitle()->setSeparator(' - '); $this->headLink()->appendStylesheet('/css/water.css'); $this->breadcrumb('首页'); $this->breadcrumb(''.$this->config->title->data.''); -$this->breadcrumb(''.$this->config->title->heihe.''); +$this->breadcrumb(''.$this->config->title->hiwater.''); $this->breadcrumb('数据列表'); $this->breadcrumb()->setSeparator(' > '); $this->theme->AppendPlus($this,'colorbox'); ?>
    -
    +
    partial('hiwater/navi.phtml'); ?>
    -
    +
    breadcrumb() ?>
    metadata) : ?> @@ -22,12 +22,12 @@ $this->theme->AppendPlus($this,'colorbox');
      metadata as $md) : ?>
    1. - + [缩略图幻灯片] - [PDF版本下载] - [ODT版本下载] - [DOC版本下载] + [PDF版本下载] + [ODT版本下载] + [DOC版本下载]
    2. diff --git a/application/default/views/scripts/hiwater/view.phtml b/application/default/views/scripts/hiwater/view.phtml index e69fd7d8..ff449a18 100644 --- a/application/default/views/scripts/hiwater/view.phtml +++ b/application/default/views/scripts/hiwater/view.phtml @@ -46,9 +46,16 @@ if ($md->title_en) echo '
      '.$this->escape($md->title_en);?>
        mcitation as $ref) : if (empty($ref->link)) - echo '
      1. '.$ref->reference.'
      2. '; + { + echo '
      3. '.$ref->reference; + echo '查看'; + if(!empty($ref->attid)) { + echo ' 下载'; + } + echo "
      4. "; + } else - echo '
      5. '.$ref->reference.' 下载
      6. '; + echo '
      7. '.$ref->reference.'查看 下载
      8. '; endforeach; ?>
      @@ -69,32 +76,61 @@ if ($md->title_en) echo '
      '.$this->escape($md->title_en);?> ?> (下载引用:RIS格式 | RIS英文格式 | Bibtex格式 | Bibtex英文格式)

      ref) : ?>
      -

      建议参考文献

      +

      相关文献(作者推荐)

        ref as $ref) : echo '
      1. '.$ref->reference; + echo '查看'; if (empty($ref->link)) { - if(!empty($ref->attid)) + if(!empty($ref->attid)) + echo '下载'; + }else{ + echo '下载'; + } + echo "
      2. "; + endforeach; + ?> +
      + themeref) :?> + +
      +

      专题文献

      +
        + themeref as $ref) : + echo '
      1. '.$ref->reference; + echo '查看'; + if (empty($ref->link)) + { + if(!empty($ref->attid)) + echo ' | 下载'; + }else{ + echo ' | 下载'; + } + echo "
      2. "; + endforeach; + ?> +
      + userref) : ?> +
      +

      数据施引文献

      +
        + userref as $ref) : + echo '
      1. '.$ref->reference; + echo '查看'; + if (empty($ref->link)) + { + if(!empty($ref->attid)) echo '下载'; }else{ echo '下载'; } echo "
      2. "; endforeach; - ?> -
      - - userref) : ?> -
      -

      数据用户发表文献

      -
        - userref as $ref) : - if (empty($ref->link)) - echo '
      1. '.$ref->reference.'
      2. '; - else - echo '
      3. '.$ref->reference.' 下载
      4. '; - endforeach; + if (count($this->userref)==15) + { + echo '更多施引文献'; + } ?>
      @@ -127,7 +163,7 @@ if ($md->title_en) echo '
      '.$this->escape($md->title_en);?> fund)) : ?>
        fund as $k=>$v) : ?> -
      • (项目编号:) [(No. )]
      • +
      • (项目编号:) [(No. )]
      suppinfo)) : ?> diff --git a/application/default/views/scripts/knowledge/datacenter.phtml b/application/default/views/scripts/knowledge/datacenter.phtml index eed31ed4..7c51f83e 100644 --- a/application/default/views/scripts/knowledge/datacenter.phtml +++ b/application/default/views/scripts/knowledge/datacenter.phtml @@ -19,7 +19,7 @@ $this->headLink()->appendStylesheet('/css/colorbox.css');

      Publicated by CARD

      paginator)): ?> -
        +
          paginator as $item): ?>
        1. headLink()->appendStylesheet('/css/colorbox.css'); ?>
        2. -
      +
    diff --git a/application/default/views/scripts/knowledge/paper.phtml b/application/default/views/scripts/knowledge/paper.phtml index c18caab3..4584a693 100644 --- a/application/default/views/scripts/knowledge/paper.phtml +++ b/application/default/views/scripts/knowledge/paper.phtml @@ -20,15 +20,15 @@ $this->headLink()->appendStylesheet('/css/colorbox.css');

    paper['title']; ?>


    - author) > 0) {?> + author) : ?>

    Authors


    - + paper['abstract']){ ?>

    Abstract

    @@ -79,7 +79,7 @@ $this->headLink()->appendStylesheet('/css/colorbox.css');

    Cannot find the metadata.

    -

    没有找到对应的元数据。

    - - - \ No newline at end of file + \ No newline at end of file diff --git a/application/models/CustomControllerAclManager.php b/application/models/CustomControllerAclManager.php index 7e275887..0bee8403 100755 --- a/application/models/CustomControllerAclManager.php +++ b/application/models/CustomControllerAclManager.php @@ -1,4 +1,8 @@ acl->deny(null, 'author'); // add an exception so guests can log in or register // in order to gain privilege - $this->acl->allow('guest', 'account', array('login', + $this->acl->allow('guest', 'account', array('login','oauth2login','callback', 'logout', 'captcha', 'fetchpwd', @@ -72,31 +76,23 @@ if(!$this->auth->hasIdentity()) { - $mb = new member(); - $mb->db=$this->db; - if($mb->checkcookie()) + $member = new Member(); + + if($member->checkcookie()) { - $auth = Zend_Auth::getInstance(); - $authAdapter = new Zend_Auth_Adapter_DbTable($this->db); - $authAdapter->setTableName('users') - ->setIdentityColumn('username') - ->setCredentialColumn('password'); - $authAdapter->setIdentity($mb->user)->setCredential($mb->srpwd); - $result = $auth->authenticate($authAdapter); - if ($result->isValid()) { - $data = $authAdapter->getResultRowObject(null,'password'); - //头像 - include_once("Avatar.php"); - $avatar = new Avatar(); - $data->avatar = $avatar->Get($data->email,40); - - //组ID - include_once("Users.php"); - $usr = new Users($this->db); - $data->gid = $usr->getGroup($data->id); - - $auth->getStorage()->write($data); - $this->db->query("update users set ts_last_login=now() where username=?",array($mb->user)); + $data = array( + 'username' => $member->user, + 'password' => $member->srpwd + ); + + $account = new Account(); + $status = $account->storeLogin($data,false); + + if(isset($status['error'])) + { + $auth = Zend_Auth::getInstance(); + $auth->clearIdentity(); + Member::flushcookie(); } } } diff --git a/application/models/ISO19115.php b/application/models/ISO19115.php index abb8ecb6..fb1ae631 100755 --- a/application/models/ISO19115.php +++ b/application/models/ISO19115.php @@ -175,7 +175,6 @@ class ISO19115 //删除所有未用到的responsible数据 $sql="delete from en.responsible where id not in (select distinct(resid) from role)"; $db->query($sql); - $this->view->config = Zend_Registry::get('config'); //if (!empty($this->doi)) $row->doi=$this->doi; //生成空白统计数据,可以转移到数据库端处理(todo) @@ -210,6 +209,8 @@ class ISO19115 if ($this->onlineresource) foreach($this->onlineresource as $resource) { $sql="insert into en.onlineresource (uuid,linkage,protocol,name,description) values(?,?,?,?,?)"; + if (!isset($resource['name'])) $resource['name']=''; + if (!isset($resource['description'])) $resource['description']=''; $db->query($sql,array($this->uuid,$resource['linkage'],$resource['protocol'],$resource['name'],$resource['description'])); } //处理缩略图 @@ -222,10 +223,7 @@ class ISO19115 $r=$db->fetchRow($sql,array($this->uuid)); if ($r) { - if ($this->view->config) - $geonetwork=$this->view->config->geonetwork->url; - else - $geonetwork='http://card.westgis.ac.cn/geonetwork/'; + $geonetwork='http://'.$_SERVER['HTTP_HOST'].'/geonetwork/'; $thumb=base64_encode(file_get_contents($geonetwork.'srv/cn/resources.get?access=public&id='.$r->gid.'&fname='.urlencode($this->graph['filename']))); $sql="insert into en.thumbnail (id,data,filetype,filedesc,filename) values(?,?,?,?,?)"; $db->query($sql,array($id,$thumb,$this->graph['filetype'],$this->graph['filedesc'],$this->graph['filename'])); @@ -425,7 +423,7 @@ class ISO19115 $this->author[$cnt+$j]['postal']=$author->getElementsByTagName('postCode')->item(0)->nodeValue; $this->author[$cnt+$j]['city']=$author->getElementsByTagName('city')->item(0)->nodeValue; $this->author[$cnt+$j]['administrative']=$author->getElementsByTagName('adminArea')->item(0)->nodeValue; - $this->author[$cnt+$j]['country']=$author->getElementsByTagName('country')->item(0)->nodeValue; + @$this->author[$cnt+$j]['country']=$author->getElementsByTagName('country')->item(0)->nodeValue; $this->author[$cnt+$j]['role']=$author->getElementsByTagName('RoleCd')->item(0)->attributes->getNamedItem('value')->nodeValue; } $cnt+=$j+1; @@ -434,7 +432,7 @@ class ISO19115 { $this->author[$cnt+$m]['individual']=$author->getElementsByTagName('rpIndName')->item(0)->nodeValue; $this->author[$cnt+$m]['organisation']=$author->getElementsByTagName('rpOrgName')->item(0)->nodeValue; - $this->author[$cnt+$m]['position']=$author->getElementsByTagName('rpPosName')->item(0)->nodeValue; + @$this->author[$cnt+$m]['position']=$author->getElementsByTagName('rpPosName')->item(0)->nodeValue; $this->author[$cnt+$m]['delivery']=$author->getElementsByTagName('delPoint')->item(0)->nodeValue; $this->author[$cnt+$m]['phone']=$author->getElementsByTagName('voiceNum')->item(0)->nodeValue; $this->author[$cnt+$m]['email']=$author->getElementsByTagName('eMailAdd')->item(0)->nodeValue; @@ -572,8 +570,8 @@ class ISO19115 foreach($ds as $k=>$dataset) { $this->datasetSeries[$k]['seriesName']=$dataset->getElementsByTagName('seriesName')->item(0)->nodeValue; - $this->datasetSeries[$k]['issId']=$dataset->getElementsByTagName('issId')->item(0)->nodeValue; - $this->datasetSeries[$k]['artPage']=$dataset->getElementsByTagName('artPage')->item(0)->nodeValue; + @$this->datasetSeries[$k]['issId']=$dataset->getElementsByTagName('issId')->item(0)->nodeValue; + @$this->datasetSeries[$k]['artPage']=$dataset->getElementsByTagName('artPage')->item(0)->nodeValue; } //unsure which one. $ds=$this->dom->getElementsByTagName('Series'); diff --git a/application/models/OfflinelogForm.php b/application/models/OfflinelogForm.php index 7ef2ca87..6e9150c6 100644 --- a/application/models/OfflinelogForm.php +++ b/application/models/OfflinelogForm.php @@ -26,6 +26,23 @@ class OfflinelogForm extends Zend_Form $address->setLabel('联系地址')->setRequired(true); $project=new Zend_Form_Element_Textarea('project'); $project->setLabel('用途')->setRequired(true)->setAttrib('rows',2); + $project_id=new Zend_Form_Element_Text('project_id'); + $project_id->setLabel('项目编号'); + $project_title=new Zend_Form_Element_Text('project_title'); + $project_title->setLabel('项目名称'); + $project_type=new Zend_Form_Element_Select('project_type'); + $project_type->setLabel('项目类型'); + $project_type->addMultiOption('','请选择项目类型'); + $project_type->addMultiOption('国家973计划项目课题','国家973计划项目课题'); + $project_type->addMultiOption('国家863计划课题','国家863计划课题'); + $project_type->addMultiOption('国家级科技支撑课题','国家级科技支撑课题'); + $project_type->addMultiOption('国家级科技重大专项','国家级科技重大专项'); + $project_type->addMultiOption('国家级国家重大工程','国家级国家重大工程'); + $project_type->addMultiOption('国家级国家自然科学基金','国家级国家自然科学基金'); + $project_type->addMultiOption('国际合作项目','国际合作项目'); + $project_type->addMultiOption('省部级项目','省部级项目'); + $project_type->addMultiOption('其他项目工程','其他项目工程'); + $datalist=new Zend_Form_Element_Textarea('datalist'); $datalist->setLabel('数据清单')->setRequired(true)->setAttrib('rows',2); $pdf=new Zend_Form_Element_File('pdf'); @@ -42,6 +59,6 @@ class OfflinelogForm extends Zend_Form $submit = new Zend_Form_Element_Submit('submit'); $submit->setAttrib('id', 'submitbutton')->setLabel('添加'); $this->setAttrib('enctype', 'multipart/form-data'); - $this->addElements(array($username,$email,$phone,$unit,$address,$postcode,$pdf,$ts_approved,$project,$datalist,$id,$submit)); + $this->addElements(array($username,$email,$phone,$unit,$address,$postcode,$pdf,$ts_approved,$project_id,$project_title,$project_type,$project,$datalist,$id,$submit)); } } \ No newline at end of file diff --git a/application/module/Files/Files.php b/application/module/Files/Files.php index f017d4a5..cf8a57e1 100644 --- a/application/module/Files/Files.php +++ b/application/module/Files/Files.php @@ -151,7 +151,7 @@ class Files{ $msg['file_url'] = $file_url; $msg['file_size'] = $file_size; - $msg['db_path'] = $this->config->upload . $dbsave; + $msg['db_path'] = $dbsave; $msg['realname'] = $file_name; $msg['file_ext'] = $file_ext; $msg['file_mime'] = $this->getFileMime($file_path); @@ -383,10 +383,19 @@ class Files{ header("Content-Length: ".$fsize); ob_clean(); flush(); + + if($fsize > 5*1024*1024) + { + $fp = fopen($fullPath, "r"); + while(!feof($fp)) { + echo fgets($fp, 4096); + } + } + if(readfile($fullPath)) - return true; + return true; else - return false; + return false; } else {return false;} } diff --git a/application/module/Files/Thumbnail.php b/application/module/Files/Thumbnail.php index 6d63fa79..9a98fae7 100644 --- a/application/module/Files/Thumbnail.php +++ b/application/module/Files/Thumbnail.php @@ -9,153 +9,224 @@ namespace Files; */ class Thumbnail { - private $maxWidth; - private $maxHeight; - private $scale; - private $inflate; - private $types; - private $imgLoaders; - private $imgCreators; - private $source; - private $sourceWidth; - private $sourceHeight; - private $sourceMime; - private $thumb; - private $thumbWidth; - private $thumbHeight; - - public function __construct($maxWidth, $maxHeight, $scale = true, $inflate = false) { - $this->maxWidth = $maxWidth; - $this->maxHeight = $maxHeight; - $this->scale = $scale; - $this->inflate = $inflate; - $this->types = array( - 'image/jpeg', - 'image/png', - 'image/gif' - ); - //加载MIME类型图像的函数名称 - $this->imgLoaders = array( - 'image/jpeg' => 'imagecreatefromjpeg', - 'image/png' => 'imagecreatefrompng', - 'image/gif' => 'imagecreatefromgif' - ); - //储存创建MIME类型图片的函数名称 - $this->imgCreators = array( - 'image/jpeg' => 'imagejpeg', - 'image/png' => 'imagepng', - 'image/gif' => 'imagegif' - ); - } - /** - * 文件方式加载图片 - * @param string $image 源图片 - * @return bool - */ - public function loadFile($image){ - if(!$dims = @getimagesize($image)){ - trigger_error("源图片不存在"); - } - if(in_array($dims['mime'], $this->types)){ - $loader = $this->imgLoaders[$dims['mime']]; - $this->source = $loader($image); - if($dims['mime'] == 'image/png' || $dims['mime'] == 'image/gif'){ - imagesavealpha($this->source, true); - } - $this->sourceWidth = $dims[0]; - $this->sourceHeight = $dims[1]; - $this->sourceMime = $dims['mime']; - $this->initThumb(); - return TRUE; - }else{ - trigger_error('不支持'.$dims['mime']."图片类型"); - } - } - /** - * 字符串方式加载图片 - * @param string $image 字符串 - * @param string $mime 图片类型 - * @return type - */ - public function loadData($image,$mime){ - if(in_array($mime, $this->types)){ - if($this->source = @imagecreatefromstring($image)){ - $this->sourceWidth = imagesx($this->source); - $this->sourceHeight = imagesy($this->source); - $this->sourceMime = $mime; - $this->initThumb(); - return TRUE; - }else{ - trigger_error("不能从字符串加载图片"); - } - }else{ - trigger_error("不支持".$mime."图片格式"); - } - } - /** - * 生成缩略图 - * @param string $file 文件名。如果不为空则储存为文件,否则直接输出到浏览器 - */ - public function buildThumb($file = NULL){ - $creator = $this->imgCreators[$this->sourceMime]; - if(isset($file) && $this->thumb !== NULL){ - return $creator($this->thumb,$file); - }else{ - return false; - } - } - /** - * 处理缩放 - */ - public function initThumb(){ - if($this->scale){ - if($this->sourceWidth > $this->sourceHeight){ - $this->thumbWidth = $this->maxWidth; - $this->thumbHeight = floor($this->sourceHeight*($this->maxWidth/$this->sourceWidth)); - }elseif($this->sourceWidth < $this->sourceHeight){ - $this->thumbHeight = $this->maxHeight; - $this->thumbWidth = floor($this->sourceWidth*($this->maxHeight/$this->sourceHeight)); - }else{ - $this->thumbWidth = $this->maxWidth; - $this->thumbHeight = $this->maxHeight; - } - } - - if($this->sourceWidth <= $this->maxWidth && $this->sourceHeight <= $this->maxHeight && $this->inflate == FALSE){ - $this->thumb = NULL; - }else{ - $this->thumb = imagecreatetruecolor($this->thumbWidth, $this->thumbHeight); - if($this->sourceMime == 'image/png' || $this->sourceMime == 'image/gif') - { - - imagealphablending($this->thumb, true); - imagesavealpha($this->thumb, true); - if($this->sourceMime == 'image/gif') - { - $bgcolor=imagecolorallocate($this->thumb,0,0,0); - $transparent = imagecolortransparent($this->thumb,$bgcolor) ; - } - if($this->sourceMime == 'image/png') - { - $transparent = imagecolorallocatealpha($this->thumb, 0, 0, 0, 127); - } - imagefill($this->thumb, 0, 0, $transparent); + private $maxWidth; + private $maxHeight; + private $scale; + private $inflate; + private $types; + private $imgLoaders; + private $imgCreators; + private $source; + private $sourceWidth; + private $sourceHeight; + private $sourceMime; + private $thumb; + private $thumbWidth; + private $thumbHeight; + + public function __construct($maxWidth, $maxHeight, $scale = true, $inflate = false) { + $this->maxWidth = $maxWidth; + $this->maxHeight = $maxHeight; + $this->scale = $scale; + $this->inflate = $inflate; + $this->types = array( + 'image/jpeg', + 'image/png', + 'image/gif' + ); + //加载MIME类型图像的函数名称 + $this->imgLoaders = array( + 'image/jpeg' => 'imagecreatefromjpeg', + 'image/png' => 'imagecreatefrompng', + 'image/gif' => 'imagecreatefromgif' + ); + //储存创建MIME类型图片的函数名称 + $this->imgCreators = array( + 'image/jpeg' => 'imagejpeg', + 'image/png' => 'imagepng', + 'image/gif' => 'imagegif' + ); + } + + /** + * 文件方式加载图片 + * @param string $image 源图片 + * @return bool + */ + public function loadFile($image){ + if(!$dims = @getimagesize($image)){ + trigger_error("源图片不存在"); + } + if(in_array($dims['mime'], $this->types)){ + $loader = $this->imgLoaders[$dims['mime']]; + $this->source = $loader($image); + if($dims['mime'] == 'image/png' || $dims['mime'] == 'image/gif'){ + imagesavealpha($this->source, true); } - imagecopyresampled($this->thumb, $this->source, 0, 0, 0, 0, $this->thumbWidth, $this->thumbHeight, $this->sourceWidth, $this->sourceHeight); - } - } - - public function getMine(){ - return $this->sourceMime; - } - - public function getThumbWidth(){ - return $this->thumbWidth; - } - - public function getThumbHeight(){ - return $this->thumbHeight; - } + $this->sourceWidth = $dims[0]; + $this->sourceHeight = $dims[1]; + $this->sourceMime = $dims['mime']; + $this->initThumb(); + return TRUE; + }else{ + trigger_error('不支持'.$dims['mime']."图片类型"); + } + } + + /** + * 字符串方式加载图片 + * @param string $image 字符串 + * @param string $mime 图片类型 + * @return type + */ + public function loadData($image,$mime){ + if(in_array($mime, $this->types)){ + if($this->source = @imagecreatefromstring($image)){ + $this->sourceWidth = imagesx($this->source); + $this->sourceHeight = imagesy($this->source); + $this->sourceMime = $mime; + $this->initThumb(); + return TRUE; + }else{ + trigger_error("不能从字符串加载图片"); + } + }else{ + trigger_error("不支持".$mime."图片格式"); + } + } + + /** + * 生成缩略图 + * @param string $file 文件名。如果不为空则储存为文件,否则直接输出到浏览器 + */ + public function buildThumb($file = NULL){ + $creator = $this->imgCreators[$this->sourceMime]; + if(isset($file) && $this->thumb !== NULL){ + return $creator($this->thumb,$file); + }else{ + return false; + } + } + + /** + * 处理缩放 + */ + public function initThumb(){ + if($this->scale){ + if($this->sourceWidth > $this->sourceHeight){ + $this->thumbWidth = $this->maxWidth; + $this->thumbHeight = floor($this->sourceHeight*($this->maxWidth/$this->sourceWidth)); + }elseif($this->sourceWidth < $this->sourceHeight){ + $this->thumbHeight = $this->maxHeight; + $this->thumbWidth = floor($this->sourceWidth*($this->maxHeight/$this->sourceHeight)); + }else{ + $this->thumbWidth = $this->maxWidth; + $this->thumbHeight = $this->maxHeight; + } + } + + if($this->sourceWidth <= $this->maxWidth && $this->sourceHeight <= $this->maxHeight && $this->inflate == FALSE){ + $this->thumb = NULL; + }else{ + $this->thumb = imagecreatetruecolor($this->thumbWidth, $this->thumbHeight); + if($this->sourceMime == 'image/png' || $this->sourceMime == 'image/gif') + { + + imagealphablending($this->thumb, true); + imagesavealpha($this->thumb, true); + if($this->sourceMime == 'image/gif') + { + $bgcolor=imagecolorallocate($this->thumb,0,0,0); + $transparent = imagecolortransparent($this->thumb,$bgcolor) ; + } + if($this->sourceMime == 'image/png') + { + $transparent = imagecolorallocatealpha($this->thumb, 0, 0, 0, 127); + } + imagefill($this->thumb, 0, 0, $transparent); + } + imagecopyresampled($this->thumb, $this->source, 0, 0, 0, 0, $this->thumbWidth, $this->thumbHeight, $this->sourceWidth, $this->sourceHeight); + } + } + + public function getMine(){ + return $this->sourceMime; + } + + public function getThumbWidth(){ + return $this->thumbWidth; + } + + public function getThumbHeight(){ + return $this->thumbHeight; + } + + static function cut($source_path, $target_width, $target_height){ + $source_info = getimagesize($source_path); + $source_width = $source_info[0]; + $source_height = $source_info[1]; + $source_mime = $source_info['mime']; + $source_ratio = $source_height / $source_width; + $target_ratio = $target_height / $target_width; + + // 源图过高 + if ($source_ratio > $target_ratio) + { + $cropped_width = $source_width; + $cropped_height = $source_width * $target_ratio; + $source_x = 0; + $source_y = ($source_height - $cropped_height) / 2; + } + // 源图过宽 + elseif ($source_ratio < $target_ratio) + { + $cropped_width = $source_height / $target_ratio; + $cropped_height = $source_height; + $source_x = ($source_width - $cropped_width) / 2; + $source_y = 0; + } + // 源图适中 + else + { + $cropped_width = $source_width; + $cropped_height = $source_height; + $source_x = 0; + $source_y = 0; + } + + switch ($source_mime) + { + case 'image/gif': + $source_image = imagecreatefromgif($source_path); + break; + + case 'image/jpeg': + $source_image = imagecreatefromjpeg($source_path); + break; + + case 'image/png': + $source_image = imagecreatefrompng($source_path); + break; + + default: + return false; + break; + } + + $target_image = imagecreatetruecolor($target_width, $target_height); + $cropped_image = imagecreatetruecolor($cropped_width, $cropped_height); + + // 裁剪 + imagecopy($cropped_image, $source_image, 0, 0, $source_x, $source_y, $cropped_width, $cropped_height); + // 缩放 + imagecopyresampled($target_image, $cropped_image, 0, 0, 0, 0, $target_width, $target_height, $cropped_width, $cropped_height); + + header('Content-Type: image/jpeg'); + imagejpeg($target_image); + imagedestroy($source_image); + imagedestroy($target_image); + imagedestroy($cropped_image); + }//cute } diff --git a/application/module/Helpers/Curl.php b/application/module/Helpers/Curl.php index bc819575..b36ad768 100644 --- a/application/module/Helpers/Curl.php +++ b/application/module/Helpers/Curl.php @@ -4,19 +4,25 @@ namespace Helpers; class Curl { private $options; - + public $port = 80; + public $H; + public function __construct($options = array()) { - $this->options = array_merge(array( + $this->initOptions($options); + } + + public function initOptions($options = array()) + { + $this->options = array_merge(array( 'debug' => false, - 'http_port' => '80', + 'http_port' => $this->port, 'user_agent' => 'Westdc DataService', 'timeout' => 20, 'curlopts' => null, 'verifyssl' => true, ), $options); - } - + } /** * Send a request to the server, receive a response * @@ -69,6 +75,11 @@ class Curl } else { $headers[] = 'Content-Length: 0'; } + + if(!empty($this->H) && is_array($this->H) && count($this->H) > 0) + { + $headers = array_merge($headers,$this->H); + } $this->debug('send '.$httpMethod.' request: '.$url); @@ -81,6 +92,16 @@ class Curl CURLOPT_HTTPHEADER => $headers, CURLOPT_SSL_VERIFYPEER => $options['verifyssl'], ); + + if($this->port === 443) + { + /*$curlOptions += array( + CURLOPT_SSLVERSION => 3, + CURLOPT_SSLCERT => "../application/module/Open/apache.pem", + CURLOPT_SSLKEY => "../application/module/Open/apache.key", + CURLOPT_CAINFO => "../application/module/Open/apache.pem" + );*/ + } if (ini_get('open_basedir') == '' && ini_get('safe_mode') != 'On') { $curlOptions[CURLOPT_FOLLOWLOCATION] = true; diff --git a/application/module/Helpers/Table.php b/application/module/Helpers/Table.php index 69256584..15bab0fb 100644 --- a/application/module/Helpers/Table.php +++ b/application/module/Helpers/Table.php @@ -26,5 +26,6 @@ class Table //开放平台 public $oauth_clients = "oauth_clients"; + public $oauth_token = "oauth_login_token"; public $oauth_access_tokens = "oauth_access_tokens"; } \ No newline at end of file diff --git a/application/module/Helpers/View.php b/application/module/Helpers/View.php index 783ba487..732468cb 100644 --- a/application/module/Helpers/View.php +++ b/application/module/Helpers/View.php @@ -55,7 +55,7 @@ class View extends \Zend_Controller_Plugin_Abstract $html = '
    '."\r\n"; $html.= '×'."\r\n"; if(!is_array($content)) { - $html.= '

    '.$content.'

    '."\r\n"; + $html.= ''.$content.''."\r\n"; }else{ $html.= '
      '."\r\n"; foreach($content as $v) { diff --git a/application/module/Mail/Mail.php b/application/module/Mail/Mail.php index 8736bffb..06288646 100644 --- a/application/module/Mail/Mail.php +++ b/application/module/Mail/Mail.php @@ -121,7 +121,12 @@ class Mail $this->subject = $subject; $this->body = $body; - $this->type = $row['type']; + if(isset($row['type'])) + { + $this->type = $row['type']; + }else{ + $this->type = "text"; + } }//加载模板 diff --git a/application/module/Open/Client.php b/application/module/Open/Client.php new file mode 100644 index 00000000..2bfc6ff6 --- /dev/null +++ b/application/module/Open/Client.php @@ -0,0 +1,172 @@ +db = \Zend_Registry::get('db'); + }else{ + $this->db = $db; + } + + $this->config = \Zend_Registry::get('config'); + + $this->table = new \Helpers\Table(); + + $this->target = $target; + + $Listener = new Listener(); + @$this->events()->attachAggregate($Listener); + } + + public function events(\Zend_EventManager_EventCollection $events = NULL) + { + if ($events !== NULL) { + $this->events = $events; + } elseif ($this->events === NULL) { + $this->events = new \Zend_EventManager_EventManager(__CLASS__); + } + return $this->events; + } + + public function initSource() + { + $this->source = new Source('heihedata'); + } + + public function getSource() + { + return $this->source; + } + + //创建获取Code的URL + public function makeRequestCodeUrl($target = NULL) + { + if(empty($this->source)) + { + $this->initSource(); + } + + if(empty($target)) + { + $target = $this->target; + } + + $main_target = $this->source->getTarget($target); + + if($main_target === false) + { + return "此登录接口可能不存在"; + } + + $source = $this->source->getSource($target); + + if($source === false) + { + return "此登录接口暂不可用"; + } + + $main_url = $main_target['code']; + + $param = array( + $source->param['id'] => $source->config['id'], + $source->param['secret'] => $source->config['secret'], + $source->param['callback'] => $source->config['callback'], + $source->param['code_response'] => $main_target['code_response'] + ); + + if(isset($source->config['other'])) + { + $param = array_merge($param,$source->config['other']); + } + + $url = $main_url."?".http_build_query($param); + + return $url; + + } + + //获得token + public function requestToken($code,$target = NULL) + { + if(empty($target)) + { + $target = $this->target; + } + + if(empty($code)) + { + return "未获得您的授权码"; + } + + $main_target = $this->source->getTarget($target); + $client = $this->source->getSource($target); + + if($client === false) + { + return "请求发生错误,登录接口不存在或者可能不再适用"; + } + + $main_url = $main_target['token']; + $param = array( + $client->param['id'] => $client->config['id'], + $client->param['secret'] => $client->config['secret'], + $client->param['grant_type'] => $main_target['grant_type'], + $client->param['callback'] => $client->config['callback'], + $client->param['code'] => $code + ); + + $curl = new Curl(); + $curl->port = 443; + $curl->initOptions(array('verifyssl'=>false)); + $data = $curl->request($main_url,$param,"POST"); + + $cache_data = json_decode($data['response'],true); + + if(!isset($cache_data['expires_in'])) + { + return "未获得授权信息,请重试链接"; + } + + return $cache_data; + + } + + //储存token信息 + public function storageTokenData($type,$token) + { + if(empty($type)) + { + return "接口类型错误"; + } + + if(empty($token)) + { + return "登录信息有误,请重新登录"; + } + + $param = compact("type","token"); + + $results = $this->events()->trigger('tokenStorage', $this, $param); + return $cache_data = $results->bottom(); + + } + + + +} \ No newline at end of file diff --git a/application/module/Open/Event/AppEvent.php b/application/module/Open/Event/AppEvent.php new file mode 100644 index 00000000..9985c74d --- /dev/null +++ b/application/module/Open/Event/AppEvent.php @@ -0,0 +1,10 @@ +db = \Zend_Registry::get('db'); + }else{ + $this->db = $db; + } + + $this->config = \Zend_Registry::get('config'); + $this->table = new Table(); + } + + //检查app参数 + public function appCheckParam(\Zend_EventManager_Event $e) + { + $data = $e->getParam('data'); + + if(!is_array($data)) + { + return "参数错误"; + } + + if(empty($data['subject'])) + { + return "请输入应用名称"; + } + + if(empty($data['client_domain'])) + { + return "请填写应用使用的域名,不带www"; + } + + if(empty($data['redirect_uri'])) + { + return "请输入授权成功后的回调地址"; + } + + $sql = "SELECT id FROM {$this->table->oauth_clients} WHERE subject='{$data['subject']}'"; + $rs = $this->db->query($sql); + $row = $rs->fetch(); + + if(!empty($row['id'])) + { + return "此应用名称已存在,请重新输入"; + } + + return true; + } + + //处理app参数数据 + public function appProcessData(\Zend_EventManager_Event $e) + { + $data = $e->getParam('data'); + $id = $e->getParam('id'); + + if(empty($id)) + { + $data['client_id'] = $this->create_client_guid(__CLASS__); + $data['client_secret'] = strtoupper(substr(md5($data['client_id'].$data['client_domain'].$data['redirect_uri'].time()),10,24)); + } + $data['user_id'] = view::User('id'); + + return $data; + } + + //创建App成功后 + public function appCreated(\Zend_EventManager_Event $e) + { + $id = $e->getParam('id'); + $data = $e->getParam('data'); + + return true; + } + + //App编辑成功后 + public function appEdited(\Zend_EventManager_Event $e) + { + $id = $e->getParam('id'); + $data = $e->getParam('data'); + + return true; + } + + public function create_client_guid($namespace = '') { + static $guid = ''; + $uid = uniqid("", true); + $data = $namespace; + if(isset($_SERVER['REQUEST_TIME'])) + $data .= $_SERVER['REQUEST_TIME']; + + if(isset($_SERVER['HTTP_USER_AGENT'])) + $data .= $_SERVER['HTTP_USER_AGENT']; + + if(isset($_SERVER['LOCAL_ADDR'])) + $data .= $_SERVER['LOCAL_ADDR']; + + if(isset($_SERVER['LOCAL_PORT'])) + $data .= $_SERVER['LOCAL_PORT']; + + if(isset($_SERVER['REMOTE_ADDR'])) + $data .= $_SERVER['REMOTE_ADDR']; + + if(isset($_SERVER['REMOTE_PORT'])) + $data .= $_SERVER['REMOTE_PORT']; + + $data .= time(); + + $hash = strtoupper(hash('ripemd128', $uid . $guid . md5($data))); + $guid = '' . + substr($hash, 0, 8) . + '-' . + substr($hash, 8, 4) . + '-' . + substr($hash, 12, 4) . + '-' . + substr($hash, 16, 4) . + '-' . + substr($hash, 20, 12) . + ''; + return $guid; + } + +} diff --git a/application/module/Open/Handler/ClientHandler.php b/application/module/Open/Handler/ClientHandler.php new file mode 100644 index 00000000..b3cd8a2f --- /dev/null +++ b/application/module/Open/Handler/ClientHandler.php @@ -0,0 +1,83 @@ +db = \Zend_Registry::get('db'); + }else{ + $this->db = $db; + } + + $this->config = \Zend_Registry::get('config'); + $this->table = new Table(); + } + + //获得Handler,type必须与 \Open\Source中同步,否则会出现错误 + // + public function getHandler($type,$data) + { + if($type == 'escience') + { + return new \Open\Handler\ClientTokenHandler\Escience($data); + } + + if($type == 'sina') + { + return new \Open\Handler\ClientTokenHandler\Sina($data); + } + + return false; + } + + //存储token信息 + public function tokenAndDataStorage(\Zend_EventManager_Event $e) + { + $type = $e->getParam('type'); + $data = $e->getParam('token'); + + $handler = $this->getHandler($type,$data); + + if($status = $handler->doit() === true) + { + return true; + }else{ + return $status; + } + } + + //检查用户账户是否存在 + //存在就返回用户信息,不存在返回false + //通用事件,通过各个 TokenHandler中内置Listener直接挂载,不需要引入整个ClientListener + public function userCheck(\Zend_EventManager_Event $e) + { + $email = $e->getParam('email'); + + $user = new Users(); + $current = $user->userExists($email); + + if($current === false) + { + return false; + } + + return $current; + } + +} diff --git a/application/module/Open/Handler/ClientTokenHandler/Escience.php b/application/module/Open/Handler/ClientTokenHandler/Escience.php new file mode 100644 index 00000000..68759322 --- /dev/null +++ b/application/module/Open/Handler/ClientTokenHandler/Escience.php @@ -0,0 +1,182 @@ +db = \Zend_Registry::get('db'); + }else{ + $this->db = $db; + } + + $this->config = \Zend_Registry::get('config'); + $this->table = new Table(); + + //预处理token信息 + $status = $this->preProcess($token); + } + + //考虑加一个接口,每个Token操作类中必须包含此函数 + public function doit() + { + //makeUserStorage在先,必须的 + $status = $this->makeUserStorage(); + + if($status!==true) + { + return $status; + } + + $status = $this->makeTokenStorage(); + + if($status !== true) + { + return $status; + } + + return true; + } + + //预处理 + public function preProcess($tokenData) + { + if(!is_array($tokenData)) + { + return "参数错误"; + } + + $this->userInfo = json_decode($tokenData['userInfo'],true); + + unset($tokenData['userInfo']); + + $this->token = $tokenData; + + return true; + } + + //检查用户信息,如果没有用户自动注册,有用户就自动绑定。 + public function makeUserStorage() + { + $uid = view::User('id'); + + if(is_numeric($uid) && $uid > 0) + { + $this->userid = $uid; + return "您已经登录,无需重复登录"; + } + + if(empty($this->userid)) + { + $current_oauth_email = $this->userInfo['cstnetId']; + + $user = new Users(TRUE); + $current = $user->userExists($current_oauth_email); + + if($current === false) + //自动注册用户 + { + $data = array( + $user->account->FieldUsername => $current_oauth_email, + $user->account->FieldEmail => $current_oauth_email, + $user->account->FieldPasword => 0, + $user->account->FieldRealname => $this->userInfo['truename'], + ); + + $dbh = new dbh(); + + $id = $dbh->insert($user->account->memberTable,$data,true); + + //登录 + $user->account->storeLogin(array( + $user->account->FieldUsername => $data[$user->account->FieldUsername], + $user->account->FieldPasword => $data[$user->account->FieldPasword] + )); + + $this->userid = $id; + + return true; + } + + //帮用户自动登录 + else{ + + $user->account->storeLogin(array( + $user->account->FieldUsername => $current[$user->account->FieldUsername], + $user->account->FieldPasword => $current[$user->account->FieldPasword] + ),false); + + $this->userid = $current[$user->account->FieldIndex]; + + return true; + } + + } + + } + + //生成写入token表的数据 + //有token记录就更新,没有再插入 + public function makeTokenStorage() + { + $data = array( + 'access_token' => $this->token['access_token'], + 'refresh_token' => $this->token['refresh_token'], + 'expires_in' => $this->token['expires_in'], + 'userid' => $this->userid, + "response_data" => json_encode($this->userInfo,JSON_NUMERIC_CHECK), + "source" => "escience" + ); + + //查看用户用escience登录的记录是否存在 + $sql = "SELECT * FROM {$this->table->oauth_token} WHERE userid={$this->userid} AND source='{$data['source']}' LIMIT 1"; + $rs = $this->db->query($sql); + $row = $rs->fetch(); + + $dbh = new dbh(); + + if(isset($row['id'])) + { + $status = $dbh->update($this->table->oauth_token,$data," id={$row['id']} AND userid={$this->userid} "); + if($status) + { + return true; + }else{ + return "更新授权信息时发生错误,请重新登录"; + } + }else{ + $status = $dbh->insert($this->table->oauth_token,$data); + if($status) + { + return true; + }else{ + return "记录授权信息时发生错误,请重新登录"; + } + } + + return true; + } + + +} diff --git a/application/module/Open/Handler/OauthHandler.php b/application/module/Open/Handler/OauthHandler.php new file mode 100644 index 00000000..5a5da972 --- /dev/null +++ b/application/module/Open/Handler/OauthHandler.php @@ -0,0 +1,46 @@ +db = \Zend_Registry::get('db'); + }else{ + $this->db = $db; + } + + $this->config = \Zend_Registry::get('config'); + $this->table = new Table(); + } + + public function checkParam(\Zend_EventManager_Event $e) + { + $data = $e->getParam('data'); + + if(!is_array($data)) + { + return "参数错误"; + } + + + + return true; + } + + + +} diff --git a/application/module/Open/Handler/OpenHandler.php b/application/module/Open/Handler/OpenHandler.php new file mode 100644 index 00000000..aa0dc5e0 --- /dev/null +++ b/application/module/Open/Handler/OpenHandler.php @@ -0,0 +1,46 @@ +db = \Zend_Registry::get('db'); + }else{ + $this->db = $db; + } + + $this->config = \Zend_Registry::get('config'); + $this->table = new Table(); + } + + public function checkParam(\Zend_EventManager_Event $e) + { + $data = $e->getParam('data'); + + if(!is_array($data)) + { + return "参数错误"; + } + + + + return true; + } + + + +} diff --git a/application/module/Open/Listener/AppListener.php b/application/module/Open/Listener/AppListener.php new file mode 100644 index 00000000..41628b18 --- /dev/null +++ b/application/module/Open/Listener/AppListener.php @@ -0,0 +1,28 @@ +event = new \Zend_EventManager_EventManager(); + } + + public function attach(\Zend_EventManager_EventCollection $events) + { + $Handler = new Handler(); + $events->attach('app.checkParam', array($Handler, 'appCheckParam'), 100); + $events->attach('app.processData', array($Handler, 'appProcessData'), 100); + $events->attach('app.created', array($Handler, 'appCreated'), 100); + $events->attach('app.eidted', array($Handler, 'appEdited'), 100); + } + + public function detach(\Zend_EventManager_EventCollection $events) + { + + } + +} \ No newline at end of file diff --git a/application/module/Open/Listener/ClientListener.php b/application/module/Open/Listener/ClientListener.php new file mode 100644 index 00000000..2ff2ad3e --- /dev/null +++ b/application/module/Open/Listener/ClientListener.php @@ -0,0 +1,26 @@ +event = new \Zend_EventManager_EventManager(); + } + + public function attach(\Zend_EventManager_EventCollection $events) + { + $Handler = new Handler(); + $events->attach('tokenStorage', array($Handler, 'tokenAndDataStorage'), 100); + $events->attach('user.check', array($Handler, 'userCheck'), 100); + } + + public function detach(\Zend_EventManager_EventCollection $events) + { + + } + +} \ No newline at end of file diff --git a/application/module/Open/Listener/OauthListener.php b/application/module/Open/Listener/OauthListener.php new file mode 100644 index 00000000..65056b9d --- /dev/null +++ b/application/module/Open/Listener/OauthListener.php @@ -0,0 +1,25 @@ +event = new \Zend_EventManager_EventManager(); + } + + public function attach(\Zend_EventManager_EventCollection $events) + { + $Handler = new OauthHandler(); + $events->attach('submit.checkParam', array($Handler, 'checkParam'), 100); + } + + public function detach(\Zend_EventManager_EventCollection $events) + { + + } + +} \ No newline at end of file diff --git a/application/module/Open/Listener/OpenListener.php b/application/module/Open/Listener/OpenListener.php new file mode 100644 index 00000000..64a06730 --- /dev/null +++ b/application/module/Open/Listener/OpenListener.php @@ -0,0 +1,25 @@ +event = new \Zend_EventManager_EventManager(); + } + + public function attach(\Zend_EventManager_EventCollection $events) + { + $Handler = new Handler(); + $events->attach('submit.checkParam', array($Handler, 'checkParam'), 100); + } + + public function detach(\Zend_EventManager_EventCollection $events) + { + + } + +} \ No newline at end of file diff --git a/application/module/Open/OAuth2.php b/application/module/Open/OAuth2.php new file mode 100644 index 00000000..f31d6f37 --- /dev/null +++ b/application/module/Open/OAuth2.php @@ -0,0 +1,31 @@ +db = \Zend_Registry::get('db'); + }else{ + $this->db = $db; + } + + $this->config = \Zend_Registry::get('config'); + $this->table = new Table(); + + } + + //用户使用谷歌账号登陆 + public function googleClient() + { + + } +} \ No newline at end of file diff --git a/application/module/Open/OAuth2/Server.php b/application/module/Open/OAuth2/Server.php new file mode 100644 index 00000000..05508c18 --- /dev/null +++ b/application/module/Open/OAuth2/Server.php @@ -0,0 +1,76 @@ +db = \Zend_Registry::get('db'); + }else{ + $this->db = $db; + } + + $this->config = \Zend_Registry::get('config'); + $this->table = new Table(); + } + + //根据ID或者Client_id获得app的信息 + public function getClientInfo($id) + { + if(empty($id)) + { + return "无效参数"; + } + + if(is_numeric($id)) + { + $field = "id"; + }else{ + $field = "client_id"; + } + + $sql = "SELECT * FROM {$this->table->oauth_clients} WHERE $field=? LIMIT 1"; + $sth = $this->db->prepare($sql); + $sth->execute(array($id)); + $row = $sth->fetch(); + + return $row; + } + + //验证App + public function clientCredentials($client_id,$client_secret) + { + + $client = $this->getClientInfo($client_id); + + if(empty($client['id'])) + { + return "此应用ID未被证实"; + } + + if($client['status'] == -1) + { + return "此应用已关闭"; + } + + if($client['client_secret'] !== $client_secret) + { + return "Invalid client secret"; + } + + return true; + } + + +} \ No newline at end of file diff --git a/application/module/Open/Server.php b/application/module/Open/Server.php new file mode 100644 index 00000000..3406b448 --- /dev/null +++ b/application/module/Open/Server.php @@ -0,0 +1,37 @@ +config = \Zend_Registry::get('config'); + if(empty($db)) + { + $this->db = \Zend_Registry::get('db'); + }else{ + $this->db = $db; + } + + if(empty($auth)) + { + $this->auth = \Zend_Auth::getInstance(); + if($this->auth->hasIdentity()) + { + $this->user = $this->auth->getIdentity(); + } + }else{ + $this->auth = false; + } + } + + public function getCode() + { + + } + +} \ No newline at end of file diff --git a/application/module/Open/Source.php b/application/module/Open/Source.php new file mode 100644 index 00000000..49730998 --- /dev/null +++ b/application/module/Open/Source.php @@ -0,0 +1,157 @@ +source = new stdClass(); + $this->target = new stdClass(); + + $this->website = $website; + + $this->initSourceConfig(); + $this->initTarget(); + } + + //获得当前绑定的站点 + public function getCurrentSite(){ + return $this->website; + } + + //设置绑定的站点 + public function setCurrentSite($website){ + $this->website = $website; + $this->initSourceConfig(); + } + + private function initSourceConfig() + { + if(!in_array($this->website,$this->sourceType)) + { + return false; + } + + // Escience + // passport.escience.cn + $this->source->escience = new stdClass(); + $this->source->escience->param = array( + "id" => "client_id", + "secret" => "client_secret", + "code_response" => "response_type", + "grant_type" => "grant_type", + "callback" => "redirect_uri", + "code"=>"code" + ); + + //新浪微博(新浪通行证) + $this->source->sina = new stdClass(); + $this->source->sina->param = array( + + ); + + if($this->website == 'westdc'){ + $this->source->escience->config = array( + 'id' => '71852', + 'secret' => 'ad7gd3jZgbzhQM6vIh9vPnQFZQoTGHZI', + 'index' => 'http://westdc.westgis.ac.cn', + 'callback' => 'http://westdc.westgis.ac.cn/account/callback/type/escience', + 'other' => array( + 'theme'=>'full' + ) + ); + } + + if($this->website == 'heihedata'){ + $this->source->escience->config = array( + 'id' => '78969', + 'secret' => 'iTGKdCkUPakA2hza2TJ4XZ4cnwlh8Hqz', + 'index' => 'http://www.heihedata.org', + 'callback' => 'http://www.heihedata.org/account/callback/type/escience', + 'other' => array( + 'theme'=>'full' + ) + ); + } + + if($this->website == 'card'){ + $this->source->escience->config = array( + 'id' => '58176', + 'secret' => 'ZM5dEFX5GpJC62IcJ3iajx51T9hzhJkQ', + 'index' => 'http://card.westgis.ac.cn/', + 'callback' => 'http://card.westgis.ac.cn/account/callback/type/escience', + 'other' => array( + 'theme'=>'full' + ) + ); + } + + } + + //Oauth2登录目标 + /* + name : 名称 + code : 获取code的url + token : 获取 token的url + code_response : 获取token时使用的参数值(配合$this->source->OBJECTIVE->param中的code_response使用 + grant_type : 获得token的认证方式,按照oauth2标准,应该是authorization_code + */ + private function initTarget(){ + //中国科技网通行证 + $this->target->escience = array( + 'name' => '中国科技网通行证', + 'code' => 'http://passport.escience.cn/oauth2/authorize', + 'token' => 'https://passport.escience.cn/oauth2/token', + 'code_response' => 'code', + 'grant_type' => 'authorization_code', + ); + + //新浪 + $this->target->sina = array( + 'name' => '新浪微博', + 'code' => 'https://api.weibo.com/oauth2/authorize', + 'token' => '', + 'code_response' => 'code', + 'grant_type' => 'authorization_code' + ); + } + + //获得一个源 + public function getSource($type = "") + { + if(empty($type)) + { + return $this->source; + }else{ + if(isset($this->source->$type)) + { + return $this->source->$type; + }else{ + return false; + } + } + } + + //获得Oauth2登录模板 + public function getTarget($type = "") + { + if(empty($type)) + { + return $this->target; + }else{ + if(isset($this->target->$type)) + { + return $this->target->$type; + }else{ + return false; + } + } + } + +} \ No newline at end of file diff --git a/application/module/Open/server.php b/application/module/Open/server.php deleted file mode 100644 index ee0b7408..00000000 --- a/application/module/Open/server.php +++ /dev/null @@ -1,50 +0,0 @@ -config = \Zend_Registry::get('config'); - if(empty($db)) - { - $this->db = \Zend_Registry::get('db'); - }else{ - $this->db = $db; - } - - if(empty($auth)) - { - $this->auth = \Zend_Auth::getInstance(); - if($this->auth->hasIdentity()) - { - $this->user = $this->auth->getIdentity(); - } - }else{ - $this->auth = false; - } - } - - public function bootstrap() - { - $dsn = "pgsql:dbname={$this->config->db->params->dbname};host={$this->config->db->params->host}"; - - $storage = new \OAuth2\Storage\Pdo(array('dsn' => $dsn, 'username' => $this->config->db->params->username, 'password' => $this->config->db->params->password)); - - $server = new \OAuth2\Server($storage); - - $server->addGrantType(new \OAuth2\GrantType\ClientCredentials($storage)); - - $server->addGrantType(new \OAuth2\GrantType\AuthorizationCode($storage)); - - //应用授权 - //$server->handleTokenRequest(OAuth2\Request::createFromGlobals())->send(); - - return $server; - } - -} \ No newline at end of file diff --git a/application/module/Order/Manager/Offlineapp.php b/application/module/Order/Manager/Offlineapp.php index 74325e73..15a15168 100644 --- a/application/module/Order/Manager/Offlineapp.php +++ b/application/module/Order/Manager/Offlineapp.php @@ -3,7 +3,7 @@ namespace Order\Manager; use Helpers\View as view; use Helpers\dbh; -use Order\listener\ManagerListener; +use Order\Listener\ManagerListener; class Offlineapp { @@ -75,15 +75,15 @@ class Offlineapp "; $rs = $this->db->query($sql); return $rs->fetchAll(); - }// - - //判断是否存在wsn数据申请 - public function hasWsnData($id) - { - $sql="select count(d.id) as wsn from dataorder d left join dataservice s on d.uuid=s.uuid where d.offlineappid=$id and s.service_type in (1,2) and position('waterwsn' in s.service_url)>0 and d.selection is not null"; - $rs=$this->db->query($sql); - $row=$rs->fetch(); - return $row['wsn']; + }// + + //判断是否存在wsn数据申请 + public function hasWsnData($id) + { + $sql="select count(d.id) as wsn from dataorder d left join dataservice s on d.uuid=s.uuid where d.offlineappid=$id and s.service_type in (1,2) and position('waterwsn' in s.service_url)>0 and d.selection is not null"; + $rs=$this->db->query($sql); + $row=$rs->fetch(); + return $row['wsn']; } //重置申请表 @@ -100,7 +100,7 @@ class Offlineapp @unlink($row['applicationform']); } - if($this->db->exec("UPDATE offlineapp SET applicationform=NULL WHERE id=$id")>0) + if($this->db->exec("UPDATE offlineapp SET applicationform=NULL,status=2 WHERE id=$id")>0 && $this->db->exec("UPDATE dataorder SET status=2 WHERE offlineappid=$id")) { @$this->events()->trigger('offlineapp.AppFormReseted', $this, compact('id')); return true; diff --git a/application/module/Reference/Handler/RisHandler.php b/application/module/Reference/Handler/RisHandler.php index 9de4d5d0..8a820795 100644 --- a/application/module/Reference/Handler/RisHandler.php +++ b/application/module/Reference/Handler/RisHandler.php @@ -36,9 +36,14 @@ class RisHandler implements \Reference\Event\RisEvent $wheresql = array(); + if(preg_match("/\'/",$ref['title'])) + { + $ref['title'] = preg_replace("/\'/","''",$ref['title']); + } + $wheresql[] = " lower(title)=lower('{$ref['title']}') "; $wheresql[] = " year='{$ref['year']}' "; - + //暂时不使用期刊限制 /*if(isset($ref['publisher'])) { diff --git a/application/module/Reference/Ris.php b/application/module/Reference/Ris.php index c9432ddd..72da0dc3 100644 --- a/application/module/Reference/Ris.php +++ b/application/module/Reference/Ris.php @@ -174,10 +174,8 @@ class Ris $results = $this->events()->trigger('checkLoad', $this, compact('ref')); $id = $results->bottom(); - - if ($id > 0) - { + { $this->unsetVar($ref); $this->events()->trigger('deleteAuthor', $this, compact('id')); $this->events()->trigger('deleteTag', $this, compact('id')); @@ -185,8 +183,8 @@ class Ris unset($ref['reference']); $dbh->update($this->table->reference,$ref," id=$id "); - } else { - $ref['reference'] = $this->makeReferenceFlag($ref); + } else { + $ref['reference'] = $this->makeReferenceFlag($ref); $this->unsetVar($ref); $id = $dbh->insert($this->table->reference,$ref,true); } @@ -261,6 +259,11 @@ class Ris } return true; }else{ + if(is_string($author)) + { + $author_splited = $this->splitAuthor($author); + $this->dbh->insert($this->table->reference_author,array('id'=>$id , 'lastname'=>$author_splited['lastname'] , 'firstname'=>$author_splited['firstname'] , 'place'=>0 )); + } return false; } } @@ -274,8 +277,14 @@ class Ris //创建reference 字段 public function makeReferenceFlag($ref){ - $str = join(', ',$ref['author']).'. '; - $str .= $ref['title'].'. '; + $str=''; + if(is_array($ref['author']) && count($ref['author']) > 0) + { + $str .= join(', ',$ref['author']).'. '; + } else if (is_string($ref['author'])) { + $str .= $ref['author'].'. '; + } + $str .= $ref['title'].'. '; $str .= $ref['publisher'].', '; isset($ref['year']) ? $str .= $ref['year'].', ':""; isset($ref['volume']) ? $str .= $ref['volume']:""; diff --git a/application/module/Statistics/User.php b/application/module/Statistics/User.php new file mode 100644 index 00000000..c7b69c04 --- /dev/null +++ b/application/module/Statistics/User.php @@ -0,0 +1,130 @@ +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; + } + +} diff --git a/application/module/Users/Account.php b/application/module/Users/Account.php index 44438e43..e363e8bf 100644 --- a/application/module/Users/Account.php +++ b/application/module/Users/Account.php @@ -22,8 +22,8 @@ class Account extends \Zend_Controller_Plugin_Abstract public $FieldRealname = "realname"; public $RoleMember = "member"; - public $getPwdEmailTemplate = "users-changepassword"; //找回密码的邮件模板名称 - public $PwdChangedEmailTemplate = "users-password-changed"; //密码修改后的邮件模板 + public $getPwdEmailTemplate = "users-changepassword-en"; //找回密码的邮件模板名称 + public $PwdChangedEmailTemplate = "users-password-changed-en"; //密码修改后的邮件模板 private $db; protected $events = NULL; //事件 diff --git a/data/doc.xsl b/data/doc.xsl index f5a3f9bc..eadd2d77 100644 --- a/data/doc.xsl +++ b/data/doc.xsl @@ -111,6 +111,10 @@
    • End:
    • +
        +
      1. 日期:
      2. +
        +
    • Citation

        diff --git a/htdocs/js/lib/custom/models/dataservice.js b/htdocs/js/lib/custom/models/dataservice.js index e7443602..3055af00 100644 --- a/htdocs/js/lib/custom/models/dataservice.js +++ b/htdocs/js/lib/custom/models/dataservice.js @@ -168,6 +168,8 @@ westdc.dataservice.wsn = { this.selects = ""; this.uls = new Array(); + this.count = 0; + this.first = 0; for(i in data.data) { this.input = new Array(); @@ -185,12 +187,32 @@ westdc.dataservice.wsn = { + '' + '
    '; this.uls.push('

    观测点:'+data.data[i].name+'

    可下载的变量: '+ this.input.join("") + this.timemap + '
    '); + + this.count++; + if(this.count == 1) + { + this.first = i; + } + } this.selects = this.uls.join(""); + if(this.count > 1) + { + this.allcontrol = '
    ' + + '
    为所有数据选择时间范围(如果某些数据的时间超出范围请单独再次修改):
    ' + + ' - ' + + '' + + '

    '; + }else{ + this.allcontrol = ""; + } + this.HTML = '
    ' - + ''); + items.push('
  • More...
  • '); $('#literature-list').html(items.join('')); searchFinish(); }, - beforeSend:function(){$('#literature-list').html('结果加载中');}, - error:function(){$('#literature-list').html('');Alert('检索中发现错误,请稍后重试或直接访问');} + beforeSend:function(){$('#literature-list').html('Loading');}, + error:function(){$('#literature-list').html('');Alert('Error occupied.');} }); } diff --git a/htdocs/proftp_sync.php b/htdocs/proftp_sync.php index 8c084bb1..c627cb1b 100644 --- a/htdocs/proftp_sync.php +++ b/htdocs/proftp_sync.php @@ -20,9 +20,11 @@ $registry->set('config', $config); // setup database $db = Zend_Db::factory($config->db); -$date=$_REQUEST["date"]; -if (empty($date)) $date="2010-11-01"; - $sql="select dataorder.userid,dataset.path from dataorder left join dataset on dataorder.uuid=dataset.uuid where dataorder.status=5 and dataorder.offlineappid>0 and dataset.path<>'' and (dataorder.ts_approved+interval '1 minute')>='".$date."'"; +@$date=$_REQUEST["date"]; +if (empty($date)) $date=date('Y-m-d',strtotime('-2 month')); +$sql="select dataorder.userid,dataset.path from dataorder + left join dataset on dataorder.uuid=dataset.uuid + where dataorder.status in (0,5) and dataset.host='ftp2.westgis.ac.cn' and dataset.path<>'' and (dataorder.ts_approved+interval '1 minute')>='".$date."'"; $rs=$db->fetchAll($sql); print '# date: '.$date."\n"; foreach($rs as $r) diff --git a/tools/wsndata.php b/tools/wsndata.php index bf74c503..d112896d 100644 --- a/tools/wsndata.php +++ b/tools/wsndata.php @@ -1,5 +1,8 @@ 0)) { die("Error in parameter."); } - $action=@$_GET['action']; - + $action=@$_GET['action']; + if(!empty($action) && $action=='prepare') { $content="php -f /var/www/ftp2.westgis.ac.cn/wsndata.php $uid"; - $filename='wsndata.sh'; - if (!file_put_contents($filename, $content, LOCK_EX)) - { - sleep(1); - if (!file_put_contents($filename, $content, LOCK_EX)) - { - sleep(1); - if (!file_put_contents($filename, $content, LOCK_EX)) - die("error in write wsndatar.sh"); - } - } - } else { - $sql_user = "SELECT * from users_pm_down where starttime is not null and result=-1 and type='down' and uid=$uid"; - $sth_user = $db->query($sql_user); - $rows_user = $sth_user->fetchAll(); - - //有需要生成的数据 - if(!empty($rows_user)) - { - foreach($rows_user as $k=>$v ) - { + $filename='wsndata.sh'; + if (!file_put_contents($filename, $content, LOCK_EX)) + { + sleep(1); + if (!file_put_contents($filename, $content, LOCK_EX)) + { + sleep(1); + if (!file_put_contents($filename, $content, LOCK_EX)) + die("error in write wsndatar.sh"); + } + } + } else { + $sql_user = "SELECT distinct uid,site,variable,starttime,endtime from users_pm_down where starttime is not null and result=-1 and type='down' and uid=$uid"; + $sth_user = $db->query($sql_user); + $rows_user = $sth_user->fetchAll(); + + //有需要生成的数据 + if($rows_user) + { + foreach($rows_user as $k=>$v ) + { //逐个生成 $site = $v['site']; - $variable = $v['variable']; - $start = $v['starttime']; - $end = $v['endtime']; - $uid = $v['uid']; - //计算有多少天 - $days=round((strtotime($end)-strtotime($start))/3600/24)+1; - //获取观测点的名称 - $sql_site= "SELECT fld_name from tbl_site_info where fld_site_id=$site"; - $sth_site = $db->query($sql_site); - $rows_site = $sth_site->fetch(); - $sitename= $rows_site['fld_name']; - //获取用户的邮箱 - $sql_mail= "SELECT email from users where id=$uid"; - $sth_mail = $db->query($sql_mail); - $rows_mail = $sth_mail->fetch(); - if(empty($rows_mail)) - {$rows_mail['email']=="wuadan@lzb.ac.cn";} - //先为该用户创建一个文件夹 - $aimDir_user=$basepath.'wsn_'.$uid; + $variable = $v['variable']; + $start = date('Y-m-d',strtotime($v['starttime'])); + $end = date('Y-m-d',strtotime($v['endtime'])); + $uid = $v['uid']; + + //计算有多少天 + $days=round((strtotime($end)-strtotime($start))/3600/24)+1; + + //获取观测点的名称 + $sql_site= "SELECT fld_name from tbl_site_info where fld_site_id=$site"; + $sth_site = $db->query($sql_site); + $rows_site = $sth_site->fetch(); + $sitename= $rows_site['fld_name']; + + //先为该用户创建一个文件夹 + $aimDir_user=$basepath.'wsn_'.$uid; if (!file_exists($aimDir_user)) { $result = mkdir($aimDir_user); - } - //在该用户文件夹下面再建立一个观测点文件夹 - $aimDir_site=$aimDir_user.DIRECTORY_SEPARATOR.$site; + } + + //在该用户文件夹下面再建立一个观测点文件夹 + $aimDir_site=$aimDir_user.DIRECTORY_SEPARATOR.$sitename; if (!file_exists($aimDir_site)) { $result = mkdir($aimDir_site); - } - - //选择全部变量 - if($variable==-1) - { + } + + //选择全部变量 + if($variable==-1) + { //获取数据 - for ($i = 1; $i <= $days; $i++) + $sql2= "SELECT v.fld_time as time,v.fld_value as value,va.fld_name as variablename FROM tbl_value v left join tbl_variable_info va on v.fld_variable_id=va.fld_variable_id WHERE v.fld_site_id=$site AND v.fld_time>='$start' AND v.fld_time<'$end' ORDER BY time "; + $sth2 = $db->query($sql2); + //$rows2 = $sth2->fetchAll(); + $endtime=date("Y-m-d",strtotime($start)+24*3600); + $head = "Time,Variable,Value, \n"; + $html=""; + while ($v=$sth2->fetch()) { - $endtime=date("Y-m-d 00:00:00",strtotime($start)+24*3600); - $sql2= "SELECT v.fld_time as time,v.fld_value as value,va.fld_name as variablename FROM tbl_value v left join tbl_variable_info va on v.fld_variable_id=va.fld_variable_id WHERE v.fld_site_id=$site AND v.fld_time>='$start' AND v.fld_time<'$endtime' ORDER BY time "; - - $sth2 = $db->query($sql2); - $rows2 = $sth2->fetchAll(); - $datamount=count( $rows2); //组装数据 - $html=""; - foreach($rows2 as $k=>$v) + if ($v['time']>=$start && $v['time']<$endtime) { - $time[$k] = $v['time']; - $value[$k] = $v['value']; - $var[$k] = $v['variablename']; - $html .=$time[$k].",".$var[$k].",".$value[$k]."\n"; - } - - $head = "Time,Variable,Value, \n"; - - //将数据写入文件 - $resulttime=date("Ymd",strtotime($start)); - - $fp = fopen($aimDir_site.DIRECTORY_SEPARATOR.$sitename."_all_".$resulttime.".CSV","a"); //打开csv文件,如果不存在则创建 - fwrite($fp,$head.$html); //写入数据 - fclose($fp); //关闭文件句柄 - - $start = $endtime; - } + $html.=$v['time'].",".$v['variablename'].",".$v['value']."\n"; + } elseif ($v['time']>=$endtime) { + //写入文件 + $resulttime=date("Ymd",strtotime($start)); + $fp = fopen($aimDir_site.DIRECTORY_SEPARATOR.$sitename."_all_".$resulttime.".CSV","w+"); + fwrite($fp,$head.$html); //写入数据 + fclose($fp); //关闭文件句柄 + $start=$endtime; + $endtime=date("Y-m-d",strtotime($start)+24*3600); + $html=$v['time'].",".$v['variablename'].",".$v['value']."\n"; + } + } + //写入文件 + $resulttime=date("Ymd",strtotime($start)); + $fp = fopen($aimDir_site.DIRECTORY_SEPARATOR.$sitename."_all_".$resulttime.".CSV","w+"); + fwrite($fp,$head.$html); //写入数据 + fclose($fp); //关闭文件句柄 + print $sitename."\r\n"; $sql_up= "update users_pm_down set result=0 WHERE site=$site and variable=-1 and uid=$uid and result=-1 and type='down'"; - $sth_up = $db->query($sql_up); - } else { - //获取观测变量的名称 + $db->query($sql_up); + } else { + //获取观测变量的名称 $sql3= "SELECT fld_name from tbl_variable_info where fld_variable_id=$variable"; $sth3 = $db->query($sql3); $rows3 = $sth3->fetch(); $varname=$rows3['fld_name']; //获取数据 - $endtime=""; - for ($i = 1; $i <= $days; $i++) + $endtime=date("Y-m-d",strtotime($start)+24*3600); + $sql2= "SELECT v.fld_time as time,v.fld_value as value,va.fld_name as variablename FROM tbl_value v left join tbl_variable_info va on v.fld_variable_id=va.fld_variable_id WHERE v.fld_variable_id=$variable and v.fld_site_id=$site AND v.fld_time>='$start' AND v.fld_time<='$end' ORDER BY time "; + $sth2 = $db->query($sql2); + //$rows2 = $sth2->fetchAll(); + $head = "Time,Variable,Value, \n"; + $html=""; + while ($v = $sth2->fetch()) { - $endtime=date("Y-m-d H:m:s",strtotime($start)+24*3600); - $sql2= "SELECT v.fld_time as time,v.fld_value as value,va.fld_name as variablename FROM tbl_value v left join tbl_variable_info va on v.fld_variable_id=va.fld_variable_id WHERE v.fld_variable_id =$variable and v.fld_site_id=$site AND v.fld_time>='$start' AND v.fld_time<='$endtime' ORDER BY time "; - - $sth2 = $db->query($sql2); - $rows2 = $sth2->fetchAll(); - $datamount=count( $rows2); //组装数据 - $html=""; - foreach($rows2 as $k=>$v) + if ($v['time']>=$start && $v['time']<$endtime) { - $time[$k] = $v['time']; - $value[$k] = $v['value']; - $var[$k] = $v['variablename']; - $html .=$time[$k].",".$var[$k].",".$value[$k]."\n"; - } - - $head = "Time,Variable,Value, \n"; - //写入文件 - $resulttime=date("Ymd",strtotime($start)); - $fp = fopen($aimDir_site.DIRECTORY_SEPARATOR.$sitename."_".$varname."_".$resulttime.".CSV","a+"); - fwrite($fp,$head.$html); //写入数据 - fclose($fp); //关闭文件句柄 - $start = $endtime; + $html.=$v['time'].",".$v['variablename'].",".$v['value']."\n"; + } elseif ($v['time']>=$endtime) { + //写入文件 + $resulttime=date("Ymd",strtotime($start)); + $fp = fopen($aimDir_site.DIRECTORY_SEPARATOR.$sitename."_".$varname."_".$resulttime.".CSV","w+"); + fwrite($fp,$head.$html); //写入数据 + fclose($fp); //关闭文件句柄 + $start=$endtime; + $endtime=date("Y-m-d",strtotime($start)+24*3600); + $html=$v['time'].",".$v['variablename'].",".$v['value']."\n"; + } } + //写入文件 + $resulttime=date("Ymd",strtotime($start)); + $fp = fopen($aimDir_site.DIRECTORY_SEPARATOR.$sitename."_".$varname."_".$resulttime.".CSV","w+"); + fwrite($fp,$head.$html); //写入数据 + fclose($fp); //关闭文件句柄 + print $sitename.'--'.$varname."\r\n"; //给处理的数据做个标记result=0 - $sql_up= "update users_pm_down set result=0 WHERE site=$site and variable=$variable and uid=$uid and result=-1 and type='down'"; - $sth_up = $db->query($sql_up); - } - } - } - } \ No newline at end of file + $sql_up= "update users_pm_down set result=0 WHERE site=$site and variable=$variable and uid=$uid and result=-1 and type='down'"; + $db->query($sql_up); + } + + } + + } + + }