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) { ?>
diff --git a/application/default/controllers/DataController.php b/application/default/controllers/DataController.php index 357d12ef..0012ccaa 100755 --- a/application/default/controllers/DataController.php +++ b/application/default/controllers/DataController.php @@ -680,6 +680,9 @@ class DataController extends Zend_Controller_Action $fund = new Fund($this->db); $this->view->fund = $fund->fetch($uuid); + $visual = new \Westdc\Visual\Visual; + $this->view->visual = $visual->getVisualVars($uuid); + //判断特殊数据服务 $this->view->dataService= $this->checkDataService($uuid); diff --git a/application/default/controllers/VisualController.php b/application/default/controllers/VisualController.php index cb3a0e11..694966c9 100644 --- a/application/default/controllers/VisualController.php +++ b/application/default/controllers/VisualController.php @@ -1,80 +1,110 @@ -view->config = Zend_Registry::get('config'); - $this->db=Zend_Registry::get('db'); - - $auth = Zend_Auth::getInstance(); - if($auth->hasIdentity()) - { - $user = $auth->getIdentity(); - $this->uid = $user->id; - }else{ - $this->_redirect('/account/login?href=/visual'); - } - } - - function indexAction() - { - $record_type = $this->_getParam("dataset"); - - if(empty($record_type)) - return true; - - $sc = Factory::Bootstrap($record_type); - } - - - //******************************************************** - - /* - * dataAction() ajax获取数据 - * - * param string $ac //请求的数据类型 - * param string $dt //请求的数据来源(气象,水文) - * - * return view - */ - function dataAction() - { - $this->_helper->viewRenderer->setNoRender(); - $this->_helper->layout->disableLayout(); - - $record_type = $this->_getParam("dataset"); - $record_subset = $this->_getParam("subdataset"); - - if(empty($record_type)) - return true; - - $record = Factory::Bootstrap($record_type); - - if(!empty($record_subset)) - { - $record->subset = $record_subset; - } - $data = $record->outPut(); - - $this->jsonexit($data); - return true; - - }//dataAction() Ajax获取数据 - - - /* - * jsonexit() 退出并返回json数据 - * - * param array $data 要返回的JSON数据,可以是任意数组 - * - * return application/JSON - */ - public function jsonexit($data){ - $this->getResponse()->setHeader('Content-Type', 'application/json')->appendBody(json_encode($data,JSON_NUMERIC_CHECK)); - return true; - }//jsonexit() 退出并返回json数据 - +view->config = Zend_Registry::get('config'); + $this->db=Zend_Registry::get('db'); + + $auth = Zend_Auth::getInstance(); + if($auth->hasIdentity()) + { + $user = $auth->getIdentity(); + $this->uid = $user->id; + }else{ + $this->_redirect('/account/login?href=/visual'); + } + } + + function indexAction() + { + $record_type = $this->_getParam("dataset"); + + if(empty($record_type)) + return true; + + $sc = Factory::Bootstrap($record_type); + } + + + //******************************************************** + + /* + * dataAction() ajax获取数据 + * + * param string $ac //请求的数据类型 + * param string $dt //请求的数据来源(气象,水文) + * + * return view + */ + function dataAction() + { + $this->_helper->viewRenderer->setNoRender(); + $this->_helper->layout->disableLayout(); + + $record_type = $this->_getParam("dataset"); + $record_subset = $this->_getParam("subdataset"); + + if(empty($record_type)) + return true; + + $record = Visual\Factory::Bootstrap($record_type); + + if(!empty($record_subset)) + { + $record->subset = $record_subset; + } + $data = $record->outPut(); + + $this->jsonexit($data); + return true; + + }//dataAction() Ajax获取数据 + + //viewAction + public function viewAction() + { + $uuid = $this->_getParam('uuid'); + + if(empty($uuid) || \Helpers\Uuid::test($uuid) == false) + { + view::Post($this,"参数错误",-1); + return; + } + + $visual = new Visual\Visual; + + $this->view->data = $visual->getVisualVars($uuid); + + if(empty($this->view->data)) + { + view::Post($this,"此数据不支持可视化",-1); + return; + } + + $metadata = new Metadata\Metadata; + + $this->view->info = $metadata->view($uuid); + + + } + + + /* + * jsonexit() 退出并返回json数据 + * + * param array $data 要返回的JSON数据,可以是任意数组 + * + * return application/JSON + */ + public function jsonexit($data){ + $this->getResponse()->setHeader('Content-Type', 'application/json')->appendBody(json_encode($data,JSON_NUMERIC_CHECK)); + return true; + }//jsonexit() 退出并返回json数据 + } \ No newline at end of file diff --git a/application/default/views/scripts/data/view.phtml b/application/default/views/scripts/data/view.phtml index ee20e461..3ab292da 100755 --- a/application/default/views/scripts/data/view.phtml +++ b/application/default/views/scripts/data/view.phtml @@ -1,577 +1,582 @@ -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"); - } -?> - -render('breadcrumbs.phtml'); ?> -metadata;if ($md):?> -

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

-
-
-
-
- -

-

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

-
-
- mcitation) : ?> -
-

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

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

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

-

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

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

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

- ref) : ?> -
-

相关文献(作者推荐)

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

专题文献

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

数据施引文献

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

数据使用声明

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

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

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

'; - endforeach; - ?> - -

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

-

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

-

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

-

- - data_archives){ ?> -

数据相关新闻

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

资助项目

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

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

';?> - -
- - resources) : ?> -

