diff --git a/application/default/controllers/HiwaterController.php b/application/default/controllers/HiwaterController.php index 3020f6b1..536ef2f4 100644 --- a/application/default/controllers/HiwaterController.php +++ b/application/default/controllers/HiwaterController.php @@ -9,27 +9,27 @@ class HiwaterController extends DataController //$this->_helper->layout->setLayout('hiwater'); $this->debug = 1; $acName = $this->_request->getActionName(); - if(in_array($acName,array("dem","landuse","core","bdk","eb"))) + if(in_array($acName,array("aviation","radiometer","lidar","widas","nearvis","thermal"))) { $this->view->pageIn = "collapse1"; } - if(in_array($acName,array("forest","dyk","plg"))) + else if(in_array($acName,array("forest","dyk","plg"))) { $this->view->pageIn = "collapse2"; } - if(in_array($acName,array("arid","hzz","yk",'zy','zynoc','lzg','lzs'))) + else if(in_array($acName,array("arid","hzz","yk",'zy','zynoc','lzg','lzs'))) { $this->view->pageIn = "collapse3"; } - if(in_array($acName,array("meteo","autometeo","mobilemeteo","ec",'las','normalmeteo','regionalmeteo','doppler','hydro','airsounding'))) + else if(in_array($acName,array("meteo","autometeo","mobilemeteo","ec",'las','normalmeteo','regionalmeteo','doppler','hydro','airsounding'))) { $this->view->pageIn = "collapse4"; } - if(in_array($acName,array("radiometer","airebone","lidar","widas",'asd'))) + else if(in_array($acName,array("radiometer","airebone","lidar","widas",'asd'))) { $this->view->pageIn = "collapse5"; } - if(in_array($acName,array("satellite"))) + else if(in_array($acName,array("satellite"))) { $this->view->pageIn = "collapse6"; } @@ -91,6 +91,37 @@ class HiwaterController extends DataController $this->view->offset=$offset+1; } + function aviationAction() + { + $this->getmd(array('航空遥感','WiDAS')); + $this->_helper->viewRenderer('base'); + } + function radiometerAction() + { + $this->getmd(array('航空遥感','PLMR')); + $this->_helper->viewRenderer('base'); + } + function lidarAction() + { + $this->getmd(array('','Lidar')); + $this->_helper->viewRenderer('base'); + } + function widasAction() + { + $this->getmd(array('','WiDAS')); + $this->_helper->viewRenderer('base'); + } + function nearvisAction() + { + $this->getmd(array('航空遥感','CASI')); + $this->_helper->viewRenderer('base'); + } + function thermalAction() + { + $this->getmd(array('','热红外高光谱数据')); + $this->_helper->viewRenderer('base'); + } + function baseAction() { $page=(int)$this->_request->getParam('page'); @@ -153,19 +184,6 @@ class HiwaterController extends DataController $this->view->offset=$offset+1; } - function economicAction() - { - $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='hiwater') 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='hiwater') 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; - } function landsurfaceAction() { @@ -328,302 +346,29 @@ class HiwaterController extends DataController $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='hiwater' and m.id in (select id from keyword where keytype='".$type."' and keyword='".$keyword."')"); + 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='hiwater' 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='hiwater') 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='hiwater') 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; } - - /* - * projectsAction() 数据汇交计划 - * - * - * - * - */ - function projectsAction() - { - - $ac = $this->_getParam('ac'); - $invite = $this->_getParam('invite'); - - $auth = Zend_Auth::getInstance(); - if($auth->hasIdentity()) - { - $user = $auth->getIdentity(); - $uid = $user->id; - $this->view->user_email = $user_email = $user->email; - } - - if(empty($ac) || $ac == "index") - { - $this->_helper->viewRenderer('project-index'); - - //Search Link - $this->view->searchLink = "/heihe/projects/ac/index/"; - - $q = $this->_getParam('q'); - - $wheresql = array(); - - if(!empty($q)) - { - if(!preg_match("/^[\x{4e00}-\x{9fa5}A-Za-z0-9_]+$/u",$q)) - { - $this->view->error = "输入的搜索条件有误,只允许输入汉字、数字、字母"; - return true; - } - $wheresql[] = " (title LIKE '%$q%' OR - code LIKE '%$q%' OR - name LIKE '%$q%')"; - $this->view->searchKeyword = $q; - } - - if(count($wheresql)>0) - { - $wheresql = join(" AND ",$wheresql); - }else{ - $wheresql = ""; - } - - if(!empty($wheresql)) - { - $wheresql = " WHERE ".$wheresql; - } - - $sql = "SELECT * FROM heiheproject $wheresql - ORDER BY id DESC"; - $sth = $this->db->query($sql); - $rows = $sth->fetchAll(); - - foreach ($rows as $k=>$v) - { - $rows[$k]['status'] = $this->replacestatus($v['status']); - } - - $paginator = Zend_Paginator::factory($rows); - $paginator->setCurrentPageNumber($this->_getParam('page')); - $paginator->setItemCountPerPage(15); - $paginator->setView($this->view); - Zend_View_Helper_PaginationControl::setDefaultViewPartial('pagination_param.phtml'); - $this->view->paginator=$paginator; - - }//ac == index - - if($ac == "submitting") - { - $this->_helper->viewRenderer('project-index'); - - $sql = "SELECT * FROM heiheproject WHERE status<4"; - $sth = $this->db->query($sql); - $rows = $sth->fetchAll(); - - foreach ($rows as $k=>$v) - { - $rows[$k]['status'] = $this->replacestatus($v['status']); - } - - $paginator = Zend_Paginator::factory($rows); - $paginator->setCurrentPageNumber($this->_getParam('page')); - $paginator->setItemCountPerPage(15); - $paginator->setView($this->view); - Zend_View_Helper_PaginationControl::setDefaultViewPartial('pagination_param.phtml'); - $this->view->paginator=$paginator; - }//ac == submitting 正在提交 - - if($ac == "unsubmit") - { - $this->_helper->viewRenderer('project-index'); - - $sql = "SELECT * FROM heiheproject WHERE attachid IS NULL OR attachid=0"; - $sth = $this->db->query($sql); - $rows = $sth->fetchAll(); - - foreach ($rows as $k=>$v) - { - $rows[$k]['status'] = $this->replacestatus($v['status']); - } - - $paginator = Zend_Paginator::factory($rows); - $paginator->setCurrentPageNumber($this->_getParam('page')); - $paginator->setItemCountPerPage(15); - $paginator->setView($this->view); - Zend_View_Helper_PaginationControl::setDefaultViewPartial('pagination_param.phtml'); - $this->view->paginator=$paginator; - }//ac == unsubmit 未提交 - - if($ac == "submit") - { - $this->_helper->viewRenderer('project-index'); - - $sql = "SELECT * FROM heiheproject WHERE status=4"; - $sth = $this->db->query($sql); - $rows = $sth->fetchAll(); - - foreach ($rows as $k=>$v) - { - $rows[$k]['status'] = $this->replacestatus($v['status']); - } - - $paginator = Zend_Paginator::factory($rows); - $paginator->setCurrentPageNumber($this->_getParam('page')); - $paginator->setItemCountPerPage(15); - $paginator->setView($this->view); - Zend_View_Helper_PaginationControl::setDefaultViewPartial('pagination_param.phtml'); - $this->view->paginator=$paginator; - }//ac == submit 已提交 - - if($ac == "upload") - { - $this->_helper->layout->setLayout('layout-iframe'); - $this->_helper->viewRenderer('project-upload'); - - $submit = $this->_getParam('submit'); - - $pid = $this->_getParam('pid'); - - if(empty($pid) || !is_numeric($pid)) - { - $this->view->error = "参数错误"; - return true; - } - - $this->view->pid = $pid; - - if(empty($uid)) - { - $this->view->error = "请先登录"; - return true; - } - - $sql = "SELECT * FROM heiheproject WHERE id=$pid"; - $sth = $this->db->query($sql); - $row = $sth->fetch(); - - if($row['email']!= $user_email) - { - $this->view->error = "您没有权限进行此操作"; - return true; - } - - if(!empty($submit) && empty($this->view->error)) - { - - $files=new files(); - $msg = $files -> upload($this->view->config->upload,$_FILES['Filedata'],'heihe'); - - if(empty($msg['error'])) - { - $msg['error']=""; - $filename = $msg['db_path']; - $filesize = $msg['file_size']; - $filedesc = $this->_request->getParam('filedesc'); - $filetype = $msg['file_type']; - $realname = $msg['realname']; - - if(!empty($row['attachid'])) - { - $sql = "SELECT * FROM attachments WHERE id={$row['attachid']}"; - $sth = $this->db->query($sql); - $attach = $sth->fetch(); - $this->db->exec("DELETE FROM attachments WHERE id={$row['attachid']} AND filetype='heihe'"); - @unlink($this->view->config->upload.$attach['filename']); - } - - $sql = " INSERT INTO attachments (filename,filetype,filedesc,userid,filesize,realname) values - ('$filename','heihe','$filedesc','$uid','$filesize','$realname') RETURNING id"; - $sth = $this->db->prepare($sql); - $sth->execute(); - $att = $sth->fetch(PDO::FETCH_ASSOC); - $msg['attid'] = $attid = $att['id']; - - $sql = "UPDATE heiheproject SET attachid=$attid WHERE id=$pid"; - $sth = $this->db->exec($sql); - - if($sth) - { - $this->view->message = "上传成功"; - }else{ - @unlink($filename); - $this->view->error = '附件上传失败:写入附件表出错'; - return true; - } - }else{ - @unlink($filename); - $this->view->error = "附件上传失败".$msg['error']; - return true; - } - } - - $sql = "SELECT * FROM heiheproject WHERE id=$pid"; - $sth = $this->db->query($sql); - $row = $sth->fetch(); - - $sql = "SELECT * FROM attachments WHERE id = {$row['attachid']}"; - $sth = $this->db->query($sql); - $this->view->att = $sth->fetch(); - - return true; - } - - if(!empty($invite)) - { - - $this->_helper->viewRenderer('project-invite'); - - if(!preg_match("/[A-Za-z0-9]/",$invite)) - { - $this->view->error = "参数错误!"; - return true; - } - - if(strlen($invite)!=12) - { - $this->view->error = "参数错误"; - return true; - } - - $pid = $this->_getParam('pid'); - - if(!is_numeric($pid)) - { - $this->view->error = "参数错误"; - return true; - } - - $sql = "SELECT * FROM $projectTable WHERE id=$pid"; - $sth = $this->db->query($sql); - $row = $sth->fetch(); - - if(empty($row['expert_name'])) - { - $this->view->error = "此项目尚未邀请跟踪专家"; - return true; - } - - $names = $this->getArray($row['expert_name']); - $emails = $this->getArray($row['expert_email']); - $validations = $this->getArray($row['expert_validation']); - $created = $this->getArray($row['expert_created']); - - if(!in_array($validations)) - { - $this->view->error = "您不在被邀请的专家名单内"; - return true; - } - - - - }//专家邀请链接 - - - }//projectsAction() - //从pgsql读取数组并拆分为php数组 function getArray($str){ if(strlen($str)>3) @@ -650,95 +395,6 @@ class HiwaterController extends DataController return "{".join(",",$array)."}"; } } - - function replacestatus($status) - { - if($status == 0) - { - return "计划未提交"; - } - if($status == 1) - { - return "计划未审核"; - } - if($status == 2) - { - return "跟踪专家审核"; - } - if($status == 3) - { - return "跟踪专家通过"; - } - if($status == 4) - { - return "数据委员会通过"; - } - } - - function genRandomString($len) - { - $chars = array( - "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", - "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", - "w", "x", "y", "z", "A", "B", "C", "D", "E", "F", "G", - "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", - "S", "T", "U", "V", "W", "X", "Y", "Z", "0", "1", "2", - "3", "4", "5", "6", "7", "8", "9" - ); - $charsLen = count($chars) - 1; - - shuffle($chars); // 将数组打乱 - - $output = ""; - for ($i=0; $i<$len; $i++) - { - $output .= $chars[mt_rand(0, $charsLen)]; - } - return $output; - } - - function chmodr($path, $filemode) { - if (!is_dir($path)) - return chmod($path, $filemode); - - $dh = opendir($path); - while (($file = readdir($dh)) !== false) { - if($file != '.' && $file != '..') { - $fullpath = $path.'/'.$file; - if(is_link($fullpath)) - return FALSE; - elseif(!is_dir($fullpath) && !chmod($fullpath, $filemode)) - return FALSE; - elseif(!$this->chmodr($fullpath, $filemode)) - return FALSE; - } - } - closedir($dh); - if(chmod($path, $filemode)) - return TRUE; - else - return FALSE; - } - - //成为作者后的后继处理工作 - private function author_first($uuid,$author) - { - $sql="insert into mdversion (xml,ts_created,uuid,changelog,userid) - select x.data,m.ts_created,?,?,? from metadata m left join xml x on m.id=x.id - left join mdversion v on m.uuid=v.uuid - where m.uuid=? and v.changelog is null"; - $sth=$this->db->prepare($sql); - try - { - $sth->execute(array($uuid,'初始版本 version 1.0',$author,$uuid)); - } catch(Exception $e){ - // do nothing here. - // 说明之前已经有对应数据 - } - $this->wdb=Zend_Db::factory($this->view->config->geonetwork); - $sql="update metadata set owner=? where uuid=?"; - $sth=$this->wdb->prepare($sql); - $sth->execute(array($author,$uuid)); - } + } \ No newline at end of file diff --git a/application/default/views/scripts/hiwater/base.phtml b/application/default/views/scripts/hiwater/base.phtml index 2b3c6991..c956349f 100644 --- a/application/default/views/scripts/hiwater/base.phtml +++ b/application/default/views/scripts/hiwater/base.phtml @@ -3,33 +3,26 @@ $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->heihe.''); -$this->breadcrumb('基础数据'); -$this->breadcrumb()->setSeparator(' > '); +$this->nav[] = array('link'=>"/water",'title'=>'黑河生态水文遥感试验'); ?> +render('breadcrumbs.phtml'); ?>
partial('hiwater/navi.phtml'); ?>
-
breadcrumb() ?>
-
-

