-- 正则替换工具
-- 引用的标题替换
-- 文件大小处理
-- 使用声明处理
-- 联系人替换
-- 关键词替换
+
\ No newline at end of file
diff --git a/application/config.ini b/application/config.ini
index 80a24be0..a4096aca 100755
--- a/application/config.ini
+++ b/application/config.ini
@@ -1,161 +1,158 @@
-[general]
-db.adapter = PDO_PGSQL
-db.params.host = localhost
-db.params.username = gis
-db.params.password = gispassword
-db.params.dbname = sanjiangyuan
-
-geonetwork.url=http://sanjiangyuan.westgis.ac.cn/geonetwork/
-geonetwork.adapter = PDO_PGSQL
-geonetwork.params.host = localhost
-geonetwork.params.username = gis
-geonetwork.params.password = gispassword
-geonetwork.params.dbname = geonetwork
-
-google.maps.api=ABQIAAAACD-MqkkoOm60o_dvwdcKVhRBSKpgcP88GYi6r2Of16IkMX_4YhSBQsywCi4J2_fh4nBuWmK7gyRjLg
-bing.api=4BC90E1E9ED351ECE0D9FB71509BC3CC1264340C
-bigthumb.path=../geonetwork/data/
-temp.path=/tmp/
-upload=../data/upload/
-
-paths.newsletter=images/newsletter/
-logging.file = /var/www/test.westgis.ac.cn/data/logs/debug.log
-page.limit=10
-import.dir=../data/import
-title.site=三江源自然保护区数据管理中心
-title.data=数据产品与服务
-title.heihe=黑河计划数据管理中心
-title.yrnmr=黄河上游宁蒙河段综合数据平台
-title.glacier=中国冰川资源及其变化调查
-title.review=数据评审
-title.author=数据作者
-title.knowledge=知识积累
-supportemail=westdc@lzb.ac.cn
-reportemail=westdc-report-subscribe@lists.westgis.ac.cn
-
-smtp.username=westdc@lzb.ac.cn
-smtp.password=ilovewestdc
-smtp.host=smtp.cstnet.cn
-smtp.ssl=TLS
-smtp.auth=login
-smtp.name=数据中心服务组
-
-ftp.user=newwestdc
-ftp.password=westdcforsmall
-download.max=5 //最多同时申请下载个数
-page.max=10 //每页显示条目数
-offline.template=../data/offline.pdf
-offline.heihetemplate=../data/heihe.pdf
-offline.security=../data/security.pdf
-offline.water_template=../data/water_offline.pdf
-offline.font=../data/simhei.ttf
-offline.savepath=../data/offlineapp
-service.email=westdc@lzb.ac.cn
-offline.email.template=../data/offline-email.txt
-offline.email.start_template=../data/offline-start-email.txt
-offline.email.finish_template=../data/offline-finish-email.txt
-offline.email.deny_template=../data/offline-deny-email.txt
-register.email.template=../data/register-email.txt
-westdc.xsl=../data/ISO19115.xsl
-
-routes.accout.route = "account/fetchpwd/:login/:key"
-routes.accout.defaults.controller = "account"
-routes.accout.defaults.action = "fetchpwd"
-
-routes.tag.route = "data/tag/:key"
-routes.tag.defaults.controller = "data"
-routes.tag.defaults.action = "tag"
-
-routes.netkites1.type = "Zend_Controller_Router_Route_Static"
-routes.netkites1.route = "knowledge/netkites"
-routes.netkites1.defaults.controller = netkites
-routes.netkites1.defaults.action = index
-
-routes.netkites.route = "knowledge/netkites/:action/*"
-routes.netkites.defaults.controller = netkites
-
-routes.dataid.route = "data/:id"
-routes.dataid.defaults.controller = "data"
-routes.dataid.defaults.action = "view"
-routes.dataid.reqs.id = "\d+"
-
-routes.dataxmluuid.route = "data/xml/:uuid"
-routes.dataxmluuid.defaults.controller = "data"
-routes.dataxmluuid.defaults.action = "xml"
-routes.dataxmluuid.reqs.uuid = "[[:xdigit:]]{8}(-[[:xdigit:]]{4}){3}-[[:xdigit:]]{12}"
-
-routes.datauuid.route = "data/:uuid"
-routes.datauuid.defaults.controller = "data"
-routes.datauuid.defaults.action = "view"
-routes.datauuid.reqs.uuid = "[[:xdigit:]]{8}(-[[:xdigit:]]{4}){3}-[[:xdigit:]]{12}"
-
-routes.datacat.route = "data/category/:code"
-routes.datacat.defaults.controller = "data"
-routes.datacat.defaults.action = "category"
-routes.datacat.reqs.code = "\d+"
-
-routes.dataseriesplace.route = "data/series/:id/:keyword"
-routes.dataseriesplace.defaults.controller = "data"
-routes.dataseriesplace.defaults.action = "series"
-//routes.dataseries.reqs.code = "\d+"
-
-routes.dataseries.route = "data/series/:id"
-routes.dataseries.defaults.controller = "data"
-routes.dataseries.defaults.action = "series"
-
-routes.wateruuid.route = "water/:uuid"
-routes.wateruuid.defaults.controller = "water"
-routes.wateruuid.defaults.action = "view"
-routes.wateruuid.reqs.uuid = "[[:xdigit:]]{8}(-[[:xdigit:]]{4}){3}-[[:xdigit:]]{12}"
-
-routes.watertag.route = "water/tag/:key"
-routes.watertag.defaults.controller = "water"
-routes.watertag.defaults.action = "tag"
-
-routes.mddoc.route = "data/wiki/:title"
-routes.mddoc.defaults.controller = "metainfo"
-routes.mddoc.defaults.action = "index"
-
-routes.mdfile.route = "filelist/uuid/:uuid"
-routes.mdfile.defaults.controller = "filelist"
-routes.mdfile.defaults.action = "index"
-
-routes.adminofflineapp.route = admin/down/offlineapp/:page
-routes.adminofflineapp.defaults.module = admin
-routes.adminofflineapp.defaults.controller = down
-routes.adminofflineapp.defaults.action = offlineapp
-routes.adminofflineapp.defaults.page = 1
-routes.adminofflineapp.reqs.page = \d+
-
-routes.admindatasetcd.route = admin/data/datasetcd/:page
-routes.admindatasetcd.defaults.module = admin
-routes.admindatasetcd.defaults.controller = data
-routes.admindatasetcd.defaults.action = datasetcd
-routes.admindatasetcd.defaults.page = 1
-routes.admindatasetcd.reqs.page = \d+
-
-routes.adminmd.route = admin/data/md/:page
-routes.adminmd.defaults.module = admin
-routes.adminmd.defaults.controller = data
-routes.adminmd.defaults.action = md
-routes.adminmd.defaults.page = 1
-routes.adminmd.reqs.page = \d+
-
-routes.admincomment.route = admin/data/comment/:page
-routes.admincomment.defaults.module = admin
-routes.admincomment.defaults.controller = data
-routes.admincomment.defaults.action = comment
-routes.admincomment.defaults.page = 1
-routes.admincomment.reqs.page = \d+
-
-routes.adminoffline.route = admin/data/offline/:page
-routes.adminoffline.defaults.module = admin
-routes.adminoffline.defaults.controller = data
-routes.adminoffline.defaults.action = offline
-routes.adminoffline.defaults.page = 1
-routes.adminoffline.reqs.page = \d+
-
-routes.news.route = archives/:ptype/:type/:page
-routes.news.defaults.controller = archives
-routes.news.defaults.action = list
-routes.news.defaults.page = 1
+[general]
+db.adapter = PDO_PGSQL
+db.params.host = localhost
+db.params.username = gis
+db.params.password = gispassword
+db.params.dbname = metadata
+
+geonetwork.url=http://www.sanjiangyuan.org.cn/geonetwork/
+geonetwork.adapter = PDO_PGSQL
+geonetwork.params.host = localhost
+geonetwork.params.username = gis
+geonetwork.params.password = gispassword
+geonetwork.params.dbname = geonetwork
+
+google.maps.api=ABQIAAAACD-MqkkoOm60o_dvwdcKVhRBSKpgcP88GYi6r2Of16IkMX_4YhSBQsywCi4J2_fh4nBuWmK7gyRjLg
+bing.api=4BC90E1E9ED351ECE0D9FB71509BC3CC1264340C
+bigthumb.path=../geonetwork/data/
+temp.path=/tmp/
+upload=../data/upload/
+
+paths.newsletter=images/newsletter/
+logging.file = /var/www/test.westgis.ac.cn/data/logs/debug.log
+page.limit=10
+import.dir=../data/import
+title.site=三江源生态监测综合数据服务平台
+title.data=数据产品与服务
+title.review=数据评审
+title.author=数据作者
+title.knowledge=知识积累
+supportemail=sjy@mygis.org
+reportemail=westdc-report-subscribe@lists.westgis.ac.cn
+
+smtp.username=sjy@mygis.org
+smtp.password=qherc@123
+smtp.host=smtp.gmail.com
+smtp.ssl=SSL
+smtp.auth=login
+smtp.name=三江源生态监测综合数据服务平台
+
+ftp.user=newwestdc
+ftp.password=westdcforsmall
+download.max=5 //最多同时申请下载个数
+page.max=10 //每页显示条目数
+offline.template=../data/offline.pdf
+offline.heihetemplate=../data/heihe.pdf
+offline.security=../data/security.pdf
+offline.water_template=../data/water_offline.pdf
+offline.font=../data/simhei.ttf
+offline.savepath=../data/offlineapp
+service.email=sjy@mygis.org
+offline.email.template=../data/offline-email.txt
+offline.email.start_template=../data/offline-start-email.txt
+offline.email.finish_template=../data/offline-finish-email.txt
+offline.email.deny_template=../data/offline-deny-email.txt
+register.email.template=../data/register-email.txt
+westdc.xsl=../data/ISO19115.xsl
+
+routes.accout.route = "account/fetchpwd/:login/:key"
+routes.accout.defaults.controller = "account"
+routes.accout.defaults.action = "fetchpwd"
+
+routes.tag.route = "data/tag/:key"
+routes.tag.defaults.controller = "data"
+routes.tag.defaults.action = "tag"
+
+routes.netkites1.type = "Zend_Controller_Router_Route_Static"
+routes.netkites1.route = "knowledge/netkites"
+routes.netkites1.defaults.controller = netkites
+routes.netkites1.defaults.action = index
+
+routes.netkites.route = "knowledge/netkites/:action/*"
+routes.netkites.defaults.controller = netkites
+
+routes.dataid.route = "data/:id"
+routes.dataid.defaults.controller = "data"
+routes.dataid.defaults.action = "view"
+routes.dataid.reqs.id = "\d+"
+
+routes.dataxmluuid.route = "data/xml/:uuid"
+routes.dataxmluuid.defaults.controller = "data"
+routes.dataxmluuid.defaults.action = "xml"
+routes.dataxmluuid.reqs.uuid = "[[:xdigit:]]{8}(-[[:xdigit:]]{4}){3}-[[:xdigit:]]{12}"
+
+routes.datauuid.route = "data/:uuid"
+routes.datauuid.defaults.controller = "data"
+routes.datauuid.defaults.action = "view"
+routes.datauuid.reqs.uuid = "[[:xdigit:]]{8}(-[[:xdigit:]]{4}){3}-[[:xdigit:]]{12}"
+
+routes.datacat.route = "data/category/:code"
+routes.datacat.defaults.controller = "data"
+routes.datacat.defaults.action = "category"
+routes.datacat.reqs.code = "\d+"
+
+routes.dataseriesplace.route = "data/series/:id/:keyword"
+routes.dataseriesplace.defaults.controller = "data"
+routes.dataseriesplace.defaults.action = "series"
+//routes.dataseries.reqs.code = "\d+"
+
+routes.dataseries.route = "data/series/:id"
+routes.dataseries.defaults.controller = "data"
+routes.dataseries.defaults.action = "series"
+
+routes.wateruuid.route = "water/:uuid"
+routes.wateruuid.defaults.controller = "water"
+routes.wateruuid.defaults.action = "view"
+routes.wateruuid.reqs.uuid = "[[:xdigit:]]{8}(-[[:xdigit:]]{4}){3}-[[:xdigit:]]{12}"
+
+routes.watertag.route = "water/tag/:key"
+routes.watertag.defaults.controller = "water"
+routes.watertag.defaults.action = "tag"
+
+routes.mddoc.route = "data/wiki/:title"
+routes.mddoc.defaults.controller = "metainfo"
+routes.mddoc.defaults.action = "index"
+
+routes.mdfile.route = "filelist/uuid/:uuid"
+routes.mdfile.defaults.controller = "filelist"
+routes.mdfile.defaults.action = "index"
+
+routes.adminofflineapp.route = admin/down/offlineapp/:page
+routes.adminofflineapp.defaults.module = admin
+routes.adminofflineapp.defaults.controller = down
+routes.adminofflineapp.defaults.action = offlineapp
+routes.adminofflineapp.defaults.page = 1
+routes.adminofflineapp.reqs.page = \d+
+
+routes.admindatasetcd.route = admin/data/datasetcd/:page
+routes.admindatasetcd.defaults.module = admin
+routes.admindatasetcd.defaults.controller = data
+routes.admindatasetcd.defaults.action = datasetcd
+routes.admindatasetcd.defaults.page = 1
+routes.admindatasetcd.reqs.page = \d+
+
+routes.adminmd.route = admin/data/md/:page
+routes.adminmd.defaults.module = admin
+routes.adminmd.defaults.controller = data
+routes.adminmd.defaults.action = md
+routes.adminmd.defaults.page = 1
+routes.adminmd.reqs.page = \d+
+
+routes.admincomment.route = admin/data/comment/:page
+routes.admincomment.defaults.module = admin
+routes.admincomment.defaults.controller = data
+routes.admincomment.defaults.action = comment
+routes.admincomment.defaults.page = 1
+routes.admincomment.reqs.page = \d+
+
+routes.adminoffline.route = admin/data/offline/:page
+routes.adminoffline.defaults.module = admin
+routes.adminoffline.defaults.controller = data
+routes.adminoffline.defaults.action = offline
+routes.adminoffline.defaults.page = 1
+routes.adminoffline.reqs.page = \d+
+
+routes.news.route = archives/:ptype/:type/:page
+routes.news.defaults.controller = archives
+routes.news.defaults.action = list
+routes.news.defaults.page = 1
diff --git a/application/default/controllers/AboutController.php b/application/default/controllers/AboutController.php
index 27f44c3a..647115d9 100755
--- a/application/default/controllers/AboutController.php
+++ b/application/default/controllers/AboutController.php
@@ -86,7 +86,7 @@ class AboutController extends Zend_Controller_Action
$siteid="e31f5ea7-a4af-4ae3-9ac1-1a84132c4338";//site uuid from geonetowrk
if(empty($ac))
{
- $sql="select * from mdref mr left join reference r on mr.refid=r.id where mr.uuid=? order by r.id desc";
+ $sql="select * from mdref mr left join reference r on mr.refid=r.id where mr.uuid=? and mr.reftype=0 order by r.year desc,r.title asc";
$sth = $this->db->prepare($sql);
$sth->execute(array($siteid));
$rows = $sth->fetchAll();
diff --git a/application/default/controllers/AuthorController.php b/application/default/controllers/AuthorController.php
index bc846292..a4fdeda1 100644
--- a/application/default/controllers/AuthorController.php
+++ b/application/default/controllers/AuthorController.php
@@ -2376,7 +2376,7 @@ class AuthorController extends Zend_Controller_Action
// 2. 保存变化记录 save changelog & userid for the latest version
$sql = "UPDATE mdversion SET changelog=?,userid=? WHERE id in (select id from mdversion where uuid=? order by ts_created desc limit 1)";
$this->db->query($sql,array($changelog,$u_id,$row['uuid']));
- file_get_contents("http://ftp2.westgis.ac.cn/proftp_upload.php?uuid=".$row['uuid']."&filelist=1");
+ file_get_contents("http://ftp.sanjiangyuan.org.cn/proftp_upload.php?uuid=".$row['uuid']."&filelist=1");
// 3. 保存数据评审状态
//导入元数据
@$iso->saveDB($this->db);
@@ -2472,10 +2472,10 @@ class AuthorController extends Zend_Controller_Action
}
//ftp 用户名
- $uname = 'westdc'.$u_id.'upload';
+ $uname = 'sjy'.$u_id.'upload';
//ftp路径
- $homedir = "/disk1/WestDC/upload/".$uuid."/";
+ $homedir = "/data/upload/".$uuid."/";
//ftp用户表
$ftptable=' pureftp ';//ftp2.westgis.ac.cn
$uid = 1002;
@@ -2491,7 +2491,7 @@ class AuthorController extends Zend_Controller_Action
//$old=umask(0);
//@mkdir($homedir,0777);
//umask($old);
- $page=file_get_contents('http://ftp2.westgis.ac.cn/proftp_upload.php?uuid='.$uuid);
+ $page=file_get_contents('http://ftp.sanjiangyuan.org.cn/proftp_upload.php?uuid='.$uuid);
if (!empty($page)) die($page);//there are errors in visit ftp page
diff --git a/application/default/controllers/DataController.php b/application/default/controllers/DataController.php
index 007644fd..357d12ef 100755
--- a/application/default/controllers/DataController.php
+++ b/application/default/controllers/DataController.php
@@ -1,2304 +1,2313 @@
-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->view->main_nav_pageID = "data";
-
- $this->view->nav = array(
- array('link'=>'/','title'=>''),
- array('link'=>'/data','title'=>$this->view->config->title->data),
- );
- }
- function indexAction()
- {
- //序列
- $state=$this->db->query('select s.id,s.name,count(*) as count from series s,dataseries d where d.sid=s.id and length(s.name)>2 group by s.id,s.name order by count desc limit 15');
- $this->view->serie=$state->fetchAll();
- //分类
- $state=$this->db->query('select c.code,name,name_zh,count(*) from category c,categorycode cc where c.code=cc.code group by c.code,cc.name,cc.name_zh');
- $this->view->category=$state->fetchAll();
- //关键词
- $state=$this->db->query("select keyword,count(*) from keyword right join normalmetadata on keyword.id=normalmetadata.id where keytype='place' group by keyword order by count desc limit 20");
- $k1=$state->fetchAll();
- $state=$this->db->query("select keyword,count(*) from keyword right join normalmetadata on keyword.id=normalmetadata.id where keytype='theme' group by keyword order by count desc limit 20");
- //$state=$this->db->query("select k.keyword,count(k.keyword) from keyword k left join normalmetadata m on k.id=m.id where k.keytype='theme' and (m.uuid in (select uuid from dataorder group by uuid order by count(uuid) desc limit 20)) group by k.keyword order by count(k.keyword) desc limit 20");
- $k2=$state->fetchAll();
- $state=$this->db->query("select keyword,count(*) from keyword right join normalmetadata on keyword.id=normalmetadata.id where keytype='discipline' group by keyword order by count desc limit 20");
- $k3=$state->fetchAll();
- $state=$this->db->query("select keyword,count(*) from keyword right join normalmetadata on keyword.id=normalmetadata.id where keytype='stratum' group by keyword order by count desc limit 20");
- $k4=$state->fetchAll();
- $state=$this->db->query("select keyword,count(*) from keyword right join normalmetadata on keyword.id=normalmetadata.id where keytype='temporal' group by keyword order by count desc limit 20");
- //$state=$this->db->query("select k.keyword,count(k.keyword) from keyword k left join normalmetadata m on k.id=m.id where k.keytype='temporal' and (m.uuid in (select uuid from dataorder group by uuid order by count(uuid) desc limit 20)) group by k.keyword order by count(k.keyword) desc limit 20");
- $k5=$state->fetchAll();
- $this->view->keywords=array('place'=>$k1,'theme'=>$k2,'discipline'=>$k3,'stratum'=>$k4,'temporal'=>$k5);
- //最新10个入库数据
- $state=$this->db->query('select id,uuid,title from normalmetadata order by id desc limit 10');
- $this->view->metadata = $state->fetchAll();
- //特色数据
-
- //服务
- $l=new mydir($this->view->config->paths->newsletter,"newsletter_*.pdf");
- $this->view->newsletter=$l->getLast();
- $name=basename($this->view->newsletter,'.pdf');
- list(,$this->view->newsletterno)=explode("_",$name);
-
- $this->view->addHelperPath('helper','Zend_View_Helper_');
- $form=new MaillistForm();
- $form->submit->setLabel('输入邮件地址,订阅数据通讯列表');
-
- $this->view->form=$form;
- if ($this->_request->isPost()) {
- //发送邮件
- $formData=$this->_request->getPost();
- if ($form->isValid($formData)) {
- $mail=new WestdcMailer($this->view->config->smtp);
- $mail->setFrom($formData['email']);
- $mail->setBodyText(".");
- $mail->setSubject('subscribe');
- $mail->addTo($this->view->config->reportemail);
- $mail->send();
- $this->messenger->addMessage('订阅成功,请检查您的邮件!');
- $this->_redirect('/data/');
- }
- } else {
- $auth = Zend_Auth::getInstance();
- if ($auth->hasIdentity()) {
- $user=$auth->getIdentity();
- $formData['email']=$user->email;
- $form->populate($formData);
- }
- }
- $searchform=new SearchForm();
- $this->view->searchform=$searchform;
-
- //其他连接
- }
- function onlinelistAction()
- {
- $page=(int)$this->_request->getParam('page');
- if (empty($page)) $page=1;
- $limit=30;
- $offset=$limit*($page-1);
- $state=$this->db->query('select count(*) from normalmetadata where datatype=0');
- $row=$state->fetchAll();
- $sum=$row[0]['count'];
- $select=$this->db->select();
- $select->from('normalmetadata','*')->where('datatype=0')->order('title')->limitPage($page,$limit);
- $this->view->metadata = $this->db->fetchAll($select);
- $this->view->page=new Pagination($sum,$page,$limit);
- }
- function offlinelistAction()
- {
- $page=(int)$this->_request->getParam('page');
- if (empty($page)) $page=1;
- $limit=30;
- $offset=$limit*($page-1);
- $state=$this->db->query('select count(*) from normalmetadata where datatype=1');
- $row=$state->fetchAll();
- $sum=$row[0]['count'];
- $select=$this->db->select();
- $select->from('normalmetadata','*')->where('datatype=1')->order('title')->limitPage($page,$limit);
- $this->view->metadata = $this->db->fetchAll($select);
- $this->view->page=new Pagination($sum,$page,$limit);
- }
- //展示最近20条离线神情记录情况
- function offlineappAction()
- {
- $sql="select * from offlineapp where ts_approved is not null and pdflink<>'' and status>=0 order by ts_created desc limit 20";
- $this->view->rows=$this->db->fetchAll($sql);
- }
- function requestAction()
- {
- $archives=new Archive($this->db);
- $this->view->item=$archives->getOneArchive('如何申请数据','help');
- }
- function submitAction()
- {
- $archives=new Archive($this->db);
- $this->view->item=$archives->getOneArchive('如何发布数据','help');
- }
- function serviceAction()
- {
- }
- function newsletterAction()
- {
- $l=new mydir($this->view->config->paths->newsletter,"newsletter_*.pdf");
- $this->view->newsletters=$l->toArray();
- $this->view->addHelperPath('helper','Zend_View_Helper_');
- rsort($this->view->newsletters);
- $form=new MaillistForm();
- $this->view->form=$form;
- $form->submit->setLabel('输入邮件地址,订阅数据通讯列表');
- if ($this->_request->isPost()) {
- //发送邮件
- $formData=$this->_request->getPost();
- if ($form->isValid($formData)) {
- //$mail=new Zend_Mail('utf-8');
- $mail=new WestdcMailer($this->view->config->smtp);
- $mail->setFrom($formData['email']);
- $mail->setBodyText(".");
- $mail->setSubject('subscribe');
- $mail->addTo($this->view->config->reportemail);
- /*
- $tr=new Zend_Mail_Transport_Smtp($this->view->config->smtp->host,
- array('ssl' => $this->view->config->smtp->ssl,
- 'auth'=>$this->view->config->smtp->auth,
- 'username'=>$this->view->config->smtp->username,
- 'password'=>$this->view->config->smtp->password));
- $mail->send($tr);
- */
- $mail->send();
- $this->messenger->addMessage('订阅成功,请检查您的邮件!');
- $this->_redirect('/data/newsletter');
- }
- } else {
- $auth = Zend_Auth::getInstance();
- if ($auth->hasIdentity()) {
- $user=$auth->getIdentity();
- $formData['email']=$user->email;
- $form->populate($formData);
- }
- }
- }
- function featureAction()
- {
- $sql="select * from datafeature order by id desc";
- $this->view->feature=$this->db->fetchAll($sql);
- }
-
- function datasetcdAction()
- {
- $cd=new DatasetcdTable();
- $this->view->rows=$cd->fetchAll();
- }
- /*
- * 数据浏览
- */
- function browseAction()
- {
- $page=(int)$this->_request->getParam('page');
- if (empty($page)) $page=1;
- $limit=10;
- $offset=$limit*($page-1);
- $state=$this->db->query('select count(*) from metadata');
- $row=$state->fetchAll();
- $sum=$row[0]['count'];
- $select=$this->db->select();
- $select->from('metadata','*')->order('id desc')->limitPage($page,$limit);
- $this->view->metadata = $this->db->fetchAll($select);
- $this->view->page=new Pagination($sum,$page,$limit);
- }
- function tagAction()
- {
- $id = (int)$this->_request->getParam('id');
- $key = $this->_request->getParam('key');
- $keytype = $this->_request->getParam('keytype');
- $page=(int)$this->_request->getParam('page');
- if (empty($page)) $page=1;
- $limit=10;
- $offset=$limit*($page-1);
- $sql='select keyword,count(*),keytype from keyword right join normalmetadata on keyword.id=normalmetadata.id ';
- if (!empty($keytype) && ($keytype=='place' || $keytype=='theme' || $keytype=='discipline'||$keytype=='temporal')) $sql.=" where keytype='".$keytype."'";
- $sql.=' group by keyword,keytype order by keytype,keyword,count desc';
- $state=$this->db->query($sql);
- $this->view->keywords=$state->fetchAll();
-
- if ($id>0 or !empty($key)) {
- if (empty($key)) {
- $where=$this->db->quoteInto('id = ?',$id);
- $row=$md->fetchRow($where);
- $key=$row->name;
- }
- $this->view->codename=$key;
- $sql=$this->db->quoteInto('select count(m.id) from normalmetadata m,keyword k where m.id=k.id and k.keyword=?',$key);
-
- $state=$this->db->query($sql);
- $row=$state->fetchAll();
- $sum=$row[0]['count'];
- $select=$this->db->select();
- $select->from('normalmetadata','*')->join('keyword','normalmetadata.id=keyword.id')->where('keyword.keyword=?',$key)->order('normalmetadata.title')->limitPage($page,$limit);
- //$sql=$db->quoteInto('select m.* from metadata m,keyword k where m.id=k.id and k.keyword=?',$key);
- //$state=$db->query($sql);
- $this->view->metadata=$this->db->fetchAll($select);
- $this->view->page=new Pagination($sum,$page,$limit);
- }
- }
- /*
- * 数据集序列浏览
- */
- function seriesAction()
- {
- $id = $this->_request->getParam('id');
- if (empty($id)) $id=0;
- if (!is_numeric($id))
- {
- $name=$id;
- $id='';
- }
- $keyword=$this->_request->getParam('keyword');
- if (empty($id)) {
- if (!empty($name))
- {
- $where=$this->db->quoteInto('name = ?',$name);
- $row=$this->db->fetchRow("select * from series where ".$where);
- }
- } else {
- $where=$this->db->quoteInto('id = ?',$id);
- $row=$this->db->fetchRow("select * from series where ".$where);
- }
- if (!empty($id) or !empty($name))
- {
- if (!$row) $this->_redirect('/data');
- $id=$row['id'];
- }
- $page=(int)$this->_request->getParam('page');
- if (empty($page)) $page=1;
- $limit=10;
- $offset=$limit*($page-1);
- $state=$this->db->query('select s.id,name,count(*) from series s,dataseries d where d.sid=s.id group by s.id,s.name');
- $this->view->serie=$state->fetchAll();
- if ($id>0) {
- //$where=$this->db->quoteInto('id = ?',$id);
- //$row=$this->db->fetchRow("select * from series where ".$where);
- $this->view->codename=$row['name'];
- if (!empty($keyword))
- {
- $sql='select count(m.id) as count from normalmetadata m,dataseries d,keyword k where m.id=d.id and m.id=k.id and d.sid=? and k.keyword=?';
- $row=$this->db->fetchAll($sql,array($id,$keyword));
- $this->view->codename.="【关键词:".$keyword."】";
- }else{
- $sql='select count(m.id) as count from normalmetadata m,dataseries d where m.id=d.id and d.sid=?';
- $row=$this->db->fetchAll($sql,array($id));
- }
- $sum=$row[0]['count'];
- $select=$this->db->select();
- $select->from('normalmetadata','*')->join('dataseries','normalmetadata.id=dataseries.id')->where('dataseries.sid=?',$id)->order('normalmetadata.title')->limitPage($page,$limit);
- if (!empty($keyword)) $select->join('keyword','keyword.id=normalmetadata.id')->where('keyword.keyword=?',$keyword);
- $this->view->metadata=$this->db->fetchAll($select);
- $this->view->page=new Pagination($sum,$page,$limit);
- //$this->view->showtools=($sum>$page)?true:false;
- //$this->view->form=new SearchForm();
- $sql=$this->db->quoteInto("select keyword,count(*) as count from (select t.keyword,t.id from keyword t left join dataseries d on t.id=d.id where t.keytype='place' and d.sid=?) as f group by keyword order by count desc limit 30",$id);
- $state=$this->db->query($sql);
- $row=$state->fetchAll();
- $this->view->places=$row;
- $this->view->seriesid=$id;
- } else {
- //提供全部数据集序列列表
- }
- }
- /*
- * 分类浏览模式
- */
- function categoryAction()
- {
- $page = $this->_request->getParam('page');
- $code = (int)$this->_request->getParam('code');
- $state=$this->db->query('select c.code,name,name_zh,count(*) from category c,categorycode cc where c.code=cc.code group by c.code,cc.name,cc.name_zh');
- $this->view->category=$state->fetchAll();
- if ($code>0 && $code<20) {
- $where=$this->db->quoteInto('code = ?',$code);
- $row=$this->db->fetchRow("select * from categorycode where ".$where);
- $this->view->codename=(empty($row['name_zh'])?$row['name']:$row['name_zh']);
- $sql='select count(m.id) from normalmetadata m left join category c on m.id=c.id where c.code=?';
- $row=$this->db->fetchRow($sql,array($code));
- $sum=$row['count'];
- $select=$this->db->select();
- $select->from('normalmetadata as m','*')->joinLeft('category as c','m.id=c.id')->where('c.code=?',$code)->order('m.title')->limitPage($page,$this->limit);
- $this->view->metadata=$this->db->fetchAll($select);
- $this->view->page=new Pagination($sum,$page,$this->limit);
- } else {
- //提供全部分类列表
- }
- }
- /*
- * 时间浏览方式
- * todo:实现xml的缓存,基于时间的缓存(每天)?基于元数据修改的缓存,每次导入后都重新生成一次。
- */
- function timelineAction()
- {
- $fn="time1.xml";
- $rows=$this->db->fetchAll("select ts_created from normalmetadata order by ts_created desc limit 1");
- $last_update=strtotime($rows[0]['ts_created']);
- if (!file_exists($fn) || (filemtime($fn)<$last_update))
- {
- $dateformat="M j Y";
- $md = new MetadataTable();
- $db=$md->getAdapter();
- $state=$db->query('select id,uuid,description,title,timebegin,timeend from normalmetadata where timebegin is not null order by timebegin');
- $rows=$state->fetchAll();
- $timexml='';
- foreach($rows as $row) {
- $timexml.='';
- $desc_length=mb_strlen($row['description'],"UTF-8");
- $desc=mb_substr($row['description'],0,($desc_length>300)?300:$desc_length,"UTF-8");
- if ($desc_length>300) $desc.=" ...";
- $timexml.=htmlspecialchars($desc);
- $timexml.="\n";
- }
- $timexml.='';
- $fp=fopen($fn,'w');
- fwrite($fp,$timexml);
- fclose($fp);
- }
- //$this->_helper->layout->disableLayout();
- }
- /*
- * todo:空间浏览
- */
- function mapAction()
- {
- //use json & openlayers?
- $id=(int)$this->_request->getParam('id');
- if ($id>0) $this->view->params="/id/$id";
- }
- /*
- * 产生geojson数据
- */
- function jsonAction()
- {
- $md=new MetadataTable();
- $db=$md->getAdapter();
- $id = (int)$this->_request->getParam('id');
- $where='';
- if (!empty($id)) { $where=' where id='.$id; }
- $sql='select id,uuid,west,south,north,east,title from normalmetadata'.$where;
- $state=$db->query($sql);
- $rows=$state->fetchAll();
- $geomd=new GeoMetaData();
- foreach($rows as $row){
- if ($id)
- $box=new GeoBox($row['west'],$row['south'],$row['east'],$row['north']);
- else
- $box=new GeoBoxLine($row['west'],$row['south'],$row['east'],$row['north']);
- $feature=new Geofeature();
- $feature->id=$row['id'];
- $feature->addProperties('title',$row['title']);
- $feature->addProperties('uuid',$row['uuid']);
- $feature->addProperties('id',$row['id']);
- $feature->geometry=$box;
- $geomd->addFeature($feature);
- }
- $this->_helper->json($geomd);
- }
- /*
- * 时空动态浏览
- */
- function timemapAction()
- {
- $sql='select id,uuid,west,south,north,east,title,timebegin,timeend from normalmetadata where timebegin is not null';
- $this->view->rows=$this->db->fetchAll($sql);
- }
- /*
- * 返回XML源文件
- */
- function xmlAction()
- {
- $uuid=$this->_request->getParam('uuid');
- $row=$this->db->fetchRow("select xml.data from xml left join metadata on xml.id=metadata.id where metadata.uuid=?",array($uuid));
- $this->_helper->layout->disableLayout();
- $this->_helper->viewRenderer->setNoRender();
- $this->getResponse()->setHeader('Content-Type', 'text/xml')
- ->setBody($row['data']);
- }
- function detailAction()
- {
- $id=(int)$this->_request->getParam('id');
- $xml=new XmlTable();
- $db=$xml->getAdapter();
- $where=$db->quoteInto('id=?',$id);
- $order='id desc';
- $row=$xml->fetchRow($where,$order);
- // Load the XML source
- $xml = new DOMDocument;
- $xml->loadXML($row->data);
- $xsl = new DOMDocument;
- $xsl->load($this->view->config->westdc->xsl);
- // Configure the transformer
- $proc = new XSLTProcessor;
- $proc->importStyleSheet($xsl); // attach the xsl rules
- $this->view->xml=$proc->transformToXML($xml);
- //$this->_helper->layout->disableLayout();
- //$this->_helper->viewRenderer->setNoRender();
- //$this->getResponse()->setHeader('Content-Type', 'text/html')
- // ->setBody($proc->transformToXML($xml));
- }
- function feedAction()
- {
- $feedArray = array(
- 'title' => '中国西部环境与生态科学数据中心',
- 'link' => 'http://'.$_SERVER['SERVER_NAME'].'/data/feed',
- 'description' => '共享西部计划产生的数据',
- 'language' => 'zh-CN',
- 'charset' => 'utf-8',
- 'published' => time(),
- //'generator' => 'Zend Framework Zend_Feed',
- 'entries' => array()
- );
- $sql="select * from normalmetadata order by ts_created desc";
- $rs=$this->db->fetchAll($sql);
- $feedArray['published']=strtotime($rs[0]['ts_created']);
- foreach($rs as $r)
- {
- $feedArray['entries'][] = array(
- 'title' => $r['title'],
- 'link' => 'http://'.$_SERVER['SERVER_NAME'].'/data/' . $r['uuid'],
- 'guid' => 'http://'.$_SERVER['SERVER_NAME'].'/data/' . $r['uuid'],
- //'content'=>$r['description'],
- 'description' => $r['description'],
- 'lastUpdate' => strtotime($r['ts_created'])
- );
- }
- $feed = Zend_Feed::importArray($feedArray,'rss');
- $this->_helper->layout->disableLayout();
- $this->_helper->viewRenderer->setNoRender();
- $feed->send();
- }
- /*
- * todo: search
- */
- function searchAction()
- {
- $this->view->addHelperPath('helper','Zend_View_Helper_');
- $form=new SearchForm();
- $this->view->form=$form;
- //$form->submit->setLabel('快速搜索');
- $key=$this->_request->getParam('q');
- if (!empty($key)) {
- //$formData=$this->_request->getPost();
- //include_once("bcspamblock.php");
- //if ($form->isValid($formData)) {
- $page=@(int)$this->_request->getParam('page');
- if (empty($page)) $page=1;
- $offset=$this->limit*($page-1);
- $search=new Search($key);
- $where=$search->sql_expr(array("title","description"));
- $row=$this->db->fetchAll("select count(*) from normalmetadata where ".$where);
- $sum=$row[0]['count'];
- $sql="select uuid,title,id,description from normalmetadata where ".$where." order by title limit ? offset ?";
- $this->view->metadata=$this->db->fetchAll($sql,array($this->limit,$offset));
- $this->view->page=new Pagination($sum,$page,$this->limit);
- $this->view->key=$key;
- }
- }
- /*
- * todo: 高级搜索
- */
- function advancesearchAction()
- {
- $this->view->addHelperPath('helper','Zend_View_Helper_');
- //$form=new SearchForm();
- //$this->view->form=$form;
-
- $md=new MetadataTable();
- $db=$md->getAdapter();
- $page=(int)$this->_request->getParam('page');
- if (empty($page)) $page=1;
- $limit=10;
- $offset=$limit*($page-1);
- $key=$this->_request->getParam('q');
- $n=(int)$this->_request->getParam('n');
- $s=(int)$this->_request->getParam('s');
- $e=(int)$this->_request->getParam('e');
- $w=(int)$this->_request->getParam('w');
- if (!(empty($n) && empty($key))) {
- if (empty($n)) $n=90;
- if (empty($s)) $s=-90;
- if (empty($e)) $e=180;
- if (empty($w)) $w=-180;
- $start=$this->_request->getParam('start');
- $end=$this->_request->getParam('end');
- if (!empty($key)) {
- $sql='select count(*) from normalmetadata where east and west>? and north and south>? and (title ilike ? or description ilike ?)';
- $row=$db->fetchAll($sql,array($e,$w,$n,$s,'%'.$key.'%','%'.$key.'%'));
- } else {
- $sql='select count(*) from normalmetadata where east and west>? and north and south>?';
- $row=$db->fetchAll($sql,array($e,$w,$n,$s));
- }
- $sum=$row[0]['count'];
- $select=$db->select();
- $select->from('normalmetadata','*')->where('east',$e)->where('west>?',$w)->where('north',$n)->where('south>?',$s);
- if (!empty($key)) $select->where('(title ilike ? or description ilike ?)','%'.$key.'%');
- $select->order('title')->limit($limit,$offset);
- $this->view->metadata = $db->fetchAll($select);
- $this->view->page=new Pagination($sum,$page);
- $this->view->key=$key;
- }
- }
- /*
- * 根据id或uuid来查看元数据
- * id为一组数字,uuid为唯一标识符
- */
- function viewAction()
- {
- $id = (int)$this->_request->getParam('id');
- $sql="select m.*,s.status,g.id as gid,t.filename,i.doi as datadoi,i.authors,i.author_en,i.publisher,i.publisher_en, date_part('year',i.ts_published) as publish_year from normalmetadata m left join mdstatus s on m.uuid=s.uuid
- left join thumbnail t on t.id=m.id left join geonetworkmetadata g on m.uuid=g.uuid left join datadoi i on i.uuid=m.uuid where ";
- if (empty($id)) {
- $uuid = $this->_request->getParam('uuid');
- if (empty($uuid)) $this->_redirect('/data');
- $where=$this->db->quoteInto('m.uuid = ?',$uuid);
- } else {
- $where=$this->db->quoteInto('m.id = ?',$id);
- }
- $sql.=$where;
- $this->db->setFetchMode(Zend_Db::FETCH_OBJ);
- $row=$this->db->fetchRow($sql);
- if (!$row) $this->_redirect('/data');
- $id=$row->id;
- $uuid=$row->uuid;
- $this->view->metadata=$row;
- //提前对表格进行预处理
- $wiki=new WikiFormat();
- $this->view->metadata->description=$wiki->parseTable($this->view->escape($row->description));
- //处理外部链接
- $this->view->metadata->description=preg_replace('/\[\s*(http:\/\/.+?)\s+(.*?)\]/m','$2',$this->view->metadata->description);
- $this->view->thumburl='/gndata/'.sprintf('%05d',floor(($row->gid+0.1)/100)*100).'-'.sprintf('%05d',ceil(($row->gid+0.1)/100)*100-1)."/".$row->gid;
- $this->view->thumburl.='/public/'.str_replace('_s.','.',$row->filename);
- if (is_numeric($row->projection))
- {
- $sql="select proj4text from spatial_ref_sys where auth_srid=?";
- $rs=$this->db->fetchRow($sql,array((int)$row->projection));
- if ($rs) $this->view->projection=$rs->proj4text;
- }
-
- $sql = "select * from keyword where id=? order by keytype,ts_created";
- $sth = $this->db->prepare($sql);
- $rs = $sth->execute(array($id));
- $this->view->keys = $sth->fetchAll(PDO::FETCH_BOTH);
-
- $sql='select c.code,cc.name,cc.name_zh from category c,categorycode cc where c.code=cc.code and c.id= ?';
- $state=$this->db->query($sql,array($id));
- $this->view->category=$state->fetchAll();
- $sql='select s.name,s.id from dataseries d, series s where d.sid=s.id and d.id= ?';
- $state=$this->db->query($sql,array($id));
- $this->view->series=$state->fetchAll();
- $sql=$this->db->quoteInto("select count(*) as count from dataorder where uuid=?",$uuid);
- $row=$this->db->fetchRow($sql);
- $this->view->downloaded=$row->count;
- //update the viewed times
- $sql="update mdstat set viewed=viewed+1 where uuid=?";
- $this->db->query($sql,array($uuid));
- $sql=$this->db->quoteInto("select viewed from mdstat where uuid=?",$uuid);
- $row=$this->db->fetchRow($sql);
- $this->view->viewed=$row->viewed;
- //数据文档
- $sql="select linkage from onlineresource where uuid=? and description='数据说明文档'";
- $sql=$this->db->quoteInto($sql,$uuid);
- $row=$this->db->fetchRow($sql);
- if ($row) $this->view->doc=$row->linkage;
- //相关资源
- $sql="select * from onlineresource where uuid=? and (linkage not like '%ftp.westgis%') and name<>'元数据地址'";
- $sql=$this->db->quoteInto($sql,$uuid);
- $this->view->resources=$this->db->fetchAll($sql);
- //建议参考文献
- $sql="select r.* from reference r left join mdref m on m.refid=r.id where m.uuid=? and m.reftype=0 order by m.place";
- $sql=$this->db->quoteInto($sql,$uuid);
- $this->view->ref=$this->db->fetchAll($sql);
- //用户发表文献
- $sql="select r.* from reference r left join mdref m on m.refid=r.id where m.uuid=? and m.reftype=1";
- $sql=$this->db->quoteInto($sql,$uuid);
- $this->view->userref=$this->db->fetchAll($sql);
- //多篇引用形式:hiwater
- $sql="select r.* from reference r left join mdref m on m.refid=r.id where m.uuid=? and m.reftype=3 order by m.place";
- $sql=$this->db->quoteInto($sql,$uuid);
- $this->view->mcitation=$this->db->fetchAll($sql);
- //相关用户
- $sql="select p.email,p.individual,p.organisation,r.role from role r left join responsible p on r.resid=p.id where r.uuid=? order by r.role,r.id";
- $this->view->authors=$this->db->fetchAll($sql,array($uuid));
- //数据限制信息
- $sql="select u.* from uselimit u left join mdlimit m on u.id=m.lid where m.uuid=?";
- $this->view->uselimits=$this->db->fetchAll($sql,array($uuid));
- //相关下载
- $sql = "select d.uuid,count(distinct(d.userid)) as downtimes,m.title from dataorder d left join metadata m on d.uuid=m.uuid where d.userid in (
- select distinct(userid) from dataorder where uuid=? and status in (0,5)
- ) and d.uuid<>? and length(m.title)>2 group by d.uuid,m.title order by count(distinct(d.userid)) desc limit 10;";
- $this->view->downlists = $this->db->fetchAll($sql,array($uuid,$uuid));
- //相关文献
- $sql="select a.*,array_to_string(array(select author from knl_author t where t.item_id=a.item_id order by place asc),'; ') as author from knl_article a where (";
- foreach($this->view->keys as $k)
- {
- if ($k['keytype']=='theme')
- {
- $sql.=" a.title like '%".$k['keyword']."%' or ";
- }
- }
- $sql.=" 1<>1) order by a.ts_created desc limit 10";
- $this->view->literature=$this->db->fetchAll($sql);
- //相关元数据,根据同名关键词实现
- $sql="select distinct(md.uuid),md.title from keyword kw left join normalmetadata md on kw.id=md.id where kw.keyword in (select k.keyword from keyword k left join metadata m on k.id=m.id where m.id=? and k.keytype='theme') and kw.id<>? limit 10";
- $this->view->related=$this->db->fetchAll($sql,array($id,$id));
- //用户下载记录
- $sql = "select o.ts_created,m.uuid,u.realname,u.unit,oa.project as onlineproject, fa.project as offlineproject
- from dataorder as o left join metadata as m on o.uuid = m.uuid left join users as u on o.userid=u.id
- left join onlineapp oa on o.onlineappid=oa.id left join offlineapp fa on o.offlineappid=fa.id
- where m.uuid = '$uuid' and (o.status=0 or o.status=5) and u.realname IS NOT NULL order by o.ts_created desc limit 10";
- $this->view->downhistory=$this->db->fetchAll($sql);
- //数据附件
- $sql = $this->db->quoteInto("select m.id,a.realname from mdattach m left join attachments a on m.id=a.id where m.uuid=?",$uuid);
- $this->view->attachments = $this->db->fetchAll($sql);
- //数据版本
- $sql = "SELECT count(id) as c FROM mdversion WHERE uuid=? AND changelog IS NOT NULL";
- $sth = $this->db->prepare($sql);
- $sth->execute(array($uuid));
- $row = $sth->fetch();
- $this->view->version = $row;
- $archives = new Archive($this->db);
- $data_archives = $archives->getArchiveByUUID($uuid);
- if(!empty($data_archives))
- {
- foreach($data_archives as $k=>$v)
- {
- $data_archives[$k]['url'] = $archives->getArchiveUrlByCid($v['id']);
- }
- }
- $this->view->data_archives = $data_archives;
- //支持项目
- include_once("data/Fund.php");
- $fund = new Fund($this->db);
- $this->view->fund = $fund->fetch($uuid);
-
- //判断特殊数据服务
- $this->view->dataService= $this->checkDataService($uuid);
-
- //自动跳转
- $sql="select s.* from datasource d left join source s on d.sourceid=s.id where d.uuid=?";
- $row=$this->db->fetchRow($this->db->quoteInto($sql,$uuid));
- $jump=$this->_request->getParam('jump');
- if ($jump=="") $jump=1;//默认跳转
- if (@$row->has_pages && ($jump==1))
- {
- $this->_helper->viewRenderer($row->code.'/view',null,true);
- }
- } //viewAction
-
- //检查特殊数据服务是否存在
- private function checkDataService($uuid)
- {
- $order = new \Order\mount\OrderOperate();
- $service = $order->getDataService($uuid);
-
- if(empty($service))
- {
- return NULL;
- }else{
- if($order->checkOrderHas($uuid))
- {
- return NULL;
- }else{
- return $service;
- }
- }
- }//checkDataService
-
- //特殊数据服务
- public function dataserviceAction()
- {
-
- $uuid = $this->_getParam('uuid');
-
- if(empty($uuid))
- {
- $this->jsonexit(array("error"=>"参数错误"));
- }
-
- $dataservice = new \data\DataService();
- $info = $dataservice->get($uuid);
-
-
- //暂时只有wsn
- {
- $this->_helper->layout->disableLayout();
- $this->_helper->viewRenderer->setNoRender();
-
- $data = array(
- "type"=>"wsn", //服务类型
- "info"=>$info, //信息 dataservice 表中的字段
- "callback"=>"westdc.dataservice.wsn.request()", //成功后的js回调函数
- );
-
- $data['data'] = $dataservice->getWsnData("site",$uuid);
-
- if(empty($data['data']))
- {
- $this->jsonexit(array("error"=>'数据接口错误,请联系管理员'));
- return true;
- }
-
- if(!is_array($data['data']))
- {
- $this->jsonexit(array("error"=>$data['data']));
- return true;
- }
-
- $this->_helper->layout->disableLayout();
- $this->_helper->viewRenderer->setNoRender();
-
- $this->jsonexit($data);
- }
- // WSN end
-
- }
-
- public function wsnAction()
- {
- $this->_helper->layout->disableLayout();
- $this->_helper->viewRenderer->setNoRender();
-
- $type = $this->_getParam('type');
- $uuid = $this->_getParam("uuid");
-
- $dataservice = new DataService();
-
- if($type == 'var')
- {
- $sites = array(
- "chk"=>$this->_getParam("siteid")
- );
-
- $info = $dataservice->get($uuid);
-
- $data = array(
- "type"=>"wsn", //服务类型
- "info"=>$info, //信息 dataservice 表中的字段
- "callback"=>"westdc.dataservice.wsn.Submit()", //成功后的js回调函数
- );
-
+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->view->main_nav_pageID = "data";
+
+ $this->view->nav = array(
+ array('link'=>'/','title'=>''),
+ array('link'=>'/data','title'=>$this->view->config->title->data),
+ );
+ }
+ function indexAction()
+ {
+ //序列
+ $state=$this->db->query('select s.id,s.name,count(*) as count from series s,dataseries d where d.sid=s.id and length(s.name)>2 group by s.id,s.name order by count desc limit 15');
+ $this->view->serie=$state->fetchAll();
+ //分类
+ $state=$this->db->query('select c.code,name,name_zh,count(*) from category c,categorycode cc where c.code=cc.code group by c.code,cc.name,cc.name_zh');
+ $this->view->category=$state->fetchAll();
+ //关键词
+ $state=$this->db->query("select keyword,count(*) from keyword right join normalmetadata on keyword.id=normalmetadata.id where keytype='place' group by keyword order by count desc limit 20");
+ $k1=$state->fetchAll();
+ $state=$this->db->query("select keyword,count(*) from keyword right join normalmetadata on keyword.id=normalmetadata.id where keytype='theme' group by keyword order by count desc limit 20");
+ //$state=$this->db->query("select k.keyword,count(k.keyword) from keyword k left join normalmetadata m on k.id=m.id where k.keytype='theme' and (m.uuid in (select uuid from dataorder group by uuid order by count(uuid) desc limit 20)) group by k.keyword order by count(k.keyword) desc limit 20");
+ $k2=$state->fetchAll();
+ $state=$this->db->query("select keyword,count(*) from keyword right join normalmetadata on keyword.id=normalmetadata.id where keytype='discipline' group by keyword order by count desc limit 20");
+ $k3=$state->fetchAll();
+ $state=$this->db->query("select keyword,count(*) from keyword right join normalmetadata on keyword.id=normalmetadata.id where keytype='stratum' group by keyword order by count desc limit 20");
+ $k4=$state->fetchAll();
+ $state=$this->db->query("select keyword,count(*) from keyword right join normalmetadata on keyword.id=normalmetadata.id where keytype='temporal' group by keyword order by count desc limit 20");
+ //$state=$this->db->query("select k.keyword,count(k.keyword) from keyword k left join normalmetadata m on k.id=m.id where k.keytype='temporal' and (m.uuid in (select uuid from dataorder group by uuid order by count(uuid) desc limit 20)) group by k.keyword order by count(k.keyword) desc limit 20");
+ $k5=$state->fetchAll();
+ $this->view->keywords=array('place'=>$k1,'theme'=>$k2,'discipline'=>$k3,'stratum'=>$k4,'temporal'=>$k5);
+ //最新10个入库数据
+ $state=$this->db->query('select id,uuid,title from normalmetadata order by id desc limit 10');
+ $this->view->metadata = $state->fetchAll();
+ //特色数据
+
+ //服务
+ $l=new mydir($this->view->config->paths->newsletter,"newsletter_*.pdf");
+ $this->view->newsletter=$l->getLast();
+ $name=basename($this->view->newsletter,'.pdf');
+ list(,$this->view->newsletterno)=explode("_",$name);
+
+ $this->view->addHelperPath('helper','Zend_View_Helper_');
+ $form=new MaillistForm();
+ $form->submit->setLabel('输入邮件地址,订阅数据通讯列表');
+
+ $this->view->form=$form;
+ if ($this->_request->isPost()) {
+ //发送邮件
+ $formData=$this->_request->getPost();
+ if ($form->isValid($formData)) {
+ $mail=new WestdcMailer($this->view->config->smtp);
+ $mail->setFrom($formData['email']);
+ $mail->setBodyText(".");
+ $mail->setSubject('subscribe');
+ $mail->addTo($this->view->config->reportemail);
+ $mail->send();
+ $this->messenger->addMessage('订阅成功,请检查您的邮件!');
+ $this->_redirect('/data/');
+ }
+ } else {
+ $auth = Zend_Auth::getInstance();
+ if ($auth->hasIdentity()) {
+ $user=$auth->getIdentity();
+ $formData['email']=$user->email;
+ $form->populate($formData);
+ }
+ }
+ $searchform=new SearchForm();
+ $this->view->searchform=$searchform;
+
+ //其他连接
+ }
+ function onlinelistAction()
+ {
+ $page=(int)$this->_request->getParam('page');
+ if (empty($page)) $page=1;
+ $limit=30;
+ $offset=$limit*($page-1);
+ $state=$this->db->query('select count(*) from normalmetadata where datatype=0');
+ $row=$state->fetchAll();
+ $sum=$row[0]['count'];
+ $select=$this->db->select();
+ $select->from('normalmetadata','*')->where('datatype=0')->order('title')->limitPage($page,$limit);
+ $this->view->metadata = $this->db->fetchAll($select);
+ $this->view->page=new Pagination($sum,$page,$limit);
+ }
+ function offlinelistAction()
+ {
+ $page=(int)$this->_request->getParam('page');
+ if (empty($page)) $page=1;
+ $limit=30;
+ $offset=$limit*($page-1);
+ $state=$this->db->query('select count(*) from normalmetadata where datatype=1');
+ $row=$state->fetchAll();
+ $sum=$row[0]['count'];
+ $select=$this->db->select();
+ $select->from('normalmetadata','*')->where('datatype=1')->order('title')->limitPage($page,$limit);
+ $this->view->metadata = $this->db->fetchAll($select);
+ $this->view->page=new Pagination($sum,$page,$limit);
+ }
+ //展示最近20条离线神情记录情况
+ function offlineappAction()
+ {
+ $sql="select * from offlineapp where ts_approved is not null and pdflink<>'' and status>=0 order by ts_created desc limit 20";
+ $this->view->rows=$this->db->fetchAll($sql);
+ }
+ function requestAction()
+ {
+ $archives=new Archive($this->db);
+ $this->view->item=$archives->getOneArchive('如何申请数据','help');
+ }
+ function submitAction()
+ {
+ $archives=new Archive($this->db);
+ $this->view->item=$archives->getOneArchive('如何发布数据','help');
+ }
+ function serviceAction()
+ {
+ }
+ function newsletterAction()
+ {
+ $l=new mydir($this->view->config->paths->newsletter,"newsletter_*.pdf");
+ $this->view->newsletters=$l->toArray();
+ $this->view->addHelperPath('helper','Zend_View_Helper_');
+ rsort($this->view->newsletters);
+ $form=new MaillistForm();
+ $this->view->form=$form;
+ $form->submit->setLabel('输入邮件地址,订阅数据通讯列表');
+ if ($this->_request->isPost()) {
+ //发送邮件
+ $formData=$this->_request->getPost();
+ if ($form->isValid($formData)) {
+ //$mail=new Zend_Mail('utf-8');
+ $mail=new WestdcMailer($this->view->config->smtp);
+ $mail->setFrom($formData['email']);
+ $mail->setBodyText(".");
+ $mail->setSubject('subscribe');
+ $mail->addTo($this->view->config->reportemail);
+ /*
+ $tr=new Zend_Mail_Transport_Smtp($this->view->config->smtp->host,
+ array('ssl' => $this->view->config->smtp->ssl,
+ 'auth'=>$this->view->config->smtp->auth,
+ 'username'=>$this->view->config->smtp->username,
+ 'password'=>$this->view->config->smtp->password));
+ $mail->send($tr);
+ */
+ $mail->send();
+ $this->messenger->addMessage('订阅成功,请检查您的邮件!');
+ $this->_redirect('/data/newsletter');
+ }
+ } else {
+ $auth = Zend_Auth::getInstance();
+ if ($auth->hasIdentity()) {
+ $user=$auth->getIdentity();
+ $formData['email']=$user->email;
+ $form->populate($formData);
+ }
+ }
+ }
+ function featureAction()
+ {
+ $sql="select * from datafeature order by id desc";
+ $this->view->feature=$this->db->fetchAll($sql);
+ }
+
+ function datasetcdAction()
+ {
+ $cd=new DatasetcdTable();
+ $this->view->rows=$cd->fetchAll();
+ }
+ /*
+ * 数据浏览
+ */
+ function browseAction()
+ {
+ $page=(int)$this->_request->getParam('page');
+ if (empty($page)) $page=1;
+ $limit=10;
+ $offset=$limit*($page-1);
+ $state=$this->db->query('select count(*) from metadata');
+ $row=$state->fetchAll();
+ $sum=$row[0]['count'];
+ $select=$this->db->select();
+ $select->from('metadata','*')->order('id desc')->limitPage($page,$limit);
+ $this->view->metadata = $this->db->fetchAll($select);
+ $this->view->page=new Pagination($sum,$page,$limit);
+ }
+ function tagAction()
+ {
+ $id = (int)$this->_request->getParam('id');
+ $key = $this->_request->getParam('key');
+ $keytype = $this->_request->getParam('keytype');
+ $page=(int)$this->_request->getParam('page');
+ if (empty($page)) $page=1;
+ $limit=10;
+ $offset=$limit*($page-1);
+ $sql='select keyword,count(*),keytype from keyword right join normalmetadata on keyword.id=normalmetadata.id ';
+ if (!empty($keytype) && ($keytype=='place' || $keytype=='theme' || $keytype=='discipline'||$keytype=='temporal')) $sql.=" where keytype='".$keytype."'";
+ $sql.=' group by keyword,keytype order by keytype,keyword,count desc';
+ $state=$this->db->query($sql);
+ $this->view->keywords=$state->fetchAll();
+
+ if ($id>0 or !empty($key)) {
+ if (empty($key)) {
+ $where=$this->db->quoteInto('id = ?',$id);
+ $row=$md->fetchRow($where);
+ $key=$row->name;
+ }
+ $this->view->codename=$key;
+ $sql=$this->db->quoteInto('select count(m.id) from normalmetadata m,keyword k where m.id=k.id and k.keyword=?',$key);
+
+ $state=$this->db->query($sql);
+ $row=$state->fetchAll();
+ $sum=$row[0]['count'];
+ $select=$this->db->select();
+ $select->from('normalmetadata','*')->join('keyword','normalmetadata.id=keyword.id')->where('keyword.keyword=?',$key)->order('normalmetadata.title')->limitPage($page,$limit);
+ //$sql=$db->quoteInto('select m.* from metadata m,keyword k where m.id=k.id and k.keyword=?',$key);
+ //$state=$db->query($sql);
+ $this->view->metadata=$this->db->fetchAll($select);
+ $this->view->page=new Pagination($sum,$page,$limit);
+ }
+ }
+ /*
+ * 数据集序列浏览
+ */
+ function seriesAction()
+ {
+ $id = $this->_request->getParam('id');
+ if (empty($id)) $id=0;
+ if (!is_numeric($id))
+ {
+ $name=$id;
+ $id='';
+ }
+ $keyword=$this->_request->getParam('keyword');
+ if (empty($id)) {
+ if (!empty($name))
+ {
+ $where=$this->db->quoteInto('name = ?',$name);
+ $row=$this->db->fetchRow("select * from series where ".$where);
+ }
+ } else {
+ $where=$this->db->quoteInto('id = ?',$id);
+ $row=$this->db->fetchRow("select * from series where ".$where);
+ }
+ if (!empty($id) or !empty($name))
+ {
+ if (!$row) $this->_redirect('/data');
+ $id=$row['id'];
+ }
+ $page=(int)$this->_request->getParam('page');
+ if (empty($page)) $page=1;
+ $limit=10;
+ $offset=$limit*($page-1);
+ $state=$this->db->query('select s.id,name,count(*) from series s,dataseries d where d.sid=s.id group by s.id,s.name');
+ $this->view->serie=$state->fetchAll();
+ if ($id>0) {
+ //$where=$this->db->quoteInto('id = ?',$id);
+ //$row=$this->db->fetchRow("select * from series where ".$where);
+ $this->view->codename=$row['name'];
+ if (!empty($keyword))
+ {
+ $sql='select count(m.id) as count from normalmetadata m,dataseries d,keyword k where m.id=d.id and m.id=k.id and d.sid=? and k.keyword=?';
+ $row=$this->db->fetchAll($sql,array($id,$keyword));
+ $this->view->codename.="【关键词:".$keyword."】";
+ }else{
+ $sql='select count(m.id) as count from normalmetadata m,dataseries d where m.id=d.id and d.sid=?';
+ $row=$this->db->fetchAll($sql,array($id));
+ }
+ $sum=$row[0]['count'];
+ $select=$this->db->select();
+ $select->from('normalmetadata','*')->join('dataseries','normalmetadata.id=dataseries.id')->where('dataseries.sid=?',$id)->order('normalmetadata.title')->limitPage($page,$limit);
+ if (!empty($keyword)) $select->join('keyword','keyword.id=normalmetadata.id')->where('keyword.keyword=?',$keyword);
+ $this->view->metadata=$this->db->fetchAll($select);
+ $this->view->page=new Pagination($sum,$page,$limit);
+ //$this->view->showtools=($sum>$page)?true:false;
+ //$this->view->form=new SearchForm();
+ $sql=$this->db->quoteInto("select keyword,count(*) as count from (select t.keyword,t.id from keyword t left join dataseries d on t.id=d.id where t.keytype='place' and d.sid=?) as f group by keyword order by count desc limit 30",$id);
+ $state=$this->db->query($sql);
+ $row=$state->fetchAll();
+ $this->view->places=$row;
+ $this->view->seriesid=$id;
+ } else {
+ //提供全部数据集序列列表
+ }
+ }
+ /*
+ * 分类浏览模式
+ */
+ function categoryAction()
+ {
+ $page = $this->_request->getParam('page');
+ $code = (int)$this->_request->getParam('code');
+ $state=$this->db->query('select c.code,name,name_zh,count(*) from category c,categorycode cc where c.code=cc.code group by c.code,cc.name,cc.name_zh');
+ $this->view->category=$state->fetchAll();
+ if ($code>0 && $code<20) {
+ $where=$this->db->quoteInto('code = ?',$code);
+ $row=$this->db->fetchRow("select * from categorycode where ".$where);
+ $this->view->codename=(empty($row['name_zh'])?$row['name']:$row['name_zh']);
+ $sql='select count(m.id) from normalmetadata m left join category c on m.id=c.id where c.code=?';
+ $row=$this->db->fetchRow($sql,array($code));
+ $sum=$row['count'];
+ $select=$this->db->select();
+ $select->from('normalmetadata as m','*')->joinLeft('category as c','m.id=c.id')->where('c.code=?',$code)->order('m.title')->limitPage($page,$this->limit);
+ $this->view->metadata=$this->db->fetchAll($select);
+ $this->view->page=new Pagination($sum,$page,$this->limit);
+ } else {
+ //提供全部分类列表
+ }
+ }
+ /*
+ * 时间浏览方式
+ * todo:实现xml的缓存,基于时间的缓存(每天)?基于元数据修改的缓存,每次导入后都重新生成一次。
+ */
+ function timelineAction()
+ {
+ $fn="time1.xml";
+ $rows=$this->db->fetchAll("select ts_created from normalmetadata order by ts_created desc limit 1");
+ $last_update=strtotime($rows[0]['ts_created']);
+ if (!file_exists($fn) || (filemtime($fn)<$last_update))
+ {
+ $dateformat="M j Y";
+ $md = new MetadataTable();
+ $db=$md->getAdapter();
+ $state=$db->query('select id,uuid,description,title,timebegin,timeend from normalmetadata where timebegin is not null order by timebegin');
+ $rows=$state->fetchAll();
+ $timexml='';
+ foreach($rows as $row) {
+ $timexml.='';
+ $desc_length=mb_strlen($row['description'],"UTF-8");
+ $desc=mb_substr($row['description'],0,($desc_length>300)?300:$desc_length,"UTF-8");
+ if ($desc_length>300) $desc.=" ...";
+ $timexml.=htmlspecialchars($desc);
+ $timexml.="\n";
+ }
+ $timexml.='';
+ $fp=fopen($fn,'w');
+ fwrite($fp,$timexml);
+ fclose($fp);
+ }
+ //$this->_helper->layout->disableLayout();
+ }
+ /*
+ * todo:空间浏览
+ */
+ function mapAction()
+ {
+ //use json & openlayers?
+ $id=(int)$this->_request->getParam('id');
+ if ($id>0) $this->view->params="/id/$id";
+ }
+ /*
+ * 产生geojson数据
+ */
+ function jsonAction()
+ {
+ $md=new MetadataTable();
+ $db=$md->getAdapter();
+ $id = (int)$this->_request->getParam('id');
+ $where='';
+ if (!empty($id)) { $where=' where id='.$id; }
+ $sql='select id,uuid,west,south,north,east,title from normalmetadata'.$where;
+ $state=$db->query($sql);
+ $rows=$state->fetchAll();
+ $geomd=new GeoMetaData();
+ foreach($rows as $row){
+ if ($id)
+ $box=new GeoBox($row['west'],$row['south'],$row['east'],$row['north']);
+ else
+ $box=new GeoBoxLine($row['west'],$row['south'],$row['east'],$row['north']);
+ $feature=new Geofeature();
+ $feature->id=$row['id'];
+ $feature->addProperties('title',$row['title']);
+ $feature->addProperties('uuid',$row['uuid']);
+ $feature->addProperties('id',$row['id']);
+ $feature->geometry=$box;
+ $geomd->addFeature($feature);
+ }
+ $this->_helper->json($geomd);
+ }
+ /*
+ * 时空动态浏览
+ */
+ function timemapAction()
+ {
+ $sql='select id,uuid,west,south,north,east,title,timebegin,timeend from normalmetadata where timebegin is not null';
+ $this->view->rows=$this->db->fetchAll($sql);
+ }
+ /*
+ * 返回XML源文件
+ */
+ function xmlAction()
+ {
+ $uuid=$this->_request->getParam('uuid');
+ $row=$this->db->fetchRow("select xml.data from xml left join metadata on xml.id=metadata.id where metadata.uuid=?",array($uuid));
+ $this->_helper->layout->disableLayout();
+ $this->_helper->viewRenderer->setNoRender();
+ $this->getResponse()->setHeader('Content-Type', 'text/xml')
+ ->setBody($row['data']);
+ }
+ function detailAction()
+ {
+ $id=(int)$this->_request->getParam('id');
+ $xml=new XmlTable();
+ $db=$xml->getAdapter();
+ $where=$db->quoteInto('id=?',$id);
+ $order='id desc';
+ $row=$xml->fetchRow($where,$order);
+ // Load the XML source
+ $xml = new DOMDocument;
+ $xml->loadXML($row->data);
+ $xsl = new DOMDocument;
+ $xsl->load($this->view->config->westdc->xsl);
+ // Configure the transformer
+ $proc = new XSLTProcessor;
+ $proc->importStyleSheet($xsl); // attach the xsl rules
+ $this->view->xml=$proc->transformToXML($xml);
+ //$this->_helper->layout->disableLayout();
+ //$this->_helper->viewRenderer->setNoRender();
+ //$this->getResponse()->setHeader('Content-Type', 'text/html')
+ // ->setBody($proc->transformToXML($xml));
+ }
+ function feedAction()
+ {
+ $feedArray = array(
+ 'title' => '中国西部环境与生态科学数据中心',
+ 'link' => 'http://'.$_SERVER['SERVER_NAME'].'/data/feed',
+ 'description' => '共享西部计划产生的数据',
+ 'language' => 'zh-CN',
+ 'charset' => 'utf-8',
+ 'published' => time(),
+ //'generator' => 'Zend Framework Zend_Feed',
+ 'entries' => array()
+ );
+ $sql="select * from normalmetadata order by ts_created desc";
+ $rs=$this->db->fetchAll($sql);
+ $feedArray['published']=strtotime($rs[0]['ts_created']);
+ foreach($rs as $r)
+ {
+ $feedArray['entries'][] = array(
+ 'title' => $r['title'],
+ 'link' => 'http://'.$_SERVER['SERVER_NAME'].'/data/' . $r['uuid'],
+ 'guid' => 'http://'.$_SERVER['SERVER_NAME'].'/data/' . $r['uuid'],
+ //'content'=>$r['description'],
+ 'description' => $r['description'],
+ 'lastUpdate' => strtotime($r['ts_created'])
+ );
+ }
+ $feed = Zend_Feed::importArray($feedArray,'rss');
+ $this->_helper->layout->disableLayout();
+ $this->_helper->viewRenderer->setNoRender();
+ $feed->send();
+ }
+ /*
+ * todo: search
+ */
+ function searchAction()
+ {
+ $this->view->addHelperPath('helper','Zend_View_Helper_');
+ $form=new SearchForm();
+ $this->view->form=$form;
+ //$form->submit->setLabel('快速搜索');
+ $key=$this->_request->getParam('q');
+ if (!empty($key)) {
+ //$formData=$this->_request->getPost();
+ //include_once("bcspamblock.php");
+ //if ($form->isValid($formData)) {
+ $page=@(int)$this->_request->getParam('page');
+ if (empty($page)) $page=1;
+ $offset=$this->limit*($page-1);
+ $search=new Search($key);
+ $where=$search->sql_expr(array("title","description"));
+ $row=$this->db->fetchAll("select count(*) from normalmetadata where ".$where);
+ $sum=$row[0]['count'];
+ $sql="select uuid,title,id,description from normalmetadata where ".$where." order by title limit ? offset ?";
+ $this->view->metadata=$this->db->fetchAll($sql,array($this->limit,$offset));
+ $this->view->page=new Pagination($sum,$page,$this->limit);
+ $this->view->key=$key;
+ }
+ }
+ /*
+ * todo: 高级搜索
+ */
+ function advancesearchAction()
+ {
+ $this->view->addHelperPath('helper','Zend_View_Helper_');
+ //$form=new SearchForm();
+ //$this->view->form=$form;
+
+ $md=new MetadataTable();
+ $db=$md->getAdapter();
+ $page=(int)$this->_request->getParam('page');
+ if (empty($page)) $page=1;
+ $limit=10;
+ $offset=$limit*($page-1);
+ $key=$this->_request->getParam('q');
+ $n=(int)$this->_request->getParam('n');
+ $s=(int)$this->_request->getParam('s');
+ $e=(int)$this->_request->getParam('e');
+ $w=(int)$this->_request->getParam('w');
+ if (!(empty($n) && empty($key))) {
+ if (empty($n)) $n=90;
+ if (empty($s)) $s=-90;
+ if (empty($e)) $e=180;
+ if (empty($w)) $w=-180;
+ $start=$this->_request->getParam('start');
+ $end=$this->_request->getParam('end');
+ if (!empty($key)) {
+ $sql='select count(*) from normalmetadata where east and west>? and north and south>? and (title ilike ? or description ilike ?)';
+ $row=$db->fetchAll($sql,array($e,$w,$n,$s,'%'.$key.'%','%'.$key.'%'));
+ } else {
+ $sql='select count(*) from normalmetadata where east and west>? and north and south>?';
+ $row=$db->fetchAll($sql,array($e,$w,$n,$s));
+ }
+ $sum=$row[0]['count'];
+ $select=$db->select();
+ $select->from('normalmetadata','*')->where('east',$e)->where('west>?',$w)->where('north',$n)->where('south>?',$s);
+ if (!empty($key)) $select->where('(title ilike ? or description ilike ?)','%'.$key.'%');
+ $select->order('title')->limit($limit,$offset);
+ $this->view->metadata = $db->fetchAll($select);
+ $this->view->page=new Pagination($sum,$page);
+ $this->view->key=$key;
+ }
+ }
+ /*
+ * 根据id或uuid来查看元数据
+ * id为一组数字,uuid为唯一标识符
+ */
+ function viewAction()
+ {
+ $id = (int)$this->_request->getParam('id');
+ $sql="select m.*,s.status,g.id as gid,t.filename,i.doi as datadoi,i.authors,i.author_en,i.publisher,i.publisher_en, date_part('year',i.ts_published) as publish_year from normalmetadata m left join mdstatus s on m.uuid=s.uuid
+ left join thumbnail t on t.id=m.id left join geonetworkmetadata g on m.uuid=g.uuid left join datadoi i on i.uuid=m.uuid where ";
+ if (empty($id)) {
+ $uuid = $this->_request->getParam('uuid');
+ if (empty($uuid)) $this->_redirect('/data');
+ $where=$this->db->quoteInto('m.uuid = ?',$uuid);
+ } else {
+ $where=$this->db->quoteInto('m.id = ?',$id);
+ }
+ $sql.=$where;
+ $this->db->setFetchMode(Zend_Db::FETCH_OBJ);
+ $row=$this->db->fetchRow($sql);
+ if (!$row) $this->_redirect('/data');
+ $id=$row->id;
+ $uuid=$row->uuid;
+ $this->view->metadata=$row;
+ //提前对表格进行预处理
+ $wiki=new WikiFormat();
+ $this->view->metadata->description=$wiki->parseTable($this->view->escape($row->description));
+ //处理外部链接
+ $this->view->metadata->description=preg_replace('/\[\s*(http:\/\/.+?)\s+(.*?)\]/m','$2',$this->view->metadata->description);
+ $this->view->thumburl='/gndata/'.sprintf('%05d',floor(($row->gid+0.1)/100)*100).'-'.sprintf('%05d',ceil(($row->gid+0.1)/100)*100-1)."/".$row->gid;
+ $this->view->thumburl.='/public/'.str_replace('_s.','.',$row->filename);
+ if (is_numeric($row->projection))
+ {
+ $sql="select proj4text from spatial_ref_sys where auth_srid=?";
+ $rs=$this->db->fetchRow($sql,array((int)$row->projection));
+ if ($rs) $this->view->projection=$rs->proj4text;
+ }
+
+ $sql = "select * from keyword where id=? order by keytype,ts_created";
+ $sth = $this->db->prepare($sql);
+ $rs = $sth->execute(array($id));
+ $this->view->keys = $sth->fetchAll(PDO::FETCH_BOTH);
+
+ $sql='select c.code,cc.name,cc.name_zh from category c,categorycode cc where c.code=cc.code and c.id= ?';
+ $state=$this->db->query($sql,array($id));
+ $this->view->category=$state->fetchAll();
+ $sql='select s.name,s.id from dataseries d, series s where d.sid=s.id and d.id= ?';
+ $state=$this->db->query($sql,array($id));
+ $this->view->series=$state->fetchAll();
+ $sql=$this->db->quoteInto("select count(*) as count from dataorder where uuid=?",$uuid);
+ $row=$this->db->fetchRow($sql);
+ $this->view->downloaded=$row->count;
+ //update the viewed times
+ $sql="update mdstat set viewed=viewed+1 where uuid=?";
+ $this->db->query($sql,array($uuid));
+ $sql=$this->db->quoteInto("select viewed from mdstat where uuid=?",$uuid);
+ $row=$this->db->fetchRow($sql);
+ $this->view->viewed=$row->viewed;
+ //数据文档
+ $sql="select linkage from onlineresource where uuid=? and description='数据说明文档'";
+ $sql=$this->db->quoteInto($sql,$uuid);
+ $row=$this->db->fetchRow($sql);
+ if ($row) $this->view->doc=$row->linkage;
+ //相关资源
+ $sql="select * from onlineresource where uuid=? and (linkage not like '%sanjiangyuan.org.cn%') and name<>'元数据地址'";
+ $sql=$this->db->quoteInto($sql,$uuid);
+ $this->view->resources=$this->db->fetchAll($sql);
+ //相关文献:作者建议
+ $sql="select r.* from reference r left join mdref m on m.refid=r.id where m.uuid=? and m.reftype=0 order by m.place";
+ $sql=$this->db->quoteInto($sql,$uuid);
+ $this->view->ref=$this->db->fetchAll($sql);
+ //数据的参考文献
+ $sql="select r.* from reference r left join mdref m on m.refid=r.id where m.uuid=? and m.reftype=2 order by m.place";
+ $sql=$this->db->quoteInto($sql,$uuid);
+ $this->view->dataref=$this->db->fetchAll($sql);
+ //数据的专题文献
+ $sql="select r.* from reference r left join mdref m on m.refid=r.id where m.uuid=? and m.reftype=4 order by m.place";
+ $sql=$this->db->quoteInto($sql,$uuid);
+ $this->view->themeref=$this->db->fetchAll($sql);
+ //用户发表文献
+ $sql="select r.* from reference r left join mdref m on m.refid=r.id where m.uuid=? and m.reftype=1 order by r.language asc,r.year desc,r.ts_created desc limit 15";
+ $sql=$this->db->quoteInto($sql,$uuid);
+ $this->view->userref=$this->db->fetchAll($sql);
+ //多篇引用形式:hiwater
+ $sql="select r.* from reference r left join mdref m on m.refid=r.id where m.uuid=? and m.reftype=3 order by m.place";
+ $sql=$this->db->quoteInto($sql,$uuid);
+ $this->view->mcitation=$this->db->fetchAll($sql);
+ //相关用户
+ $sql="select p.email,p.individual,p.organisation,r.role from role r left join responsible p on r.resid=p.id where r.uuid=? order by r.role,r.id";
+ $this->view->authors=$this->db->fetchAll($sql,array($uuid));
+ //数据限制信息
+ $sql="select u.* from uselimit u left join mdlimit m on u.id=m.lid where m.uuid=?";
+ $this->view->uselimits=$this->db->fetchAll($sql,array($uuid));
+ //相关下载
+ $sql = "select d.uuid,count(distinct(d.userid)) as downtimes,m.title from dataorder d left join metadata m on d.uuid=m.uuid where d.userid in (
+ select distinct(userid) from dataorder where uuid=? and status in (0,5)
+ ) and d.uuid<>? and length(m.title)>2 group by d.uuid,m.title order by count(distinct(d.userid)) desc limit 10;";
+ $this->view->downlists = $this->db->fetchAll($sql,array($uuid,$uuid));
+ //相关文献
+ $sql="select a.*,array_to_string(array(select author from knl_author t where t.item_id=a.item_id order by place asc),'; ') as author from knl_article a where (";
+ foreach($this->view->keys as $k)
+ {
+ if ($k['keytype']=='theme')
+ {
+ $sql.=" a.title like '%".$k['keyword']."%' or ";
+ }
+ }
+ $sql.=" 1<>1) order by a.ts_created desc limit 10";
+ $this->view->literature=$this->db->fetchAll($sql);
+ //相关元数据,根据同名关键词实现
+ $sql="select distinct(md.uuid),md.title from keyword kw left join normalmetadata md on kw.id=md.id where kw.keyword in (select k.keyword from keyword k left join metadata m on k.id=m.id where m.id=? and k.keytype='theme') and kw.id<>? limit 10";
+ $this->view->related=$this->db->fetchAll($sql,array($id,$id));
+ //用户下载记录
+ $sql = "select o.ts_created,m.uuid,u.realname,u.unit,oa.project as onlineproject, fa.project as offlineproject
+ from dataorder as o left join metadata as m on o.uuid = m.uuid left join users as u on o.userid=u.id
+ left join onlineapp oa on o.onlineappid=oa.id left join offlineapp fa on o.offlineappid=fa.id
+ where m.uuid = '$uuid' and (o.status=0 or o.status=5) and u.realname IS NOT NULL order by o.ts_created desc limit 10";
+ $this->view->downhistory=$this->db->fetchAll($sql);
+ //数据附件
+ $sql = $this->db->quoteInto("select m.id,a.realname from mdattach m left join attachments a on m.id=a.id where m.uuid=?",$uuid);
+ $this->view->attachments = $this->db->fetchAll($sql);
+ //数据版本
+ $sql = "SELECT count(id) as c FROM mdversion WHERE uuid=? AND changelog IS NOT NULL";
+ $sth = $this->db->prepare($sql);
+ $sth->execute(array($uuid));
+ $row = $sth->fetch();
+ $this->view->version = $row;
+ $archives = new Archive($this->db);
+ $data_archives = $archives->getArchiveByUUID($uuid);
+ if(!empty($data_archives))
+ {
+ foreach($data_archives as $k=>$v)
+ {
+ $data_archives[$k]['url'] = $archives->getArchiveUrlByCid($v['id']);
+ }
+ }
+ $this->view->data_archives = $data_archives;
+ //支持项目
+ include_once("data/Fund.php");
+ $fund = new Fund($this->db);
+ $this->view->fund = $fund->fetch($uuid);
+
+ //判断特殊数据服务
+ $this->view->dataService= $this->checkDataService($uuid);
+
+ //自动跳转
+ $sql="select s.* from datasource d left join source s on d.sourceid=s.id where d.uuid=?";
+ $row=$this->db->fetchRow($this->db->quoteInto($sql,$uuid));
+ $jump=$this->_request->getParam('jump');
+ if ($jump=="") $jump=1;//默认跳转
+ if (@$row->has_pages && ($jump==1))
+ {
+ $this->_helper->viewRenderer($row->code.'/view',null,true);
+ }
+ } //viewAction
+
+ //检查特殊数据服务是否存在
+ private function checkDataService($uuid)
+ {
+ $order = new \Order\Mount\OrderOperate();
+ $service = $order->getDataService($uuid);
+
+ if(empty($service))
+ {
+ return NULL;
+ }else{
+ if($order->checkOrderHas($uuid))
+ {
+ return NULL;
+ }else{
+ return $service;
+ }
+ }
+ }//checkDataService
+
+ //特殊数据服务
+ public function dataserviceAction()
+ {
+
+ $uuid = $this->_getParam('uuid');
+
+ if(empty($uuid))
+ {
+ $this->jsonexit(array("error"=>"参数错误"));
+ }
+
+ $dataservice = new \data\DataService();
+ $info = $dataservice->get($uuid);
+
+
+ //暂时只有wsn
+ {
+ $this->_helper->layout->disableLayout();
+ $this->_helper->viewRenderer->setNoRender();
+
+ $data = array(
+ "type"=>"wsn", //服务类型
+ "info"=>$info, //信息 dataservice 表中的字段
+ "callback"=>"westdc.dataservice.wsn.request()", //成功后的js回调函数
+ );
+
+ $data['data'] = $dataservice->getWsnData("site",$uuid);
+
+ if(empty($data['data']))
+ {
+ $this->jsonexit(array("error"=>'数据接口错误,请联系管理员'));
+ return true;
+ }
+
+ if(!is_array($data['data']))
+ {
+ $this->jsonexit(array("error"=>$data['data']));
+ return true;
+ }
+
+ $this->_helper->layout->disableLayout();
+ $this->_helper->viewRenderer->setNoRender();
+
+ $this->jsonexit($data);
+ }
+ // WSN end
+
+ }
+
+ public function wsnAction()
+ {
+ $this->_helper->layout->disableLayout();
+ $this->_helper->viewRenderer->setNoRender();
+
+ $type = $this->_getParam('type');
+ $uuid = $this->_getParam("uuid");
+
+ $dataservice = new DataService();
+
+ if($type == 'var')
+ {
+ $sites = array(
+ "chk"=>$this->_getParam("siteid")
+ );
+
+ $info = $dataservice->get($uuid);
+
+ $data = array(
+ "type"=>"wsn", //服务类型
+ "info"=>$info, //信息 dataservice 表中的字段
+ "callback"=>"westdc.dataservice.wsn.Submit()", //成功后的js回调函数
+ );
+
$data['data'] = $dataservice->getWsnData("var",$uuid,$sites);
-
- if(empty($data['data']))
- {
- $this->jsonexit(array("error"=>'数据接口错误,请联系管理员'));
- return true;
- }
-
- if(!is_array($data['data']))
- {
- $this->jsonexit(array("error"=>$data['data']));
- return true;
- }
-
- $this->jsonexit($data);
- return true;
- }
-
- if($type == "submit")
- {
- $info = $dataservice->get($uuid);
- $param = array(
- "site" => $this->_getParam("site"),
- );
-
- $data = array(
- "type"=>"wsn", //服务类型
- "info"=>$info, //信息 dataservice 表中的字段
- "callback"=>"westdc.dataservice.wsn.Submited()", //成功后的js回调函数
- );
-
+
+ if(empty($data['data']))
+ {
+ $this->jsonexit(array("error"=>'数据接口错误,请联系管理员'));
+ return true;
+ }
+
+ if(!is_array($data['data']))
+ {
+ $this->jsonexit(array("error"=>$data['data']));
+ return true;
+ }
+
+ $this->jsonexit($data);
+ return true;
+ }
+
+ if($type == "submit")
+ {
+ $info = $dataservice->get($uuid);
+ $param = array(
+ "site" => $this->_getParam("site"),
+ );
+
+ $data = array(
+ "type"=>"wsn", //服务类型
+ "info"=>$info, //信息 dataservice 表中的字段
+ "callback"=>"westdc.dataservice.wsn.Submited()", //成功后的js回调函数
+ );
+
$data['data'] = $dataservice->getWsnData("submit",$uuid,$param);
-
-
- if(empty($data['data']))
- {
- $this->jsonexit(array("error"=>'数据接口错误,请联系管理员'));
- return true;
- }
-
- if(!is_array($data['data']))
- {
- $this->jsonexit(array("error"=>$data['data']));
- return true;
- }
-
- $order = new Order();
- $status = $order->addOrder($uuid,json_encode($data['data']['site'],JSON_NUMERIC_CHECK));
- if($status !== true)
- {
- $this->jsonexit(array("error"=>$status));
- return true;
- }
-
- $this->jsonexit($data);
- return true;
- }
- }
-
-
-
- /*
- getversionAction() 获取数据版本
- */
- function getversionAction(){
-
- $ac = $this->_getParam('ac');
- $uuid = $this->_getParam('uuid');
-
- if($ac == 'list')
- {
- $this->_helper->layout->disableLayout();
- $this->_helper->viewRenderer->setNoRender();
-
- $sql = "SELECT v.changelog,v.ts_created,u.username FROM mdversion v
- LEFT JOIN users u ON v.userid=u.id
- WHERE v.uuid=? AND v.changelog IS NOT NULL
- ORDER BY v.ts_created DESC";
-
- $sth = $this->db->prepare($sql);
- $sth->execute(array($uuid));
- $rows = $sth->fetchAll();
-
- if($rows)
- {
- foreach($rows as $k=>$v)
- {
- $rows[$k]['ts_created'] = date("Y-m-d H:i",strtotime($v['ts_created']));
- $rows[$k]['changelog'] = str_replace("\n","",$v['changelog']);
- }
- $data = array("list"=>$rows);
- $this->jsonexit($data);
- return true;
- }else{
- $data = array("error"=>"处理中出现错误");
- $this->jsonexit($data);
- return true;
- }
- }
-
- }//getversionAction()
-
- function replace($string){
- $patterns = array("/\"/i","/\'/i");
- $replacements = array("“","‘");
- ksort($patterns);
- ksort($replacements);
- return preg_replace($patterns, $replacements, $string);
- }//引号替换
-
-
- function postcommentAction(){
- $this->_helper->layout->disableLayout();
- $this->_helper->viewRenderer->setNoRender();
- try{
- $auth = Zend_Auth::getInstance();
- if($auth->hasIdentity())
- {
- $user = $auth->getIdentity();
- $userid = $user->id;
- }else
- {
- $userid=0;
- }
-
- $author = mb_substr($this->replace(trim($this->_request->getParam('author'))),0,30,'UTF-8');
- $email = mb_substr($this->replace(trim($this->_request->getParam('email'))),0,60,'UTF-8');
- $url = mb_substr($this->replace(trim($this->_request->getParam('url'))),0,60,'UTF-8');
- $content = $this->replace(trim($this->_request->getParam('content')));
- $vdcode = mb_substr($this->replace(trim($this->_request->getParam('vdcode'))),0,4,'UTF-8');
-
- if(empty($author))
- {
- echo "请输入您的名字";
- exit();
- }
-
- if(strlen($author)<3) exit("姓名长度不得少于2个汉字 :)");
-
- if(empty($email))
- {
- echo "请输入您的电子邮箱地址";
- exit();
- }
-
- if(strlen($email)<4) exit("Email长度太短,请填写正确的Email :)");
-
- if(!preg_match("/\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*/i",$email))
- {
- echo "Email格式不正确";
- exit();
- }
-
- if(strlen($content)<5) exit("评论长度不得少于3个汉字 :)");
-
- if(preg_match("/script/i",$content))
- {
- $content = preg_replace("/script/i","script",$content);
- }
-
- if(preg_match("/<|>/",$content))
- {
- $data=array(
- '<'=>'<',
- '>'=>'>',
- );
-
- $patterns = array();
- $replacements = array();
- foreach($data as $k=>$v)
- {
- $patterns[]='/'.$k.'/i';
- $replacements[]=$v;
- }
- ksort($patterns);
- ksort($replacements);
- $content=preg_replace($patterns, $replacements, $content);
- if(!empty($url))
- {
- $url=preg_replace($patterns, $replacements, $url);
- }
- }
-
- if(preg_match("/script/i",$url))
- {
- $url = preg_replace("/script/i","script",$url);
- }
-
- if(!preg_match("/http:\/\//",$url))
- {
- $url = "http://".$url;
- }
-
- $uuid = trim($this->_request->getParam('uuid'));
-
- if(!preg_match("/^[0-9A-Za-z]{8}-[0-9A-Za-z]{4}-[0-9A-Za-z]{4}-[0-9A-Za-z]{4}-[0-9A-Za-z]{12}$/",$uuid))
- {
- echo "参数错误!";
- exit();
- }
-
- if(strtolower($vdcode) != $_SESSION['vdcodes'])
- {
- echo "验证码错误,请重新输入";
- exit();
- }
-
-
- $data = array(
- 'uuid' => $uuid,
- 'uid' => $userid,
- 'author' => $author,
- 'email' => $email,
- 'url' => $url,
- 'ip' => $_SERVER['REMOTE_ADDR'],
- 'content' => $content,
- 'agent' => $_SERVER['HTTP_USER_AGENT'],
- 'type' => 'comment'
- );
-
- $sql = "INSERT INTO comments (author,email,url,ip,content,agent,type,uuid,userid) VALUES (?,?,?,?,?,?,?,?,?)";
- $sth = $this->db->prepare($sql);
- $exec = $sth->execute(array($data['author'],$data['email'],$data['url'],$data['ip'],$data['content'],$data['agent'],$data['type'],$data['uuid'],$data['uid']));
-
- if($exec)
- {
- $sql = "SELECT u.email FROM mdauthor au
- LEFT JOIN users u on au.userid=u.id
- WHERE au.uuid='$uuid'";
- $sth = $this->db->query($sql);
- $rows = $sth->fetchAll();
-
- @$mailtp=new EmailText(
- $this->db,
- 'data-comment-note',
- array(
- 'user' =>$user->username,
- 'uuid' =>$data['uuid'],
- 'title' =>$this->replace(trim($this->_request->getParam('mdtitle'))),
- 'content'=>$content
- )
- );
- @$mail=new WestdcMailer($this->view->config->smtp);
- @$mail->setBodyText($mailtp->getBody());
- @$mail->setFrom($this->view->config->service->email,'西部数据中心服务组');
- @$mail->addTo($this->view->config->service->email);
- if(is_array($rows) && count($rows)>0)
- {
- foreach($rows as $v)
- {
- @$mail->addTo($v['email']);
- }
- }
- @$mail->setSubject($mailtp->getSubject());
- @$mail->send();
- $msg = "用户".$user->username."对元数据《".$this->replace(trim($this->_request->getParam('mdtitle')))."》进行了评论,点击查看";
- include_once("message.php");
- message::post($this->db,0,-1,"收到新数据评论",$msg);
- echo "评论成功";
- exit();
- }else
- {
- echo "评论失败,请重试 :)";
- exit();
- }
- }catch(Exception $e){
- echo "出错了,请稍后再试";
- exit();
- }
- }//ajax评论
-
-
- /*
- * 数据评论,根据UUID读取
- */
- function commentAction()
- {
- $this->_helper->layout->disableLayout();
- $this->_helper->viewRenderer->setNoRender();
- $uuid=$this->_request->getParam('uuid');
- if (empty($uuid)) die();
- $sql="select * from comments where uuid=? AND reply=0 order by id desc";
- $comments=$this->db->fetchAll($sql,array($uuid));
-
- $paginator = Zend_Paginator::factory($comments);
- $paginator->setCurrentPageNumber($this->_getParam('page'));
- $paginator->setItemCountPerPage(5);
- $paginator->setView($this->view);
- Zend_View_Helper_PaginationControl::setDefaultViewPartial('data/pagination_ajax.phtml');
-
- include_once("Avatar.php");
- $avatar = new Avatar();
- if ($paginator)
- {
- foreach($paginator as $c)
- {
- //$author=$this->view->escape($c['author']);
- $sql = "SELECT cr.id,cr.content as body,cr.reply,u.username,cr.ts_created,u.usertype,u.email as email,
- (SELECT au.uuid FROM mdauthor au WHERE au.userid=u.id AND au.uuid='$uuid') as uuid
- FROM comments cr
- LEFT JOIN users u ON cr.userid=u.id
- WHERE cr.reply=?";
- $sth = $this->db->prepare($sql);
- $sth->execute(array($c['id']));
- $replys = $sth->fetchAll();
- $replyhtml = "";
- if(!empty($replys) || count($replys)>0)
- {
- foreach($replys as $v)
- {
- $usertype = "";
- $color = "";
- if($v['usertype'] == "administrator")
- {
- $usertype = "[管理员]";
- $color="#009d00";
- }
- if($v['uuid'] == $uuid)
- {
- $usertype = "[数据作者]";
- $color="#add2e9";
- }
- if(!empty($color))
- {
- $color = 'background:'.$color.';color:#FFFFFF;';
- }
- $img = $avatar->Get($v['email'],48);
- $replyhtml .='
-
- ';
-
- }
- }
-
- $img = $avatar->Get($c['email'],64);
- //$img = '';
-
- $author = $c['author'];
- $author = ($c['url'])?''.$author.'':$author;
- $author = ''.$author."";
- $time = '发表于'.date('Y-m-d H:i:s',strtotime($c['ts_created'])).'';
- print '
-
- ';
- }
- echo ''.$paginator.'
';
- }//else echo "- No comments.
";
- }//评论列表
-
- /**
- * 判断用户是否填写了申请信息
- * @param string $uuid
- * @param int $userid
- */
- function todownloadAction() {
-
- $this->view->pageID = "account-dataorder";
-
- $this->_helper->viewRenderer('onlineapp-download');
-
- $this->view->uuid = $uuid = $this->_request->getParam('uuid');
-
- $auth = Zend_Auth::getInstance();
- if (!$auth->hasIdentity())
- {
- $this->view->AlertType = "alert-error";
- $this->view->msg = "请先登录您的账户后进行下载,页面将自动跳转";
- $this->view->jump_url = '/account/login/?href=/data/todownload/uuid/'.$uuid;
- return true;
- }
-
- if(empty($uuid))
- {
- $this->view->AlertType = "alert-error";
- $this->view->msg = "参数错误!";
- $this->view->jump_url = "/data";
- return true;
- }
-
- $this->view->projectType = array(
- "请选择项目类型" => "",
- "国家973计划项目课题" => "国家973计划项目课题",
- "国家863计划课题"=>"国家863计划课题",
- "国家级科技支撑课题" => "国家级科技支撑课题",
- "国家级科技重大专项" => "国家级科技重大专项",
- "国家级国家重大工程" => "国家级国家重大工程",
- "国家级国家自然科学基金" => "国家级国家自然科学基金",
- "国际合作项目"=>"国际合作项目",
- "省部级项目" => "省部级项目",
- "其他项目工程" => "其他项目工程",
- );
-
- $userid = Zend_Auth::getInstance()->getIdentity()->id;
-
- $submit = $this->_getParam('submit');
- if(!empty($submit)){
-
- $datas = array();
- $datas['realname'] = $this->_request->getParam('realname');
- $datas['unit'] = $this->_request->getParam('unit');
- $datas['phone'] = $this->_request->getParam('phone');
- $datas['address'] = $this->_request->getParam('address');
- $datas['postcode'] = $this->_request->getParam('postcode');
- $datas['email'] = $this->_request->getParam('email');
- $datas['project'] = $this->_request->getParam('project');
- $datas['project_id'] = $this->_request->getParam('project_id');
- $datas['project_type'] = $this->_request->getParam('project_type');
- $datas['project_title'] = $this->_request->getParam('project_title');
- $datas['project_leader']= $this->_request->getParam('project_leader');
-
- $this->view->info = $datas;
-
- $this->view->AlertType = "alert-error";
-
- foreach($datas as $k=>$v)
- {
- if(empty($v))
- {
- $this->view->error = "每一项内容都需要填写";
- return true;
- }
- }
-
- if(!is_numeric($datas['postcode']))
- {
- $this->view->error = "联系电话和邮政编码请填写数字";
- return true;
- }
-
- if(!preg_match("/\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*/i",$datas['email']))
- {
- $this->view->error = "请填写正确的email地址";
- return true;
- }
-
- if(mb_strlen($datas['project'],"utf-8")<8)
- {
- $this->view->error = "项目介绍内容不少于8个字符";
- return true;
- }
-
- if(preg_match('/^\d+$/',$datas['project']))
- {
- $this->view->error = "请输入有意义的项目介绍内容";
- return true;
- }
-
- $data = array(
- 'userid' => $userid,
- 'username' => $datas['realname'],
- 'unit' => $datas['unit'],
- 'phone' => $datas['phone'],
- 'address' => $datas['address'],
- 'postcode' => $datas['postcode'],
- 'project' => $datas['project'],
- 'uuid' =>$uuid,
- 'email' =>$datas['email'],
- 'project_id'=>$datas['project_id'],
- 'project_title'=>$datas['project_title'],
- 'project_type'=>$datas['project_type'],
- 'project_leader'=>$datas['project_leader']
- );
-
- if($this->db->insert('onlineapp',$data))
- {
- $select = "select id from onlineapp where userid='$userid' order by id desc";
- $re=$this->db->query($select);
- $row=$re->fetch();
-
- $this->view->AlertType = "alert-success";
- $this->view->jump_url = '/data/download/uuid/'.$uuid.'/onlineappid/'.$row['id'];
- $this->view->msg = "您的信息已经提交成功,可以进行下载。请等待页面自动跳转,view->jump_url."\">或点击这里进入下载页面";
-
- $msg = "用户{$data['username']} 填写了在线数据申请表 查看详细";
- $title = "用户 {$data['username']} 申请了在线下载数据";
- include_once("message.php");
- message::post($this->db,0,-1,$title,$msg);
-
- return true;
- }
- else {
- $this->view->AlertType = "alert-error";
- $this->view->error = "申请失败,请稍后重新尝试";
- $this->view->info = $data;
- return true;
- }
-
- return true;
- }else{
-
- $testsql="select * from onlineapp where userid='$userid' and uuid='$uuid' order by id desc";
- $result=$this->db->query($testsql);
- $rows = $result->fetch();
- if (empty($rows['id']))
- {
- include_once("Users.php");
- $usr = new Users($this->db);
- $this->view->info = $usr->getUserInfo($userid);
- return true;
- }
- else
- {
- $datas['realname'] = $rows['username'];
- $datas['unit'] = $rows['unit'];
- $datas['phone'] = $rows['phone'];
- $datas['address'] = $rows['address'];
- $datas['postcode'] = $rows['postcode'];
- $datas['email'] = $rows['email'];
- $datas['project'] = $rows['project'];
- $datas['project_id'] = $rows['project_id'];
- $datas['project_type'] = $rows['project_type'];
- $datas['project_title'] = $rows['project_title'];
- $datas['project_leader'] = $rows['project_leader'];
- $this->view->info = $datas;
- return true;
- }
- }
-
- return true;
-
- $userid=Zend_Auth::getInstance()->getIdentity()->id;
-
- $datas = array();
- $submited = $this->_request->getParam('submited');
- $datas['username'] = $this->_request->getParam('username');
- $datas['unit'] = $this->_request->getParam('unit');
- $datas['phone'] = $this->_request->getParam('phone');
- $datas['address'] = $this->_request->getParam('address');
- $datas['postcode'] = $this->_request->getParam('postcode');
- $datas['email'] = $this->_request->getParam('email');
- $datas['project'] = $this->_request->getParam('project');
- $datas['project_id'] = $this->_request->getParam('projectid');
- $datas['project_type'] = $this->_request->getParam('projecttype');
- $datas['project_title'] = $this->_request->getParam('projecttitle');
- $datas['project_leader'] = $this->_request->getParam('projectleader');
-
-
-
- $form=$this->creatform($datas);
-
- if (!empty($submited) && $ft==0){
-
- foreach($datas as $k=>$v)
- {
- if($v == '')
- {
- echo $form.'';
- exit();
- }
- }
-
- if(!is_numeric($datas['postcode']))
- {
- echo $form.'';
- exit();
- }
-
- if(!preg_match("/\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*/i",$datas['email']))
- {
- echo $form.'';
- exit();
- }
-
- if(mb_strlen($datas['project'],"utf-8")<8)
- {
- echo $form.'';
- exit();
- }
-
- if(preg_match('/^\d+$/',$datas['project']))
- {
- echo $form.'';
- exit();
- }
-
- $data = array(
- 'userid' => $userid,
- 'username' => $datas['username'],
- 'unit' => $datas['unit'],
- 'phone' => $datas['phone'],
- 'address' => $datas['address'],
- 'postcode' => $datas['postcode'],
- 'project' => $datas['project'],
- 'uuid' =>$uuid,
- 'email' =>$datas['email'],
- 'project_id'=>$datas['project_id'],
- 'project_title'=>$datas['project_title'],
- 'project_type'=>$datas['project_type'],
- 'project_leader'=>$datas['project_leader']
- );
-
- if($this->db->insert('onlineapp',$data))
- {
- $select = "select id from onlineapp where userid='$userid' order by id desc";
- $re=$this->db->query($select);
- $row=$re->fetch();
- echo "您的信息已经提交成功,可以进行下载。
- 如果页面没有自动跳转,请点击这里进入下载页面
- ";
- $msg = "用户{$data['username']} 填写了在线数据申请表 查看详细";
- $title = "用户 {$data['username']} 申请了在线下载数据";
- include_once("message.php");
- message::post($this->db,0,-1,$title,$msg);
- exit();
- }
- else {
- echo $form.'';
- exit();
- }
-
- }else if( $ft==1 )
- {
- $testsql="select * from onlineapp where userid='$userid' and uuid='$uuid' order by id desc";
- $result=$this->db->query($testsql);
- $rows = $result->fetch();
- if (empty($rows['id']))
- {
- $sql="select * from users where id='$userid'";
- $result=$this->db->query($sql);
- $rows = $result->fetch();
-
- $datas['username'] = $rows['realname'];
- $datas['unit'] = $rows['unit'];
- $datas['phone'] = $rows['phone'];
- $datas['address'] = $rows['address'];
- $datas['postcode'] = $rows['postcode'];
- $datas['email'] = $rows['email'];
- $datas['project'] = $rows['project'];
- $datas['project_id'] = $rows['project_id'];
- $datas['project_type'] = $rows['project_type'];
- $datas['project_title'] = $rows['project_title'];
- $datas['project_leader'] = $rows['project_leader'];
- echo $this->creatform($datas);
- exit();
- }
- else
- {
- $datas['username'] = $rows['username'];
- $datas['unit'] = $rows['unit'];
- $datas['phone'] = $rows['phone'];
- $datas['address'] = $rows['address'];
- $datas['postcode'] = $rows['postcode'];
- $datas['email'] = $rows['email'];
- $datas['project'] = $rows['project'];
- $datas['project_id'] = $rows['project_id'];
- $datas['project_type'] = $rows['project_type'];
- $datas['project_title'] = $rows['project_title'];
- $datas['project_leader'] = $rows['project_leader'];
- echo $this->creatform($datas);
- exit();
- }
- }
-
- }
-
- /*
- * 数据下载,根据UUID进行判断
- * 一次只下载一个数据(一个元数据项)
- */
- function downloadAction()
- {
- $uuid=$this->_request->getParam('uuid');
- $onlineappid=$this->_request->getParam('onlineappid');
- $this->view->pageID = "account-dataorder";
-
- if (empty($uuid)) $this->_redirect('/data');
-
- $auth = Zend_Auth::getInstance();
- if($auth->hasIdentity())
- {
- $user = $auth->getIdentity();
- $userid = $user->id;
- }
-
- $testsql="select id,has_send_mail from onlineapp where userid='$userid' and uuid='$uuid' order by id desc";
- $result=$this->db->query($testsql);
- $rows = $result->fetch();
- $has_send_mail=$rows['has_send_mail'];
- if (empty($rows['id']))
- {
- $this->_redirect('/data/'.$uuid);
- }
- else
- {
- $sql="select onlineappid,id from dataorder where status=0 and userid='$userid' and uuid='$uuid' order by id desc";
- $re=$this->db->query($sql);
- $row=$re->fetch();
- if(empty($row['onlineappid']))
- {
- $data = array(
- 'userid' => $userid,
- 'uuid' => $uuid,
- 'onlineappid'=> $onlineappid,
- 'ts_approved'=>'now()',
- );
- try {$this->db->insert('dataorder',$data);} catch (Exception $e) {}
- }else
- {
- $sql="update dataorder set onlineappid='$onlineappid',ts_approved=now() where id='{$row['id']}'";
- try {$this->db->exec($sql);} catch (Exception $e) {}
- }
- }
-
-
- $sql=$this->db->quoteInto("select * from dataset o left join metadata m on o.uuid=m.uuid left join mdstatus s on m.uuid=s.uuid where s.status>4 and m.datatype=0 and m.uuid=?",$uuid);
- $data=$this->db->fetchRow($sql);
- $updateftp=$updateftp1=false;
- $this->view->md=$data;
- $this->view->userpass=md5('westdc'.rand(1000,9999));
- $this->view->ftptime=date('Y-m-d H:i:s', strtotime('+1 week'));
- $sql=$this->db->quoteInto("select * from ftpuser where userid=?",$userid);
- $row=$this->db->fetchRow($sql);
- $datacount=$row['datacount'];
- if ($data['host']=='ftp.westgis.ac.cn')
- {
- //添加FTP帐号信息以及时间控制信息
- $updateftp=true;
- $g6=new G6ftp();
- $g6->db=$this->db;
- //不进行判断,每个元数据中的下载地址都对应一个虚拟路径
- $path[]=$data['path'];
- $this->view->username='westdc'.$userid;
- $uu=(object)array("id"=>$userid,
- "username"=>$this->view->username,
- "password"=>$this->view->userpass,
- "path"=>$path,
- "maxdata"=>$this->view->config->download->max,
- "time"=>$this->view->ftptime,
- "datacount"=>$datacount);
- if ($g6->createuser($uu)) {
- $this->view->userpass=$g6->pwd;
- $this->view->ftptime=$g6->time;
- } else {
- $this->messenger->addMessage('错误:您正在进行下载的在线数据数已经超过系统允许的最大值,请在下面点击“完成”或“取消”对应的在线数据下载!');
- $this->_redirect('/data/order');
- }
- } elseif ($data['host']=='ftp1.westgis.ac.cn')
- {
- //添加FTP1帐号信息以及时间控制信息
- $proftp=new Proftp();
- $proftp->db=$this->db;
- //proftp离线用户名和g6的用户名稍有不同
- $this->view->username='westdc_'.$userid;
- $uu=(object)array("id"=>$userid,
- "username"=>$this->view->username,
- "password"=>$this->view->userpass,
- "host"=>'ftp1.westgis.ac.cn',
- "param"=>"onlineappid=".$onlineappid,
- "maxdata"=>$this->view->config->download->max,
- "time"=>$this->view->ftptime,
- "datacount"=>$datacount);
- if ($proftp->createuser($uu))
- {
- $this->view->userpass=$proftp->pwd;
- $this->view->ftptime=$proftp->time;
- }
- } elseif ($data['host']=='ftp2.westgis.ac.cn')
- {
- //添加FTP2帐号信息以及时间控制信息
- $proftp=new Pureftp();
- $proftp->db=$this->db;
- $this->view->username='westdc_'.$userid;
- $uu=(object)array("id"=>$userid,
- "username"=>$this->view->username,
- "password"=>$this->view->userpass,
- "host"=>'ftp2.westgis.ac.cn',
- "param"=>"onlineappid=".$onlineappid,
- "maxdata"=>$this->view->config->download->max,
- "time"=>$this->view->ftptime,
- "datacount"=>$datacount);
- if ($proftp->createuser($uu))
- {
- $this->view->userpass=$proftp->pwd;
- $this->view->ftptime=$proftp->time;
- }
- }
- $ftpurl='ftp://'.$this->view->username.'@'.$data['host'];
- if ($data['host']=='ftp.westgis.ac.cn') $ftpurl.=$data['path'];
-
- //设置输出
- //if ($updateftp || $updateftp1) $this->view->userpass=$password;
- $this->view->ftpurl=$ftpurl;
- //更新下载记录
- //todo: 尝试添加一个RULE:若有对应数据存在,则不插入( userid,uuid,status=0,ts_approved:null)
- /*$sql="select * from dataorder where userid=? and uuid=? and status=0 and (ts_approved is null)";
- $u=$this->db->fetchRow($sql,array($userid,$uuid));
- if (empty($u)) {
- $sql="insert into dataorder (userid,uuid,ts_created) values(?,?,now())";
- $this->db->query($sql,array($userid,$uuid));
- }*/
- if (!empty($ftpurl) && !$has_send_mail)
- {
- $data = array(
- "uuid"=>$uuid,
- "title"=>$this->view->md['title']."(".$this->view->md['filesize']."MB)",
- "user"=>$user->username,
- "ftpuser"=>$this->view->username,
- "ftppwd"=>$this->view->userpass,
- "ftptime"=>$this->view->ftptime,
- "ftpurl"=>$this->view->ftpurl,
- "note"=>$updateftp?'BTW:请注意登陆后要手工进入对应的目录!':''
- );
- $mailtp=new EmailText($this->db,'online-download',$data);
- $mail=new WestdcMailer($this->view->config->smtp);
- $mail->setBodyText($mailtp->getBody());
- $mail->setFrom($this->view->config->service->email,'西部数据中心服务组');
- $mail->addTo($user->email);
- $mail->setSubject($mailtp->getSubject());
- @$mail->send();
- $sql="update onlineapp set has_send_mail=true where id=?";
- $sth=$this->db->prepare($sql);
- $sth->execute(array($onlineappid));
- }
- }
- /*
- * 离线申请(可以包括在线数据),在无数据参数时,则显示已有列表
- */
- function orderAction()
- {
- $this->view->pageID = "account-dataorder";
- $ac = $this->_request->getParam('ac');
-
- $uuid = $this->_request->getParam('uuid');
-
- $del = $this->_request->getParam('del');
- $apply = $this->_request->getParam('apply');
- $finish = $this->_request->getParam('finish');
- $cancel = $this->_request->getParam('cancel');
- $wsn = $this->_request->getParam('wsn');
- $pdf = $this->_request->getParam('pdf');
- $selections = $this->_request->getParam('data');
-
- //if (empty($uuid)) $this->_redirect('/data');
- $userid = view::User('id');
-
- //添加到数据篮
- if ($uuid)
- {
- //存在历史遗留问题,原来的数据并不能保证唯一
-
- $order = new Order();
- $state = $order->addOrder($uuid);
-
- if($state !== true)
- {
- if(!is_array($state))
- {
- $this->view->msg = view::Msg('alert-error',$state);
- }else{
- $service_type = $order->serviceTypeTest($state['service_type']);
- if($service_type !== false)
- {
- view::Post($this,$service_type,$state['service_url']."?href=".urlencode(view::getHostLink()."/data/order/")."&uuid=".$state['uuid']."&uid=".$userid);
- }else{
- $this->view->msg = view::Msg('alert-error',"无法申请:此元数据的数据类型未知");
- }
- }
- }else{
- $this->view->msg = view::Msg('alert-success',"添加成功!您可以继续浏览数据或是继续提交申请表");
- }
-
- if (empty($ac)) $ac='offline1';
-
- }
-
- elseif ($selections)
- {
- if(empty($uuid))
- {
- $this->view->msg = view::Msg('alert-error',"无法申请:参数出错,请通过正确的途径访问");
- }
-
- $order = new Order();
- $state = $order->addOrder($uuid,$selections);
-
- if($state !== true)
- {
- $this->view->msg = view::Msg('alert-error',$state);
- }else{
- $this->view->msg = view::Msg('alert-success',"添加成功!您可以继续浏览数据或是继续提交申请表");
- }
-
- if (empty($ac)) $ac='offline1';
- }
-
- //删除申请
- elseif ($del) {
- $order = new Order();
- $state = $order->del($del);
- if($state !== true)
- {
- $this->view->msg = view::Msg('alert-error',$state);
- }else{
- $this->view->msg = view::Msg('alert-success',"数据申请取消成功");
- }
- $this->_redirect('/data/order');
- }
-
- //提交申请
- elseif ($apply) {
- if($apply == "all" || !is_numeric($apply))
- {
- $apply = -1;
- }
- $order = new Order();
- $state = $order->apply($apply);
- if($state !== true)
- {
- $this->view->msg = view::Msg('alert-error',$state);
- }else{
- $this->view->msg = view::Msg('alert-success',"提交成功,您可以点击“提交离线申请”来生成PDF申请表");
- }
- if (empty($ac)) $ac='offline2';
- }
-
- //完成
- elseif ($finish) {
- if ($finish=='all') {
- $sql=$this->db->quoteInto("update dataorder set ts_approved=now() where status=0 and userid=?",$userid);
- $this->db->query($sql);
- $sql="update ftpuser set datacount=0 where userid=?";
- $this->db->query($sql,array($userid));
- } else {
- $sql="update dataorder set ts_approved=now() where status=0 and userid=? and id=?";
- $this->db->query($sql,array($userid,(int)$finish));
- $sql="update ftpuser set datacount=datacount-1 where userid=? and datacount>0";
- $this->db->query($sql,array($userid));
- }
- }
-
- elseif($wsn)
- {
- $this->_helper->viewRenderer('order-wsn');
-
- return true;
- }
-
- elseif ($cancel) {
- if ($cancel=='all') {
- $sql=$this->db->quoteInto("update dataorder set ts_approved=now(),status=-1 where status=0 and userid=?",$userid);
- $this->db->query($sql);
- $sql="update ftpuser set datacount=0 where userid=?";
- $this->db->query($sql,array($userid));
- } else {
- $sql="update dataorder set ts_approved=now(),status=-1 where status in (0,1,2) and userid=? and id=?";
- $this->db->query($sql,array($userid,(int)$cancel));
- $sql="update ftpuser set datacount=datacount-1 where userid=? and datacount>0";
- $this->db->query($sql,array($userid));
- }
- if (empty($ac)) $ac='offline2';
- }
-
- //生成PDF离线申请文件
- elseif ($pdf) {
-
- //用户信息可以从SESSION中读取?离线申请信息
- //$sql="select * from users where id=?";
- $order = new Order();
- $rows = $order->getOrderItemForPdf();
- $this->view->projectType = $order->projectType;
-
- if ($rows) {
- $this->_helper->viewRenderer('pdf');
-
- $this->view->data2 = $rows;
-
- if ($this->_request->isPost()) {
-
- $this->view->formData = $formData = $this->_request->getPost();
-
- $datalist='';
- foreach($rows as $i=>$row)
- {
- $datalist.=($i+1).". ".$row['title'].";";
- }
- $formData['datalist'] = $datalist;
-
- if (@$formData['save']) {
-
- $order->setPdfData($rows);
-
- $s = $order->SaveOrder($formData);
-
- if($s !== true)
- {
- $this->view->error = view::Msg('alert-error',$s);
- return true;
- }
-
- //不能修改顺序
- $this->_helper->layout->disableLayout();
- $this->_helper->viewRenderer->setNoRender();
-
- return true;
- } elseif ($formData['submit']) {
- //生成PDF
- $order->setPdfData($rows);
- $s = $order->SubmitOrder($formData);
-
- if($s !== true)
- {
- $this->view->error = view::Msg('alert-error',$s);
- return true;
- }
-
- $this->view->msg = view::Msg('alert-success','提示信息:您的离线申请已经提交,请在线上传PDF的签字版PDF文件。',0);
- if (empty($ac)) $ac='offline3';
- }
- } else {
- $sql="select u.* from users u left join offlineapp o on u.id=o.userid where u.id=? ORDER BY o.id DESC";
- $row=$this->db->fetchRow($sql,array($userid));
- $this->view->formData = $row;
- }
- } else{
- $this->view->msg=view::Msg('alert-error',"错误:您还没有提交任何离线申请的数据,或您的数据申请已经提交(等待处理过程中)!",0);
- }
- return true;
- }//pdf
-
- if($ac == "commitapplicationform")
- {
- $offlineappid = $this->_getParam('offlineappid');
-
- if(!is_numeric($offlineappid) || $offlineappid < 1)
- {
- view::Post($this,"参数错误",-1);
- return true;
- }
-
- $order = new Order();
- $status = $order->commitApplicationForm($offlineappid);
-
- if( $status !== true)
- {
- view::Post($this,$status,-1);
- }else{
- view::Post($this,"申请已提交,请等待管理员接收并通过数据所有者审核",'/data/order/ac/offline3');
- }
-
- return true;
- }
-
- //index
- $this->view->ac = $ac;
- $this->_helper->viewRenderer('order');
- if ($ac=='' || $ac=='online')
- {
- $this->view->tabID='order-online';
- } else if ($ac=='offline1') {
- $this->view->tabID='order-offline1';
- } else if ($ac=='offline2') {
- $this->view->tabID='order-offline2';
- } else if ($ac=='offline3') {
- $this->view->tabID='order-offline3';
- } else if ($ac=='offline4') {
- $this->view->tabID='order-offline4';
- }
- //显示已经申请的数据,包括已经提交的申请和未提交的申请,还有已经处理完成的申请,正在进行的在线数据下载
- $sql="select d.*,m.title,m.datatype,off.applicationform from dataorder d
- left join metadata m on d.uuid=m.uuid
- left join offlineapp off ON off.id = d.offlineappid
- where d.userid=? order by d.status,d.ts_created desc";
- $rows=$this->db->fetchAll($sql,array($userid));
-
- $showorders = array();
- $counts = array(
- 'onlineapp' => 0,
- 'offline1' => 0,
- 'offline2' => 0,
- 'offline3' => 0,
- 'offline4' => 0
- );
-
- if(count($rows) > 0) {
- foreach($rows as $k=>$v)
- {
- switch($v['status']) {
- case 0:
- $counts['onlineapp'] ++;
- break;
- case 1:
- $counts['offline1'] ++;
- break;
- case 2:
- $counts['offline2'] ++;
- break;
- case 3:
- $counts['offline3'] ++;
- break;
- case 4:
- $counts['offline3'] ++;
- break;
- case 5:
- $counts['offline4'] ++;
- break;
- }
- switch($ac){
- default :
- if($v['status'] == 0 && !empty($v['ts_approved']))$showorders[] = $rows[$k];
- break;
- case 'online' :
- if($v['status'] == 0 && !empty($v['ts_approved']))$showorders[] = $rows[$k];
- break;
- case 'offline1' :
- if($v['status'] == 1) $showorders[] = $rows[$k];
- break;
- case 'offline2' :
+
+
+ if(empty($data['data']))
+ {
+ $this->jsonexit(array("error"=>'数据接口错误,请联系管理员'));
+ return true;
+ }
+
+ if(!is_array($data['data']))
+ {
+ $this->jsonexit(array("error"=>$data['data']));
+ return true;
+ }
+
+ $order = new Order();
+ $status = $order->addOrder($uuid,json_encode($data['data']['site'],JSON_NUMERIC_CHECK));
+ if($status !== true)
+ {
+ $this->jsonexit(array("error"=>$status));
+ return true;
+ }
+
+ $this->jsonexit($data);
+ return true;
+ }
+ }
+
+
+
+ /*
+ getversionAction() 获取数据版本
+ */
+ function getversionAction(){
+
+ $ac = $this->_getParam('ac');
+ $uuid = $this->_getParam('uuid');
+
+ if($ac == 'list')
+ {
+ $this->_helper->layout->disableLayout();
+ $this->_helper->viewRenderer->setNoRender();
+
+ $sql = "SELECT v.changelog,v.ts_created,u.username FROM mdversion v
+ LEFT JOIN users u ON v.userid=u.id
+ WHERE v.uuid=? AND v.changelog IS NOT NULL
+ ORDER BY v.ts_created DESC";
+
+ $sth = $this->db->prepare($sql);
+ $sth->execute(array($uuid));
+ $rows = $sth->fetchAll();
+
+ if($rows)
+ {
+ foreach($rows as $k=>$v)
+ {
+ $rows[$k]['ts_created'] = date("Y-m-d H:i",strtotime($v['ts_created']));
+ $rows[$k]['changelog'] = str_replace("\n","",$v['changelog']);
+ }
+ $data = array("list"=>$rows);
+ $this->jsonexit($data);
+ return true;
+ }else{
+ $data = array("error"=>"处理中出现错误");
+ $this->jsonexit($data);
+ return true;
+ }
+ }
+
+ }//getversionAction()
+
+ function replace($string){
+ $patterns = array("/\"/i","/\'/i");
+ $replacements = array("“","‘");
+ ksort($patterns);
+ ksort($replacements);
+ return preg_replace($patterns, $replacements, $string);
+ }//引号替换
+
+
+ function postcommentAction(){
+ $this->_helper->layout->disableLayout();
+ $this->_helper->viewRenderer->setNoRender();
+ try{
+ $auth = Zend_Auth::getInstance();
+ if($auth->hasIdentity())
+ {
+ $user = $auth->getIdentity();
+ $userid = $user->id;
+ }else
+ {
+ $userid=0;
+ }
+
+ $author = mb_substr($this->replace(trim($this->_request->getParam('author'))),0,30,'UTF-8');
+ $email = mb_substr($this->replace(trim($this->_request->getParam('email'))),0,60,'UTF-8');
+ $url = mb_substr($this->replace(trim($this->_request->getParam('url'))),0,60,'UTF-8');
+ $content = $this->replace(trim($this->_request->getParam('content')));
+ $vdcode = mb_substr($this->replace(trim($this->_request->getParam('vdcode'))),0,4,'UTF-8');
+
+ if(empty($author))
+ {
+ echo "请输入您的名字";
+ exit();
+ }
+
+ if(strlen($author)<3) exit("姓名长度不得少于2个汉字 :)");
+
+ if(empty($email))
+ {
+ echo "请输入您的电子邮箱地址";
+ exit();
+ }
+
+ if(strlen($email)<4) exit("Email长度太短,请填写正确的Email :)");
+
+ if(!preg_match("/\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*/i",$email))
+ {
+ echo "Email格式不正确";
+ exit();
+ }
+
+ if(strlen($content)<5) exit("评论长度不得少于3个汉字 :)");
+
+ if(preg_match("/script/i",$content))
+ {
+ $content = preg_replace("/script/i","script",$content);
+ }
+
+ if(preg_match("/<|>/",$content))
+ {
+ $data=array(
+ '<'=>'<',
+ '>'=>'>',
+ );
+
+ $patterns = array();
+ $replacements = array();
+ foreach($data as $k=>$v)
+ {
+ $patterns[]='/'.$k.'/i';
+ $replacements[]=$v;
+ }
+ ksort($patterns);
+ ksort($replacements);
+ $content=preg_replace($patterns, $replacements, $content);
+ if(!empty($url))
+ {
+ $url=preg_replace($patterns, $replacements, $url);
+ }
+ }
+
+ if(preg_match("/script/i",$url))
+ {
+ $url = preg_replace("/script/i","script",$url);
+ }
+
+ if(!preg_match("/http:\/\//",$url))
+ {
+ $url = "http://".$url;
+ }
+
+ $uuid = trim($this->_request->getParam('uuid'));
+
+ if(!preg_match("/^[0-9A-Za-z]{8}-[0-9A-Za-z]{4}-[0-9A-Za-z]{4}-[0-9A-Za-z]{4}-[0-9A-Za-z]{12}$/",$uuid))
+ {
+ echo "参数错误!";
+ exit();
+ }
+
+ if(strtolower($vdcode) != $_SESSION['vdcodes'])
+ {
+ echo "验证码错误,请重新输入";
+ exit();
+ }
+
+
+ $data = array(
+ 'uuid' => $uuid,
+ 'uid' => $userid,
+ 'author' => $author,
+ 'email' => $email,
+ 'url' => $url,
+ 'ip' => $_SERVER['REMOTE_ADDR'],
+ 'content' => $content,
+ 'agent' => $_SERVER['HTTP_USER_AGENT'],
+ 'type' => 'comment'
+ );
+
+ $sql = "INSERT INTO comments (author,email,url,ip,content,agent,type,uuid,userid) VALUES (?,?,?,?,?,?,?,?,?)";
+ $sth = $this->db->prepare($sql);
+ $exec = $sth->execute(array($data['author'],$data['email'],$data['url'],$data['ip'],$data['content'],$data['agent'],$data['type'],$data['uuid'],$data['uid']));
+
+ if($exec)
+ {
+ $sql = "SELECT u.email FROM mdauthor au
+ LEFT JOIN users u on au.userid=u.id
+ WHERE au.uuid='$uuid'";
+ $sth = $this->db->query($sql);
+ $rows = $sth->fetchAll();
+
+ @$mailtp=new EmailText(
+ $this->db,
+ 'data-comment-note',
+ array(
+ 'user' =>$user->username,
+ 'uuid' =>$data['uuid'],
+ 'title' =>$this->replace(trim($this->_request->getParam('mdtitle'))),
+ 'content'=>$content
+ )
+ );
+ @$mail=new WestdcMailer($this->view->config->smtp);
+ @$mail->setBodyText($mailtp->getBody());
+ @$mail->setFrom($this->view->config->service->email,'西部数据中心服务组');
+ @$mail->addTo($this->view->config->service->email);
+ if(is_array($rows) && count($rows)>0)
+ {
+ foreach($rows as $v)
+ {
+ @$mail->addTo($v['email']);
+ }
+ }
+ @$mail->setSubject($mailtp->getSubject());
+ @$mail->send();
+ $msg = "用户".$user->username."对元数据《".$this->replace(trim($this->_request->getParam('mdtitle')))."》进行了评论,点击查看";
+ include_once("message.php");
+ message::post($this->db,0,-1,"收到新数据评论",$msg);
+ echo "评论成功";
+ exit();
+ }else
+ {
+ echo "评论失败,请重试 :)";
+ exit();
+ }
+ }catch(Exception $e){
+ echo "出错了,请稍后再试";
+ exit();
+ }
+ }//ajax评论
+
+
+ /*
+ * 数据评论,根据UUID读取
+ */
+ function commentAction()
+ {
+ $this->_helper->layout->disableLayout();
+ $this->_helper->viewRenderer->setNoRender();
+ $uuid=$this->_request->getParam('uuid');
+ if (empty($uuid)) die();
+ $sql="select * from comments where uuid=? AND reply=0 order by id desc";
+ $comments=$this->db->fetchAll($sql,array($uuid));
+
+ $paginator = Zend_Paginator::factory($comments);
+ $paginator->setCurrentPageNumber($this->_getParam('page'));
+ $paginator->setItemCountPerPage(5);
+ $paginator->setView($this->view);
+ Zend_View_Helper_PaginationControl::setDefaultViewPartial('data/pagination_ajax.phtml');
+
+ include_once("Avatar.php");
+ $avatar = new Avatar();
+ if ($paginator)
+ {
+ foreach($paginator as $c)
+ {
+ //$author=$this->view->escape($c['author']);
+ $sql = "SELECT cr.id,cr.content as body,cr.reply,u.username,cr.ts_created,u.usertype,u.email as email,
+ (SELECT au.uuid FROM mdauthor au WHERE au.userid=u.id AND au.uuid='$uuid') as uuid
+ FROM comments cr
+ LEFT JOIN users u ON cr.userid=u.id
+ WHERE cr.reply=?";
+ $sth = $this->db->prepare($sql);
+ $sth->execute(array($c['id']));
+ $replys = $sth->fetchAll();
+ $replyhtml = "";
+ if(!empty($replys) || count($replys)>0)
+ {
+ foreach($replys as $v)
+ {
+ $usertype = "";
+ $color = "";
+ if($v['usertype'] == "administrator")
+ {
+ $usertype = "[管理员]";
+ $color="#009d00";
+ }
+ if($v['uuid'] == $uuid)
+ {
+ $usertype = "[数据作者]";
+ $color="#add2e9";
+ }
+ if(!empty($color))
+ {
+ $color = 'background:'.$color.';color:#FFFFFF;';
+ }
+ $img = $avatar->Get($v['email'],48);
+ $replyhtml .='
+
+ ';
+
+ }
+ }
+
+ $img = $avatar->Get($c['email'],64);
+ //$img = '';
+
+ $author = $c['author'];
+ $author = ($c['url'])?''.$author.'':$author;
+ $author = ''.$author."";
+ $time = '发表于'.date('Y-m-d H:i:s',strtotime($c['ts_created'])).'';
+ print '
+
+ ';
+ }
+ echo ''.$paginator.'
';
+ }//else echo "- No comments.
";
+ }//评论列表
+
+ /**
+ * 判断用户是否填写了申请信息
+ * @param string $uuid
+ * @param int $userid
+ */
+ function todownloadAction() {
+
+ $this->view->pageID = "account-dataorder";
+
+ $this->_helper->viewRenderer('onlineapp-download');
+
+ $this->view->uuid = $uuid = $this->_request->getParam('uuid');
+
+ $auth = Zend_Auth::getInstance();
+ if (!$auth->hasIdentity())
+ {
+ $this->view->AlertType = "alert-error";
+ $this->view->msg = "请先登录您的账户后进行下载,页面将自动跳转";
+ $this->view->jump_url = '/account/login/?href=/data/todownload/uuid/'.$uuid;
+ return true;
+ }
+
+ if(empty($uuid))
+ {
+ $this->view->AlertType = "alert-error";
+ $this->view->msg = "参数错误!";
+ $this->view->jump_url = "/data";
+ return true;
+ }
+
+ $this->view->projectType = array(
+ "请选择项目类型" => "",
+ "国家973计划项目课题" => "国家973计划项目课题",
+ "国家863计划课题"=>"国家863计划课题",
+ "国家级科技支撑课题" => "国家级科技支撑课题",
+ "国家级科技重大专项" => "国家级科技重大专项",
+ "国家级国家重大工程" => "国家级国家重大工程",
+ "国家级国家自然科学基金" => "国家级国家自然科学基金",
+ "国际合作项目"=>"国际合作项目",
+ "省部级项目" => "省部级项目",
+ "其他项目工程" => "其他项目工程",
+ );
+
+ $userid = Zend_Auth::getInstance()->getIdentity()->id;
+
+ $submit = $this->_getParam('submit');
+ if(!empty($submit)){
+
+ $datas = array();
+ $datas['realname'] = $this->_request->getParam('realname');
+ $datas['unit'] = $this->_request->getParam('unit');
+ $datas['phone'] = $this->_request->getParam('phone');
+ $datas['address'] = $this->_request->getParam('address');
+ $datas['postcode'] = $this->_request->getParam('postcode');
+ $datas['email'] = $this->_request->getParam('email');
+ $datas['project'] = $this->_request->getParam('project');
+ $datas['project_id'] = $this->_request->getParam('project_id');
+ $datas['project_type'] = $this->_request->getParam('project_type');
+ $datas['project_title'] = $this->_request->getParam('project_title');
+ $datas['project_leader']= $this->_request->getParam('project_leader');
+
+ $this->view->info = $datas;
+
+ $this->view->AlertType = "alert-error";
+
+ foreach($datas as $k=>$v)
+ {
+ if(empty($v))
+ {
+ $this->view->error = "每一项内容都需要填写";
+ return true;
+ }
+ }
+
+ if(!is_numeric($datas['postcode']))
+ {
+ $this->view->error = "联系电话和邮政编码请填写数字";
+ return true;
+ }
+
+ if(!preg_match("/\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*/i",$datas['email']))
+ {
+ $this->view->error = "请填写正确的email地址";
+ return true;
+ }
+
+ if(mb_strlen($datas['project'],"utf-8")<8)
+ {
+ $this->view->error = "项目介绍内容不少于8个字符";
+ return true;
+ }
+
+ if(preg_match('/^\d+$/',$datas['project']))
+ {
+ $this->view->error = "请输入有意义的项目介绍内容";
+ return true;
+ }
+
+ $data = array(
+ 'userid' => $userid,
+ 'username' => $datas['realname'],
+ 'unit' => $datas['unit'],
+ 'phone' => $datas['phone'],
+ 'address' => $datas['address'],
+ 'postcode' => $datas['postcode'],
+ 'project' => $datas['project'],
+ 'uuid' =>$uuid,
+ 'email' =>$datas['email'],
+ 'project_id'=>$datas['project_id'],
+ 'project_title'=>$datas['project_title'],
+ 'project_type'=>$datas['project_type'],
+ 'project_leader'=>$datas['project_leader']
+ );
+
+ if($this->db->insert('onlineapp',$data))
+ {
+ $select = "select id from onlineapp where userid='$userid' order by id desc";
+ $re=$this->db->query($select);
+ $row=$re->fetch();
+
+ $this->view->AlertType = "alert-success";
+ $this->view->jump_url = '/data/download/uuid/'.$uuid.'/onlineappid/'.$row['id'];
+ $this->view->msg = "您的信息已经提交成功,可以进行下载。请等待页面自动跳转,view->jump_url."\">或点击这里进入下载页面";
+
+ $msg = "用户{$data['username']} 填写了在线数据申请表 查看详细";
+ $title = "用户 {$data['username']} 申请了在线下载数据";
+ include_once("message.php");
+ message::post($this->db,0,-1,$title,$msg);
+
+ return true;
+ }
+ else {
+ $this->view->AlertType = "alert-error";
+ $this->view->error = "申请失败,请稍后重新尝试";
+ $this->view->info = $data;
+ return true;
+ }
+
+ return true;
+ }else{
+
+ $testsql="select * from onlineapp where userid='$userid' and uuid='$uuid' order by id desc";
+ $result=$this->db->query($testsql);
+ $rows = $result->fetch();
+ if (empty($rows['id']))
+ {
+ include_once("Users.php");
+ $usr = new Users($this->db);
+ $this->view->info = $usr->getUserInfo($userid);
+ return true;
+ }
+ else
+ {
+ $datas['realname'] = $rows['username'];
+ $datas['unit'] = $rows['unit'];
+ $datas['phone'] = $rows['phone'];
+ $datas['address'] = $rows['address'];
+ $datas['postcode'] = $rows['postcode'];
+ $datas['email'] = $rows['email'];
+ $datas['project'] = $rows['project'];
+ $datas['project_id'] = $rows['project_id'];
+ $datas['project_type'] = $rows['project_type'];
+ $datas['project_title'] = $rows['project_title'];
+ $datas['project_leader'] = $rows['project_leader'];
+ $this->view->info = $datas;
+ return true;
+ }
+ }
+
+ return true;
+
+ $userid=Zend_Auth::getInstance()->getIdentity()->id;
+
+ $datas = array();
+ $submited = $this->_request->getParam('submited');
+ $datas['username'] = $this->_request->getParam('username');
+ $datas['unit'] = $this->_request->getParam('unit');
+ $datas['phone'] = $this->_request->getParam('phone');
+ $datas['address'] = $this->_request->getParam('address');
+ $datas['postcode'] = $this->_request->getParam('postcode');
+ $datas['email'] = $this->_request->getParam('email');
+ $datas['project'] = $this->_request->getParam('project');
+ $datas['project_id'] = $this->_request->getParam('projectid');
+ $datas['project_type'] = $this->_request->getParam('projecttype');
+ $datas['project_title'] = $this->_request->getParam('projecttitle');
+ $datas['project_leader'] = $this->_request->getParam('projectleader');
+
+
+
+ $form=$this->creatform($datas);
+
+ if (!empty($submited) && $ft==0){
+
+ foreach($datas as $k=>$v)
+ {
+ if($v == '')
+ {
+ echo $form.'';
+ exit();
+ }
+ }
+
+ if(!is_numeric($datas['postcode']))
+ {
+ echo $form.'';
+ exit();
+ }
+
+ if(!preg_match("/\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*/i",$datas['email']))
+ {
+ echo $form.'';
+ exit();
+ }
+
+ if(mb_strlen($datas['project'],"utf-8")<8)
+ {
+ echo $form.'';
+ exit();
+ }
+
+ if(preg_match('/^\d+$/',$datas['project']))
+ {
+ echo $form.'';
+ exit();
+ }
+
+ $data = array(
+ 'userid' => $userid,
+ 'username' => $datas['username'],
+ 'unit' => $datas['unit'],
+ 'phone' => $datas['phone'],
+ 'address' => $datas['address'],
+ 'postcode' => $datas['postcode'],
+ 'project' => $datas['project'],
+ 'uuid' =>$uuid,
+ 'email' =>$datas['email'],
+ 'project_id'=>$datas['project_id'],
+ 'project_title'=>$datas['project_title'],
+ 'project_type'=>$datas['project_type'],
+ 'project_leader'=>$datas['project_leader']
+ );
+
+ if($this->db->insert('onlineapp',$data))
+ {
+ $select = "select id from onlineapp where userid='$userid' order by id desc";
+ $re=$this->db->query($select);
+ $row=$re->fetch();
+ echo "您的信息已经提交成功,可以进行下载。
+ 如果页面没有自动跳转,请点击这里进入下载页面
+ ";
+ $msg = "用户{$data['username']} 填写了在线数据申请表 查看详细";
+ $title = "用户 {$data['username']} 申请了在线下载数据";
+ include_once("message.php");
+ message::post($this->db,0,-1,$title,$msg);
+ exit();
+ }
+ else {
+ echo $form.'';
+ exit();
+ }
+
+ }else if( $ft==1 )
+ {
+ $testsql="select * from onlineapp where userid='$userid' and uuid='$uuid' order by id desc";
+ $result=$this->db->query($testsql);
+ $rows = $result->fetch();
+ if (empty($rows['id']))
+ {
+ $sql="select * from users where id='$userid'";
+ $result=$this->db->query($sql);
+ $rows = $result->fetch();
+
+ $datas['username'] = $rows['realname'];
+ $datas['unit'] = $rows['unit'];
+ $datas['phone'] = $rows['phone'];
+ $datas['address'] = $rows['address'];
+ $datas['postcode'] = $rows['postcode'];
+ $datas['email'] = $rows['email'];
+ $datas['project'] = $rows['project'];
+ $datas['project_id'] = $rows['project_id'];
+ $datas['project_type'] = $rows['project_type'];
+ $datas['project_title'] = $rows['project_title'];
+ $datas['project_leader'] = $rows['project_leader'];
+ echo $this->creatform($datas);
+ exit();
+ }
+ else
+ {
+ $datas['username'] = $rows['username'];
+ $datas['unit'] = $rows['unit'];
+ $datas['phone'] = $rows['phone'];
+ $datas['address'] = $rows['address'];
+ $datas['postcode'] = $rows['postcode'];
+ $datas['email'] = $rows['email'];
+ $datas['project'] = $rows['project'];
+ $datas['project_id'] = $rows['project_id'];
+ $datas['project_type'] = $rows['project_type'];
+ $datas['project_title'] = $rows['project_title'];
+ $datas['project_leader'] = $rows['project_leader'];
+ echo $this->creatform($datas);
+ exit();
+ }
+ }
+
+ }
+
+ /*
+ * 数据下载,根据UUID进行判断
+ * 一次只下载一个数据(一个元数据项)
+ */
+ function downloadAction()
+ {
+ $uuid=$this->_request->getParam('uuid');
+ $onlineappid=$this->_request->getParam('onlineappid');
+ $this->view->pageID = "account-dataorder";
+
+ if (empty($uuid)) $this->_redirect('/data');
+
+ $auth = Zend_Auth::getInstance();
+ if($auth->hasIdentity())
+ {
+ $user = $auth->getIdentity();
+ $userid = $user->id;
+ }
+
+ $testsql="select id,has_send_mail from onlineapp where userid='$userid' and uuid='$uuid' order by id desc";
+ $result=$this->db->query($testsql);
+ $rows = $result->fetch();
+ $has_send_mail=$rows['has_send_mail'];
+ if (empty($rows['id']))
+ {
+ $this->_redirect('/data/'.$uuid);
+ }
+ else
+ {
+ $sql="select onlineappid,id from dataorder where status=0 and userid='$userid' and uuid='$uuid' order by id desc";
+ $re=$this->db->query($sql);
+ $row=$re->fetch();
+ if(empty($row['onlineappid']))
+ {
+ $data = array(
+ 'userid' => $userid,
+ 'uuid' => $uuid,
+ 'onlineappid'=> $onlineappid,
+ 'ts_approved'=>'now()',
+ );
+ try {$this->db->insert('dataorder',$data);} catch (Exception $e) {}
+ }else
+ {
+ $sql="update dataorder set onlineappid='$onlineappid',ts_approved=now() where id='{$row['id']}'";
+ try {$this->db->exec($sql);} catch (Exception $e) {}
+ }
+ }
+
+
+ $sql=$this->db->quoteInto("select * from dataset o left join metadata m on o.uuid=m.uuid left join mdstatus s on m.uuid=s.uuid where s.status>4 and m.datatype=0 and m.uuid=?",$uuid);
+ $data=$this->db->fetchRow($sql);
+ $updateftp=$updateftp1=false;
+ $this->view->md=$data;
+ $this->view->userpass=md5('westdc'.rand(1000,9999));
+ $this->view->ftptime=date('Y-m-d H:i:s', strtotime('+1 week'));
+ $sql=$this->db->quoteInto("select * from ftpuser where userid=?",$userid);
+ $row=$this->db->fetchRow($sql);
+ $datacount=$row['datacount'];
+ if ($data['host']=='ftp.westgis.ac.cn')
+ {
+ //添加FTP帐号信息以及时间控制信息
+ $updateftp=true;
+ $g6=new G6ftp();
+ $g6->db=$this->db;
+ //不进行判断,每个元数据中的下载地址都对应一个虚拟路径
+ $path[]=$data['path'];
+ $this->view->username='westdc'.$userid;
+ $uu=(object)array("id"=>$userid,
+ "username"=>$this->view->username,
+ "password"=>$this->view->userpass,
+ "path"=>$path,
+ "maxdata"=>$this->view->config->download->max,
+ "time"=>$this->view->ftptime,
+ "datacount"=>$datacount);
+ if ($g6->createuser($uu)) {
+ $this->view->userpass=$g6->pwd;
+ $this->view->ftptime=$g6->time;
+ } else {
+ $this->messenger->addMessage('错误:您正在进行下载的在线数据数已经超过系统允许的最大值,请在下面点击“完成”或“取消”对应的在线数据下载!');
+ $this->_redirect('/data/order');
+ }
+ } elseif ($data['host']=='ftp1.westgis.ac.cn')
+ {
+ //添加FTP1帐号信息以及时间控制信息
+ $proftp=new Proftp();
+ $proftp->db=$this->db;
+ //proftp离线用户名和g6的用户名稍有不同
+ $this->view->username='westdc_'.$userid;
+ $uu=(object)array("id"=>$userid,
+ "username"=>$this->view->username,
+ "password"=>$this->view->userpass,
+ "host"=>'ftp1.westgis.ac.cn',
+ "param"=>"onlineappid=".$onlineappid,
+ "maxdata"=>$this->view->config->download->max,
+ "time"=>$this->view->ftptime,
+ "datacount"=>$datacount);
+ if ($proftp->createuser($uu))
+ {
+ $this->view->userpass=$proftp->pwd;
+ $this->view->ftptime=$proftp->time;
+ }
+ } elseif ($data['host']=='ftp.sanjiangyuan.org.cn')
+ {
+ //添加FTP2帐号信息以及时间控制信息
+ $proftp=new Pureftp();
+ $proftp->db=$this->db;
+ $this->view->username='sjy_'.$userid;
+ $uu=(object)array("id"=>$userid,
+ "username"=>$this->view->username,
+ "password"=>$this->view->userpass,
+ "host"=>'ftp.sanjiangyuan.org.cn',
+ "param"=>"onlineappid=".$onlineappid,
+ "maxdata"=>$this->view->config->download->max,
+ "time"=>$this->view->ftptime,
+ "datacount"=>$datacount);
+ if ($proftp->createuser($uu))
+ {
+ $this->view->userpass=$proftp->pwd;
+ $this->view->ftptime=$proftp->time;
+ }
+ }
+ $ftpurl='ftp://'.$this->view->username.'@'.$data['host'];
+ if ($data['host']=='ftp.westgis.ac.cn') $ftpurl.=$data['path'];
+
+ //设置输出
+ //if ($updateftp || $updateftp1) $this->view->userpass=$password;
+ $this->view->ftpurl=$ftpurl;
+ //更新下载记录
+ //todo: 尝试添加一个RULE:若有对应数据存在,则不插入( userid,uuid,status=0,ts_approved:null)
+ /*$sql="select * from dataorder where userid=? and uuid=? and status=0 and (ts_approved is null)";
+ $u=$this->db->fetchRow($sql,array($userid,$uuid));
+ if (empty($u)) {
+ $sql="insert into dataorder (userid,uuid,ts_created) values(?,?,now())";
+ $this->db->query($sql,array($userid,$uuid));
+ }*/
+ if (!empty($ftpurl) && !$has_send_mail)
+ {
+ $data = array(
+ "uuid"=>$uuid,
+ "title"=>$this->view->md['title']."(".$this->view->md['filesize']."MB)",
+ "user"=>$user->username,
+ "ftpuser"=>$this->view->username,
+ "ftppwd"=>$this->view->userpass,
+ "ftptime"=>$this->view->ftptime,
+ "ftpurl"=>$this->view->ftpurl,
+ "note"=>$updateftp?'BTW:请注意登陆后要手工进入对应的目录!':''
+ );
+ $mailtp=new EmailText($this->db,'online-download',$data);
+ $mail=new WestdcMailer($this->view->config->smtp);
+ $mail->setBodyText($mailtp->getBody());
+ $mail->setFrom($this->view->config->service->email,'西部数据中心服务组');
+ $mail->addTo($user->email);
+ $mail->setSubject($mailtp->getSubject());
+ @$mail->send();
+ $sql="update onlineapp set has_send_mail=true where id=?";
+ $sth=$this->db->prepare($sql);
+ $sth->execute(array($onlineappid));
+ }
+ }
+ /*
+ * 离线申请(可以包括在线数据),在无数据参数时,则显示已有列表
+ */
+ function orderAction()
+ {
+ $this->view->pageID = "account-dataorder";
+ $ac = $this->_request->getParam('ac');
+
+ $uuid = $this->_request->getParam('uuid');
+
+ $del = $this->_request->getParam('del');
+ $apply = $this->_request->getParam('apply');
+ $finish = $this->_request->getParam('finish');
+ $cancel = $this->_request->getParam('cancel');
+ $wsn = $this->_request->getParam('wsn');
+ $pdf = $this->_request->getParam('pdf');
+ $selections = $this->_request->getParam('data');
+
+ //if (empty($uuid)) $this->_redirect('/data');
+ $userid = view::User('id');
+
+ //添加到数据篮
+ if ($uuid)
+ {
+ //存在历史遗留问题,原来的数据并不能保证唯一
+
+ $order = new Order();
+ $state = $order->addOrder($uuid);
+
+ if($state !== true)
+ {
+ if(!is_array($state))
+ {
+ $this->view->msg = view::Msg('alert-error',$state);
+ }else{
+ $service_type = $order->serviceTypeTest($state['service_type']);
+ if($service_type !== false)
+ {
+ view::Post($this,$service_type,$state['service_url']."?href=".urlencode(view::getHostLink()."/data/order/")."&uuid=".$state['uuid']."&uid=".$userid);
+ }else{
+ $this->view->msg = view::Msg('alert-error',"无法申请:此元数据的数据类型未知");
+ }
+ }
+ }else{
+ $this->view->msg = view::Msg('alert-success',"添加成功!您可以继续浏览数据或是继续提交申请表");
+ }
+
+ if (empty($ac)) $ac='offline1';
+
+ }
+
+ elseif ($selections)
+ {
+ if(empty($uuid))
+ {
+ $this->view->msg = view::Msg('alert-error',"无法申请:参数出错,请通过正确的途径访问");
+ }
+
+ $order = new Order();
+ $state = $order->addOrder($uuid,$selections);
+
+ if($state !== true)
+ {
+ $this->view->msg = view::Msg('alert-error',$state);
+ }else{
+ $this->view->msg = view::Msg('alert-success',"添加成功!您可以继续浏览数据或是继续提交申请表");
+ }
+
+ if (empty($ac)) $ac='offline1';
+ }
+
+ //删除申请
+ elseif ($del) {
+ $order = new Order();
+ $state = $order->del($del);
+ if($state !== true)
+ {
+ $this->view->msg = view::Msg('alert-error',$state);
+ }else{
+ $this->view->msg = view::Msg('alert-success',"数据申请取消成功");
+ }
+ $this->_redirect('/data/order');
+ }
+
+ //提交申请
+ elseif ($apply) {
+ if($apply == "all" || !is_numeric($apply))
+ {
+ $apply = -1;
+ }
+ $order = new Order();
+ $state = $order->apply($apply);
+ if($state !== true)
+ {
+ $this->view->msg = view::Msg('alert-error',$state);
+ }else{
+ $this->view->msg = view::Msg('alert-success',"提交成功,您可以点击“提交离线申请”来生成PDF申请表");
+ }
+ if (empty($ac)) $ac='offline2';
+ }
+
+ //完成
+ elseif ($finish) {
+ if ($finish=='all') {
+ $sql=$this->db->quoteInto("update dataorder set ts_approved=now() where status=0 and userid=?",$userid);
+ $this->db->query($sql);
+ $sql="update ftpuser set datacount=0 where userid=?";
+ $this->db->query($sql,array($userid));
+ } else {
+ $sql="update dataorder set ts_approved=now() where status=0 and userid=? and id=?";
+ $this->db->query($sql,array($userid,(int)$finish));
+ $sql="update ftpuser set datacount=datacount-1 where userid=? and datacount>0";
+ $this->db->query($sql,array($userid));
+ }
+ }
+
+ elseif($wsn)
+ {
+ $this->_helper->viewRenderer('order-wsn');
+
+ return true;
+ }
+
+ elseif ($cancel) {
+ if ($cancel=='all') {
+ $sql=$this->db->quoteInto("update dataorder set ts_approved=now(),status=-1 where status=0 and userid=?",$userid);
+ $this->db->query($sql);
+ $sql="update ftpuser set datacount=0 where userid=?";
+ $this->db->query($sql,array($userid));
+ } else {
+ $sql="update dataorder set ts_approved=now(),status=-1 where status in (0,1,2) and userid=? and id=?";
+ $this->db->query($sql,array($userid,(int)$cancel));
+ $sql="update ftpuser set datacount=datacount-1 where userid=? and datacount>0";
+ $this->db->query($sql,array($userid));
+ }
+ if (empty($ac)) $ac='offline2';
+ }
+
+ //生成PDF离线申请文件
+ elseif ($pdf) {
+
+ //用户信息可以从SESSION中读取?离线申请信息
+ //$sql="select * from users where id=?";
+ $order = new Order();
+ $rows = $order->getOrderItemForPdf();
+ $this->view->projectType = $order->projectType;
+
+ if ($rows) {
+ $this->_helper->viewRenderer('pdf');
+
+ $this->view->data2 = $rows;
+
+ if ($this->_request->isPost()) {
+
+ $this->view->formData = $formData = $this->_request->getPost();
+
+ $datalist='';
+ foreach($rows as $i=>$row)
+ {
+ $datalist.=($i+1).". ".$row['title'].";";
+ }
+ $formData['datalist'] = $datalist;
+
+ if (@$formData['save']) {
+
+ $order->setPdfData($rows);
+
+ $s = $order->SaveOrder($formData);
+
+ if($s !== true)
+ {
+ $this->view->error = view::Msg('alert-error',$s);
+ return true;
+ }
+
+ //不能修改顺序
+ $this->_helper->layout->disableLayout();
+ $this->_helper->viewRenderer->setNoRender();
+
+ return true;
+ } elseif ($formData['submit']) {
+ //生成PDF
+ $order->setPdfData($rows);
+ $s = $order->SubmitOrder($formData);
+
+ if($s !== true)
+ {
+ $this->view->error = view::Msg('alert-error',$s);
+ return true;
+ }
+
+ $this->view->msg = view::Msg('alert-success','提示信息:您的离线申请已经提交,请在线上传PDF的签字版PDF文件。',0);
+ if (empty($ac)) $ac='offline3';
+ }
+ } else {
+ $sql="select u.* from users u left join offlineapp o on u.id=o.userid where u.id=? ORDER BY o.id DESC";
+ $row=$this->db->fetchRow($sql,array($userid));
+ $this->view->formData = $row;
+ }
+ } else{
+ $this->view->msg=view::Msg('alert-error',"错误:您还没有提交任何离线申请的数据,或您的数据申请已经提交(等待处理过程中)!",0);
+ }
+ return true;
+ }//pdf
+
+ if($ac == "commitapplicationform")
+ {
+ $offlineappid = $this->_getParam('offlineappid');
+
+ if(!is_numeric($offlineappid) || $offlineappid < 1)
+ {
+ view::Post($this,"参数错误",-1);
+ return true;
+ }
+
+ $order = new Order();
+ $status = $order->commitApplicationForm($offlineappid);
+
+ if( $status !== true)
+ {
+ view::Post($this,$status,-1);
+ }else{
+ view::Post($this,"申请已提交,请等待管理员接收并通过数据所有者审核",'/data/order/ac/offline3');
+ }
+
+ return true;
+ }
+
+ //index
+ $this->view->ac = $ac;
+ $this->_helper->viewRenderer('order');
+ if ($ac=='' || $ac=='online')
+ {
+ $this->view->tabID='order-online';
+ } else if ($ac=='offline1') {
+ $this->view->tabID='order-offline1';
+ } else if ($ac=='offline2') {
+ $this->view->tabID='order-offline2';
+ } else if ($ac=='offline3') {
+ $this->view->tabID='order-offline3';
+ } else if ($ac=='offline4') {
+ $this->view->tabID='order-offline4';
+ }
+ //显示已经申请的数据,包括已经提交的申请和未提交的申请,还有已经处理完成的申请,正在进行的在线数据下载
+ $sql="select d.*,m.title,m.datatype,off.applicationform from dataorder d
+ left join metadata m on d.uuid=m.uuid
+ left join offlineapp off ON off.id = d.offlineappid
+ where d.userid=? order by d.status,d.ts_created desc";
+ $rows=$this->db->fetchAll($sql,array($userid));
+
+ $showorders = array();
+ $counts = array(
+ 'onlineapp' => 0,
+ 'offline1' => 0,
+ 'offline2' => 0,
+ 'offline3' => 0,
+ 'offline4' => 0
+ );
+
+ if(count($rows) > 0) {
+ foreach($rows as $k=>$v)
+ {
+ switch($v['status']) {
+ case 0:
+ $counts['onlineapp'] ++;
+ break;
+ case 1:
+ $counts['offline1'] ++;
+ break;
+ case 2:
+ $counts['offline2'] ++;
+ break;
+ case 3:
+ $counts['offline3'] ++;
+ break;
+ case 4:
+ $counts['offline3'] ++;
+ break;
+ case 5:
+ $counts['offline4'] ++;
+ break;
+ }
+ switch($ac){
+ default :
+ if($v['status'] == 0 && !empty($v['ts_approved']))$showorders[] = $rows[$k];
+ break;
+ case 'online' :
+ if($v['status'] == 0 && !empty($v['ts_approved']))$showorders[] = $rows[$k];
+ break;
+ case 'offline1' :
+ if($v['status'] == 1) $showorders[] = $rows[$k];
+ break;
+ case 'offline2' :
if($v['status'] == 2)
{
- $showorders[] = $rows[$k];
- $this->view->offlineappid = $v['offlineappid'];
- $this->view->applicationform = $v['applicationform'];
+ $showorders[] = $rows[$k];
+ $this->view->offlineappid = $v['offlineappid'];
+ $this->view->applicationform = $v['applicationform'];
$this->view->offlineappstatus = $v['status'];
- }
- break;
- case 'offline3' :
+ }
+ break;
+ case 'offline3' :
if($v['status'] == 3 || $v['status'] == 4)
{
- $showorders[] = $rows[$k];
- $this->view->offlineappid = $v['offlineappid'];
- $this->view->applicationform = $v['applicationform'];
+ $showorders[] = $rows[$k];
+ $this->view->offlineappid = $v['offlineappid'];
+ $this->view->applicationform = $v['applicationform'];
$this->view->offlineappstatus = $v['status'];
- }
- break;
- case 'offline4' :
- if($v['status'] == 5) $showorders[] = $rows[$k];
- break;
- }
- }
- }
-
- $this->view->counts = $counts;
- view::addPaginator($showorders,$this,10);
-
- }
-
- /*
- * 查看数据缩略图
- */
- function thumbAction()
- {
- $page=(int)$this->_request->getParam('page');
- if (empty($page)) $page=1;
- $offset=$this->limit*($page-1);
- $state=$this->db->query("select count(*) from normalmetadata");
- $row=$state->fetchAll();
- $sum=$row[0]['count'];
- $select=$this->db->select();
- $select->from('normalmetadata as m','m.*')
- ->order('m.title desc')->limitPage($page,9);
- $this->view->metadata = $this->db->fetchAll($select);
- $this->view->page=new Pagination($sum,$page,$this->limit);
- }
-
- /*
- *附件下载
- */
- function attachAction(){
-
- $uuid = $this->_request->getParam('uuid');
-
- if(!empty($uuid))
- {
-
- $sql="select * from mdattach m left join attachments a on m.id=a.id where m.uuid='$uuid'";
- $re=$this->db->query($sql);
- $atts = $re->fetch();
-
- if(empty($atts['id']))
- {
- $this->_redirect("/data/$uuid");
- }//没有附件
-
- $auth = Zend_Auth::getInstance();
- if($auth->hasIdentity())
- {
- /*
- $user = $auth->getIdentity();
- $userid = $user->id;
- $sql = "select d.* from dataorder d
- left join users u on u.id=d.userid
- left join metadata m on m.uuid=d.uuid
- where (d.status=5 and d.userid='$userid' and d.uuid='$uuid') or u.usertype='administrator'";
- $re= $this->db->query($sql);
- $row=$re->fetch();
- if(!empty($row['uuid']))
- {
- $this->messenger->addMessage('您没有权限下载该附件');
- $this->_redirect("/data");
- }
- else
- {*/
- //由于涉及多个文件下载,所以将附件添加到zip压缩文件再输出
-
- $sql="select * from mdattach m left join attachments a on m.id=a.id where m.uuid='$uuid'";
- $re=$this->db->query($sql);
- $atts = $re->fetchAll();
-
- $zip = new ZipArchive();
- $url=$this->view->config->upload."tmp/attachments_$uuid.zip";//创建临时文件
- $opened=$zip->open($url, ZIPARCHIVE::CREATE | ZIPARCHIVE::OVERWRITE);
- if( $opened !== true ){
- die("cannot open {$url} for writing.");
- }
-
- $updates = array(); //统计被下载的附件ID
-
- foreach ($atts as $k=>$v)
- {
- if (is_file($this->view->config->upload.$v['filename'])) {
- $updates[]=$v['id'];
- $zip->addFile($this->view->config->upload.$v['filename'],'/'.basename($v['filename']));
- }
- }
- $zip->close();
-
- //更新统计
- $ids=join(',',$updates);
- $sql = "update attachments set downtimes=downtimes+1 where id in ($ids)";
- @$this->db->exec($sql);
-
-
- //输出下载
- $content=file_get_contents($url);
- $this->_helper->layout->disableLayout();
- $this->_helper->viewRenderer->setNoRender();
- $this->getResponse()->setHeader('Content-Type', 'application/octet-stream')
- ->setHeader('Content-Disposition','attachment; filename="'.basename($url).'"')
- ->setHeader('Content-Length', strlen($content))
- ->setHeader('Content-Type','application/force-download')
- ->setHeader('Content-Type','application/download')
- ->setHeader('Content-Type','application/zip')
- ->setHeader('Content-Description','File Transfer')
- ->setHeader('Content-Transfer-Encoding','binary')
- ->setHeader('Expires',0)
- ->setHeader('Cache-Control','must-revalidate, post-check=0, pre-check=0')
- ->setHeader('Pragma','public')
- ->setBody($content);
- // }
- }//end if
- else
- {
- $this->messenger->addMessage('您没有权限下载该附件');
- $this->_redirect("/data/$uuid");
- }//未登陆
- }//end if
- else
- {
- $this->messenger->addMessage('您没有权限下载该附件');
- $this->_redirect("/data/$uuid");
- }//无权限
-
- }
-
-
- /*
- * 西部计划项目及其数据产出
- */
- public function westeeAction()
- {
- //$sql="select w.*,m.uuid from westee w left join westeemd m on w.id=m.eeid order by w.id";
- $sql="select * from westee order by id";
- $this->view->westee=$this->db->fetchAll($sql);
- $sql="select w.eeid,m.title,m.uuid from westeemd w left join metadata m on w.uuid=m.uuid order by w.eeid";
- $this->view->westeemd=$this->db->fetchAll($sql);
- }
-
- public function pingbackAction()
- {
- $this->_helper->ViewRenderer->setNoRender();
- $this->_helper->layout->disableLayout();
- $server = new Zend_XmlRpc_Server();
- $server->setClass('PingbackRpc', 'pingback');
- echo $server->handle();
- }
-
- public function pingtestAction()
- {
- $this->_helper->ViewRenderer->setNoRender();
- $this->_helper->layout->disableLayout();
- $client = new Zend_XmlRpc_Client('http://test.westgis.ac.cn/data/pingback');
- $arg1 = 'http://wlx.westgis.ac.cn/567/';
- $arg2 = 'http://test.westgis.ac.cn/data/487591d0-d437-4114-b810-cbef7c4ee4b2';
- //$result = $client->call('pingback.ping', array($arg1, $arg2));
- $test = $client->getProxy('pingback');
- $test->ping($arg1,$arg2);
- //var_dump($result);
- }
- public function outputAction()
- {
- $this->_helper->layout->disableLayout();
- $this->_helper->viewRenderer->setNoRender();
- $sql="select title,datatype,filesize,id from normalmetadata";
- $md=$this->db->fetchAll($sql);
- foreach($md as $m)
- {
- print $m["title"].",";
- print ($m["datatype"]?"内部":"公开").",";
- print ($m["filesize"]==1?" ":$m["filesize"]).",";
- $sql1="select keyword from keyword where id=".$m["id"]." and keytype='place'";
- $kd=$this->db->fetchAll($sql1);
- foreach ($kd as $p) print $p["keyword"]." ";
- print ",";
- $sql1="select keyword from keyword where id=".$m["id"]." and keytype='temporal'";
- $kd=$this->db->fetchAll($sql1);
- foreach ($kd as $p) print $p["keyword"]." ";
- print ",";
- print "
";
- }
-
- }
-
-
- public function jsonexit($data){
- $this->getResponse()->setHeader('Content-Type', 'application/json')->appendBody(json_encode($data,JSON_NUMERIC_CHECK));
- return true;
- }
- function organizationAction()
- {
- $page = $this->_request->getParam('page');
- $name = $this->_request->getParam('name');
- $state=$this->db->query("select distinct responsible.organisation from responsible left join role on role.resid=responsible.id where role.role in ('pointOfContact','resourceProvider','owner')");
- $this->view->organisation=$state->fetchAll();
- if (!empty($name)) {
- $this->view->codename=$name;
- $sql="select distinct m.* from normalmetadata m left join role r on m.uuid=r.uuid left join responsible s on r.resid=s.id where r.role in ('pointOfContact','resourceProvider','owner') and s.organisation=?";
- $sth = $this->db->prepare($sql);
- $sth->execute(array($name));
- $rows = $sth->fetchAll();
- $paginator = Zend_Paginator::factory($rows);
- $paginator->setCurrentPageNumber($this->_getParam('page'));
- $paginator->setItemCountPerPage(10);
- $paginator->setView($this->view);
- Zend_View_Helper_PaginationControl::setDefaultViewPartial('pagination_param.phtml');
- $this->view->paginator=$paginator;
- } else {
- //提供全部分类列表
- }
- }
- function fundAction()
- {
- $id = (int)$this->_request->getParam('id');
- if (!empty($id)) {
- $sql="select * from fund where id=?";
- $this->view->fund=$this->db->fetchRow($sql,array($id));
- if ($this->view->fund) {
- $sql="select distinct m.* from normalmetadata m left join mdfund mf on m.uuid=mf.uuid where mf.fid=?";
- $sth = $this->db->prepare($sql);
- $sth->execute(array($id));
- $rows = $sth->fetchAll();
- $paginator = Zend_Paginator::factory($rows);
- $paginator->setCurrentPageNumber($this->_getParam('page'));
- $paginator->setItemCountPerPage(10);
- $paginator->setView($this->view);
- Zend_View_Helper_PaginationControl::setDefaultViewPartial('pagination_param.phtml');
- $this->view->paginator=$paginator;
- }
- } else {
- //提供全部分类列表
- $sql="select f.id,f.title,f.fund_id,f.fund_type,f.ts_created,count(m.id) as datacount,sum(md.filesize) as filesize from fund f left join mdfund m on f.id=m.fid left join metadata md on m.uuid=md.uuid where m.id is not null group by f.id,f.title,f.fund_id,f.fund_type,f.ts_created order by datacount desc,f.ts_created desc";
- $sth = $this->db->prepare($sql);
- $sth->execute();
- $rows = $sth->fetchAll();
- $paginator = Zend_Paginator::factory($rows);
- $paginator->setCurrentPageNumber($this->_getParam('page'));
- $paginator->setItemCountPerPage(10);
- $paginator->setView($this->view);
- Zend_View_Helper_PaginationControl::setDefaultViewPartial('pagination_param.phtml');
- $this->view->paginator=$paginator;
- $this->_helper->viewRenderer('fund-list');
- }
- }
-
- //实现基于DOI信息的浏览
- function doiAction()
- {
- $ac = $this->_request->getParam('ac');
- if ($ac=='unready') {
- //列出没有DOI的数据
- $sql="select m.* from normalmetadata m where length(m.doi)<3 and m.uuid not in (select uuid from datadoi) order by m.ts_created desc";
- $this->view->pageID='doi-unready';
- } else if ($ac=='prepare') {
- //列出有DOI但还未进行提交申请的数据
- $sql="select m.* from normalmetadata m where length(m.doi)>3 and m.uuid not in (select uuid from datadoi) order by m.ts_created desc";
- $this->view->pageID='doi-prepare';
- } else if ($ac=='unsubmit') {
- //列出有DOI并计划提交申请的数据
- $sql="select m.*,d.doi as datadoi,date(d.ts_created) as ts_created from normalmetadata m left join datadoi d on m.uuid=d.uuid where length(m.doi)>3 and d.ts_created is not null and d.ts_submitted is null order by d.ts_created desc";
- $this->view->pageID='doi-unsubmit';
- } else if ($ac=='submit') {
- //列出有DOI并计划提交申请的数据
- $sql="select m.*,d.doi as datadoi,date(d.ts_submitted) as ts_submitted from normalmetadata m left join datadoi d on m.uuid=d.uuid where length(m.doi)>3 and d.ts_submitted is not null and d.ts_published is null order by d.ts_submitted desc,d.ts_created desc";
- $this->view->pageID='doi-submit';
- } else if ($ac=='publish' || empty($ac)) {
- //默认:列出最新发布的DOI数据
- $sql="select m.*,d.doi as datadoi,date(d.ts_submitted) as ts_submitted,date(d.ts_published) as ts_published from normalmetadata m left join datadoi d on m.uuid=d.uuid where length(m.doi)>3 and d.ts_published is not null order by d.ts_published desc,d.ts_submitted desc,d.ts_created desc";
- $this->view->pageID='doi-publish';
- }
- $sth = $this->db->prepare($sql);
- $sth->execute();
- $rows = $sth->fetchAll();
- $paginator = Zend_Paginator::factory($rows);
- $paginator->setCurrentPageNumber($this->_getParam('page'));
- $paginator->setItemCountPerPage(10);
- $paginator->setView($this->view);
- Zend_View_Helper_PaginationControl::setDefaultViewPartial('pagination_param.phtml');
- $this->view->paginator=$paginator;
- }
-
- //基于数据作者的浏览(包括认证后的数据作者以及未认证的数据作者)
- function authorAction()
- {
- $ac = $this->_request->getParam('ac');
- $id = (int)$this->_request->getParam('id');
- if ($ac=='verified') {
- //已经认证过的数据作者
- $this->view->pageID='author-verified';
- $this->view->ac='verified';
- if ($id) {
- //列出作者的数据
- $sql="select username,realname from users where id=?";
- $this->view->author=$this->db->fetchRow($sql,array($id));
- $sql="select m.* from normalmetadata m left join mdauthor a on a.uuid=m.uuid where a.userid=?";
- $sth = $this->db->prepare($sql);
- $sth->execute(array($id));
- $rows = $sth->fetchAll();
- $paginator = Zend_Paginator::factory($rows);
- $paginator->setCurrentPageNumber($this->_getParam('page'));
- $paginator->setItemCountPerPage(10);
- $paginator->setView($this->view);
- Zend_View_Helper_PaginationControl::setDefaultViewPartial('pagination_param.phtml');
- $this->view->paginator=$paginator;
- } else {
- //已经认证过的数据作者
- $sql="select u.username,u.realname,u.id,count(u.id) as count from mdauthor a left join users u on a.userid=u.id where a.status=1 and a.uuid in (select uuid from normalmetadata) group by u.id,u.username,u.realname";
- $sth = $this->db->prepare($sql);
- $sth->execute();
- $rows = $sth->fetchAll();
- $paginator = Zend_Paginator::factory($rows);
- $paginator->setCurrentPageNumber($this->_getParam('page'));
- $paginator->setItemCountPerPage(50);
- $paginator->setView($this->view);
- Zend_View_Helper_PaginationControl::setDefaultViewPartial('pagination_param.phtml');
- $this->view->paginator=$paginator;
- }
- } else if ($ac=='unverified' || empty($ac)) {
- //未认证的数据作者
- $this->view->pageID='author-unverified';
- $this->view->ac='unverified';
- if ($id) {
- //列出数据
- $sql="select individual as username from responsible where id=?";
- $this->view->author=$this->db->fetchRow($sql,array($id));
- $sql="select distinct m.* from normalmetadata m left join role r on m.uuid=r.uuid left join responsible s on r.resid=s.id where r.role in ('pointOfContact','resourceProvider','owner') and s.id=?";
- $sth = $this->db->prepare($sql);
- $sth->execute(array($id));
- $rows = $sth->fetchAll();
- $paginator = Zend_Paginator::factory($rows);
- $paginator->setCurrentPageNumber($this->_getParam('page'));
- $paginator->setItemCountPerPage(10);
- $paginator->setView($this->view);
- Zend_View_Helper_PaginationControl::setDefaultViewPartial('pagination_param.phtml');
- $this->view->paginator=$paginator;
- } else {
- //列出所有作者
- $sql="select distinct responsible.individual as username,responsible.id from responsible left join role on role.resid=responsible.id where role.role in ('pointOfContact','resourceProvider','owner')";
- $sth = $this->db->prepare($sql);
- $sth->execute();
- $rows = $sth->fetchAll();
- $paginator = Zend_Paginator::factory($rows);
- $paginator->setCurrentPageNumber($this->_getParam('page'));
- $paginator->setItemCountPerPage(50);
- $paginator->setView($this->view);
- Zend_View_Helper_PaginationControl::setDefaultViewPartial('pagination_param.phtml');
- $this->view->paginator=$paginator;
- }
- }
- }
-
- function listAction()
- {
- $sql="select m.uuid,m.title,m.citation,m.doi,d.doi as datadoi,d.ts_published,d.authors,d.publisher,date_part('year',d.ts_published) as publish_year from normalmetadata m
-left join mdstatus s on m.uuid=s.uuid
-left join datadoi d on d.uuid=m.uuid
-where s.status>4
-and m.uuid not in
-(select d.uuid from datasource d left join source s on d.sourceid=s.id
-where s.code in ('heihe','water','hiwater','westee'))
-order by m.title";
- $this->view->metadata=$this->db->fetchAll($sql);
- $sql="select m.uuid,m.title,m.citation,m.doi,d.doi as datadoi,d.ts_published,d.authors,d.publisher,date_part('year',d.ts_published) as publish_year
- from normalmetadata m left join datadoi d on d.uuid=m.uuid left join mdstatus s on m.uuid=s.uuid where s.status>4 and m.title like '黑河综合遥感联合试验%' order by title";
- $this->view->water=$this->db->fetchAll($sql);
- $sql="select m.uuid,m.title,m.citation ,m.doi,d.doi as datadoi,d.ts_published,d.authors,d.publisher,date_part('year',d.ts_published) as publish_year
- from normalmetadata m left join datadoi d on d.uuid=m.uuid left join mdstatus s on m.uuid=s.uuid where s.status>0 and m.title like '黑河生态水文遥感试验%' order by title";
- $this->view->hiwater=$this->db->fetchAll($sql);
- $sql="select m.uuid,m.title,m.citation ,m.doi,d.doi as datadoi,d.ts_published,d.authors,d.publisher,date_part('year',d.ts_published) as publish_year
- from normalmetadata m left join datadoi d on d.uuid=m.uuid left join mdstatus s on m.uuid=s.uuid left join datasource ds on ds.uuid=m.uuid left join source sr on ds.sourceid=sr.id where sr.code='heihe' and s.status>0 and m.title not like '黑河生态水文遥感试验%' order by title";
- $this->view->heihe=$this->db->fetchAll($sql);
- $sql="select m.uuid,m.title,m.citation ,m.doi,d.doi as datadoi,d.ts_published,d.authors,d.publisher,date_part('year',d.ts_published) as publish_year
- from normalmetadata m left join datadoi d on d.uuid=m.uuid left join mdstatus s on m.uuid=s.uuid left join datasource ds on ds.uuid=m.uuid left join source sr on ds.sourceid=sr.id where sr.code='westee' and s.status>4 order by title";
- $this->view->westee=$this->db->fetchAll($sql);
-
- }
-}
-
+ }
+ break;
+ case 'offline4' :
+ if($v['status'] == 5) $showorders[] = $rows[$k];
+ break;
+ }
+ }
+ }
+
+ $this->view->counts = $counts;
+ view::addPaginator($showorders,$this,10);
+
+ }
+
+ /*
+ * 查看数据缩略图
+ */
+ function thumbAction()
+ {
+ $page=(int)$this->_request->getParam('page');
+ if (empty($page)) $page=1;
+ $offset=$this->limit*($page-1);
+ $state=$this->db->query("select count(*) from normalmetadata");
+ $row=$state->fetchAll();
+ $sum=$row[0]['count'];
+ $select=$this->db->select();
+ $select->from('normalmetadata as m','m.*')
+ ->order('m.title desc')->limitPage($page,9);
+ $this->view->metadata = $this->db->fetchAll($select);
+ $this->view->page=new Pagination($sum,$page,$this->limit);
+ }
+
+ /*
+ *附件下载
+ */
+ function attachAction(){
+
+ $uuid = $this->_request->getParam('uuid');
+
+ if(!empty($uuid))
+ {
+
+ $sql="select * from mdattach m left join attachments a on m.id=a.id where m.uuid='$uuid'";
+ $re=$this->db->query($sql);
+ $atts = $re->fetch();
+
+ if(empty($atts['id']))
+ {
+ $this->_redirect("/data/$uuid");
+ }//没有附件
+
+ $auth = Zend_Auth::getInstance();
+ if($auth->hasIdentity())
+ {
+ /*
+ $user = $auth->getIdentity();
+ $userid = $user->id;
+ $sql = "select d.* from dataorder d
+ left join users u on u.id=d.userid
+ left join metadata m on m.uuid=d.uuid
+ where (d.status=5 and d.userid='$userid' and d.uuid='$uuid') or u.usertype='administrator'";
+ $re= $this->db->query($sql);
+ $row=$re->fetch();
+ if(!empty($row['uuid']))
+ {
+ $this->messenger->addMessage('您没有权限下载该附件');
+ $this->_redirect("/data");
+ }
+ else
+ {*/
+ //由于涉及多个文件下载,所以将附件添加到zip压缩文件再输出
+
+ $sql="select * from mdattach m left join attachments a on m.id=a.id where m.uuid='$uuid'";
+ $re=$this->db->query($sql);
+ $atts = $re->fetchAll();
+
+ $zip = new ZipArchive();
+ $url=$this->view->config->upload."tmp/attachments_$uuid.zip";//创建临时文件
+ $opened=$zip->open($url, ZIPARCHIVE::CREATE | ZIPARCHIVE::OVERWRITE);
+ if( $opened !== true ){
+ die("cannot open {$url} for writing.");
+ }
+
+ $updates = array(); //统计被下载的附件ID
+
+ foreach ($atts as $k=>$v)
+ {
+ if (is_file($this->view->config->upload.$v['filename'])) {
+ $updates[]=$v['id'];
+ $zip->addFile($this->view->config->upload.$v['filename'],'/'.basename($v['filename']));
+ }
+ }
+ $zip->close();
+
+ //更新统计
+ $ids=join(',',$updates);
+ $sql = "update attachments set downtimes=downtimes+1 where id in ($ids)";
+ @$this->db->exec($sql);
+
+
+ //输出下载
+ $content=file_get_contents($url);
+ $this->_helper->layout->disableLayout();
+ $this->_helper->viewRenderer->setNoRender();
+ $this->getResponse()->setHeader('Content-Type', 'application/octet-stream')
+ ->setHeader('Content-Disposition','attachment; filename="'.basename($url).'"')
+ ->setHeader('Content-Length', strlen($content))
+ ->setHeader('Content-Type','application/force-download')
+ ->setHeader('Content-Type','application/download')
+ ->setHeader('Content-Type','application/zip')
+ ->setHeader('Content-Description','File Transfer')
+ ->setHeader('Content-Transfer-Encoding','binary')
+ ->setHeader('Expires',0)
+ ->setHeader('Cache-Control','must-revalidate, post-check=0, pre-check=0')
+ ->setHeader('Pragma','public')
+ ->setBody($content);
+ // }
+ }//end if
+ else
+ {
+ $this->messenger->addMessage('您没有权限下载该附件');
+ $this->_redirect("/data/$uuid");
+ }//未登陆
+ }//end if
+ else
+ {
+ $this->messenger->addMessage('您没有权限下载该附件');
+ $this->_redirect("/data/$uuid");
+ }//无权限
+
+ }
+
+
+ /*
+ * 西部计划项目及其数据产出
+ */
+ public function westeeAction()
+ {
+ //$sql="select w.*,m.uuid from westee w left join westeemd m on w.id=m.eeid order by w.id";
+ $sql="select * from westee order by id";
+ $this->view->westee=$this->db->fetchAll($sql);
+ $sql="select w.eeid,m.title,m.uuid from westeemd w left join metadata m on w.uuid=m.uuid order by w.eeid";
+ $this->view->westeemd=$this->db->fetchAll($sql);
+ }
+
+ public function pingbackAction()
+ {
+ $this->_helper->ViewRenderer->setNoRender();
+ $this->_helper->layout->disableLayout();
+ $server = new Zend_XmlRpc_Server();
+ $server->setClass('PingbackRpc', 'pingback');
+ echo $server->handle();
+ }
+
+ public function pingtestAction()
+ {
+ $this->_helper->ViewRenderer->setNoRender();
+ $this->_helper->layout->disableLayout();
+ $client = new Zend_XmlRpc_Client('http://test.westgis.ac.cn/data/pingback');
+ $arg1 = 'http://wlx.westgis.ac.cn/567/';
+ $arg2 = 'http://test.westgis.ac.cn/data/487591d0-d437-4114-b810-cbef7c4ee4b2';
+ //$result = $client->call('pingback.ping', array($arg1, $arg2));
+ $test = $client->getProxy('pingback');
+ $test->ping($arg1,$arg2);
+ //var_dump($result);
+ }
+ public function outputAction()
+ {
+ $this->_helper->layout->disableLayout();
+ $this->_helper->viewRenderer->setNoRender();
+ $sql="select title,datatype,filesize,id from normalmetadata";
+ $md=$this->db->fetchAll($sql);
+ foreach($md as $m)
+ {
+ print $m["title"].",";
+ print ($m["datatype"]?"内部":"公开").",";
+ print ($m["filesize"]==1?" ":$m["filesize"]).",";
+ $sql1="select keyword from keyword where id=".$m["id"]." and keytype='place'";
+ $kd=$this->db->fetchAll($sql1);
+ foreach ($kd as $p) print $p["keyword"]." ";
+ print ",";
+ $sql1="select keyword from keyword where id=".$m["id"]." and keytype='temporal'";
+ $kd=$this->db->fetchAll($sql1);
+ foreach ($kd as $p) print $p["keyword"]." ";
+ print ",";
+ print "
";
+ }
+
+ }
+
+
+ public function jsonexit($data){
+ $this->getResponse()->setHeader('Content-Type', 'application/json')->appendBody(json_encode($data,JSON_NUMERIC_CHECK));
+ return true;
+ }
+
+ public function organizationAction()
+ {
+ $page = $this->_request->getParam('page');
+ $name = $this->_request->getParam('name');
+ $state=$this->db->query("select distinct responsible.organisation from responsible left join role on role.resid=responsible.id where role.role in ('pointOfContact','resourceProvider','owner')");
+ $this->view->organisation=$state->fetchAll();
+ if (!empty($name)) {
+ $this->view->codename=$name;
+ $sql="select distinct m.* from normalmetadata m left join role r on m.uuid=r.uuid left join responsible s on r.resid=s.id where r.role in ('pointOfContact','resourceProvider','owner') and s.organisation=?";
+ $sth = $this->db->prepare($sql);
+ $sth->execute(array($name));
+ $rows = $sth->fetchAll();
+ $paginator = Zend_Paginator::factory($rows);
+ $paginator->setCurrentPageNumber($this->_getParam('page'));
+ $paginator->setItemCountPerPage(10);
+ $paginator->setView($this->view);
+ Zend_View_Helper_PaginationControl::setDefaultViewPartial('pagination_param.phtml');
+ $this->view->paginator=$paginator;
+ } else {
+ //提供全部分类列表
+ }
+ }
+ function fundAction()
+ {
+ $id = (int)$this->_request->getParam('id');
+ if (!empty($id)) {
+ $sql="select * from fund where id=?";
+ $this->view->fund=$this->db->fetchRow($sql,array($id));
+ if ($this->view->fund) {
+ $sql="select distinct m.* from normalmetadata m left join mdfund mf on m.uuid=mf.uuid where mf.fid=?";
+ $sth = $this->db->prepare($sql);
+ $sth->execute(array($id));
+ $rows = $sth->fetchAll();
+ $paginator = Zend_Paginator::factory($rows);
+ $paginator->setCurrentPageNumber($this->_getParam('page'));
+ $paginator->setItemCountPerPage(10);
+ $paginator->setView($this->view);
+ Zend_View_Helper_PaginationControl::setDefaultViewPartial('pagination_param.phtml');
+ $this->view->paginator=$paginator;
+ }
+ } else {
+ //提供全部分类列表
+ $sql="select f.id,f.title,f.fund_id,f.fund_type,f.ts_created,count(m.id) as datacount,sum(md.filesize) as filesize from fund f left join mdfund m on f.id=m.fid left join metadata md on m.uuid=md.uuid where m.id is not null group by f.id,f.title,f.fund_id,f.fund_type,f.ts_created order by datacount desc,f.ts_created desc";
+ $sth = $this->db->prepare($sql);
+ $sth->execute();
+ $rows = $sth->fetchAll();
+ $paginator = Zend_Paginator::factory($rows);
+ $paginator->setCurrentPageNumber($this->_getParam('page'));
+ $paginator->setItemCountPerPage(10);
+ $paginator->setView($this->view);
+ Zend_View_Helper_PaginationControl::setDefaultViewPartial('pagination_param.phtml');
+ $this->view->paginator=$paginator;
+ $this->_helper->viewRenderer('fund-list');
+ }
+ }
+
+ //实现基于DOI信息的浏览
+ function doiAction()
+ {
+ $ac = $this->_request->getParam('ac');
+ if ($ac=='unready') {
+ //列出没有DOI的数据
+ $sql="select m.* from normalmetadata m where length(m.doi)<3 and m.uuid not in (select uuid from datadoi) order by m.ts_created desc";
+ $this->view->pageID='doi-unready';
+ } else if ($ac=='prepare') {
+ //列出有DOI但还未进行提交申请的数据
+ $sql="select m.* from normalmetadata m where length(m.doi)>3 and m.uuid not in (select uuid from datadoi) order by m.ts_created desc";
+ $this->view->pageID='doi-prepare';
+ } else if ($ac=='unsubmit') {
+ //列出有DOI并计划提交申请的数据
+ $sql="select m.*,d.doi as datadoi,date(d.ts_created) as ts_created from normalmetadata m left join datadoi d on m.uuid=d.uuid where length(m.doi)>3 and d.ts_created is not null and d.ts_submitted is null order by d.ts_created desc";
+ $this->view->pageID='doi-unsubmit';
+ } else if ($ac=='submit') {
+ //列出有DOI并计划提交申请的数据
+ $sql="select m.*,d.doi as datadoi,date(d.ts_submitted) as ts_submitted from normalmetadata m left join datadoi d on m.uuid=d.uuid where length(m.doi)>3 and d.ts_submitted is not null and d.ts_published is null order by d.ts_submitted desc,d.ts_created desc";
+ $this->view->pageID='doi-submit';
+ } else if ($ac=='publish' || empty($ac)) {
+ //默认:列出最新发布的DOI数据
+ $sql="select m.*,d.doi as datadoi,date(d.ts_submitted) as ts_submitted,date(d.ts_published) as ts_published from normalmetadata m left join datadoi d on m.uuid=d.uuid where length(m.doi)>3 and d.ts_published is not null order by d.ts_published desc,d.ts_submitted desc,d.ts_created desc";
+ $this->view->pageID='doi-publish';
+ }
+ $sth = $this->db->prepare($sql);
+ $sth->execute();
+ $rows = $sth->fetchAll();
+ $paginator = Zend_Paginator::factory($rows);
+ $paginator->setCurrentPageNumber($this->_getParam('page'));
+ $paginator->setItemCountPerPage(10);
+ $paginator->setView($this->view);
+ Zend_View_Helper_PaginationControl::setDefaultViewPartial('pagination_param.phtml');
+ $this->view->paginator=$paginator;
+ }
+
+ //基于数据作者的浏览(包括认证后的数据作者以及未认证的数据作者)
+ function authorAction()
+ {
+ $ac = $this->_request->getParam('ac');
+ $id = (int)$this->_request->getParam('id');
+ if ($ac=='verified') {
+ //已经认证过的数据作者
+ $this->view->pageID='author-verified';
+ $this->view->ac='verified';
+ if ($id) {
+ //列出作者的数据
+ $sql="select username,realname from users where id=?";
+ $this->view->author=$this->db->fetchRow($sql,array($id));
+ $sql="select m.* from normalmetadata m left join mdauthor a on a.uuid=m.uuid where a.userid=?";
+ $sth = $this->db->prepare($sql);
+ $sth->execute(array($id));
+ $rows = $sth->fetchAll();
+ $paginator = Zend_Paginator::factory($rows);
+ $paginator->setCurrentPageNumber($this->_getParam('page'));
+ $paginator->setItemCountPerPage(10);
+ $paginator->setView($this->view);
+ Zend_View_Helper_PaginationControl::setDefaultViewPartial('pagination_param.phtml');
+ $this->view->paginator=$paginator;
+ } else {
+ //已经认证过的数据作者
+ $sql="select u.username,u.realname,u.id,count(u.id) as count from mdauthor a left join users u on a.userid=u.id where a.status=1 and a.uuid in (select uuid from normalmetadata) group by u.id,u.username,u.realname";
+ $sth = $this->db->prepare($sql);
+ $sth->execute();
+ $rows = $sth->fetchAll();
+ $paginator = Zend_Paginator::factory($rows);
+ $paginator->setCurrentPageNumber($this->_getParam('page'));
+ $paginator->setItemCountPerPage(50);
+ $paginator->setView($this->view);
+ Zend_View_Helper_PaginationControl::setDefaultViewPartial('pagination_param.phtml');
+ $this->view->paginator=$paginator;
+ }
+ } else if ($ac=='unverified' || empty($ac)) {
+ //未认证的数据作者
+ $this->view->pageID='author-unverified';
+ $this->view->ac='unverified';
+ if ($id) {
+ //列出数据
+ $sql="select individual as username from responsible where id=?";
+ $this->view->author=$this->db->fetchRow($sql,array($id));
+ $sql="select distinct m.* from normalmetadata m left join role r on m.uuid=r.uuid left join responsible s on r.resid=s.id where r.role in ('pointOfContact','resourceProvider','owner') and s.id=?";
+ $sth = $this->db->prepare($sql);
+ $sth->execute(array($id));
+ $rows = $sth->fetchAll();
+ $paginator = Zend_Paginator::factory($rows);
+ $paginator->setCurrentPageNumber($this->_getParam('page'));
+ $paginator->setItemCountPerPage(10);
+ $paginator->setView($this->view);
+ Zend_View_Helper_PaginationControl::setDefaultViewPartial('pagination_param.phtml');
+ $this->view->paginator=$paginator;
+ } else {
+ //列出所有作者
+ $sql="select distinct responsible.individual as username,responsible.id from responsible left join role on role.resid=responsible.id where role.role in ('pointOfContact','resourceProvider','owner')";
+ $sth = $this->db->prepare($sql);
+ $sth->execute();
+ $rows = $sth->fetchAll();
+ $paginator = Zend_Paginator::factory($rows);
+ $paginator->setCurrentPageNumber($this->_getParam('page'));
+ $paginator->setItemCountPerPage(50);
+ $paginator->setView($this->view);
+ Zend_View_Helper_PaginationControl::setDefaultViewPartial('pagination_param.phtml');
+ $this->view->paginator=$paginator;
+ }
+ }
+ }
+
+ function listAction()
+ {
+ $sql="select m.uuid,m.title,m.citation,m.doi,d.doi as datadoi,d.ts_published,d.authors,d.publisher,date_part('year',d.ts_published) as publish_year from normalmetadata m
+left join mdstatus s on m.uuid=s.uuid
+left join datadoi d on d.uuid=m.uuid
+where s.status>4
+and m.uuid not in
+(select d.uuid from datasource d left join source s on d.sourceid=s.id
+where s.code in ('heihe','water','hiwater','westee'))
+order by m.title";
+ $this->view->metadata=$this->db->fetchAll($sql);
+ $sql="select m.uuid,m.title,m.citation,m.doi,d.doi as datadoi,d.ts_published,d.authors,d.publisher,date_part('year',d.ts_published) as publish_year
+ from normalmetadata m left join datadoi d on d.uuid=m.uuid left join mdstatus s on m.uuid=s.uuid where s.status>4 and m.title like '黑河综合遥感联合试验%' order by title";
+ $this->view->water=$this->db->fetchAll($sql);
+ $sql="select m.uuid,m.title,m.citation ,m.doi,d.doi as datadoi,d.ts_published,d.authors,d.publisher,date_part('year',d.ts_published) as publish_year
+ from normalmetadata m left join datadoi d on d.uuid=m.uuid left join mdstatus s on m.uuid=s.uuid where s.status>0 and m.title like '黑河生态水文遥感试验%' order by title";
+ $this->view->hiwater=$this->db->fetchAll($sql);
+ $sql="select m.uuid,m.title,m.citation ,m.doi,d.doi as datadoi,d.ts_published,d.authors,d.publisher,date_part('year',d.ts_published) as publish_year
+ from normalmetadata m left join datadoi d on d.uuid=m.uuid left join mdstatus s on m.uuid=s.uuid left join datasource ds on ds.uuid=m.uuid left join source sr on ds.sourceid=sr.id where sr.code='heihe' and s.status>0 and m.title not like '黑河生态水文遥感试验%' order by title";
+ $this->view->heihe=$this->db->fetchAll($sql);
+ $sql="select m.uuid,m.title,m.citation ,m.doi,d.doi as datadoi,d.ts_published,d.authors,d.publisher,date_part('year',d.ts_published) as publish_year
+ from normalmetadata m left join datadoi d on d.uuid=m.uuid left join mdstatus s on m.uuid=s.uuid left join datasource ds on ds.uuid=m.uuid left join source sr on ds.sourceid=sr.id where sr.code='westee' and s.status>4 order by title";
+ $this->view->westee=$this->db->fetchAll($sql);
+
+ }
+}
+
diff --git a/application/default/controllers/GlacierController.php b/application/default/controllers/GlacierController.php
index 719bcdf9..0d36abc4 100644
--- a/application/default/controllers/GlacierController.php
+++ b/application/default/controllers/GlacierController.php
@@ -25,8 +25,8 @@ class GlacierController extends DataController
function indexAction()
{
- $sql="select m.uuid,m.title,m.id,m.description from normalmetadata m left join thumbnail t on m.id=t.id where m.uuid in (select d.uuid from datasource d left join source s on d.sourceid=s.id where s.code='glacier') and length(t.data)>2 order by random() limit 3";
- $this->view->meatdata=$this->db->fetchAll($sql);
+ $archive = new Archive($this->db);
+ $this->view->info = $archive->getOneArchive('中国冰川资源及其变化调查-项目简介','about');
}
/*
@@ -78,187 +78,148 @@ class GlacierController extends DataController
function geobaseAction()
{
- $page=(int)$this->_request->getParam('page');
- if (empty($page)) $page=1;
- $offset=$this->limit*($page-1);
- $state=$this->db->query("select count(*) from normalmetadata where uuid in (select d.uuid from datasource d left join source s on d.sourceid=s.id where s.code='glacier') and id in (select id from keyword where keytype='theme' and (keyword='遥感影像' or keyword='DEM'))");
- $row=$state->fetchAll();
- $sum=$row[0]['count'];
- $sql="select uuid,title from normalmetadata where uuid in (select d.uuid from datasource d left join source s on d.sourceid=s.id where s.code='glacier') and id in (select id from keyword where keytype='theme' and (keyword='遥感影像' or keyword='DEM')) order by timebegin,title limit ? offset ?";
- $this->view->metadata=$this->db->fetchAll($sql,array($this->limit,$offset));
- $this->view->page=new Pagination($sum,$page,$this->limit);
- $this->view->offset=$offset+1;
+ $archive = new Archive($this->db);
+ $this->view->info = $archive->getOneArchive('中国冰川资源及其变化调查-基础数据','about');
+ $this->getmd(array('遥感影像','DEM'));
+ $this->_helper->viewRenderer('base');
}
function demAction()
{
$this->getmd('DEM');
+ $archive = new Archive($this->db);
+ $this->view->info = $archive->getOneArchive('中国冰川资源及其变化调查-DEM','about');
+ $this->_helper->viewRenderer('base');
}
function rsAction()
{
$this->getmd('遥感影像');
+ $archive = new Archive($this->db);
+ $this->view->info = $archive->getOneArchive('中国冰川资源及其变化调查-遥感影像','about');
+ $this->_helper->viewRenderer('base');
}
function inventoryAction()
{
- $page=(int)$this->_request->getParam('page');
- if (empty($page)) $page=1;
- $offset=$this->limit*($page-1);
- $state=$this->db->query("select count(*) from normalmetadata where uuid in (select d.uuid from datasource d left join source s on d.sourceid=s.id where s.code='glacier') and id in (select id from keyword where keytype='theme' and (keyword='冰川编目' or keyword='冰湖编目'))");
- $row=$state->fetchAll();
- $sum=$row[0]['count'];
- $sql="select uuid,title from normalmetadata where uuid in (select d.uuid from datasource d left join source s on d.sourceid=s.id where s.code='glacier') and id in (select id from keyword where keytype='theme' and (keyword='冰川编目' or keyword='冰湖编目')) order by timebegin,title limit ? offset ?";
- $this->view->metadata=$this->db->fetchAll($sql,array($this->limit,$offset));
- $this->view->page=new Pagination($sum,$page,$this->limit);
- $this->view->offset=$offset+1;
+ $this->getmd(array('冰川编目','冰湖编目'));
+ $archive = new Archive($this->db);
+ $this->view->info = $archive->getOneArchive('中国冰川资源及其变化调查-冰川冰湖编目','about');
+ $this->_helper->viewRenderer('base');
}
function glacierAction()
{
$this->getmd('冰川编目');
+ $archive = new Archive($this->db);
+ $this->view->info = $archive->getOneArchive('中国冰川资源及其变化调查-冰川编目','about');
+ $this->_helper->viewRenderer('base');
}
function lakeAction()
{
$this->getmd('冰湖编目');
+ $archive = new Archive($this->db);
+ $this->view->info = $archive->getOneArchive('中国冰川资源及其变化调查-冰湖编目','about');
+ $this->_helper->viewRenderer('base');
}
function fieldAction()
{
- $page=(int)$this->_request->getParam('page');
- if (empty($page)) $page=1;
- $offset=$this->limit*($page-1);
- $state=$this->db->query("select count(*) from normalmetadata where uuid in (select d.uuid from datasource d left join source s on d.sourceid=s.id where s.code='glacier') and id in (select id from keyword where keytype='theme'
- and (keyword='水文' or keyword='流量' or keyword='水质' or keyword='同位素' or keyword='径流' or keyword='水位' or keyword='气象' or keyword='雨量' or keyword='GPS'
- or keyword='雷达' or keyword='雷达测厚' or keyword='冰川厚度' or keyword='物质平衡' or keyword='花杆' or keyword='运动速度' or keyword='花杆消融观测' or keyword='冰舌'
- or keyword='冰雪物理过程' or keyword='冰温' or keyword='摄影测量' or keyword='照片' or keyword='第四纪' or keyword='冻土' or keyword='植被' ))");
- $row=$state->fetchAll();
- $sum=$row[0]['count'];
- $sql="select uuid,title from normalmetadata where uuid in (select d.uuid from datasource d left join source s on d.sourceid=s.id where s.code='glacier') and id in (select id from keyword where keytype='theme' and (keyword='水文' or keyword='流量' or keyword='水质' or keyword='同位素' or keyword='径流' or keyword='水位' or keyword='气象' or keyword='雨量' or keyword='GPS'
- or keyword='雷达' or keyword='雷达测厚' or keyword='冰川厚度' or keyword='物质平衡' or keyword='花杆' or keyword='运动速度' or keyword='花杆消融观测' or keyword='冰舌'
- or keyword='冰雪物理过程' or keyword='冰温' or keyword='摄影测量' or keyword='照片' or keyword='第四纪' or keyword='冻土' or keyword='植被' )) order by timebegin,title limit ? offset ?";
- $this->view->metadata=$this->db->fetchAll($sql,array($this->limit,$offset));
- $this->view->page=new Pagination($sum,$page,$this->limit);
- $this->view->offset=$offset+1;
+ $this->getmd(array('水文','流量','水质','同位素','径流','水位','气象','雨量','GPS',
+ '雷达','雷达测厚','冰川厚度','物质平衡','花杆','运动速度','花杆消融观测','冰舌',
+ '冰雪物理过程','冰温','摄影测量','照片','第四纪','冻土','植被'));
+ $archive = new Archive($this->db);
+ $this->view->info = $archive->getOneArchive('中国冰川资源及其变化调查-野外考察与定位观测','about');
+ $this->_helper->viewRenderer('base');
}
function meteoAction()
{
- $page=(int)$this->_request->getParam('page');
- if (empty($page)) $page=1;
- $offset=$this->limit*($page-1);
- $state=$this->db->query("select count(*) from normalmetadata where uuid in (select d.uuid from datasource d left join source s on d.sourceid=s.id where s.code='glacier') and id in (select id from keyword where keytype='theme' and (keyword='气象' or keyword='雨量'))");
- $row=$state->fetchAll();
- $sum=$row[0]['count'];
- $sql="select uuid,title from normalmetadata where uuid in (select d.uuid from datasource d left join source s on d.sourceid=s.id where s.code='glacier') and id in (select id from keyword where keytype='theme' and (keyword='气象' or keyword='雨量')) order by timebegin,title limit ? offset ?";
- $this->view->metadata=$this->db->fetchAll($sql,array($this->limit,$offset));
- $this->view->page=new Pagination($sum,$page,$this->limit);
- $this->view->offset=$offset+1;
+ $this->getmd(array('气象','雨量'));
+ $archive = new Archive($this->db);
+ $this->view->info = $archive->getOneArchive('中国冰川资源及其变化调查-气象','about');
+ $this->_helper->viewRenderer('base');
}
function hydroAction()
{
- $page=(int)$this->_request->getParam('page');
- if (empty($page)) $page=1;
- $offset=$this->limit*($page-1);
- $state=$this->db->query("select count(*) from normalmetadata where uuid in (select d.uuid from datasource d left join source s on d.sourceid=s.id where s.code='glacier') and id in (select id from keyword where keytype='theme' and (keyword='水文' or keyword='流量' or keyword='水质' or keyword='同位素' or keyword='径流' or keyword='水位'))");
- $row=$state->fetchAll();
- $sum=$row[0]['count'];
- $sql="select uuid,title from normalmetadata where uuid in (select d.uuid from datasource d left join source s on d.sourceid=s.id where s.code='glacier') and id in (select id from keyword where keytype='theme' and (keyword='水文' or keyword='流量' or keyword='水质' or keyword='同位素' or keyword='径流' or keyword='水位')) order by timebegin,title limit ? offset ?";
- $this->view->metadata=$this->db->fetchAll($sql,array($this->limit,$offset));
- $this->view->page=new Pagination($sum,$page,$this->limit);
- $this->view->offset=$offset+1;
+ $this->getmd(array('水文','流量','水质','同位素','径流','水位'));
+ $archive = new Archive($this->db);
+ $this->view->info = $archive->getOneArchive('中国冰川资源及其变化调查-水文','about');
+ $this->_helper->viewRenderer('base');
}
function gpsAction()
{
$this->getmd('GPS','theme');
+ $archive = new Archive($this->db);
+ $this->view->info = $archive->getOneArchive('中国冰川资源及其变化调查-GPS','about');
+ $this->_helper->viewRenderer('base');
}
function lidarAction()
{
- $page=(int)$this->_request->getParam('page');
- if (empty($page)) $page=1;
- $offset=$this->limit*($page-1);
- $state=$this->db->query("select count(*) from normalmetadata where uuid in (select d.uuid from datasource d left join source s on d.sourceid=s.id where s.code='glacier') and id in (select id from keyword where keytype='theme' and (keyword='雷达' or keyword='雷达测厚' or keyword='冰川厚度'))");
- $row=$state->fetchAll();
- $sum=$row[0]['count'];
- $sql="select uuid,title from normalmetadata where uuid in (select d.uuid from datasource d left join source s on d.sourceid=s.id where s.code='glacier') and id in (select id from keyword where keytype='theme' and (keyword='雷达' or keyword='雷达测厚' or keyword='冰川厚度')) order by timebegin,title limit ? offset ?";
- $this->view->metadata=$this->db->fetchAll($sql,array($this->limit,$offset));
- $this->view->page=new Pagination($sum,$page,$this->limit);
- $this->view->offset=$offset+1;
+ $this->getmd(array('雷达','雷达测厚','冰川厚度'));
+ $archive = new Archive($this->db);
+ $this->view->info = $archive->getOneArchive('中国冰川资源及其变化调查-雷达测厚','about');
+ $this->_helper->viewRenderer('base');
}
function materialAction()
{
- $page=(int)$this->_request->getParam('page');
- if (empty($page)) $page=1;
- $offset=$this->limit*($page-1);
- $state=$this->db->query("select count(*) from normalmetadata where uuid in (select d.uuid from datasource d left join source s on d.sourceid=s.id where s.code='glacier') and id in (select id from keyword where keytype='theme' and (keyword='物质平衡' or keyword='花杆'))");
- $row=$state->fetchAll();
- $sum=$row[0]['count'];
- $sql="select uuid,title from normalmetadata where uuid in (select d.uuid from datasource d left join source s on d.sourceid=s.id where s.code='glacier') and id in (select id from keyword where keytype='theme' and (keyword='物质平衡' or keyword='花杆')) order by timebegin,title limit ? offset ?";
- $this->view->metadata=$this->db->fetchAll($sql,array($this->limit,$offset));
- $this->view->page=new Pagination($sum,$page,$this->limit);
- $this->view->offset=$offset+1;
+ $this->getmd(array('物质平衡','花杆'));
+ $archive = new Archive($this->db);
+ $this->view->info = $archive->getOneArchive('中国冰川资源及其变化调查-物质平衡','about');
+ $this->_helper->viewRenderer('base');
}
function movementAction()
{
- $page=(int)$this->_request->getParam('page');
- if (empty($page)) $page=1;
- $offset=$this->limit*($page-1);
- $state=$this->db->query("select count(*) from normalmetadata where uuid in (select d.uuid from datasource d left join source s on d.sourceid=s.id where s.code='glacier') and id in (select id from keyword where keytype='theme' and (keyword='运动速度' or keyword='花杆消融观测' or keyword='冰舌'))");
- $row=$state->fetchAll();
- $sum=$row[0]['count'];
- $sql="select uuid,title from normalmetadata where uuid in (select d.uuid from datasource d left join source s on d.sourceid=s.id where s.code='glacier') and id in (select id from keyword where keytype='theme' and (keyword='运动速度' or keyword='花杆消融观测' or keyword='冰舌')) order by timebegin,title limit ? offset ?";
- $this->view->metadata=$this->db->fetchAll($sql,array($this->limit,$offset));
- $this->view->page=new Pagination($sum,$page,$this->limit);
- $this->view->offset=$offset+1;
+ $this->getmd(array('运动速度','花杆消融观测','冰舌'));
+ $archive = new Archive($this->db);
+ $this->view->info = $archive->getOneArchive('中国冰川资源及其变化调查-冰川运动','about');
+ $this->_helper->viewRenderer('base');
}
function physicalAction()
{
- $page=(int)$this->_request->getParam('page');
- if (empty($page)) $page=1;
- $offset=$this->limit*($page-1);
- $state=$this->db->query("select count(*) from normalmetadata where uuid in (select d.uuid from datasource d left join source s on d.sourceid=s.id where s.code='glacier') and id in (select id from keyword where keytype='theme' and (keyword='冰雪物理过程' or keyword='冰温'))");
- $row=$state->fetchAll();
- $sum=$row[0]['count'];
- $sql="select uuid,title from normalmetadata where uuid in (select d.uuid from datasource d left join source s on d.sourceid=s.id where s.code='glacier') and id in (select id from keyword where keytype='theme' and (keyword='冰雪物理过程' or keyword='冰温')) order by timebegin,title limit ? offset ?";
- $this->view->metadata=$this->db->fetchAll($sql,array($this->limit,$offset));
- $this->view->page=new Pagination($sum,$page,$this->limit);
- $this->view->offset=$offset+1;
+ $this->getmd(array('冰雪物理过程','冰温'));
+ $archive = new Archive($this->db);
+ $this->view->info = $archive->getOneArchive('中国冰川资源及其变化调查-冰雪物理过程','about');
+ $this->_helper->viewRenderer('base');
}
function photogrammetryAction()
{
- $page=(int)$this->_request->getParam('page');
- if (empty($page)) $page=1;
- $offset=$this->limit*($page-1);
- $state=$this->db->query("select count(*) from normalmetadata where uuid in (select d.uuid from datasource d left join source s on d.sourceid=s.id where s.code='glacier') and id in (select id from keyword where keytype='theme' and (keyword='摄影测量' or keyword='照片'))");
- $row=$state->fetchAll();
- $sum=$row[0]['count'];
- $sql="select uuid,title from normalmetadata where uuid in (select d.uuid from datasource d left join source s on d.sourceid=s.id where s.code='glacier') and id in (select id from keyword where keytype='theme' and (keyword='摄影测量' or keyword='照片')) order by timebegin,title limit ? offset ?";
- $this->view->metadata=$this->db->fetchAll($sql,array($this->limit,$offset));
- $this->view->page=new Pagination($sum,$page,$this->limit);
- $this->view->offset=$offset+1;
+ $this->getmd(array('摄影测量','照片'));
+ $archive = new Archive($this->db);
+ $this->view->info = $archive->getOneArchive('中国冰川资源及其变化调查-近景摄影测量','about');
+ $this->_helper->viewRenderer('base');
}
function vegetationAction()
{
$this->getmd('植被');
+ $archive = new Archive($this->db);
+ $this->view->info = $archive->getOneArchive('中国冰川资源及其变化调查-植被调查','about');
+ $this->_helper->viewRenderer('base');
}
function frozensoilAction()
{
$this->getmd('冻土');
+ $archive = new Archive($this->db);
+ $this->view->info = $archive->getOneArchive('中国冰川资源及其变化调查-冻土调查','about');
+ $this->_helper->viewRenderer('base');
}
function quatemaryAction()
{
$this->getmd('第四纪');
+ $archive = new Archive($this->db);
+ $this->view->info = $archive->getOneArchive('中国冰川资源及其变化调查-第四纪','about');
+ $this->_helper->viewRenderer('base');
}
function listAction()
@@ -270,12 +231,13 @@ class GlacierController extends DataController
function tagAction()
{
$key = $this->_request->getParam('key');
+ $keytype = $this->_request->getParam('keytype');
$page=(int)$this->_request->getParam('page');
if (empty($page)) $page=1;
$offset=$this->limit*($page-1);
if (!empty($key)) {
$this->view->codename=$key;
- $sql=$this->db->quoteInto('select count(id) from keyword where keyword=?',$key);
+ $sql=$this->db->quoteInto("select count(k.id) from keyword k left join normalmetadata m on k.id=m.id where m.uuid in (select d.uuid from datasource d left join source s on d.sourceid=s.id where s.code='glaicer') and k.keyword=?",$key);
$state=$this->db->query($sql);
$row=$state->fetchAll();
$sum=$row[0]['count'];
@@ -283,17 +245,12 @@ class GlacierController extends DataController
$this->view->metadata=$this->db->fetchAll($sql,array($this->limit,$offset));
$this->view->page=new Pagination($sum,$page,$this->limit);
} else {
- $state=$this->db->query("select keyword.keyword,count(*) from keyword left join normalmetadata m on keyword.id=m.id where keyword.keytype='place' and m.uuid in (select d.uuid from datasource d left join source s on d.sourceid=s.id where s.code='glacier') group by keyword.keyword order by count desc");
- $k1=$state->fetchAll();
- $state=$this->db->query("select k.keyword,count(k.keyword) from keyword k left join normalmetadata m on k.id=m.id where k.keytype='theme' and m.uuid in (select d.uuid from datasource d left join source s on d.sourceid=s.id where s.code='glacier') group by k.keyword order by k.keyword");
- $k2=$state->fetchAll();
- $state=$this->db->query("select k.keyword,count(k.keyword) from keyword k left join normalmetadata m on k.id=m.id where k.keytype='discipline' and m.uuid in (select d.uuid from datasource d left join source s on d.sourceid=s.id where s.code='glacier') group by k.keyword order by k.keyword");
- $k3=$state->fetchAll();
- $state=$this->db->query("select k.keyword,count(k.keyword) from keyword k left join normalmetadata m on k.id=m.id where k.keytype='stratum' and m.uuid in (select d.uuid from datasource d left join source s on d.sourceid=s.id where s.code='glacier') group by k.keyword order by k.keyword");
- $k4=$state->fetchAll();
- $state=$this->db->query("select keyword.keyword,count(*) from keyword left join normalmetadata m on keyword.id=m.id where keyword.keytype='temporal' and m.uuid in (select d.uuid from datasource d left join source s on d.sourceid=s.id where s.code='glacier') group by keyword.keyword order by keyword.keyword");
- $k5=$state->fetchAll();
- $this->view->keywords=array('place'=>$k1,'theme'=>$k2,'discipline'=>$k3,'stratum'=>$k4,'temporal'=>$k5);
+ $sql="select k.keyword,count(*),k.keytype from keyword k left join normalmetadata m on k.id=m.id where length(k.keyword)>0 and m.uuid in (select d.uuid from datasource d left join source s on d.sourceid=s.id where s.code='glacier') ";
+ if (!empty($keytype) && ($keytype=='place' || $keytype=='theme' || $keytype=='discipline'||$keytype=='temporal')) $sql.=" and k.keytype='".$keytype."'";
+ $sql.=' group by k.keyword,k.keytype order by k.keytype,k.keyword,count desc';
+ $state=$this->db->query($sql);
+ $this->view->keytype=$keytype;
+ $this->view->keywords=$state->fetchAll();
}
}
@@ -376,14 +333,58 @@ class GlacierController extends DataController
private function getmd($keyword,$type='theme')
{
- $page=(int)$this->_request->getParam('page');
- if (empty($page)) $page=1;
- $offset=$this->limit*($page-1);
- $state=$this->db->query("select count(m.*) from normalmetadata m left join datasource d on m.uuid=d.uuid left join source s on d.sourceid=s.id where s.code='glacier' and m.id in (select id from keyword where keytype='".$type."' and keyword='".$keyword."')");
+ $page=(int)$this->_request->getParam('page');
+ if (empty($page)) $page=1;
+ $offset=$this->limit*($page-1);
+ if (!is_array($keyword))
+ {
+ $keyword=array($keyword);
+ }
+ $key="(";
+ foreach($keyword as $k)
+ {
+ $key.="'".$k."',";
+ }
+ $key=substr($key,0,-1);
+ $key.=")";
+ $keyword=$key;
+
+ $state=$this->db->query("select count(m.*) from normalmetadata m left join datasource d on m.uuid=d.uuid left join source s on d.sourceid=s.id where s.code='glacier' and m.id in (select id from keyword where keytype='".$type."' and keyword in ".$keyword.")");
$row=$state->fetchAll();
$sum=$row[0]['count'];
//@todo: add order with title
- $sql="select uuid,title from normalmetadata where uuid in (select d.uuid from datasource d left join source s on d.sourceid=s.id where s.code='glacier') and id in (select id from keyword where keytype='".$type."' and keyword='".$keyword."') order by timebegin,title limit ? offset ?";
+ $sql="select uuid,title from normalmetadata where uuid in (select d.uuid from datasource d left join source s on d.sourceid=s.id where s.code='glacier') and id in (select id from keyword where keytype='".$type."' and keyword in ".$keyword.") order by timebegin,title limit ? offset ?";
+ $this->view->metadata=$this->db->fetchAll($sql,array($this->limit,$offset));
+ $this->view->page=new Pagination($sum,$page,$this->limit);
+ $this->view->offset=$offset+1;
+ }
+
+ //获取多项条件并列关系的数据并必须满足limited条件
+ //$keyword:字符串或字符串数组
+ //$limited:限制字符串
+ private function getmdlimited($keyword,$limited)
+ {
+ $page=(int)$this->_request->getParam('page');
+ if (empty($page)) $page=1;
+ $offset=$this->limit*($page-1);
+ if (!is_array($keyword))
+ {
+ $keyword=array($keyword);
+ }
+ $key="(";
+ foreach($keyword as $k)
+ {
+ $key.="'".$k."',";
+ }
+ $key=substr($key,0,-1);
+ $key.=")";
+ $keyword=$key;
+
+ $state=$this->db->query("select count(m.*) from normalmetadata m left join datasource d on m.uuid=d.uuid left join source s on d.sourceid=s.id where s.code='glacier' and m.id in (select id from keyword where keyword='".$limited."') and m.id in (select id from keyword where keyword in ".$keyword.")");
+ $row=$state->fetchAll();
+ $sum=$row[0]['count'];
+ //@todo: add order with title
+ $sql="select uuid,title from normalmetadata where uuid in (select d.uuid from datasource d left join source s on d.sourceid=s.id where s.code='glacier') and id in (select id from keyword where keyword='".$limited."') and id in (select id from keyword where keyword in ".$keyword.") order by title limit ? offset ?";
$this->view->metadata=$this->db->fetchAll($sql,array($this->limit,$offset));
$this->view->page=new Pagination($sum,$page,$this->limit);
$this->view->offset=$offset+1;
diff --git a/application/default/controllers/HaiheController.php b/application/default/controllers/HaiheController.php
new file mode 100644
index 00000000..5c54b895
--- /dev/null
+++ b/application/default/controllers/HaiheController.php
@@ -0,0 +1,85 @@
+debug = 1;
+ $acName = $this->_request->getActionName();
+ $this->view->pageID = "haihe-".$acName;
+ //$this->_helper->layout->setLayout('heihe');
+ }
+
+ function indexAction()
+ {
+ $archive = new Archive($this->db);
+ $this->view->info = $archive->getOneArchive('海河流域多尺度地表通量与气象要素观测数据集','about');
+ }
+
+ function documentAction()
+ {
+ $page=(int)$this->_request->getParam('page');
+ if (empty($page)) $page=1;
+ $offset=$this->limit*($page-1);
+ $row=$this->db->fetchAll("select count(*) from reference where id in (select refid from mdref where uuid in (select uuid from normalmetadata where uuid in (select d.uuid from datasource d left join source s on d.sourceid=s.id where s.code='haihe') ))");
+ $sum=$row[0]['count'];
+ $sql="select * from reference where id in (select refid from mdref where uuid in (select uuid from normalmetadata where uuid in (select d.uuid from datasource d left join source s on d.sourceid=s.id where s.code='haihe') )) order by reference limit ? offset ?";
+ $this->view->refs=$this->db->fetchAll($sql,array($this->limit,$offset));
+ $this->view->page=new Pagination($sum,$page,$this->limit,"文献");
+ $this->view->offset=$offset+1;
+ }
+
+ function daxingAction()
+ {
+ $this->getmd(array('大兴区'),'place');
+ $this->_helper->viewRenderer('base');
+ }
+
+ function miyunAction()
+ {
+ $this->getmd(array('密云'),'place');
+ $this->_helper->viewRenderer('base');
+ }
+
+ function guantaoAction()
+ {
+ $this->getmd(array('馆陶县'),'place');
+ $this->_helper->viewRenderer('base');
+ }
+
+ function viewAction()
+ {
+ parent::viewAction();
+ $this->_helper->viewRenderer('haihe/view');
+ }
+
+ private function getmd($keyword,$type='theme')
+ {
+ $page=(int)$this->_request->getParam('page');
+ if (empty($page)) $page=1;
+ $offset=$this->limit*($page-1);
+ if (!is_array($keyword))
+ {
+ $keyword=array($keyword);
+ }
+ $key="(";
+ foreach($keyword as $k)
+ {
+ $key.="'".$k."',";
+ }
+ $key=substr($key,0,-1);
+ $key.=")";
+ $keyword=$key;
+
+ $state=$this->db->query("select count(m.*) from normalmetadata m left join datasource d on m.uuid=d.uuid left join source s on d.sourceid=s.id where s.code='haihe' and m.id in (select id from keyword where keytype='".$type."' and keyword in ".$keyword.")");
+ $row=$state->fetchAll();
+ $sum=$row[0]['count'];
+ //@todo: add order with title
+ $sql="select uuid,title from normalmetadata where uuid in (select d.uuid from datasource d left join source s on d.sourceid=s.id where s.code='haihe') and id in (select id from keyword where keytype='".$type."' and keyword in ".$keyword.") order by title limit ? offset ?";
+ $this->view->metadata=$this->db->fetchAll($sql,array($this->limit,$offset));
+ $this->view->page=new Pagination($sum,$page,$this->limit);
+ $this->view->offset=$offset+1;
+ }
+}
\ No newline at end of file
diff --git a/application/default/controllers/HeiheController.php b/application/default/controllers/HeiheController.php
index 742b59c1..782b3fa6 100644
--- a/application/default/controllers/HeiheController.php
+++ b/application/default/controllers/HeiheController.php
@@ -1167,7 +1167,10 @@ class HeiheController extends DataController
}
} else {
//提供全部分类列表
- $sql="select f.id,f.title,f.fund_id,f.fund_type,f.ts_created,count(m.id) as datacount,sum(md.filesize) as filesize from fund f left join mdfund m on f.id=m.fid left join metadata md on m.uuid=md.uuid left join heiheproject hp on f.fund_id=hp.code where hp.id is not null and m.uuid in (select d.uuid from datasource d left join source s on d.sourceid=s.id where s.code='heihe') group by f.id,f.title,f.fund_id,f.fund_type,f.ts_created order by f.ts_created desc";
+ $sql="select f.id,f.title,f.fund_id,f.fund_type,f.ts_created,count(m.id) as datacount,sum(md.filesize) as filesize
+ from fund f left join mdfund m on f.id=m.fid left join metadata md on m.uuid=md.uuid left join heiheproject hp on f.fund_id=hp.code
+ where hp.id is not null and m.uuid in (select d.uuid from datasource d left join source s on d.sourceid=s.id where s.code='heihe')
+ group by f.id,f.title,f.fund_id,f.fund_type,f.ts_created order by f.fund_id asc";
$sth = $this->db->prepare($sql);
$sth->execute();
$rows = $sth->fetchAll();
diff --git a/application/default/controllers/HiwaterController.php b/application/default/controllers/HiwaterController.php
index e271ee6a..eaeb061c 100644
--- a/application/default/controllers/HiwaterController.php
+++ b/application/default/controllers/HiwaterController.php
@@ -153,12 +153,12 @@ class HiwaterController extends DataController
function demdsmAction()
{
- $this->getmd(array('DEM','DSM','DOM'),"数据产品");
+ $this->getmdlimited(array('DEM','DSM','DOM'),"数据产品");
$this->_helper->viewRenderer('base');
}
function reflectanceAction()
{
- $this->getmd(array('地表反照率','地表反射率'),"数据产品");
+ $this->getmdlimited(array('地表反照率','地表反射率'),"数据产品");
$this->_helper->viewRenderer('base');
}
function vegtypeairAction()
@@ -168,17 +168,17 @@ class HiwaterController extends DataController
}
function vegparamAction()
{
- $this->getmd(array("",'植被结构参数'),"数据产品");
+ $this->getmdlimited(array("",'植被结构参数'),"数据产品");
$this->_helper->viewRenderer('base');
}
function soilmoistureAction()
{
- $this->getmd(array('','土壤水分'),"数据产品");
+ $this->getmdlimited(array('','土壤水分'),"数据产品");
$this->_helper->viewRenderer('base');
}
function temperatureAction()
{
- $this->getmd(array('','地表温度'),"数据产品");
+ $this->getmdlimited(array('','地表温度'),"数据产品");
$this->_helper->viewRenderer('base');
}
@@ -197,7 +197,8 @@ class HiwaterController extends DataController
}
function normalAction()
{
- $this->getmdlimited(array('西支','黄藏寺','黄草沟','峨堡','景阳岭','阿柔阳坡','阿柔阴坡','戈壁站','神沙窝沙漠站','花寨子荒漠站','张掖湿地站'),'水文气象');
+ $this->getmdlimited(array('景阳岭站','峨堡站','黄草沟站','阿柔阴坡站','阿柔阳坡站','黄藏寺站','大沙龙站','寺大隆站','排露沟林前气象站','水源涵养林研究院观测站','巴吉滩戈壁站','神沙窝沙漠站','张掖湿地站',
+ '花寒子荒漠站','五里墩气象站','四道桥混合林站','四道桥胡杨林站','四道桥裸地站','四道桥农田站','黑河上游生态-水文试验研究站','临泽内陆河流域研究站','阿拉善荒漠生态-水文实验研究站'),'水文气象');
$this->_helper->viewRenderer('base');
}
diff --git a/application/default/controllers/IndexController.php b/application/default/controllers/IndexController.php
index 90c440cb..b67ac8f9 100755
--- a/application/default/controllers/IndexController.php
+++ b/application/default/controllers/IndexController.php
@@ -18,7 +18,7 @@ class IndexController extends Zend_Controller_Action
$name=basename($this->view->newsletter,'.pdf');
list(,$this->view->newsletterno)=explode("_",$name);
//统计数据
- $sql='select (select count(*) from users) as usernum,(select count(*) from heihemetadata) as metanum,(select count(*) from offlineapp where ts_approved is not null ) as offlinenum';
+ $sql='select (select count(*) from users) as usernum,(select count(*) from normalmetadata) as metanum,(select count(*) from offlineapp where ts_approved is not null ) as offlinenum';
$row=$this->db->fetchRow($sql);
$this->view->usernum=$row['usernum'];
$this->view->metanum=$row['metanum'];
@@ -26,7 +26,7 @@ class IndexController extends Zend_Controller_Action
/*$sql='select count(*) from metadata';
$row=$this->db->fetchRow($sql);
$this->view->metanum=$row['count'];*/
- $sql="select sum(filesize) as sum,datatype from heihemetadata group by datatype";
+ $sql="select sum(filesize) as sum,datatype from normalmetadata group by datatype";
$rows=$this->db->fetchAll($sql);
foreach($rows as $row)
{
@@ -42,12 +42,12 @@ class IndexController extends Zend_Controller_Action
$sql="select * from datasetcd order by random()";
$this->view->datasetcd=$this->db->fetchRow($sql);
//下载最多数据(top 5)
- $sql="select uuid,title,id from heihemetadata where id in (select m.id from heihemetadata m left join dataorder d on m.uuid=d.uuid where m.datatype=0 group by m.id order by count(d.uuid) desc limit 5)";
+ $sql="select uuid,title,id from normalmetadata where id in (select m.id from normalmetadata m left join dataorder d on m.uuid=d.uuid where m.datatype=0 group by m.id order by count(d.uuid) desc limit 5)";
$this->db->setFetchMode(Zend_Db::FETCH_OBJ);
$this->view->mdtop=$this->db->fetchAll($sql);
- $sql="select uuid,title,id from heihemetadata where id in (select m.id from heihemetadata m left join dataorder d on m.uuid=d.uuid where m.datatype=1 group by m.id order by count(d.uuid) desc limit 5)";
+ $sql="select uuid,title,id from normalmetadata where id in (select m.id from normalmetadata m left join dataorder d on m.uuid=d.uuid where m.datatype=1 group by m.id order by count(d.uuid) desc limit 5)";
$this->view->offlinemdtop=$this->db->fetchAll($sql);
- $sql="select m.uuid,m.title,m.id,m.description from heihemetadata m left join thumbnail t on m.id=t.id where length(t.data)>2 order by random()";
+ $sql="select m.uuid,m.title,m.id,m.description from normalmetadata m left join thumbnail t on m.id=t.id where length(t.data)>2 order by random()";
$this->view->mdrandom=$this->db->fetchRow($sql);
//搜索
$this->view->addHelperPath('helper','Zend_View_Helper_');
@@ -85,7 +85,7 @@ class IndexController extends Zend_Controller_Action
$this->view->list_news = $rows;
- $sql="select d.*,m.ts_published as publish_year from datadoi d right join heihemetadata m on d.uuid=m.uuid where d.ts_published is not null order by ts_published desc limit 4";
+ $sql="select d.*,m.ts_published as publish_year from datadoi d right join normalmetadata m on d.uuid=m.uuid where d.ts_published is not null order by ts_published desc limit 4";
$sth = $this->db->query($sql);
$this->view->dois = $sth->fetchAll();
diff --git a/application/default/controllers/KnowledgeController.php b/application/default/controllers/KnowledgeController.php
index ad5ce3e6..9e76286c 100755
--- a/application/default/controllers/KnowledgeController.php
+++ b/application/default/controllers/KnowledgeController.php
@@ -1,81 +1,107 @@
-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();
- }
- function datacenterAction()
- {
+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();
+ }
+ function datacenterAction()
+ {
$siteid="e31f5ea7-a4af-4ae3-9ac1-1a84132c4338";//site uuid from geonetowrk
- $sql="select * from mdref mr left join reference r on mr.refid=r.id where mr.uuid=? order by r.id desc";
- $sth = $this->db->prepare($sql);
- $sth->execute(array($siteid));
- $rows = $sth->fetchAll();
- $paginator = Zend_Paginator::factory($rows);
- $paginator->setCurrentPageNumber($this->_getParam('page'));
- $paginator->setItemCountPerPage(10);
- $paginator->setView($this->view);
- Zend_View_Helper_PaginationControl::setDefaultViewPartial('pagination_param.phtml');
- $this->view->paginator=$paginator;
- }
- function userAction()
- {
- $sql="select * from reference where id in (select refid from mdref where reftype=1 and uuid in (select uuid from normalmetadata)) order by id desc";
- $sth = $this->db->prepare($sql);
- $sth->execute();
- $rows = $sth->fetchAll();
- $paginator = Zend_Paginator::factory($rows);
- $paginator->setCurrentPageNumber($this->_getParam('page'));
- $paginator->setItemCountPerPage(10);
- $paginator->setView($this->view);
- Zend_View_Helper_PaginationControl::setDefaultViewPartial('pagination_param.phtml');
- $this->view->paginator=$paginator;
- }
- function authorAction()
- {
- $sql="select * from reference where id in (select refid from mdref where reftype=0 and uuid in (select uuid from normalmetadata)) order by id desc";
- $sth = $this->db->prepare($sql);
- $sth->execute();
- $rows = $sth->fetchAll();
- $paginator = Zend_Paginator::factory($rows);
- $paginator->setCurrentPageNumber($this->_getParam('page'));
- $paginator->setItemCountPerPage(10);
- $paginator->setView($this->view);
- Zend_View_Helper_PaginationControl::setDefaultViewPartial('pagination_param.phtml');
- $this->view->paginator=$paginator;
- }
-
- function westplanAction()
- {
- $sql="select distinct array_to_string(array(select author from knl_author t where t.item_id=c.item_id order by place asc),'; ') as author,c.title,c.publisher,c.ts_created,c.ts_issued,c.item_id,c.url from knl_article c where c.url <>'' order by ts_created desc";
- $sth = $this->db->prepare($sql);
- $sth->execute();
- $rows = $sth->fetchAll();
- $paginator = Zend_Paginator::factory($rows);
- $paginator->setCurrentPageNumber($this->_getParam('page'));
- $paginator->setItemCountPerPage(10);
- $paginator->setView($this->view);
- Zend_View_Helper_PaginationControl::setDefaultViewPartial('pagination_param.phtml');
- $this->view->paginator=$paginator;
- }
- function searchAction()
- {
- $key=$this->_request->getParam('q');
- $source=$this->_request->getParam('searchsource');
- if(preg_match("/\"|'|<|>/",$key))
- {
- $data=array('<'=>'<','>'=>'>', "\'"=>'’', "\""=>'”');
+ $sql="select * from mdref mr left join reference r on mr.refid=r.id where mr.uuid=? order by r.year desc, reference desc";
+ $sth = $this->db->prepare($sql);
+ $sth->execute(array($siteid));
+ $rows = $sth->fetchAll();
+ $paginator = Zend_Paginator::factory($rows);
+ $paginator->setCurrentPageNumber($this->_getParam('page'));
+ $paginator->setItemCountPerPage(10);
+ $paginator->setView($this->view);
+ Zend_View_Helper_PaginationControl::setDefaultViewPartial('pagination_param.phtml');
+ $this->view->paginator=$paginator;
+ }
+ function waterAction()
+ {
+ $sql="select * from reference where id in (select refid from mdref where uuid in (select uuid from en.normalmetadata)) order by year desc, reference desc";
+ $sth = $this->db->prepare($sql);
+ $sth->execute();
+ $rows = $sth->fetchAll();
+ $paginator = Zend_Paginator::factory($rows);
+ $paginator->setCurrentPageNumber($this->_getParam('page'));
+ $paginator->setItemCountPerPage(10);
+ $paginator->setView($this->view);
+ Zend_View_Helper_PaginationControl::setDefaultViewPartial('pagination_param.phtml');
+ $this->view->paginator=$paginator;
+ }
- $patterns = array();
- $replacements = array();
+ function userAction()
+ {
+ $uuid=$this->_request->getParam('uuid');
+ if (preg_match('/([a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12})/',$uuid))
+ {
+ $sql="select uuid,title from metadata where uuid='$uuid'";
+ $sth = $this->db->prepare($sql);
+ $sth->execute();
+ $this->view->md = $sth->fetch();
+ $sql="select * from reference where id in (select refid from mdref where reftype=1 and uuid='$uuid') order by year desc, reference desc";
+ } else
+ $sql="select * from reference where id in (select refid from mdref where reftype=1 and uuid in (select uuid from normalmetadata)) order by year desc, reference desc";
+ $sth = $this->db->prepare($sql);
+ $sth->execute();
+ $rows = $sth->fetchAll();
+ $paginator = Zend_Paginator::factory($rows);
+ $paginator->setCurrentPageNumber($this->_getParam('page'));
+ $paginator->setItemCountPerPage(10);
+ $paginator->setView($this->view);
+ Zend_View_Helper_PaginationControl::setDefaultViewPartial('pagination_param.phtml');
+ $this->view->paginator=$paginator;
+ }
+
+ function authorAction()
+ {
+ $sql="select * from reference where id in (select refid from mdref where reftype=0 and uuid in (select uuid from normalmetadata)) order by year desc, reference desc";
+ $sth = $this->db->prepare($sql);
+ $sth->execute();
+ $rows = $sth->fetchAll();
+ $paginator = Zend_Paginator::factory($rows);
+ $paginator->setCurrentPageNumber($this->_getParam('page'));
+ $paginator->setItemCountPerPage(10);
+ $paginator->setView($this->view);
+ Zend_View_Helper_PaginationControl::setDefaultViewPartial('pagination_param.phtml');
+ $this->view->paginator=$paginator;
+ }
+
+ function westplanAction()
+ {
+ $sql="select distinct array_to_string(array(select author from knl_author t where t.item_id=c.item_id order by place asc),'; ') as author,c.title,c.publisher,c.ts_created,c.ts_issued,c.item_id,c.url from knl_article c where c.url <>'' order by ts_created desc";
+ $sth = $this->db->prepare($sql);
+ $sth->execute();
+ $rows = $sth->fetchAll();
+ $paginator = Zend_Paginator::factory($rows);
+ $paginator->setCurrentPageNumber($this->_getParam('page'));
+ $paginator->setItemCountPerPage(10);
+ $paginator->setView($this->view);
+ Zend_View_Helper_PaginationControl::setDefaultViewPartial('pagination_param.phtml');
+ $this->view->paginator=$paginator;
+ }
+
+ function searchAction()
+ {
+ $key=$this->_request->getParam('q');
+ $author = (int)$this->_request->getParam('author');
+ $place = (int)$this->_request->getParam('place');
+ $source=$this->_request->getParam('searchsource');
+ if(preg_match("/\"|'|<|>/",$key))
+ {
+ $data=array('<'=>'<','>'=>'>', "\'"=>'’', "\""=>'”');
+ $patterns = array();
+ $replacements = array();
foreach($data as $k=>$v)
{
$patterns[]='/'.$k.'/i';
@@ -86,39 +112,44 @@ class KnowledgeController extends Zend_Controller_Action
$key=preg_replace($patterns, $replacements, $key);
}
- if (!empty($key) && $source=='datasource') {
+ if (!empty($key)) {
$search=new SimpleSearch($key);
$where=$search->sql_expr(array("reference"));
- $sql="select * from reference where ".$where." order by id desc";
+ $sql="select * from reference where ".$where." order by year desc, reference desc";
+ } else if ($author && $place) {
+ $sql="select * from reference where id in (select a1.id from ref_author a1,ref_author a2 where a1.firstname=a2.firstname and a1.lastname=a2.lastname and a2.id=$author and a2.place=$place)";
+ }
$sth = $this->db->prepare($sql);
- $sth->execute();
+ $sth->execute();
$rows = $sth->fetchAll();
$paginator = Zend_Paginator::factory($rows);
$paginator->setCurrentPageNumber($this->_getParam('page'));
$paginator->setItemCountPerPage(10);
$paginator->setView($this->view);
Zend_View_Helper_PaginationControl::setDefaultViewPartial('pagination_param.phtml');
- $this->view->paginator=$paginator;
- $this->view->key=$key;
- $this->view->source=$source;
+ $this->view->paginator=$paginator;
+ $this->view->key=$key;
+ $this->view->source=$source;
$this->_helper->viewRenderer('search-data');
- }
- else if (!empty($key) && $source=='westsource') {
- $search=new SimpleSearch($key);
- $where=$search->sql_expr(array("c.title","a.author"));
- $sql="select distinct a.author,c.title,c.publisher,c.ts_created,c.ts_issued,c.item_id,c.url from knl_article c left join knl_author a on c.item_id=a.item_id where c.url <>'' and a.place=1 and $where order by ts_created desc";
- $sth = $this->db->prepare($sql);
- $sth->execute();
- $rows = $sth->fetchAll();
- $paginator = Zend_Paginator::factory($rows);
- $paginator->setCurrentPageNumber($this->_getParam('page'));
- $paginator->setItemCountPerPage(10);
- $paginator->setView($this->view);
- Zend_View_Helper_PaginationControl::setDefaultViewPartial('pagination_param.phtml');
- $this->view->paginator=$paginator;
- $this->view->key=$key;
- $this->view->source=$source;
- //$this->_helper->viewRenderer('search-data');
- }
- }
+
+ }
+
+ function paperAction()
+ {
+ $id = (int)$this->_request->getParam('id');
+ $sql="select * from reference where id=$id";
+ $sth = $this->db->prepare($sql);
+ $sth->execute();
+ $this->view->paper = $sth->fetch();
+
+ $sql="select * from ref_author where id=$id order by place";
+ $sth = $this->db->prepare($sql);
+ $sth->execute();
+ $this->view->author = $sth->fetchAll();
+
+ $sql="select * from ref_tag where id=$id";
+ $sth = $this->db->prepare($sql);
+ $sth->execute();
+ $this->view->tag = $sth->fetchAll();
+ }
}
\ No newline at end of file
diff --git a/application/default/controllers/OpenController.php b/application/default/controllers/OpenController.php
new file mode 100644
index 00000000..65805abe
--- /dev/null
+++ b/application/default/controllers/OpenController.php
@@ -0,0 +1,165 @@
+view->config = $this->config = \Zend_Registry::get('config');
+ $this->db = \Zend_Registry::get('db');
+ $this->view->theme = new Theme();
+ $this->_helper->layout->setLayout('layout-open');
+ }
+
+ function indexAction()
+ {
+ $this->view->pageID = "open-index";
+ }
+
+ //我的应用
+ function myappAction()
+ {
+ $this->view->pageID = "open-myapp";
+
+ $app = new App();
+
+ $user_state = $app->checkinfo();
+ if( $user_state !== true)
+ {
+ view::post($this,$user_state,"/account/edit");
+ }
+
+ $ac = $this->_getParam('ac');
+ $id = $this->_getParam('id');
+ $submit = $this->_getParam('submit');
+
+ if(empty($ac))
+ {
+ $this->view->myapp = $app->getUserApp();
+ return true;
+ }
+
+ if($ac == "create")
+ {
+ $this->_helper->viewRenderer('myapp-create');
+
+ $this->view->appStatus = $app->appStatus();
+
+ if(!empty($id))
+ {
+ $this->view->info = $app->getAppInfo($id);
+ }
+
+ if(!empty($submit))
+ {
+ if(empty($id))
+ {
+ $status = $app->appCreate();
+ }else{
+ $this->view->info = $app->getAppCreateParam();
+ $status = $app->appCreate($id);
+ }
+
+ if($status !== true && !is_numeric($status))
+ {
+ $this->view->error = view::Error($status);
+ }else{
+ if(!empty($id))
+ view::Post($this,"修改成功!",'/open/myapp/ac/view/id/'.$id);
+ else
+ view::Post($this,"添加成功!","/open/myapp/ac/view/id/".$status);
+ }
+
+ }
+ return true;
+ }
+
+ if($ac == "delete")
+ {
+ $status = $app->delete($id);
+ if($status !== true)
+ {
+ view::Post($this,$status,"/open/myapp");
+ }else{
+ view::Post($this,'删除成功',"/open/myapp");
+ }
+ return false;
+ }
+
+ if($ac == "view")
+ {
+ $this->_helper->viewRenderer('myapp-view');
+ $this->view->data = $app->getAppInfo($id);
+ $this->view->appStatus = $app->appStatus();
+ return true;
+ }
+
+ }
+
+ function authenticateAction()
+ {
+ $this->_helper->layout->disableLayout();
+ $this->_helper->viewRenderer->setNoRender();
+
+ $data = array(
+ 'client_id' => $this->_getParam('client_id'),
+ 'redirect_uri' => $this->_getParam('redirect_uri'),
+ 'client_secret' => $this->_getParam('client_secret'),
+ 'host' => $_SERVER['HTTP_HOST'],
+ 'ip' => $_SERVER['REMOTE_ADDR']
+ );
+
+ $server = new Server();
+
+ $status = $server->clientCredentials($data['client_id'],$data['client_secret']);
+
+ if($status !== true)
+ {
+ echo $status;
+ }else{
+
+ }
+
+ }
+
+ function authorizeAction()
+ {
+ $submit = $this->_getParam('submit');
+
+ if(empty($submit))
+ {
+ return true;
+ }
+
+ $sv = new open\server();
+ $server = $sv->bootstrap();
+
+ $request = OAuth2\Request::createFromGlobals();
+ $response = new OAuth2\Response();
+
+ // validate the authorize request
+ if (!$server->validateAuthorizeRequest($request, $response)) {
+ $response->send();
+ die;
+ }
+
+ // print the authorization code if the user has authorized your client
+ $is_authorized = ($_POST['authorized'] === 'yes');
+ $server->handleAuthorizeRequest($request, $response, $is_authorized);
+ if ($is_authorized) {
+ // this is only here so that you get to see your code in the cURL request. Otherwise, we'd redirect back to the client
+ $code = substr($response->getHttpHeader('Location'), strpos($response->getHttpHeader('Location'), 'code=')+5, 40);
+ exit("SUCCESS! Authorization Code: $code");
+ }
+ $response->send();
+ }
+
+}
+
diff --git a/application/default/controllers/ServiceController.php b/application/default/controllers/ServiceController.php
index 446dd0a6..eede4257 100644
--- a/application/default/controllers/ServiceController.php
+++ b/application/default/controllers/ServiceController.php
@@ -314,11 +314,8 @@ class ServiceController extends Zend_Controller_Action
$citation=$row['mcitation'];
} else if ($row['citation'])
{
- if (empty($row['datadoi']))
- {
- $citation=$row['citation'];
- }
- elseif (!strpos($row['citation'],$row['datadoi']))
+ $citation=$row['citation'];
+ if (!empty($row['datadoi']) && !strpos($row['citation'],$row['datadoi']))
{
$citation='- 文章引用:'.$row['citation'].'
';
$citation.="- 数据的引用:";
@@ -722,11 +719,8 @@ class ServiceController extends Zend_Controller_Action
$cit=$row['mcitation'];
} else if ($row['citation'])
{
- if (empty($row['datadoi']))
- {
- $cit=$row['citation'];
- }
- elseif (!strpos($row['citation'],$row['datadoi']))
+ $cit=$row['citation'];
+ if (!empty($row['datadoi']) && !strpos($row['citation'],$row['datadoi']))
{
$cit='文章引用:'.$row['citation'];
$cit.="\r\n数据的引用:";
@@ -1405,7 +1399,7 @@ class ServiceController extends Zend_Controller_Action
$pageSize = 10;//每页容量
- $sql = "select md.title,md.uuid from mdref mr
+ $sql = "select distinct md.title,md.uuid from mdref mr
right join normalmetadata md on md.uuid=mr.uuid
where mr.refid=$id";
$pagnation="";
@@ -1453,6 +1447,24 @@ class ServiceController extends Zend_Controller_Action
echo '
';
echo $pagnation;
}//文档页面相关数据
+
+ function refdatacountAction()
+ {
+ if(view::isXmlHttpRequest($this))
+ {
+ $id = (int)$this->_getParam('id');
+ if($id < 1){
+ echo 0;
+ return;
+ }
+ $sql = "select count(distinct md.id) as total from mdref mr
+ right join normalmetadata md on md.uuid=mr.uuid
+ where mr.refid=$id";
+ $rs = $this->db->query($sql);
+ $row = $rs->fetch();
+ echo $row['total'];
+ }
+ }
function tagdatalistAction(){
@@ -1649,6 +1661,8 @@ class ServiceController extends Zend_Controller_Action
$this->_helper->layout->disableLayout();
$this->_helper->viewRenderer->setNoRender();
$uuid=$this->_request->getParam('uuid');
+ //文献id
+ $id=(int)$this->_request->getParam('id');
$lang=$this->_request->getParam('lang');
$ris='';
if ($lang=='cn' && !empty($uuid))
@@ -1690,6 +1704,10 @@ class ServiceController extends Zend_Controller_Action
$ris.='M3 - doi:'.$row['doi']."\r\n";
$ris.='DO - doi:'.$row['doi']."\r\n";
$ris.='ER -'."\r\n";
+ } else if ($id) {
+ $sql="select ris from reference where id=$id";
+ $row=$this->db->fetchRow($sql);
+ $ris=$row['ris'];
}
if (!empty($ris))
{
@@ -1787,6 +1805,98 @@ class ServiceController extends Zend_Controller_Action
public function jsonexit($data){
$this->getResponse()->setHeader('Content-Type', 'application/json')->appendBody(json_encode($data,JSON_NUMERIC_CHECK));
return true;
- }
-
+ }
+
+ public function dciAction()
+ {
+ $this->_helper->layout->disableLayout();
+ $this->_helper->viewRenderer->setNoRender();
+ //must have doi to output dci
+ $uuid=$this->_request->getParam('uuid');
+
+ $xml='
+
@@ -107,13 +107,13 @@
diff --git a/application/default/views/scripts/account/fetchpwd.phtml b/application/default/views/scripts/account/fetchpwd.phtml
index fcea22a9..ac41ca95 100644
--- a/application/default/views/scripts/account/fetchpwd.phtml
+++ b/application/default/views/scripts/account/fetchpwd.phtml
@@ -1,24 +1,55 @@
-headTitle($this->config->title->site);
- $this->headTitle('用户登录');
- $this->headTitle()->setSeparator(' - ');
- $this->headLink()->appendStylesheet('/css/register.css');
- $this->breadcrumb('
首页');
- $this->breadcrumb('
找回密码');
- $this->breadcrumb()->setSeparator(' > ');
-?>
-messages)) : ?>
-
-messages as $info)echo $info;
- ?>
-
-
-form) : ?>
-
-form;?>
-
-
-
+headTitle($this->config->title->site);
+ $this->headTitle('用户登录');
+ $this->headTitle()->setSeparator(' - ');
+ $this->headLink()->appendStylesheet('/css/register.css');
+ $this->breadcrumb('
首页');
+ $this->breadcrumb('
找回密码');
+ $this->breadcrumb()->setSeparator(' > ');
+?>
+
+ error)) { ?>
+ = $this->error ?>
+
+
+
+
\ No newline at end of file
diff --git a/application/default/views/scripts/account/left.phtml b/application/default/views/scripts/account/left.phtml
index 8608f255..c219e4d7 100644
--- a/application/default/views/scripts/account/left.phtml
+++ b/application/default/views/scripts/account/left.phtml
@@ -2,6 +2,7 @@
数据篮
+
账户信息
安全性
diff --git a/application/default/views/scripts/account/register.phtml b/application/default/views/scripts/account/register.phtml
index cf161a9b..fb1d8a7a 100755
--- a/application/default/views/scripts/account/register.phtml
+++ b/application/default/views/scripts/account/register.phtml
@@ -1,19 +1,81 @@
-headTitle($this->config->title->site);
- $this->headTitle('用户注册');
- $this->headTitle()->setSeparator(' - ');
- $this->headLink()->appendStylesheet('/css/register.css');
- $this->breadcrumb('
首页');
- $this->breadcrumb('
用户注册');
- $this->breadcrumb()->setSeparator(' > ');
-?>
-
-
-
确认服务条款
-
-
填写基本信息
-
-
注册完成
- form;?>
-
-
\ No newline at end of file
+headTitle($this->config->title->site);
+ $this->headTitle('用户注册');
+ $this->headTitle()->setSeparator(' - ');
+ $this->headLink()->appendStylesheet('/css/register.css');
+ $this->breadcrumb('
首页');
+ $this->breadcrumb('
用户注册');
+ $this->breadcrumb()->setSeparator(' > ');
+?>
+
+place)){?>
+
+
\ No newline at end of file
diff --git a/application/default/views/scripts/author/newdata.phtml b/application/default/views/scripts/author/newdata.phtml
index b9452845..e5588fe5 100644
--- a/application/default/views/scripts/author/newdata.phtml
+++ b/application/default/views/scripts/author/newdata.phtml
@@ -96,10 +96,10 @@ function getFtp(uuid){
{
if(data.statu > 0)
{
- var html = '
临时FTP帐号信息(此帐号仅对应当前数据集!)
ftp://ftp2.westgis.ac.cn/
'+
+ var html = '
临时FTP帐号信息(此帐号仅对应当前数据集!)
ftp://ftp.sanjiangyuan.org.cn/
'+
'
用户名:'+data.user+
'
密码:'+data.passwd+'
'
- +'
或直接点击此链接
';
+ +'
或直接点击此链接
';
Alert(html);
}
}
diff --git a/application/default/views/scripts/data/index.phtml b/application/default/views/scripts/data/index.phtml
index c589d345..c4ab8b53 100755
--- a/application/default/views/scripts/data/index.phtml
+++ b/application/default/views/scripts/data/index.phtml
@@ -8,81 +8,81 @@ $this->headTitle()->setSeparator(' - ');
.fieldlist ul li:hover{color:#FFF;background:#0088CC;border-radius: 6px 6px 6px 6px;}
.fieldlist ul li:hover a{color:#FFF; text-decoration:none;}
.news_list ul li{line-height:24px;}
-
-
-
-
特色导航
-
+
+
'地点关键词','theme'=>'主题关键词','discipline'=>'学科关键词','stratum'=>'地层关键词','temporal'=>'时间关键词');
+ $keytypezh=array('place'=>'地点关键词','theme'=>'主题关键词','discipline'=>'学科关键词','stratum'=>'地层关键词','temporal'=>'时间关键词');
$type='theme';
-?>
-
-
+?>
+
+
keywords[$type] as $cg) : ?>
- '>()
-
+
-
-
+
+
keywords[$type] as $cg) : ?>
- '>()
-
-
-
+
+
+
-
-
+?>
+
+
keywords[$type] as $cg) : ?>
- '>()
-
+
-
-
+
+
keywords[$type] as $cg) : ?>
- '>()
-
+
@@ -94,7 +94,7 @@ $this->headTitle()->setSeparator(' - ');
'>()
-
+
数据服务
diff --git a/application/default/views/scripts/data/view.phtml b/application/default/views/scripts/data/view.phtml
index b193aa7d..ee20e461 100755
--- a/application/default/views/scripts/data/view.phtml
+++ b/application/default/views/scripts/data/view.phtml
@@ -19,6 +19,7 @@ h3.gs_rt{font-size:110%;}
#file-list li li:hover {background-color: #dedede;}
#file-list li li li:hover {background-color: #eeeeee;}
+= $this->render('breadcrumbs.phtml'); ?>
metadata;if ($md):?>
escape($md->title);
if ($md->title_en) echo '
'.$this->escape($md->title_en);?>
@@ -32,7 +33,26 @@ if ($md->title_en) echo '
'.$this->escape($md->title_en);?>
',$md->description);?>
-
+
+ mcitation) : ?>
+
+
本数据要求的多篇文献引用
+
+ mcitation as $ref) :
+ echo '- '.$ref->reference;
+ echo '查看';
+ if (empty($ref->link))
+ {
+ if(!empty($ref->attid))
+ echo '下载';
+ }else{
+ echo '下载';
+ }
+ echo "
";
+ endforeach;
+ ?>
+
+
citation) : ?>
@@ -46,29 +66,63 @@ if ($md->title_en) echo '
'.$this->escape($md->title_en);?>
echo substr($md->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) : ?>
-
建议参考文献
+
相关文献(作者推荐)
ref as $ref) :
+ echo '- '.$ref->reference;
+ echo '查看';
if (empty($ref->link))
- echo '
- '.$ref->reference.'
';
- else
- echo '- '.$ref->reference.' 下载
';
+ {
+ if(!empty($ref->attid))
+ echo '下载';
+ }else{
+ echo '下载';
+ }
+ echo "";
endforeach;
?>
-
- userref) : ?>
+ themeref) :?>
+
-
数据用户发表文献
+
专题文献
+
+ themeref as $ref) :
+ echo '- '.$ref->reference;
+ echo '查看';
+ if (empty($ref->link))
+ {
+ if(!empty($ref->attid))
+ echo ' | 下载';
+ }else{
+ echo ' | 下载';
+ }
+ echo "
";
+ endforeach;
+ ?>
+
+ userref) : ?>
+
+
数据施引文献
userref as $ref) :
+ echo '- '.$ref->reference;
+ echo '查看';
if (empty($ref->link))
- echo '
- '.$ref->reference.'
';
- else
- echo '- '.$ref->reference.' 下载
';
+ {
+ if(!empty($ref->attid))
+ echo '下载';
+ }else{
+ echo '下载';
+ }
+ echo "";
endforeach;
+ if (count($this->userref)==15)
+ {
+ echo '更多施引文献';
+ }
?>
@@ -101,7 +155,7 @@ if ($md->title_en) echo '
'.$this->escape($md->title_en);?>
fund)) : ?>
fund as $k=>$v) : ?>
- - = $v['fund_type'] ?>:= $v['title'] ?>(项目编号:= $v['fund_id']?>) [= $v['fund_type_en'] ?>(No. = $v['fund_id']?>)]
+ - = $v['fund_type'] ?>:= $v['title'] ?>(项目编号:= $v['fund_id']?>) [= $v['fund_type_en'] ?>(No. = $v['fund_id']?>)]
suppinfo)) : ?>
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);
+?>
+= $this->render('breadcrumbs.phtml'); ?>
+
+
+ = $this->partial('glacier/navi.phtml'); ?>
+
+
+ info) : ?>
+
+ info['body'])) echo $this->info['body'];?>
+
+
+ metadata) : ?>
+ page->getNavigation(); ?>
+
+
+ metadata as $md) : ?>
+
+
+
+
+
+
+
\ 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(' > ');
?>
-
+
= $this->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(' > ');
-?>
-
-
- = $this->partial('glacier/navi.phtml'); ?>
-
-
-
-
- category as $cg) : ?>
- - '>()
-
-
-
-
- metadata)) : ?>
-
- page->getNavigation(); ?>
-
-
-
- metadata as $md) : ?>
-
-
-
-
-
- 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(' > ');
-?>
-
-
-
-
-
-
-
-metadata) : ?>
-page->getNavigation(); ?>
-
-
- metadata as $md) : ?>
-
-
-
-
-
-
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(' > ');
-?>
-
-
- = $this->partial('glacier/navi.phtml'); ?>
-
-
-
-
为了对冰川编目结果进行验证并获得更多的冰川环境信息,项目开展了大量的野外考察。考察范围包括:祁连山、昆仑山-唐古拉山、喜马拉雅山、青藏高原腹地冰川考察、黄河源-念青唐古拉山中段北坡-喜马拉雅山中段。考察内容包括GPS测量、冰川厚度测量、冰川区地形摄影测量、冰川物质平衡测量、冰川区气象水文要素测量、冰湖水位和温度测量等。
-
-
-
- metadata) : ?>
- page->getNavigation(); ?>
-
-
- metadata as $md) : ?>
-
-
-
-
-
-
-
\ 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(' > ');
-?>
-
-
- = $this->partial('glacier/navi.phtml'); ?>
-
-
-
-
与多年冻土相关的测量数据,包括探地雷达测量的地下冰厚度、冻土层上限等。
-
-
-
- metadata) : ?>
- page->getNavigation(); ?>
-
-
- metadata as $md) : ?>
-
-
-
-
-
-
-
\ 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(' > ');
-?>
-
-
- = $this->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) : ?>
-
-
-
-
-
-
-
\ 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(' > ');
-?>
-
-
- = $this->partial('glacier/navi.phtml'); ?>
-
-
-
-
冰川编目数据:基于遥感影像解译获得的反应我国2005年前后冰川现状的冰川分布图及其基本属性。除了包括中国全境的冰川编目数据外,还包括祁连山、天山、贡嘎山、纳木错流域、长江源区、年楚河流域和珠穆朗玛峰北坡等典型地区的多年代冰川分布数据。
-
-
-
- metadata) : ?>
- page->getNavigation(); ?>
-
-
- metadata as $md) : ?>
-
-
-
-
-
-
-
\ 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(' > ');
-?>
-
-
-
-
-
-
-
-metadata) : ?>
-page->getNavigation(); ?>
-
-
- metadata as $md) : ?>
-
-
-
-
-
-
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(' > ');
-?>
-
-
- = $this->partial('glacier/navi.phtml'); ?>
-
-
-
-
采用高精度GPS设备在冰川表面或周边地区测量获得的数据,可用来获得冰川高程信息,也可与以前的观测数据相比较获得冰川流动和物质平衡变化信息。
-
-
-
- metadata) : ?>
- page->getNavigation(); ?>
-
-
- metadata as $md) : ?>
-
-
-
-
-
-
-
\ 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(' > ');
-?>
-
-
- = $this->partial('glacier/navi.phtml'); ?>
-
-
-
-
在冰川下游观测获得的水文数据,观测要素包括径流、水质和水文化学等,也包括部分冰湖的观测数据。
-
-
-
- metadata) : ?>
- page->getNavigation(); ?>
-
-
- metadata as $md) : ?>
-
-
-
-
-
-
-
\ 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);
?>
+= $this->render('breadcrumbs.phtml'); ?>
-
- = $this->partial('glacier/navi.phtml'); ?>
+
+ = $this->partial('glacier/navi.phtml'); ?>
-
+
+
-
“中国冰川资源及其变化调查”项目简介
-
- 冰川是最敏感、最直接、最易于辩识、长纪录、高分辨的气候变化信息指示器和储存体,冰川变化信息是全球变化中的重要基础性资源。我国是中、低纬度山 地冰川面积最多的国家(占52%),是两极冰盖之外最重要的冰川集结地,冰川变化信息的挖掘、调查、监测、编目是十分重要的基础性工作。
-
-
- 始于1978年的第一次冰川编目历时24年,查清了截止到第一次全国航空测量时(西部冰川区约为1960s-1980s)中国冰川资源的基本情况。第一次冰川清查工作在国际和国内产生了重大影响,被国际冰川学会主席誉为建立了一座“冰川和气候变化研究的金矿”。
- 本次冰川资源调查是在中国科技部和中国科学院的联合支持下开展的一次大规模冰川普查,其目标以第一次冰川编目为参考,以2005-2006年为现状 年,以高分辨率遥感数据与地理信息系统技术为基础,深入研究基于遥感的冰川制图方法,结合冰川野外考察考察,获取我国冰川的分布状况,对有观测历史的典型 冰川进行重点监测;并与第一次冰川编目数据进行比较,查明我国冰川资源变化情况;同时,以此调查数据为基础,综合定位监测与相关资料,评估冰川变化对水资 源的影响,为西部水资源开发利用提供决策依据 。
-
-
《中国冰川资源及其变化调查》主要研究内容
-
- - 第一次冰川编目的数字化:重点开展第一次冰川编目时期冰川及冰湖分布的数字化,为冰川遥感监测提供基础数据。
- - 现状年(2005-2006年)西北干旱区和其它典型区冰川(湖)分布遥感调查:重点开展现状年基于高分辨率遥感影像的冰川与冰湖分布调查,同时,开展研究区部分冰川表面高程和运动速度信息的提取。
- - 遥感冰川制图地面验证、典型冰川厚度测量与冰川变化野外调查:重点开展代表性区域野外调查和典型冰川定位观测,验证遥感解译结果,获取典型监测冰川过程观测数据;开展代表性冰川厚度的雷达测量。
- - 冰川变化对水资源的影响评估:以现有定位观测冰川和区域冰川变化遥感调查数据为基础,评估西北干旱区和其它典型区冰川变化特征及其对水资源的影响。
- - 冰川资源及其变化调查信息共享平台建设:建立冰川资源管理及共享信息系统,为资源共享服务。
-
-
《西部冰川变化监测及其影响评估方法研究》主要研究内容
-
- - 各类冰川参数的遥感提取方法研究:针对西部三类冰川特点,综合运用现有卫星遥感数据,建立冰川几何尺寸、特征要素、物理特征、表面高程等信息的提取算法,为大范围冰川调查提供适合各类冰川下垫面状况和气候条件的参数提取方法集,提高遥感获取冰川信息的自动化程度。
- - 冰川储量估算与冰川参数遥感提取精度评估:研制或改进冰川厚度测量雷达,对不同类型典型冰川流域不同规模的代表性冰川进行冰川厚度测量,建立适 合不同规模冰川的储量计算公式;开展各典型监测冰川区遥感冰川制图的野外验证、控制点采集与冰川变化的调查,进行遥感提取参数的误差分析与方法验证研究。
- - 流域冰川融水径流估算方法研究:以典型监测冰川长期观测资料为基础,并进行加强观测,同时收集流域出山口径流长期水文气象观测数据,建立适合不同资料条件的简单和复杂冰川融水径流模型,在对比分析基础上,提出适合西部流域尺度的冰川融水径流计算方案。
- - 冰川变化对水资源影响的评估方法及其应用研究:分析典型冰川流域冰川变化的空间特征及其差异;以典型冰川融水径流过程和流域尺度冰川动力响应研 究为基础,研究不同融水径流计算方案、基于冰川动力响应和基于冰川几何尺度转换关系模型对于不同性质冰川流域融水径流年际变化的模拟能力;根据流域融水径 流模型集,剖析冰川变化对冰川径流临界转变的影响及其强度。
-
+
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(' > ');
-?>
-
-
- = $this->partial('glacier/navi.phtml'); ?>
-
-
-
-
冰川编目数据:基于遥感影像解译获得的反应我国2005年前后冰川现状的冰川分布图及其基本属性。除了包括中国全境的冰川编目数据外,还包括祁连山、天山、贡嘎山、纳木错流域、长江源区、年楚河流域和珠穆朗玛峰北坡等典型地区的多年代冰川分布数据。
-
-
冰湖编目数据:
- 冰湖是指在冰川前端、表面或内部形成的湖泊。冰湖编目是指利用地形图和遥感数据等资料对位于冰川前端和表面的湖泊进行登记的调查行为。
-
-
- metadata) : ?>
- page->getNavigation(); ?>
-
-
- metadata as $md) : ?>
-
-
-
-
-
-
-
\ 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(' > ');
-?>
-
-
- = $this->partial('glacier/navi.phtml'); ?>
-
-
-
-
冰湖编目数据:
- 冰湖是指在冰川前端、表面或内部形成的湖泊。冰湖编目是指利用地形图和遥感数据等资料对位于冰川前端和表面的湖泊进行登记的调查行为。
-
-
-
- metadata) : ?>
- page->getNavigation(); ?>
-
-
- metadata as $md) : ?>
-
-
-
-
-
-
-
\ 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(' > ');
-?>
-
-
- = $this->partial('glacier/navi.phtml'); ?>
-
-
-
-
- 利用冰川测厚雷达获得的反应冰川厚度和冰下地形的野外测量数据,可为冰川厚度分布图和冰下地形图等提供重要的基础资料。同时,利用这些测量资料可以估算冰川的冰储量,为冰川变化响应气候变化提供定量科学依据,而且可以为各种水文模型提供重要的冰下地形参数。
-
-
-
-
- metadata) : ?>
- page->getNavigation(); ?>
-
-
- metadata as $md) : ?>
-
-
-
-
-
-
-
\ 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(' > ');
-?>
-
-
- = $this->partial('glacier/navi.phtml'); ?>
-
-
-
-
- 冰川在一定时间内的物质变化即积累与消融之差。积累大于消融为正平衡,消融大于积累为负平衡。冰川物质平衡野外观测一般包括利用雪坑剖面观测冰川积累量和花杆观测冰川消融量。
-
-
-
-
- metadata) : ?>
- page->getNavigation(); ?>
-
-
- metadata as $md) : ?>
-
-
-
-
-
-
-
\ 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(' > ');
-?>
-
-
- = $this->partial('glacier/navi.phtml'); ?>
-
-
-
-
在冰川区观测的气象数据,观测要素包括温度、风速、风向、降水等。受观测条件的限制,观测要素和观测时段不能保持完全一致。
-
-
-
- metadata) : ?>
- page->getNavigation(); ?>
-
-
- metadata as $md) : ?>
-
-
-
-
-
-
-
\ 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(' > ');
-?>
-
-
- = $this->partial('glacier/navi.phtml'); ?>
-
-
-
-
冰川运动观测一般分为冰川表面运动观测和冰川内部运动观测。前者一般采用GPS和花杆等测量方法,后者一般采用挖坑法、冰隧道法和钻孔法。
-
-
-
- metadata) : ?>
- page->getNavigation(); ?>
-
-
- metadata as $md) : ?>
-
-
-
-
-
-
-
\ 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(' > ');
-?>
-
-
-
-
-
-
-
-metadata) : ?>
-page->getNavigation(); ?>
-
-
- metadata as $md) : ?>
-
-
-
-
-
-
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(' > ');
-?>
-
-
-
-
-
-
-
-metadata) : ?>
-page->getNavigation(); ?>
-
-
- metadata as $md) : ?>
-
-
-
-
-
-
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'=>'时间轴导航');
?>
-
+
= $this->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'=>'时空导航');
?>
-
+
= $this->partial('glacier/navi.phtml'); ?>
-
+
= $this->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(' > ');
-?>
-
-
- = $this->partial('glacier/navi.phtml'); ?>
-
-
-
-
- metadata) : ?>
- page->getNavigation(); ?>
-
-
- metadata as $md) : ?>
-
-
-
-
-
-
-
\ 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'=>'查看元数据');
+?>
+= $this->render('breadcrumbs.phtml'); ?>
metadata;if ($md):?>
-
+
= $this->partial('glacier/navi.phtml'); ?>
-
-
-
= $this->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 '- '.$ref->reference.'
';
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 '- '.$ref->reference;
+ echo '查看';
+ if (empty($ref->link))
+ {
+ if(!empty($ref->attid))
+ echo '下载';
+ }else{
+ echo '下载';
+ }
+ echo "
";
+ endforeach;
+ ?>
+
+ themeref) :?>
+
+
+
专题文献
+
+ themeref as $ref) :
+ echo '- '.$ref->reference;
+ echo '查看';
+ if (empty($ref->link))
+ {
+ if(!empty($ref->attid))
+ echo ' | 下载';
+ }else{
+ echo ' | 下载';
+ }
+ echo "
";
+ endforeach;
+ ?>
+
+ userref) : ?>
+
+
数据施引文献
userref as $ref) :
+ echo '- '.$ref->reference;
+ echo '查看';
if (empty($ref->link))
- echo '
- '.$ref->reference.'
';
- else
- echo '- '.$ref->reference.' 下载
';
+ {
+ 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) : ?>
- - = $v['fund_type'] ?>:= $v['title'] ?>(项目编号:= $v['fund_id']?>) [= $v['fund_type_en'] ?>(No. = $v['fund_id']?>)]
-
-
- suppinfo)) : ?>
- '.str_replace(array("\r\n", "\n", "\r"),'
',$this->escape($md->suppinfo)).'
';?>
-
-
+ suppinfo || $this->fund) : ?>
+
资助项目
+ fund)) : ?>
+
+ fund as $k=>$v) : ?>
+ - = $v['fund_type'] ?>:= $v['title'] ?>(项目编号:= $v['fund_id']?>) [= $v['fund_type_en'] ?>(No. = $v['fund_id']?>)]
+
+
+ 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);?>
-
+
- 类别:
category as $cat): ?>
@@ -273,19 +326,19 @@ foreach($this->keys as $cg) :
if ($i==0) {
?>
- doi) : ?>
-
-
+ doi) : ?>
+
+
-
+
fileformat) : ?>
- 格式:fileformat; ?>
@@ -341,10 +394,21 @@ endforeach;
在线下载
-
- 离线申请
-
+ dataService)) { ?>
+ theme->AppendPlus($this,'datepicker'); ?>
+
+
+
+
+ 放入数据篮
+
+
@@ -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,'= $md->uuid; ?>');
}
-function getFileList(){
- getFileList_h('uuid;?>');
-}
-
function ajaxpage(page){
ajaxpage_get(page,'= $md->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(' > ');
-?>
-
-
-
-
-
-
-
-metadata) : ?>
-page->getNavigation(); ?>
-
-
- metadata as $md) : ?>
-
-
-
-
-
-
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'=>'海河流域观测数据集');
+?>
+= $this->render('breadcrumbs.phtml'); ?>
+
+
+ = $this->partial('haihe/navi.phtml'); ?>
+
+
+ info) : ?>
+
+ info['body'])) echo $this->info['body'];?>
+
+
+ metadata) : ?>
+ page->getNavigation(); ?>
+
+
+ metadata as $md) : ?>
+
+
+
+
+
+
+
\ 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'=>'海河流域观测数据集');
+?>
+= $this->render('breadcrumbs.phtml'); ?>
+
+
+ = $this->partial('haihe/navi.phtml'); ?>
+
+
+
+
数据相关文献
+ refs) : ?>
+ page->getNavigation(); ?>
+
+
+ refs as $md) : ?>
+ - 查看';
+ if (!empty($md['link'])) :
+ echo ' 下载';
+ else :
+ if (!empty($md['attid'])) echo ' 下载';
+ endif;
+ ?>
+ 相关数据]
+
+
+
+
+
+
+
+
\ 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'=>'海河流域观测数据集');
+?>
+= $this->render('breadcrumbs.phtml'); ?>
+
+
+ = $this->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'=>'海河流域观测数据集');
+?>
+
+= $this->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 '- '.$ref->reference;
+ echo '查看';
+ if (empty($ref->link))
+ {
+ if(!empty($ref->attid))
+ echo '下载';
+ }else{
+ echo '下载';
+ }
+ echo "
";
+ 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 '- '.$ref->reference;
+ echo '查看';
+ if (empty($ref->link))
+ {
+ if(!empty($ref->attid))
+ echo '下载';
+ }else{
+ echo '下载';
+ }
+ echo "
";
+ endforeach;
+ ?>
+
+ themeref) :?>
+
+
+
专题文献
+
+ themeref as $ref) :
+ echo '- '.$ref->reference;
+ echo '查看';
+ if (empty($ref->link))
+ {
+ if(!empty($ref->attid))
+ echo ' | 下载';
+ }else{
+ echo ' | 下载';
+ }
+ echo "
";
+ endforeach;
+ ?>
+
+ userref) : ?>
+
+
数据施引文献
+
+ userref as $ref) :
+ echo '- '.$ref->reference;
+ echo '查看';
+ if (empty($ref->link))
+ {
+ if(!empty($ref->attid))
+ echo '下载';
+ }else{
+ echo '下载';
+ }
+ echo "
";
+ 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){ ?>
+
数据相关新闻
+
+
+
+ suppinfo || $this->fund) : ?>
+
资助项目
+ fund)) : ?>
+
+ fund as $k=>$v) : ?>
+ - = $v['fund_type'] ?>:= $v['title'] ?>(项目编号:= $v['fund_id']?>) [= $v['fund_type_en'] ?>(No. = $v['fund_id']?>)]
+
+
+ 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 '- '.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 '
';
+ }
+ ?>
+
+
+ 暂时没有服务记录,欢迎您下载使用!
+
+
+
+
+
+
+
+
+
+
+
+
+
+ '学科','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) : ?>
+
+
+
+
+
+
+ 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 "在线(可直接下载)";?>
+
+
+
+
+
空间位置
+
+
+
联系信息
+
+
+ '资源提供者','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;
+ ?>
+
+
+
+
+
+
+
+
+
+
+
+
+
Cannot find the metadata.
+
没有找到对应的元数据。
+
+
+
diff --git a/application/default/views/scripts/header.phtml b/application/default/views/scripts/header.phtml
index c926f63a..4669f345 100755
--- a/application/default/views/scripts/header.phtml
+++ b/application/default/views/scripts/header.phtml
@@ -1,7 +1,7 @@
@@ -520,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');
?>
-
+
= $this->partial('hiwater/navi.phtml'); ?>
-
+
= $this->breadcrumb() ?>
metadata) : ?>
@@ -22,12 +22,12 @@ $this->theme->AppendPlus($this,'colorbox');
metadata as $md) : ?>
-
-
+
[缩略图幻灯片]
- [PDF版本下载]
- [ODT版本下载]
- [DOC版本下载]
+ [PDF版本下载]
+ [ODT版本下载]
+ [DOC版本下载]
diff --git a/application/default/views/scripts/hiwater/view.phtml b/application/default/views/scripts/hiwater/view.phtml
index 4178c489..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 '- '.$ref->reference.'
';
+ {
+ echo '- '.$ref->reference;
+ echo '查看';
+ if(!empty($ref->attid)) {
+ echo ' 下载';
+ }
+ echo "
";
+ }
else
- echo '- '.$ref->reference.' 下载
';
+ echo '- '.$ref->reference.'查看 下载
';
endforeach;
?>
@@ -69,27 +76,61 @@ if ($md->title_en) echo '
'.$this->escape($md->title_en);?>
?> (下载引用:RIS格式 | RIS英文格式 | Bibtex格式 | Bibtex英文格式)
ref) : ?>
- 建议参考文献
+ 相关文献(作者推荐)
ref as $ref) :
+ echo '- '.$ref->reference;
+ echo '查看';
if (empty($ref->link))
- echo '
- '.$ref->reference.'
';
- else
- echo '- '.$ref->reference.' 下载
';
+ {
+ if(!empty($ref->attid))
+ echo '下载';
+ }else{
+ echo '下载';
+ }
+ echo "";
endforeach;
?>
-
- userref) : ?>
+ themeref) :?>
+
- 数据用户发表文献
+ 专题文献
+
+ themeref as $ref) :
+ echo '- '.$ref->reference;
+ echo '查看';
+ if (empty($ref->link))
+ {
+ if(!empty($ref->attid))
+ echo ' | 下载';
+ }else{
+ echo ' | 下载';
+ }
+ echo "
";
+ endforeach;
+ ?>
+
+ userref) : ?>
+
+ 数据施引文献
userref as $ref) :
+ echo '- '.$ref->reference;
+ echo '查看';
if (empty($ref->link))
- echo '
- '.$ref->reference.'
';
- else
- echo '- '.$ref->reference.' 下载
';
+ {
+ if(!empty($ref->attid))
+ echo '下载';
+ }else{
+ echo '下载';
+ }
+ echo "";
endforeach;
+ if (count($this->userref)==15)
+ {
+ echo '更多施引文献';
+ }
?>
@@ -122,7 +163,7 @@ if ($md->title_en) echo '
'.$this->escape($md->title_en);?>
fund)) : ?>
fund as $k=>$v) : ?>
- - = $v['fund_type'] ?>:= $v['title'] ?>(项目编号:= $v['fund_id']?>) [= $v['fund_type_en'] ?>(No. = $v['fund_id']?>)]
+ - = $v['fund_type'] ?>:= $v['title'] ?>(项目编号:= $v['fund_id']?>) [= $v['fund_type_en'] ?>(No. = $v['fund_id']?>)]
suppinfo)) : ?>
diff --git a/application/default/views/scripts/index/index.phtml b/application/default/views/scripts/index/index.phtml
index 1867014d..929ee88f 100755
--- a/application/default/views/scripts/index/index.phtml
+++ b/application/default/views/scripts/index/index.phtml
@@ -42,9 +42,12 @@
@@ -83,7 +86,7 @@
-
青海省草原总站
+
@@ -110,7 +113,7 @@
-
青海省林业调查规划院
+
@@ -126,7 +129,7 @@
-
青海省水文水资源局
+
diff --git a/application/default/views/scripts/knowledge/author.phtml b/application/default/views/scripts/knowledge/author.phtml
index 88a92cf9..2ed61408 100644
--- a/application/default/views/scripts/knowledge/author.phtml
+++ b/application/default/views/scripts/knowledge/author.phtml
@@ -5,7 +5,7 @@ $this->headTitle()->setSeparator(' - ');
$this->headLink()->appendStylesheet('/css/mdreview.css');
$this->breadcrumb('
首页');
$this->breadcrumb('
知识积累');
-$this->breadcrumb('数据作者');
+$this->breadcrumb('作者推荐文献库');
$this->breadcrumb()->setSeparator(' > ');
$this->headScript()->appendFile('/js/jquery.colorbox-min.js');
$this->headLink()->appendStylesheet('/css/colorbox.css');
@@ -16,20 +16,23 @@ $this->headLink()->appendStylesheet('/css/colorbox.css');
-
数据作者文献库
+
作者推荐文献库
- paginator)): ?>
-
- paginator as $item): ?>
- -
- 下载';
- endif;
+ paginator)): ?>
+
+ paginator as $item): ?>
+ - 查看';
+ if (!empty($item['link'])) :
+ echo ' 下载';
+ else :
+ if (!empty($item['attid'])) echo ' 下载';
+ endif;
?>
- 相关数据
-
-
-
+
相关数据
+
+
+
= $this->paginator; ?>
diff --git a/application/default/views/scripts/knowledge/datacenter.phtml b/application/default/views/scripts/knowledge/datacenter.phtml
index afbf6bb9..29ec7c29 100644
--- a/application/default/views/scripts/knowledge/datacenter.phtml
+++ b/application/default/views/scripts/knowledge/datacenter.phtml
@@ -17,16 +17,21 @@ $this->breadcrumb()->setSeparator(' > ');
数据中心文献库
paginator)): ?>
-
+
paginator as $item): ?>
- -
- 下载';
- endif;
+
- 数据中心施引文献';
+ echo $item['reference'];
+ echo ' 查看';
+ if (!empty($item['link'])) :
+ echo ' 下载';
+ else :
+ if (!empty($item['attid'])) echo ' 下载';
+ endif;
?>
-
+
= $this->paginator; ?>
diff --git a/application/default/views/scripts/knowledge/index.phtml b/application/default/views/scripts/knowledge/index.phtml
index 66596a82..a9765cbb 100755
--- a/application/default/views/scripts/knowledge/index.phtml
+++ b/application/default/views/scripts/knowledge/index.phtml
@@ -10,16 +10,6 @@ $this->breadcrumb()->setSeparator(' > ');
= $this->partial('knowledge/navi.phtml'); ?>
-
@@ -27,10 +17,32 @@ $this->breadcrumb()->setSeparator(' > ');
+
-
西部计划文献库
+
+
数据施引文献库
+
数据施引文献库是数据用户在使用科学数据后公开发表在科技期刊上的文献,由用户自发通知数据中心、数据作者收集和数据中心集中手机三种方式进行收集整理。
+
从数据用户的文献库中,可以挖掘出更多的知识,了解用户是如何使用数据中心提供的科学数据。数据作者也可以从其中获取到数据相关的趋势性知识。
+ 数据中心也欢迎用户提供更多的公开发表成果,我们将持续更新其内容,以满足数据的深层挖掘,实现学术信息进行搜索、发现、聚集和再组织。
+
查看 »
+
+
+
作者推荐文献库
+
作者推荐文献库是对发布在数据中心的科学数据的作者所推荐的和其数据相关的科技文献,主要是由数据作者发表的、和其数据紧密相关的科学文献。
+
用户可以通过数据作者的文献库中挖掘出对应的数据信息,实现从文献到数据的一个知识挖掘。将数据中心所有的数据作者文献构建一个和数据紧密相关的知识库,可以供用户更好的了解和发现数据和知识。
+ 支持用户对数据作者的学术信息进行搜索、发现、聚集和再组织。
+
查看 »
+
+
+
WATER文献库
+
WATER文献库是对由WATER项目所相关的科技文献,包括WATER项目自身发表的文献以及WATER数据用户所发表的文献。
+
用户可以通过WATER文献库中挖掘出对应的数据信息,实现从文献到数据的一个知识挖掘。将数据中心所有的数据作者文献构建一个和数据紧密相关的知识库,可以供用户更好的了解和发现数据和知识。
+ 支持用户对数据作者的学术信息进行搜索、发现、聚集和再组织。
+
查看 »
+
+
西部计划文献库
旨在发展和形成一个支持环境与生态科学领域开放学术信息的自助存档、交流和发现的领域知识平台。
首先,实现对国家自然科学基金委组织实施的“中国西部环境与生态科学研究计划”历年来所支持的研究项目和课题所产生的有重要科研和学术价值的知识产出进行统一组织和管理,
@@ -38,20 +50,6 @@ $this->breadcrumb()->setSeparator(' > ');
特别是对有重要学术影响的研究性数字知识库所涉及的环境与生态科学领域的学术信息进行搜索、发现、聚集和再组织。
查看 » 访问seekspace »
-
-
数据作者文献库
-
数据作者文献库是对发布在数据中心的科学数据中相关的参考文献,主要是由数据作者发表的、和其数据紧密相关的科学文献。
-
用户可以通过数据作者的文献库中挖掘出对应的数据信息,实现从文献到数据的一个知识挖掘。将数据中心所有的数据作者文献构建一个和数据紧密相关的知识库,可以供用户更好的了解和发现数据和知识。
- 支持用户对数据作者的学术信息进行搜索、发现、聚集和再组织。
-
查看 »
-
-
-
数据用户文献库
-
数据用户文献库是数据用户在使用科学数据后公开发表在科技期刊上的文献,由用户自发通知数据中心、数据作者收集和数据中心集中手机三种方式进行收集整理。
-
从数据用户的文献库中,可以挖掘出更多的知识,了解用户是如何使用数据中心提供的科学数据。数据作者也可以从其中获取到数据相关的趋势性知识。
- 数据中心也欢迎用户提供更多的公开发表成果,我们将持续更新其内容,以满足数据的深层挖掘,实现学术信息进行搜索、发现、聚集和再组织。
-
查看 »
-
‹
diff --git a/application/default/views/scripts/knowledge/navi.phtml b/application/default/views/scripts/knowledge/navi.phtml
index 5ddc4339..260138ad 100644
--- a/application/default/views/scripts/knowledge/navi.phtml
+++ b/application/default/views/scripts/knowledge/navi.phtml
@@ -1,25 +1,16 @@
diff --git a/application/default/views/scripts/knowledge/paper.phtml b/application/default/views/scripts/knowledge/paper.phtml
new file mode 100644
index 00000000..e629b8bd
--- /dev/null
+++ b/application/default/views/scripts/knowledge/paper.phtml
@@ -0,0 +1,105 @@
+headTitle($this->config->title->site);
+$this->headTitle('知识积累');
+$this->headTitle()->setSeparator(' - ');
+$this->headLink()->appendStylesheet('/css/mdreview.css');
+$this->breadcrumb('
首页');
+$this->breadcrumb('
知识积累');
+$this->breadcrumb('文章查看');
+$this->breadcrumb()->setSeparator(' > ');
+$this->headScript()->appendFile('/js/jquery.colorbox-min.js');
+$this->headLink()->appendStylesheet('/css/colorbox.css');
+?>
+
+
+ = $this->partial('knowledge/navi.phtml'); ?>
+
+
+
+ paper['title'])){ ?>
+
paper['title']; ?>
+
+
+ author) : ?>
+
作者
+
+ author as $a) : ?>
+ - 【所有文章】
+
+
+
+
+
+ paper['abstract']){ ?>
+
摘要
+
paper['abstract']; ?>
+
+
+
+ tag) > 0) { ?>
+
关键词
+
+
+
+
+ paper['reference'])) { ?>
+
引用方式
+
+ paper['reference']; ?>
+
+
+
+
+
+ paper['link']))
+ {
+ if(!empty($this->paper['attid']))
+ {
+ echo '
PDF下载';
+ }
+ }else{
+ echo '
PDF下载';
+ }
+
+ if (!empty($this->paper['ris'])) :
+ echo '
RIS下载';
+ endif;
+ ?>
+
相关数据(共?条)
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/application/default/views/scripts/knowledge/search-data.phtml b/application/default/views/scripts/knowledge/search-data.phtml
index 77da8dd8..6a312ace 100644
--- a/application/default/views/scripts/knowledge/search-data.phtml
+++ b/application/default/views/scripts/knowledge/search-data.phtml
@@ -19,17 +19,20 @@ $this->headLink()->appendStylesheet('/css/colorbox.css');
数据文献搜索
paginator)): ?>
-
- paginator as $item): ?>
- -
- 下载';
- endif;
+
+ paginator as $item): ?>
+ - 查看';
+ if (!empty($item['link'])) :
+ echo ' 下载';
+ else :
+ if (!empty($item['attid'])) echo ' 下载';
+ endif;
?>
- 相关数据
-
-
-
+
相关数据
+
+
+
= $this->paginator; ?>
diff --git a/application/default/views/scripts/knowledge/search.phtml b/application/default/views/scripts/knowledge/search.phtml
index 164b3b2b..fa37577c 100644
--- a/application/default/views/scripts/knowledge/search.phtml
+++ b/application/default/views/scripts/knowledge/search.phtml
@@ -43,7 +43,7 @@ $('#Nav-knowledge-westplan').addClass('active');
+
\ No newline at end of file
diff --git a/application/default/views/scripts/visual/data.phtml b/application/default/views/scripts/visual/data.phtml
new file mode 100644
index 00000000..5bf9f199
--- /dev/null
+++ b/application/default/views/scripts/visual/data.phtml
@@ -0,0 +1,174 @@
+headTitle($this->config->title->site);
+$this->headTitle($this->config->title->author);
+$this->headTitle()->setSeparator(' - ');
+$this->headScript()->appendFile('/js/jquery.colorbox-min.js');
+$this->headLink()->appendStylesheet('/css/colorbox.css');
+$this->headScript()->appendFile('/static/js/highcharts/highcharts.js');
+$this->headScript()->appendFile('/static/js/highcharts/modules/exporting.js');
+$this->breadcrumb('
首页');
+$this->breadcrumb('
数据可视化');
+$this->breadcrumb()->setSeparator(' > ');
+?>
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/application/default/views/scripts/visual/index.phtml b/application/default/views/scripts/visual/index.phtml
new file mode 100644
index 00000000..1e3e474b
--- /dev/null
+++ b/application/default/views/scripts/visual/index.phtml
@@ -0,0 +1,140 @@
+headTitle($this->config->title->site);
+$this->headTitle($this->config->title->data);
+$this->headTitle()->setSeparator(' - ');
+$theme = new Theme;
+$theme->appendPlus($this,'highstock');
+$this->breadcrumb('
首页');
+$this->breadcrumb('
数据与服务');
+$this->breadcrumb('数据可视化');
+$this->breadcrumb()->setSeparator(' > ');
+?>
+
+
\ No newline at end of file
diff --git a/application/default/views/scripts/water/view.phtml b/application/default/views/scripts/water/view.phtml
index b05aaf16..e17dd3e4 100755
--- a/application/default/views/scripts/water/view.phtml
+++ b/application/default/views/scripts/water/view.phtml
@@ -23,10 +23,10 @@ h3.gs_rt{font-size:110%;}
= $this->render('breadcrumbs.phtml'); ?>
metadata;if ($md):?>
-
escape($md->title);
-if ($md->title_en) echo '
'.$this->escape($md->title_en);?>
-
-
+
escape($md->title);
+ if ($md->title_en) echo '
'.$this->escape($md->title_en);?>
+
+
@@ -36,39 +36,75 @@ if ($md->title_en) echo '
'.$this->escape($md->title_en);?>
- citation) : ?>
+ citation) : ?>
datadoi) || !strpos($md->citation,$md->datadoi)) : ?>文章的引用
escape($md->citation);?>
- datadoi) && !strpos($md->citation,$md->datadoi)) : ?>
-
数据的引用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.', '.(empty($md->ts_published)?$md->publish_year:date('Y',strtotime($md->ts_published))).'. doi:'.$md->doi.']';
?> (下载引用:RIS格式 | RIS英文格式 | Bibtex格式 | Bibtex英文格式)
- ref) : ?>
+ ref) : ?>
-
建议参考文献
+
相关文献(作者推荐)
ref as $ref) :
+ echo '- '.$ref->reference;
+ echo '查看';
if (empty($ref->link))
- echo '
- '.$ref->reference.'
';
- else
- echo '- '.$ref->reference.' 下载
';
+ {
+ if(!empty($ref->attid))
+ echo '下载';
+ }else{
+ echo '下载';
+ }
+ echo "";
endforeach;
?>
-
- userref) : ?>
+ themeref) :?>
+
-
数据用户发表文献
+
专题文献
+
+ themeref as $ref) :
+ echo '- '.$ref->reference;
+ echo '查看';
+ if (empty($ref->link))
+ {
+ if(!empty($ref->attid))
+ echo ' | 下载';
+ }else{
+ echo ' | 下载';
+ }
+ echo "
";
+ endforeach;
+ ?>
+
+ userref) : ?>
+
+
数据施引文献
userref as $ref) :
+ echo '- '.$ref->reference;
+ echo '查看';
if (empty($ref->link))
- echo '
- '.$ref->reference.'
';
- else
- echo '- '.$ref->reference.' 下载
';
+ {
+ if(!empty($ref->attid))
+ echo '下载';
+ }else{
+ echo '下载';
+ }
+ echo "";
endforeach;
+ if (count($this->userref)==15)
+ {
+ echo '更多施引文献';
+ }
?>
@@ -101,7 +137,7 @@ if ($md->title_en) echo '
'.$this->escape($md->title_en);?>
fund)) : ?>
fund as $k=>$v) : ?>
- - = $v['fund_type'] ?>:= $v['title'] ?>(项目编号:= $v['fund_id']?>) [= $v['fund_type_en'] ?>(No. = $v['fund_id']?>)]
+ - = $v['fund_type'] ?>:= $v['title'] ?>(项目编号:= $v['fund_id']?>) [= $v['fund_type_en'] ?>(No. = $v['fund_id']?>)]
suppinfo)) : ?>
diff --git a/application/layouts/layout.phtml b/application/layouts/layout.phtml
index 2b56287b..825bbf07 100755
--- a/application/layouts/layout.phtml
+++ b/application/layouts/layout.phtml
@@ -28,16 +28,20 @@
= $this->render('footer.phtml') ?>
此数据还在评审过程中,我们真切地邀请您参加此数据的评审,以便我们能尽快发布此数据!评审
+ +数据评论
+