westdc-zf1/application/default/views/scripts/metadata/view.phtml

134 lines
5.5 KiB
PHTML
Executable File

<?php
$config = Zend_Registry::get('config');
$this->headTitle($this->config->title->site);
$this->headTitle($this->config->title->metadata);
$this->headTitle('数据查看');
$this->headTitle()->setSeparator(' - ');
$this->headLink()->appendStylesheet('/css/metadata.css');
$this->breadcrumb('<a href="/">首页</a>');
$this->breadcrumb('<a href="/metadata">数据产品与服务</a>');
$this->breadcrumb('查看元数据');
$this->breadcrumb()->setSeparator(' > ');
$this->headScript()->appendFile('/js/prototype.js');
$this->headScript()->appendFile('/js/OpenLayers.js');
$this->headLink()->appendStylesheet('/js/theme/default/style.css');
?>
<div id='tools'>
<?= $this->partial('metadata/tools.phtml'); ?>
</div>
<script src='http://maps.google.com/maps?file=api&amp;v=2&amp;key=ABQIAAAACD-MqkkoOm60o_dvwdcKVhThiRESR0xRCe9JKd36EL3glTk0OxTsRzifkUWmTTrYWaE7dY1lYUlGxA'></script>
<?php $md=$this->metadata;
if ($md):?>
<hr />
<div class="mditem">
<div class="thumb"><img src="/metadata/thumb/id/<?php echo $md->id;?>" /></div>
<div class="title"><?php echo $this->escape($md->title);?>
<a href="/metadata/delete/id/<?php echo $md->id;?>"><img src="/images/del.gif"></a>
<a href="/metadata/xml/id/<?php echo $md->id;?>"><img src="/images/xml.gif" alt="查看XML源文件"></a>
<a href="/metadata/convert/id/<?php echo $md->id;?>/format/fgdc"><img src="/images/fgdc.gif"></a>
<a href="/metadata/convert/id/<?php echo $md->id;?>/format/iso19139"><img src="/images/iso19139.gif"></a>
</div>
<div class="summary"><?php echo str_replace(array("\r\n", "\n", "\r"),'<br />',$this->escape($md->description));?></div>
<div id="leftnav">
<fieldset><legend>关键词</legend><ul>
<?php
foreach($this->keys as $cg) :
?>
<li><a href='/metadata/tag/key/<?php echo $cg->keyword; ?>'><?php echo $cg->keyword; ?></a></li>
<?php endforeach; ?>
</ul></fieldset>
<fieldset><legend>数据类别</legend><ul>
<?php foreach($this->category as $cat): ?>
<li><a href="/metadata/category/code/<?php echo $cat['code'];?>"><?php echo $this->escape($cat['name_zh']);?></a></li>
<?php endforeach; ?>
</ul></fieldset></div>
<?php if ($this->series): ?>
<fieldset><legend>数据集序列</legend><ul>
<?php foreach($this->series as $serie): ?>
<li><a href="/metadata/series/id/<?php echo $serie['id']; ?>"> <?php echo $this->escape($serie['name']);?></a></li>
<?php endforeach; ?>
</ul></fieldset>
<?php endif; ?>
</div>
<div id='map' style="clear:left;height:400px;width:500px;border:1px;"></div>
<script type="text/javascript">
var map;
map = new OpenLayers.Map('map');
map.addControl(new OpenLayers.Control.LayerSwitcher());
var gphy = new OpenLayers.Layer.Google(
"Google Physical",
{type: G_PHYSICAL_MAP}
);
var gmap = new OpenLayers.Layer.Google(
"Google Streets" // the default
);
var ghyb = new OpenLayers.Layer.Google(
"Google Hybrid",
{type: G_HYBRID_MAP}
);
var gsat = new OpenLayers.Layer.Google(
"Google Satellite",
{type: G_SATELLITE_MAP}
);
var ol_wms = new OpenLayers.Layer.WMS( "OpenLayers WMS",
"http://labs.metacarta.com/wms/vmap0?", {layers: 'basic'} );
map.addLayers([ol_wms,gphy, gmap, ghyb, gsat]);
map.setCenter(new OpenLayers.LonLat(102, 36), 4);
var ajax=new OpenLayers.Ajax.Request('/metadata/json/id/<?php echo $md->id; ?>',{method:'get',onSuccess:featureresult});
function featureresult(response){
var feature1= eval('(' + response.responseText + ')');
//alert(feature1.type);
var geojson_format = new OpenLayers.Format.GeoJSON();
var vector_layer = new OpenLayers.Layer.Vector('metadata');
map.addLayer(vector_layer);
vector_layer.addFeatures(geojson_format.read(feature1));
//map.zoomToExtent(vector_layer.getExtent());
var sf = new OpenLayers.Control.SelectFeature(vector_layer);
map.addControl(sf);
sf.activate();
}
</script>
<script type="text/javascript">
function viewdetail(){
if (document.getElementById("detailbutton").value=="+显示详细元数据") {
document.getElementById("detailbutton").value="-关闭详细元数据显示";
document.getElementById("viewdetail").style.display="block";
var ajax=new Ajax.Request('/metadata/detail/id/<?php echo $md->id;?>',
{
method: 'get',
onSuccess: function (req) {
//alert(req.responseText);
var parent = $('viewdetail');
//clearNode(parent);
// create new element
var div = document.createElement('div');
//div.className = 'metadata_current';
//div.style.display = 'none';
//div.style.width = '100%';
parent.appendChild(div);
div.innerHTML = req.responseText;
}
});
} else {
document.getElementById("detailbutton").value="+显示详细元数据";
document.getElementById("viewdetail").style.display="none";
var parent=$('viewdetail');
clearNode(parent);
}
}
</script>
<form>
<input name="detailbutton" id="detailbutton" value="+显示详细元数据" type="button" onclick="viewdetail();"/></form>
<div id="viewdetail"></div>
<div id="comment"></div>
<?php else: ?>
<p>Cannot find the metadata.</p>
<?php endif;?>