相关资源

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

    最近10条服务记录如下:

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

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

    - -

    数据评论

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

    数据细节文件列表

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

    空间位置

    -
    -
    -

    联系信息

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

    Cannot find the metadata.

    -

    没有找到对应的元数据。

    - - - +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"); + } +?> + +render('breadcrumbs.phtml'); ?> +metadata;if ($md):?> +

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

    +
    +
    +
    +
    + +

    +

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

    +
    +
    + mcitation) : ?> +
    +

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

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

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

    +

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

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

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

    + ref) : ?> +
    +

    相关文献(作者推荐)

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

    专题文献

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

    数据施引文献

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

    数据使用声明

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

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

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

    '; + endforeach; + ?> + +

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

    +

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

    +

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

    +

    + + data_archives){ ?> +

    数据相关新闻

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

    资助项目

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

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

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

    相关资源

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

      最近10条服务记录如下:

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

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

      + +

      数据评论

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

      数据细节文件列表

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

      空间位置

      +
      +
      +

      联系信息

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

      Cannot find the metadata.

      +

      没有找到对应的元数据。

      + + + diff --git a/application/default/views/scripts/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'=>'查看元数据'); -?> - -render('breadcrumbs.phtml'); ?> -metadata;if ($md):?> -
      -
      - partial('glacier/navi.phtml'); ?> -
      -
      -

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

      -
      - -
      -
      -
      - -

      -

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

      -
      -
      - mcitation) : ?> -
      -

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

      -
        - mcitation as $ref) : - if (empty($ref->link)) - echo '
      1. '.$ref->reference.'
      2. '; - else - echo '
      3. '.$ref->reference.' 下载
      4. '; - endforeach; - ?> -
      - - - citation) : ?> -
      -

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

      -

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

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

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

      - ref) : ?> -
      -

      相关文献(作者推荐)

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

      专题文献

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

      数据施引文献

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

      数据使用声明

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

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

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

      '; - endforeach; - ?> - -

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

      -

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

      -

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

      -

      - - data_archives){ ?> -

      数据相关新闻

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

      资助项目

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

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

      ';?> - -
      - - resources) : ?> -

      相关资源

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

        最近10条服务记录如下:

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

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

        - -

        数据评论

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

        数据细节文件列表

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

        空间位置

        -
        -
        -

        联系信息

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

        Cannot find the metadata.

        -

        没有找到对应的元数据。

        - -
        +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'=>'查看元数据'); +?> + +render('breadcrumbs.phtml'); ?> +metadata;if ($md):?> +
        +
        + partial('glacier/navi.phtml'); ?> +
        +
        +

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

        +
        + +
        +
        +
        + +

        +

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

        +
        +
        + mcitation) : ?> +
        +

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

        +
          + mcitation as $ref) : + if (empty($ref->link)) + echo '
        1. '.$ref->reference.'
        2. '; + else + echo '
        3. '.$ref->reference.' 下载
        4. '; + endforeach; + ?> +
        + + + citation) : ?> +
        +

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

        +

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

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

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

        + ref) : ?> +
        +

        相关文献(作者推荐)

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

        专题文献

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

        数据施引文献

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

        数据使用声明

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

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

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

        '; + endforeach; + ?> + +

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

        +

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

        +

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

        +

        + + data_archives){ ?> +

        数据相关新闻

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

        资助项目

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

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

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

        相关资源

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

          最近10条服务记录如下:

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

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

          + +

          数据评论

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

          数据细节文件列表

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

          空间位置

          +
          +
          +

          联系信息

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

          Cannot find the metadata.

          +

          没有找到对应的元数据。

          + + \ 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(' > '); +?> +
          +
          +

          info['title'] ?> 数据可视化查看

          +
          + + normaldecode($this->data['vars']);?> + $v) { ?> + + + + + +
          + + +
          +
          + + 清除图像 + +
          + +
          + \ No newline at end of file diff --git a/application/module/Helpers/Uuid.php b/application/module/Helpers/Uuid.php new file mode 100755 index 00000000..44bc0ea4 --- /dev/null +++ b/application/module/Helpers/Uuid.php @@ -0,0 +1,48 @@ +getLocalHost(); + $this->valueBeforeMD5 = $address.':'.$this->currentTimeMillis().':'.$this->nextLong(); + $this->valueAfterMD5 = md5($this->valueBeforeMD5); + } + function toString() + { + $raw = strtoupper($this->valueAfterMD5); + return substr($raw,0,8).'-'.substr($raw,8,4).'-'.substr($raw,12,4).'-'.substr($raw,16,4).'-'.substr($raw,20); + } + + private function nextLong() + { + $tmp = rand(0,1)?'-':''; + return $tmp.rand(1000, 9999).rand(1000, 9999).rand(1000, 9999).rand(100, 999).rand(100, 999); + } + private function currentTimeMillis() + { + list($usec, $sec) = explode(" ",microtime()); + return $sec.substr($usec, 2, 3); + } + private function getLocalHost() + { + $address = isset($_ENV["COMPUTERNAME"]) ? $_ENV["COMPUTERNAME"]."/":"".'/'; + $address.= $_SERVER["SERVER_ADDR"]; + return strtolower($address); + } + + static function test($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)) + { + return false; + }else{ + return true; + } + } +} \ No newline at end of file diff --git a/application/module/Helpers/dbh.php b/application/module/Helpers/dbh.php index b9f2e7a8..7dde60aa 100644 --- a/application/module/Helpers/dbh.php +++ b/application/module/Helpers/dbh.php @@ -1,206 +1,206 @@ -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; - } - } - +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