英文站添加新Dataservice模块,增加冰川数据dataservice

service_type 3
This commit is contained in:
Li Jianxuan 2014-05-12 07:15:24 +00:00
parent 6da90a2f76
commit 08723b8a43
7 changed files with 3585 additions and 1506 deletions

File diff suppressed because it is too large Load Diff

View File

@ -337,8 +337,11 @@ endforeach;
<?php else: ?> <?php else: ?>
<?php <?php
if(!empty($this->dataService)) { ?> if(!empty($this->dataService)) { ?>
<?php $this->theme->AppendPlus($this,'datepicker'); ?> <?php if($this->dataService['service_type'] == 2) { ?>
<a href="javascript:void(0);" class="btn btn-primary btn-large btn-block" title="Select the subset" onclick="westdc.dataservice.choiceData('<?= $md->uuid ?>',this);"> <a href="javascript:void(0);" class="btn btn-primary btn-large btn-block" title="Select the subset" onclick="westdc.dataservice.choiceData('<?= $md->uuid ?>',this);">
<?php }else if($this->dataService['service_type'] == 3) {?>
<a href="#selectDataWindow" role="button" class="btn btn-primary btn-large btn-block" data-toggle="modal">
<?php } ?>
<?php }else{ ?> <?php }else{ ?>
<a href="/data/order/uuid/<?php echo $md->uuid; ?>" class="btn btn-primary btn-large btn-block" title="Free of Charge!"> <a href="/data/order/uuid/<?php echo $md->uuid; ?>" class="btn btn-primary btn-large btn-block" title="Free of Charge!">
<?php } ?> <?php } ?>
@ -475,3 +478,45 @@ var bound = {
<?php else: ?> <?php else: ?>
<p>Cannot find the metadata.</p> <p>Cannot find the metadata.</p>
<?php endif;?> <?php endif;?>
<?php if(!empty($this->dataService)) { ?>
<?php if($this->dataService['service_type'] == 2) { ?>
<?php $this->theme->AppendPlus($this,'datepicker'); ?>
<script src="/js/lib/custom/models/dataservice.js"></script>
<?php }else if($this->dataService['service_type'] == 3) {?>
<?php $this->theme->AppendPlus($this,'datepicker'); ?>
<!-- <script src="/js/lib/custom/models/dataservice.geodata.js"></script> -->
<?php } ?>
<?php } ?>
<?php if(!empty($this->dataService)) { ?>
<?php if($this->dataService['service_type'] == 2) { ?>
<?php }else if($this->dataService['service_type'] == 3) {?>
<!-- Modal -->
<div id="selectDataWindow" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<h3 id="myModalLabel">选择数据范围</h3>
</div>
<div class="modal-body">
<h4>按流域</h4>
<p>
<a href="" class="btn btn-default">黄河流域</a>
<a href="" class="btn btn-default">长江流域</a>
<a href="" class="btn btn-default">黑河流域</a>
<a href="" class="btn btn-default">塔里木河流域</a>
</p>
<hr />
<h4>按山脉</h4>
<p>
<a href="" class="btn btn-default">祁连山脉</a>
<a href="" class="btn btn-default">天山山脉</a>
<a href="" class="btn btn-default">昆仑山脉</a>
<a href="" class="btn btn-default">横断山山脉</a>
</p>
</div>
<div class="modal-footer">
<button class="btn" data-dismiss="modal" aria-hidden="true">关闭</button>
</div>
</div>
<?php } ?>
<?php } ?>

View File

@ -0,0 +1,12 @@
<?php
namespace Westdc\Metadata\Dataservice;
class Adapter
{
function __construct()
{
}
}

View File

@ -0,0 +1,77 @@
<?php
namespace Westdc\Metadata\Dataservice\Extra;
use Westdc\Metadata\Dataservice\Services;
class Wsn extends Services
{
function __construct()
{
parent::__construct();
}
public function getData($type,$uuid = "",$param = ""){
$info = $this->get($uuid);
$curl = new Curl();
$uid = view::User('id');
if(!is_numeric($uid) || $uid <1)
{
return "请先登录";
}
if($type == 'site')
{
$param = array(
'uuid'=>$uuid,
//'uuid'=> 'b7beb8bf-58d9-4e58-a945-7b6e1dc7705f', ///TEST TEST TEST
'uid'=> view::User('id')
);
$data = $curl->request($info['service_url']."site/",$param,"POST");
$data = json_decode($data['response'],TRUE);
}//site
if($type == 'var')
{
$param_temp = array(
'uuid'=>$uuid,
//'uuid'=> 'b7beb8bf-58d9-4e58-a945-7b6e1dc7705f', ///TEST TEST TEST
'uid'=> view::User('id'),
);
$param = array_merge($param,$param_temp);
$data = $curl->request($info['service_url']."var/",$param,"POST");
$data = json_decode($data['response'],TRUE);
}
if($type == 'submit')
{
$param_temp = array(
'uuid'=>$uuid,
//'uuid'=> 'b7beb8bf-58d9-4e58-a945-7b6e1dc7705f', ///TEST TEST TEST
'uid'=> view::User('id'),
);
$param = array_merge($param,$param_temp);
$data = $curl->request($info['service_url']."insert/",$param,"POST");
$data = json_decode($data['response'],TRUE);
}
if($data['status'] == 0)
{
return $data['error'];
}
else if($data['status'] == 1)
{
return $data['data'];
}
else
{
return NULL;
}
}//获取Wsn数据
}

View File

@ -0,0 +1,35 @@
<?php
namespace Westdc\Metadata\Dataservice;
class Factory
{
private $namespace_root = "\\Westdc\\Metadata\\Dataservice\\";
function __construct()
{
}
static function Bootstrap($recordType)
{
$namespace_root = "\\Westdc\\Metadata\\Dataservice\\Extra";
$recordType = ucfirst($recordType);
$_class = $namespace_root . $recordType;
return new $_class;
}
static function Handle($recordType)
{
$namespace_root = "\\Westdc\\Metadata\\Dataservice\\Handle\\";
$recordType = ucfirst($recordType);
$_class = $namespace_root . $recordType . "Handle";
return new $_class;
}
}

View File

@ -0,0 +1,14 @@
<?php
namespace Westdc\Metadata\Dataservice;
class Proxy
{
function __construct()
{
}
}

View File

@ -0,0 +1,31 @@
<?php
namespace Westdc\Metadata\Dataservice;
class Services
{
private $db;
function __construct($recordType)
{
$this->db = \Zend_Registry::get('db');
}
static function getServiceType($uuid)
{
$sql = "SELECT * FROM dataservice WHERE uuid='$uuid'";
$db = \Zend_Registry::get('db');
$rs = $db->query($sql);
$row = $rs->fetch(\PDO::FETCH_ASSOC);
if(isset($row['uuid']) && !empty($row['uuid']))
{
return $row;
}else{
return NULL;
}
}
}