- 基础数据指为流域生态-水文研究提供各种自然、生态、水文、社会经济等本底信息的数据,同时还包括了主要的几次科学试验数据、模型数据集等。 -

-

- 基础数据主要包括了流域基础地理数据、流域各种专题数据、水文水资源数据、流域科学试验数据、航空遥感和卫星遥感数据、模型数据、社会经济数据等。 -

+ info) : ?> +
+ info['body'])) echo $this->info['body'];?>
+
metadata) : ?> page->getNavigation(); ?>
    metadata as $md) : ?> -
  1. +
diff --git a/application/default/views/scripts/hiwater/browse.phtml b/application/default/views/scripts/hiwater/browse.phtml index 20f2abf5..51528ee9 100644 --- a/application/default/views/scripts/hiwater/browse.phtml +++ b/application/default/views/scripts/hiwater/browse.phtml @@ -4,31 +4,23 @@ $this->headTitle('全部浏览'); $this->headTitle()->setSeparator(' - '); $this->headLink()->appendStylesheet('/css/water.css'); -$this->breadcrumb('首页'); -$this->breadcrumb(''.$this->config->title->data.''); -$this->breadcrumb('浏览'); -$this->breadcrumb()->setSeparator(' > '); +$this->nav[] = array('link'=>"/water",'title'=>'黑河生态水文遥感试验'); ?> +render('breadcrumbs.phtml'); ?>
partial('hiwater/navi.phtml'); ?>
-
- partial('data/tools.phtml'); ?> -
- page->getNavigation(); ?> - metadata as $md) : ?> + page->getNavigation(); ?>
-
-
-

