diff --git a/application/config.ini b/application/config.ini index a4096aca..cf788cd3 100755 --- a/application/config.ini +++ b/application/config.ini @@ -12,6 +12,13 @@ geonetwork.params.username = gis geonetwork.params.password = gispassword geonetwork.params.dbname = geonetwork +visual_db.adapter = PDO_PGSQL +visual_db.hostname = localhost +visual_db.username = gis +visual_db.password = gispassword +visual_db.database = sanjiangyuan +visual_db.port = 5432 + google.maps.api=ABQIAAAACD-MqkkoOm60o_dvwdcKVhRBSKpgcP88GYi6r2Of16IkMX_4YhSBQsywCi4J2_fh4nBuWmK7gyRjLg bing.api=4BC90E1E9ED351ECE0D9FB71509BC3CC1264340C bigthumb.path=../geonetwork/data/ @@ -22,7 +29,8 @@ 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=三江源生态监测综合数据服务平台 +sub.metadata = grasslandmd +title.site=青海省草原总站 title.data=数据产品与服务 title.review=数据评审 title.author=数据作者 diff --git a/application/default/controllers/DataController.php b/application/default/controllers/DataController.php index 7d9cf4fe..7187f372 100755 --- a/application/default/controllers/DataController.php +++ b/application/default/controllers/DataController.php @@ -11,6 +11,7 @@ class DataController extends Zend_Controller_Action { $this->db=Zend_Registry::get('db'); $this->view->config = Zend_Registry::get('config'); + $this->submd = $this->view->config->sub->metadata; $this->messenger=$this->_helper->getHelper('FlashMessenger'); $this->view->messages = $this->messenger->getMessages(); $this->view->theme = new Theme(); @@ -30,21 +31,21 @@ class DataController extends Zend_Controller_Action $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"); + $state=$this->db->query("select keyword,count(*) from keyword right join {$this->submd} m on keyword.id=m.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 keyword,count(*) from keyword right join {$this->submd} m on keyword.id=m.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"); + $state=$this->db->query("select keyword,count(*) from keyword right join {$this->submd} m on keyword.id=m.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"); + $state=$this->db->query("select keyword,count(*) from keyword right join {$this->submd} m on keyword.id=m.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 keyword,count(*) from keyword right join {$this->submd} m on keyword.id=m.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'); + $state=$this->db->query("select id,uuid,title from {$this->submd} order by id desc limit 10"); $this->view->metadata = $state->fetchAll(); //服务 $searchform=new SearchForm(); @@ -58,11 +59,11 @@ class DataController extends Zend_Controller_Action if (empty($page)) $page=1; $limit=30; $offset=$limit*($page-1); - $state=$this->db->query('select count(*) from normalmetadata where datatype=0'); + $state=$this->db->query("select count(*) from {$this->submd} 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); + $select->from("{$this->submd}",'*')->where('datatype=0')->order('title')->limitPage($page,$limit); $this->view->metadata = $this->db->fetchAll($select); $this->view->page=new Pagination($sum,$page,$limit); } @@ -72,11 +73,11 @@ class DataController extends Zend_Controller_Action if (empty($page)) $page=1; $limit=30; $offset=$limit*($page-1); - $state=$this->db->query('select count(*) from normalmetadata where datatype=1'); + $state=$this->db->query("select count(*) from {$this->submd} 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); + $select->from("{$this->submd}",'*')->where('datatype=1')->order('title')->limitPage($page,$limit); $this->view->metadata = $this->db->fetchAll($select); $this->view->page=new Pagination($sum,$page,$limit); } @@ -99,57 +100,7 @@ class DataController extends Zend_Controller_Action 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(); - } + /* * 数据浏览 */ diff --git a/application/default/controllers/IndexController.php b/application/default/controllers/IndexController.php index 9620e27e..d2e1ed88 100755 --- a/application/default/controllers/IndexController.php +++ b/application/default/controllers/IndexController.php @@ -7,13 +7,15 @@ class IndexController extends Zend_Controller_Action $this->view->config = Zend_Registry::get('config'); $this->db=Zend_Registry::get('db'); $this->view->theme = new Theme(); -# $this->view->main_nav_pageID = "index"; + $this->submd = $this->view->config->sub->metadata; + $this->_helper->layout->setLayout('index'); + //$this->view->main_nav_pageID = "index"; } function indexAction() { //统计数据 - $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'; + $sql="select (select count(*) from users) as usernum,(select count(*) from {$this->submd}) 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']; @@ -21,7 +23,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 normalmetadata group by datatype"; + $sql="select sum(filesize) as sum,datatype from {$this->submd} group by datatype"; $rows=$this->db->fetchAll($sql); foreach($rows as $row) { @@ -31,12 +33,12 @@ class IndexController extends Zend_Controller_Action $this->view->onlinesize=$row['sum']; } //下载最多数据(top 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)"; + $sql="select uuid,title,id from {$this->submd} where id in (select m.id from {$this->submd} 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 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)"; + $sql="select uuid,title,id from {$this->submd} where id in (select m.id from {$this->submd} 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 normalmetadata 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 {$this->submd} 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_'); @@ -47,7 +49,7 @@ class IndexController extends Zend_Controller_Action $News = new Archive($this->db); $time = date("Y-m-d H:i:s",time()); - $sql = "SELECT * FROM archive WHERE is_pub=true AND ts_published<'$time' AND image!='' and id in (select ar_catalog.aid from ar_category left join ar_catalog on ar_category.id=ar_catalog.cid where ar_category.code='featured') order by ts_published desc LIMIT 5"; + $sql = "SELECT * FROM archive WHERE is_pub=true and sub='$this->submd' AND ts_published<'$time' AND image!='' and id in (select ar_catalog.aid from ar_category left join ar_catalog on ar_category.id=ar_catalog.cid where ar_category.code='featured') order by ts_published desc LIMIT 5"; $sth = $this->db->query($sql); $rows = $sth->fetchAll(PDO::FETCH_BOTH); @@ -60,7 +62,7 @@ class IndexController extends Zend_Controller_Action $this->view->news = $rows; //$time = date("Y-m-d H:i:s",time()); - $sql = "SELECT * FROM archive WHERE is_pub=true AND ts_publisheddb->query($sql); $rows = $sth->fetchAll(PDO::FETCH_BOTH); diff --git a/application/default/views/scripts/data/browse.phtml b/application/default/views/scripts/data/browse.phtml index d6d3fce2..e857cf10 100755 --- a/application/default/views/scripts/data/browse.phtml +++ b/application/default/views/scripts/data/browse.phtml @@ -8,7 +8,6 @@ $this->nav[] = array('link'=>"/data/browse",'title'=>'全部浏览'); $this->theme->AppendPlus($this,'colorbox'); ?>
-render('breadcrumbs.phtml'); ?> partial('data/tools.phtml'); ?>
page->getNavigation(); ?> diff --git a/application/default/views/scripts/data/offlinelist.phtml b/application/default/views/scripts/data/offlinelist.phtml index b5dbd864..372140f4 100755 --- a/application/default/views/scripts/data/offlinelist.phtml +++ b/application/default/views/scripts/data/offlinelist.phtml @@ -8,7 +8,6 @@ $this->headLink()->appendStylesheet('/css/metadata.css'); $this->nav[] = array('link'=>"/data/offline",'title'=>'离线数据浏览'); ?>
-render('breadcrumbs.phtml'); ?> partial('data/tools.phtml'); ?>
page->getNavigation(); ?> diff --git a/application/default/views/scripts/data/onlinelist.phtml b/application/default/views/scripts/data/onlinelist.phtml index 8ef5b45b..973006ad 100755 --- a/application/default/views/scripts/data/onlinelist.phtml +++ b/application/default/views/scripts/data/onlinelist.phtml @@ -8,7 +8,6 @@ $this->headLink()->appendStylesheet('/css/metadata.css'); $this->nav[] = array('link'=>"/data/offline",'title'=>'在线数据浏览'); ?>
-render('breadcrumbs.phtml'); ?> partial('data/tools.phtml'); ?>
page->getNavigation(); ?> diff --git a/application/default/views/scripts/data/tag.phtml b/application/default/views/scripts/data/tag.phtml index 95e43f6d..3c665c75 100755 --- a/application/default/views/scripts/data/tag.phtml +++ b/application/default/views/scripts/data/tag.phtml @@ -8,7 +8,6 @@ $this->nav[] = array('link'=>"/data/tag",'title'=>'关键词浏览'); $this->theme->AppendPlus($this,'colorbox'); ?>
-render('breadcrumbs.phtml') ?> partial('data/tools.phtml'); ?>
metadata)) : ?> diff --git a/application/default/views/scripts/header-index.phtml b/application/default/views/scripts/header-index.phtml new file mode 100755 index 00000000..97008942 --- /dev/null +++ b/application/default/views/scripts/header-index.phtml @@ -0,0 +1,66 @@ + + + + +
+
+
+
+
+

