diff --git a/application/admin/views/scripts/data/visual-add.phtml b/application/admin/views/scripts/data/visual-add.phtml index f6953ded..1a2b312b 100644 --- a/application/admin/views/scripts/data/visual-add.phtml +++ b/application/admin/views/scripts/data/visual-add.phtml @@ -36,7 +36,9 @@ - info['vars']) ?> + + + decode($this->info['vars']);?> $v) { ?>
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) : ?> -'.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){ ?> -',$this->escape($md->suppinfo)).'
';?> - -最近10条服务记录如下:
-Cannot find the metadata.
-没有找到对应的元数据。
- - - +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->render('breadcrumbs.phtml'); ?> +metadata;if ($md):?> +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) : ?> +'.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){ ?> +',$this->escape($md->suppinfo)).'
';?> + +最近10条服务记录如下:
+此数据还在评审过程中,我们真切地邀请您参加此数据的评审,以便我们能尽快发布此数据!评审
+ +Cannot find the metadata.
+没有找到对应的元数据。
+ + + diff --git a/application/default/views/scripts/glacier/view.phtml b/application/default/views/scripts/glacier/view.phtml index 34d9053a..8ffd4567 100755 --- a/application/default/views/scripts/glacier/view.phtml +++ b/application/default/views/scripts/glacier/view.phtml @@ -1,554 +1,559 @@ -headTitle($this->config->title->site); - $this->headTitle($this->config->title->data); - $this->headTitle($this->metadata->title); - $this->headTitle()->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):?> -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) : ?> -'.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){ ?> -',$this->escape($md->suppinfo)).'
';?> - -最近10条服务记录如下:
-此数据还在评审过程中,我们真切地邀请您参加此数据的评审,以便我们能尽快发布此数据!评审
- -Cannot find the metadata.
-没有找到对应的元数据。
- -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) : ?> +'.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){ ?> +',$this->escape($md->suppinfo)).'
';?> + +最近10条服务记录如下:
+此数据还在评审过程中,我们真切地邀请您参加此数据的评审,以便我们能尽快发布此数据!评审
+ +Cannot find the metadata.
+没有找到对应的元数据。
+ + \ No newline at end of file diff --git a/application/default/views/scripts/visual/view.phtml b/application/default/views/scripts/visual/view.phtml new file mode 100644 index 00000000..f5a1a9c0 --- /dev/null +++ b/application/default/views/scripts/visual/view.phtml @@ -0,0 +1,104 @@ +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(' > '); +?> +"; - echo $sql."\r\n"; - echo 'Caught exception: '. $e->getMessage(). "\r\n"; - echo ""; - } - } - } - - }//update - - //select - public function select($opt,$debug = false) - { - $field = (isset($opt['field']) && !empty($opt['field'])) ? $opt['field']:"*"; - $tbl = (isset($opt['table']) && !empty($opt['table'])) ? $opt['table'] : ""; - $join = (isset($opt['join']) && !empty($opt['join'])) ? $opt['join'] : ""; - $wheresql = (isset($opt['where']) && !empty($opt['where'])) ? " WHERE ".$opt['where']:" "; - $limit = (isset($opt['limit']) && !empty($opt['limit'])) ? " LIMIT ".$opt['limit']:""; - $offset = (isset($opt['start']) && !empty($opt['start'])) ? " OFFSET ".$opt['start']:""; - $order = (isset($opt['order']) && !empty($opt['order'])) ? " ORDER BY ".$opt['order']:""; - $order .= (isset($opt['sort']) && !empty($opt['sort']) && $order !== '') ? " ".$opt['sort']:""; - $sql = "SELECT $field FROM $tbl - " . $join . " - " . $wheresql . " - " . $order . " - " . $limit . " - " . $offset . " - "; - if($debug) return $sql; - - $rs = $this->db->query($sql); - return $rs->fetchAll(); - } - - public function chk($p) - { - if(!isset($p) || empty($p)) - { - return false; - }else{ - return true; - } - } - +db = \Zend_Registry::get('db'); + }else{ + $this->db = $db; + } + } + + function insert($table,$data,$return=false) + { + $fields = array(); + $datas = array(); + + foreach($data as $k=>$v) + { + $fields[] = '"'.$k.'"'; + if(is_int($v) || is_float($v) || is_bool($v)) + { + $datas[] = $v; + }else{ + if(preg_match("/\'/",$v)) + { + $v = preg_replace("/\'/","''",$v); + } + $datas[] = "'".$v."'"; + } + } + + $fields = join(",",$fields); + $datas = join(",",$datas); + + if($return == false){ + $sql = "INSERT INTO \"".$table."\" ($fields) VALUES ($datas)"; + + if($this->debug == 1) + { + view::Dump($sql,false); + } + + try{ + return $this->db->exec($sql); + }catch (Exception $e) { + if($this->product) + { + return false; + }else{ + echo 'Caught exception: '. $e->getMessage(). "\n"; + } + } + }else{ + $sql = "INSERT INTO \"".$table."\" ($fields) VALUES ($datas) RETURNING id"; + + if($this->debug == 1) + { + view::Dump($sql,false); + } + + try{ + $sth = $this->db->prepare($sql); + if($sth->execute()) + { + $temp = $sth->fetch(\PDO::FETCH_ASSOC); + return $temp['id']; + }else{ + return false; + } + }catch (Exception $e) { + if($this->product) + { + return false; + }else{ + echo 'Caught exception: '. $e->getMessage(). "\n"; + } + } + } + }//insert + + function update($table,$data,$condition="",$return=false) + { + $ups = array(); + + foreach($data as $k=>$v) + { + if(is_int($v) || is_float($v) || is_bool($v)) + { + $ups[] = '"'.$k.'"='.$v; + }else{ + if(preg_match("/\'/",$v)) + { + $v = preg_replace("/\'/","''",$v); + } + if(preg_match("/\"/",$v)) + { + $v = preg_replace("/\"/","\"",$v); + } + $ups[] = '"'.$k.'"=\''.$v."'"; + } + } + + $fields = join(",",$ups); + + if(!empty($condition)) + { + $wheresql = " WHERE ".$condition; + }else{ + $wheresql = ""; + } + + if($return == false){ + + try{ + $sql = "UPDATE \"".$table."\" SET $fields $wheresql"; + + if($this->debug == 1) + { + view::Dump($sql,false); + } + + if($this->db->exec($sql)) + { + return true; + }else{ + return false; + } + }catch (Exception $e) { + if($this->product) + { + return false; + }else{ + echo 'Caught exception: '. $e->getMessage(). "\n"; + } + } + }else{ + try{ + $sql = "UPDATE \"".$table."\" SET $fields $wheresql"; + + if($this->debug == 1) + { + view::Dump($sql,false); + } + + return $this->db->exec($sql); + }catch (Exception $e) { + if($this->product) + { + return false; + }else{ + echo "
"; + echo $sql."\r\n"; + echo 'Caught exception: '. $e->getMessage(). "\r\n"; + echo ""; + } + } + } + + }//update + + //select + public function select($opt,$debug = false) + { + $field = (isset($opt['field']) && !empty($opt['field'])) ? $opt['field']:"*"; + $tbl = (isset($opt['table']) && !empty($opt['table'])) ? $opt['table'] : ""; + $join = (isset($opt['join']) && !empty($opt['join'])) ? $opt['join'] : ""; + $wheresql = (isset($opt['where']) && !empty($opt['where'])) ? " WHERE ".$opt['where']:" "; + $limit = (isset($opt['limit']) && !empty($opt['limit'])) ? " LIMIT ".$opt['limit']:""; + $offset = (isset($opt['start']) && !empty($opt['start'])) ? " OFFSET ".$opt['start']:""; + $order = (isset($opt['order']) && !empty($opt['order'])) ? " ORDER BY ".$opt['order']:""; + $order .= (isset($opt['sort']) && !empty($opt['sort']) && $order !== '') ? " ".$opt['sort']:""; + $sql = "SELECT $field FROM $tbl + " . $join . " + " . $wheresql . " + " . $order . " + " . $limit . " + " . $offset . " + "; + if($debug) return $sql; + + $rs = $this->db->query($sql); + return $rs->fetchAll(); + } + + public function chk($p) + { + if(!isset($p) || empty($p)) + { + return false; + }else{ + return true; + } + } + } \ No newline at end of file diff --git a/application/module/Westdc/Metadata/Metadata.php b/application/module/Westdc/Metadata/Metadata.php new file mode 100755 index 00000000..38b64a13 --- /dev/null +++ b/application/module/Westdc/Metadata/Metadata.php @@ -0,0 +1,28 @@ +db = \Zend_Registry::get('db'); + } + + function view($uuid) + { + if(\Helpers\Uuid::test($uuid) !== true) + { + return "参数错误"; + } + + $sql = "SELECT * FROM ".$this->tbl_metadata." WHERE uuid='$uuid'"; + $rs = $this->db->query($sql); + return $rs->fetch(); + } + +} diff --git a/application/module/Westdc/Visual/Handle/VisualHandle.php b/application/module/Westdc/Visual/Handle/VisualHandle.php index 2462d815..24850071 100644 --- a/application/module/Westdc/Visual/Handle/VisualHandle.php +++ b/application/module/Westdc/Visual/Handle/VisualHandle.php @@ -6,7 +6,7 @@ use \Helpers\View as view; use \Helpers\Table; //事件中存在的操作 -class VisualHandle +class VisualHandle extends \Westdc\Visual\VariableEncoder { private $db; //传入PDO对象误 private $config; //全局配置 @@ -40,7 +40,7 @@ class VisualHandle { $data = $e->getParam('data'); - $data['vars'] = join(",",$data['vars']); + $data['vars'] = $this->encode($data['vars']); if(!isset($data['status'])) { diff --git a/application/module/Westdc/Visual/VariableEncoder.php b/application/module/Westdc/Visual/VariableEncoder.php new file mode 100644 index 00000000..986bf001 --- /dev/null +++ b/application/module/Westdc/Visual/VariableEncoder.php @@ -0,0 +1,44 @@ +decode($json); + } + + public function encode($vars) + { + $arr = []; + foreach($vars as $k=>$v) + { + $names = explode("|",$v); + $arr[] = [ 'dataset' => $names[0], 'subdataset' => $names[1],'seriename' => $names[2]]; + } + return json_encode($arr); + } + + public function decode($json) + { + $arr = json_decode($json,true); + //var_dump($arr); + $data = []; + foreach($arr as $k=>$v) + { + $data[$k] = join("|",$v); + } + return $data; + } + + public function normaldecode($json) + { + return json_decode($json,true); + } + +} \ No newline at end of file diff --git a/application/module/Westdc/Visual/Visual.php b/application/module/Westdc/Visual/Visual.php index 05b2db4c..f6fbce96 100644 --- a/application/module/Westdc/Visual/Visual.php +++ b/application/module/Westdc/Visual/Visual.php @@ -95,6 +95,6 @@ class Visual { $sql = "SELECT * FROM {$this->mainTable} WHERE uuid='$uuid' LIMIT 1"; $rs = $this->db->query($sql); - return $rs->fetch(); + return $rs->fetch(\PDO::FETCH_ASSOC); } } \ No newline at end of file
此数据还在评审过程中,我们真切地邀请您参加此数据的评审,以便我们能尽快发布此数据!评审
- -数据评论
-