escape($md['title']);?> - - -

-
',mb_strlen($md['description'])>400?$this->escape(mb_substr($md['description'],0,400,'UTF-8').'...'):$this->escape($md['description']));?>
+
+
    + metadata as $md) : ?> +
  1. + +
-
page->getNavigation(); ?>
diff --git a/application/default/views/scripts/hiwater/index.phtml b/application/default/views/scripts/hiwater/index.phtml index f165f8c8..5b1df0cf 100644 --- a/application/default/views/scripts/hiwater/index.phtml +++ b/application/default/views/scripts/hiwater/index.phtml @@ -3,13 +3,9 @@ $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->headScript()->appendFile('/js/jquery-1.7.min.js'); -$this->breadcrumb($this->config->title->heihe); -$this->breadcrumb()->setSeparator(' > '); +$this->nav[] = array('link'=>"/water",'title'=>'黑河生态水文遥感试验'); ?> - +render('breadcrumbs.phtml'); ?>
partial('hiwater/navi.phtml'); ?> @@ -21,36 +17,5 @@ $this->breadcrumb()->setSeparator(' > '); info['body'])) echo $this->info['body'];?>
-
-

已整理数据展示

-
    - meatdata as $md) : ?> -
  • - - Data Thumbnail - -
  • - -
- -
- \ No newline at end of file diff --git a/application/default/views/scripts/hiwater/navi.phtml b/application/default/views/scripts/hiwater/navi.phtml index 5584457b..55a3590d 100644 --- a/application/default/views/scripts/hiwater/navi.phtml +++ b/application/default/views/scripts/hiwater/navi.phtml @@ -22,18 +22,19 @@
@@ -52,6 +53,7 @@ + @@ -62,14 +64,14 @@