青海省草原总站

+
+
+

+ hasIdentity()) + { + $user = $auth->getIdentity(); + echo ' '.$user->username.' '; + if ($user->usertype=="administrator") echo ' 后台 数据篮 退出 '; + } else { + echo '登 录  |  注 册'; + } ?> + +

+ + +
+
+
+
+
+ + +
+ +
+ + +
\ No newline at end of file diff --git a/application/layouts/glacier.phtml b/application/layouts/glacier.phtml deleted file mode 100644 index e343cfae..00000000 --- a/application/layouts/glacier.phtml +++ /dev/null @@ -1,39 +0,0 @@ - - - - - - - - - - headTitle() ?> - headScript() ?> - headLink() ?> - headStyle() ?> - - - render('glacier_header.phtml') ?> -
-
breadcrumb() ?>
-
layout()->content ?>
-
- render('footer.phtml') ?> - - - - - - diff --git a/application/layouts/hiwater.phtml b/application/layouts/hiwater.phtml deleted file mode 100644 index 2ccfef80..00000000 --- a/application/layouts/hiwater.phtml +++ /dev/null @@ -1,39 +0,0 @@ - - - - - - - - - - headTitle() ?> - headScript() ?> - headLink() ?> - headStyle() ?> - - - render('hiwater_header.phtml') ?> -
-
breadcrumb() ?>
-
layout()->content ?>
-
- render('footer.phtml') ?> - - - - - - diff --git a/application/layouts/index.phtml b/application/layouts/index.phtml new file mode 100755 index 00000000..acb1608c --- /dev/null +++ b/application/layouts/index.phtml @@ -0,0 +1,58 @@ + + + + headTitle() ?> + + + + + + + + + + + + + + + + + + + headScript() ?> + headLink() ?> + headStyle() ?> + + + + + + + render('header-index.phtml') ?> + + layout()->content ?> + render('footer.phtml') ?> + + + + + + + + \ No newline at end of file diff --git a/application/layouts/layout.phtml b/application/layouts/layout.phtml index 8b730719..89bed1c3 100755 --- a/application/layouts/layout.phtml +++ b/application/layouts/layout.phtml @@ -39,16 +39,20 @@ render('footer.phtml') ?> - - + + + + \ No newline at end of file diff --git a/application/layouts/yrnmr.phtml b/application/layouts/yrnmr.phtml deleted file mode 100644 index 09cb3d5a..00000000 --- a/application/layouts/yrnmr.phtml +++ /dev/null @@ -1,39 +0,0 @@ - - - - - - - - - - headTitle() ?> - headScript() ?> - headLink() ?> - headStyle() ?> - - - render('yrnmr_header.phtml') ?> -
-
breadcrumb() ?>
-
layout()->content ?>
-
- render('footer.phtml') ?> - - - - - -