显示缩略图的大图,数据库查询设置为对象模式
This commit is contained in:
parent
cb38a6f11a
commit
557b667f04
|
@ -541,18 +541,19 @@ class DataController extends Zend_Controller_Action
|
||||||
*/
|
*/
|
||||||
function viewAction()
|
function viewAction()
|
||||||
{
|
{
|
||||||
$md=new MetadataTable();
|
|
||||||
$db=$md->getAdapter();
|
|
||||||
$id = (int)$this->_request->getParam('id');
|
$id = (int)$this->_request->getParam('id');
|
||||||
|
$sql="select m.*,s.status,g.id as gid,t.filename from normalmetadata m left join mdstatus s on m.uuid=s.uuid
|
||||||
|
left join thumbnail t on t.id=m.id left join geonetworkmetadata g on m.uuid=g.uuid where ";
|
||||||
if (empty($id)) {
|
if (empty($id)) {
|
||||||
$uuid = $this->_request->getParam('uuid');
|
$uuid = $this->_request->getParam('uuid');
|
||||||
if (empty($uuid)) $this->_redirect('/data');
|
if (empty($uuid)) $this->_redirect('/data');
|
||||||
$where=$db->quoteInto('uuid = ?',$uuid);
|
$where=$this->db->quoteInto('m.uuid = ?',$uuid);
|
||||||
$row=$md->fetchRow($where);
|
|
||||||
} else {
|
} else {
|
||||||
$where=$db->quoteInto('id = ?',$id);
|
$where=$this->db->quoteInto('m.id = ?',$id);
|
||||||
$row=$md->fetchRow($where);
|
|
||||||
}
|
}
|
||||||
|
$sql.=$where;
|
||||||
|
$this->db->setFetchMode(Zend_Db::FETCH_OBJ);
|
||||||
|
$row=$this->db->fetchRow($sql);
|
||||||
if (!$row) $this->_redirect('/data');
|
if (!$row) $this->_redirect('/data');
|
||||||
$id=$row->id;
|
$id=$row->id;
|
||||||
$uuid=$row->uuid;
|
$uuid=$row->uuid;
|
||||||
|
@ -562,47 +563,49 @@ class DataController extends Zend_Controller_Action
|
||||||
$this->view->metadata->description=$wiki->parseTable($this->view->escape($row->description));
|
$this->view->metadata->description=$wiki->parseTable($this->view->escape($row->description));
|
||||||
//处理外部链接
|
//处理外部链接
|
||||||
$this->view->metadata->description=preg_replace('/\[\s*(http:\/\/.+?)\s+(.*?)\]/m','<a href="$1">$2</a>',$this->view->metadata->description);
|
$this->view->metadata->description=preg_replace('/\[\s*(http:\/\/.+?)\s+(.*?)\]/m','<a href="$1">$2</a>',$this->view->metadata->description);
|
||||||
|
$this->view->thumburl='/gndata/'.sprintf('%05d',floor(($row->gid+0.1)/100)*100).'-'.sprintf('%05d',ceil(($row->gid+0.1)/100)*100-1)."/".$row->gid;
|
||||||
|
$this->view->thumburl.='/public/'.str_replace('_s.','.',$row->filename);
|
||||||
if (is_numeric($row->projection))
|
if (is_numeric($row->projection))
|
||||||
{
|
{
|
||||||
$sql="select proj4text from spatial_ref_sys where auth_srid=?";
|
$sql="select proj4text from spatial_ref_sys where auth_srid=?";
|
||||||
$rs=$db->fetchRow($sql,array((int)$row->projection));
|
$rs=$this->db->fetchRow($sql,array((int)$row->projection));
|
||||||
if ($rs) $this->view->projection=$rs['proj4text'];
|
if ($rs) $this->view->projection=$rs->proj4text;
|
||||||
}
|
}
|
||||||
$this->view->keys=$this->db->fetchAll("select * from keyword where id=? order by keytype,ts_created",array($id));
|
$this->view->keys=$this->db->fetchAll("select * from keyword where id=? order by keytype,ts_created",array($id));
|
||||||
$sql='select c.code,cc.name,cc.name_zh from category c,categorycode cc where c.code=cc.code and c.id= ?';
|
$sql='select c.code,cc.name,cc.name_zh from category c,categorycode cc where c.code=cc.code and c.id= ?';
|
||||||
$state=$db->query($sql,array($id));
|
$state=$this->db->query($sql,array($id));
|
||||||
$this->view->category=$state->fetchAll();
|
$this->view->category=$state->fetchAll();
|
||||||
$sql='select s.name,s.id from dataseries d, series s where d.sid=s.id and d.id= ?';
|
$sql='select s.name,s.id from dataseries d, series s where d.sid=s.id and d.id= ?';
|
||||||
$state=$db->query($sql,array($id));
|
$state=$this->db->query($sql,array($id));
|
||||||
$this->view->series=$state->fetchAll();
|
$this->view->series=$state->fetchAll();
|
||||||
$sql=$db->quoteInto("select count(*) as count from dataorder where uuid=?",$uuid);
|
$sql=$this->db->quoteInto("select count(*) as count from dataorder where uuid=?",$uuid);
|
||||||
$row=$db->fetchRow($sql);
|
$row=$this->db->fetchRow($sql);
|
||||||
$this->view->downloaded=$row['count'];
|
$this->view->downloaded=$row->count;
|
||||||
//update the viewed times
|
//update the viewed times
|
||||||
$sql="update mdstat set viewed=viewed+1 where uuid=?";
|
$sql="update mdstat set viewed=viewed+1 where uuid=?";
|
||||||
$db->query($sql,array($uuid));
|
$this->db->query($sql,array($uuid));
|
||||||
$sql=$db->quoteInto("select viewed from mdstat where uuid=?",$uuid);
|
$sql=$this->db->quoteInto("select viewed from mdstat where uuid=?",$uuid);
|
||||||
$row=$db->fetchRow($sql);
|
$row=$this->db->fetchRow($sql);
|
||||||
$this->view->viewed=$row['viewed'];
|
$this->view->viewed=$row->viewed;
|
||||||
//数据文档
|
//数据文档
|
||||||
$sql="select linkage from onlineresource where uuid=? and description='数据说明文档'";
|
$sql="select linkage from onlineresource where uuid=? and description='数据说明文档'";
|
||||||
$sql=$db->quoteInto($sql,$uuid);
|
$sql=$this->db->quoteInto($sql,$uuid);
|
||||||
$row=$db->fetchRow($sql);
|
$row=$this->db->fetchRow($sql);
|
||||||
if ($row) $this->view->doc=$row['linkage'];
|
if ($row) $this->view->doc=$row->linkage;
|
||||||
//相关资源
|
//相关资源
|
||||||
$sql="select * from onlineresource where uuid=? and description<>'数据说明文档' and (linkage not like '%ftp.westgis%') and name<>'元数据地址'";
|
$sql="select * from onlineresource where uuid=? and description<>'数据说明文档' and (linkage not like '%ftp.westgis%') and name<>'元数据地址'";
|
||||||
$sql=$db->quoteInto($sql,$uuid);
|
$sql=$this->db->quoteInto($sql,$uuid);
|
||||||
$this->view->resources=$db->fetchAll($sql);
|
$this->view->resources=$this->db->fetchAll($sql);
|
||||||
//建议参考文献
|
//建议参考文献
|
||||||
$sql="select r.* from reference r left join mdref m on m.refid=r.id where m.uuid=?";
|
$sql="select r.* from reference r left join mdref m on m.refid=r.id where m.uuid=?";
|
||||||
$sql=$db->quoteInto($sql,$uuid);
|
$sql=$this->db->quoteInto($sql,$uuid);
|
||||||
$this->view->ref=$db->fetchAll($sql);
|
$this->view->ref=$this->db->fetchAll($sql);
|
||||||
//相关用户
|
//相关用户
|
||||||
$sql="select p.email,p.individual,p.organisation,r.role from role r left join responsible p on r.resid=p.id where r.uuid=? order by r.role,r.id";
|
$sql="select p.email,p.individual,p.organisation,r.role from role r left join responsible p on r.resid=p.id where r.uuid=? order by r.role,r.id";
|
||||||
$this->view->authors=$db->fetchAll($sql,array($uuid));
|
$this->view->authors=$this->db->fetchAll($sql,array($uuid));
|
||||||
//数据限制信息
|
//数据限制信息
|
||||||
$sql="select u.* from uselimit u left join mdlimit m on u.id=m.lid where m.uuid=?";
|
$sql="select u.* from uselimit u left join mdlimit m on u.id=m.lid where m.uuid=?";
|
||||||
$this->view->uselimits=$db->fetchAll($sql,array($uuid));
|
$this->view->uselimits=$this->db->fetchAll($sql,array($uuid));
|
||||||
//相关元数据,根据同名关键词实现
|
//相关元数据,根据同名关键词实现
|
||||||
//$sql="select distinct(md.uuid),md.title from keyword kw left join metadata md on kw.id=md.id where kw.keyword in (select k.keyword from keyword k left join metadata m on k.id=m.id where m.id=? and k.keytype='theme') and kw.id<>? limit 10";
|
//$sql="select distinct(md.uuid),md.title from keyword kw left join metadata md on kw.id=md.id where kw.keyword in (select k.keyword from keyword k left join metadata m on k.id=m.id where m.id=? and k.keytype='theme') and kw.id<>? limit 10";
|
||||||
$sql="select distinct(md.uuid),md.title from keyword kw left join metadata md on kw.id=md.id where kw.keyword in (select k.keyword from keyword k left join metadata m on k.id=m.id where m.id=?) and kw.id<>? limit 10";
|
$sql="select distinct(md.uuid),md.title from keyword kw left join metadata md on kw.id=md.id where kw.keyword in (select k.keyword from keyword k left join metadata m on k.id=m.id where m.id=?) and kw.id<>? limit 10";
|
||||||
|
@ -611,9 +614,9 @@ class DataController extends Zend_Controller_Action
|
||||||
$sql="select * from knl_article where ";
|
$sql="select * from knl_article where ";
|
||||||
foreach($this->view->keys as $k)
|
foreach($this->view->keys as $k)
|
||||||
{
|
{
|
||||||
if ($k["keytype"]=='theme')
|
if ($k->keytype=='theme')
|
||||||
{
|
{
|
||||||
$sql.=" title like '%".$k["keyword"]."%' or ";
|
$sql.=" title like '%".$k->keyword."%' or ";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$sql.=" 1<>1 limit 10";
|
$sql.=" 1<>1 limit 10";
|
||||||
|
|
|
@ -23,7 +23,7 @@ if ($md->title_en) echo '<br />'.$this->escape($md->title_en);?>
|
||||||
<div id="ItemSummary">
|
<div id="ItemSummary">
|
||||||
<div id="category">
|
<div id="category">
|
||||||
<ul><?php foreach($this->category as $cat): ?>
|
<ul><?php foreach($this->category as $cat): ?>
|
||||||
<li><a href="/data/category/code/<?php echo $cat['code'];?>"><?php echo $this->escape($cat['name_zh']);?></a></li>
|
<li><a href="/data/category/code/<?php echo $cat->code;?>"><?php echo $this->escape($cat->name_zh);?></a></li>
|
||||||
<?php endforeach; ?>
|
<?php endforeach; ?>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
|
@ -31,15 +31,15 @@ if ($md->title_en) echo '<br />'.$this->escape($md->title_en);?>
|
||||||
$kt='';
|
$kt='';
|
||||||
$i=0;
|
$i=0;
|
||||||
foreach($this->keys as $cg) :
|
foreach($this->keys as $cg) :
|
||||||
if ($kt==$cg['keytype']) :
|
if ($kt==$cg->keytype) :
|
||||||
$i+=1;
|
$i+=1;
|
||||||
else :
|
else :
|
||||||
if (!empty($kt)) echo '</ul></div>';
|
if (!empty($kt)) echo '</ul></div>';
|
||||||
$kt=$cg['keytype'];
|
$kt=$cg->keytype;
|
||||||
$i=0;
|
$i=0;
|
||||||
endif;
|
endif;
|
||||||
if ($i==0) echo '<div id="'.$cg['keytype'].'"><ul>';
|
if ($i==0) echo '<div id="'.$cg->keytype.'"><ul>';
|
||||||
echo '<li><a href="/data/tag/key/'.urlencode($cg['keyword']).'">'.$cg['keyword'].'</a></li>';
|
echo '<li><a href="/data/tag/key/'.urlencode($cg->keyword).'">'.$cg->keyword.'</a></li>';
|
||||||
endforeach;
|
endforeach;
|
||||||
echo '</ul></div>';
|
echo '</ul></div>';
|
||||||
?>
|
?>
|
||||||
|
@ -48,7 +48,7 @@ echo '</ul></div>';
|
||||||
<?php if ($this->series): ?>
|
<?php if ($this->series): ?>
|
||||||
<div id="series">
|
<div id="series">
|
||||||
<ul><?php foreach($this->series as $serie): ?>
|
<ul><?php foreach($this->series as $serie): ?>
|
||||||
<li><a href="/data/series/id/<?php echo $serie['id']; ?>"> <?php echo $this->escape($serie['name']);?></a></li>
|
<li><a href="/data/series/id/<?php echo $serie->id; ?>"> <?php echo $this->escape($serie->name);?></a></li>
|
||||||
<?php endforeach; ?>
|
<?php endforeach; ?>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
|
@ -114,24 +114,24 @@ $party_zh=array('resourceProvider'=>'资源提供者','custodian'=>'维护者','
|
||||||
$r='';
|
$r='';
|
||||||
$i=0;
|
$i=0;
|
||||||
foreach($this->authors as $k=>$author) :
|
foreach($this->authors as $k=>$author) :
|
||||||
if ($author['role']!=$r)
|
if ($author->role!=$r)
|
||||||
{
|
{
|
||||||
$r=$author['role'];
|
$r=$author->role;
|
||||||
$i=0;
|
$i=0;
|
||||||
if ($k>0) echo '</li>';
|
if ($k>0) echo '</li>';
|
||||||
echo '<li>'.$party_zh[$author['role']].':';
|
echo '<li>'.$party_zh[$author->role].':';
|
||||||
}
|
}
|
||||||
if ($i>0) echo ',';
|
if ($i>0) echo ',';
|
||||||
$i+=1;
|
$i+=1;
|
||||||
if (!empty($author['email']) && $r!='principalInvestigator')
|
if (!empty($author->email) && $r!='principalInvestigator')
|
||||||
echo '<a href="mailto:'.$author['email'].'">';
|
echo '<a href="mailto:'.$author->email.'">';
|
||||||
echo '<strong title="'.$author['organisation'].'">';
|
echo '<strong title="'.$author->organisation.'">';
|
||||||
if (!empty($author['individual']))
|
if (!empty($author->individual))
|
||||||
echo $author['individual'];
|
echo $author->individual;
|
||||||
else
|
else
|
||||||
echo $author['organisation'];
|
echo $author->organisation;
|
||||||
echo '</strong>';
|
echo '</strong>';
|
||||||
if (!empty($author['email'])) echo '</a>';
|
if (!empty($author->email)) echo '</a>';
|
||||||
if ($k+1==count($this->authors)) echo '</li>';
|
if ($k+1==count($this->authors)) echo '</li>';
|
||||||
endforeach;
|
endforeach;
|
||||||
?>
|
?>
|
||||||
|
@ -145,7 +145,7 @@ endforeach;
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
<div id="left">
|
<div id="left">
|
||||||
<div id="ImageViewer"><img src="/data/thumb/id/<?php echo $md->id;?>" onclick="fnCreate('/images/ssimg.jpg')" /> </div>
|
<div id="ImageViewer"><img src="/data/thumb/id/<?php echo $md->id;?>" onclick="fnCreate('<?php echo $this->thumburl; ?>')" /> </div>
|
||||||
<div id="abstract">
|
<div id="abstract">
|
||||||
<p>
|
<p>
|
||||||
<?php echo str_replace(array("\r\n", "\n", "\r"),'</p><p>',$md->description);?>
|
<?php echo str_replace(array("\r\n", "\n", "\r"),'</p><p>',$md->description);?>
|
||||||
|
@ -175,7 +175,7 @@ endforeach;
|
||||||
<?php
|
<?php
|
||||||
if ($this->uselimits) :
|
if ($this->uselimits) :
|
||||||
foreach($this->uselimits as $uselimit) :
|
foreach($this->uselimits as $uselimit) :
|
||||||
echo '<p>'.str_replace(array("\r\n", "\n", "\r"),'</p><p>',$this->escape($uselimit['uselimit'])).'</p>';
|
echo '<p>'.str_replace(array("\r\n", "\n", "\r"),'</p><p>',$this->escape($uselimit->uselimit)).'</p>';
|
||||||
endforeach;
|
endforeach;
|
||||||
?>
|
?>
|
||||||
<?php else : ?>
|
<?php else : ?>
|
||||||
|
@ -191,14 +191,14 @@ endforeach;
|
||||||
<?php if ($this->resources) : ?>
|
<?php if ($this->resources) : ?>
|
||||||
<h2>其他在线资源</h2>
|
<h2>其他在线资源</h2>
|
||||||
<ul><?php foreach($this->resources as $link) : ?>
|
<ul><?php foreach($this->resources as $link) : ?>
|
||||||
<li><a href="<?php echo $link['linkage']; ?>" title="<?php echo $link['description']; ?>">
|
<li><a href="<?php echo $link->linkage; ?>" title="<?php echo $link->description; ?>">
|
||||||
<?php
|
<?php
|
||||||
if (!empty($link['name']))
|
if (!empty($link->name))
|
||||||
echo $link['name'];
|
echo $link->name;
|
||||||
elseif (!empty($link['description']))
|
elseif (!empty($link->description))
|
||||||
echo $link['description'];
|
echo $link->description;
|
||||||
else
|
else
|
||||||
echo $link['linkage'];
|
echo $link->linkage;
|
||||||
?></a></li>
|
?></a></li>
|
||||||
<?php endforeach; ?>
|
<?php endforeach; ?>
|
||||||
</ul>
|
</ul>
|
||||||
|
@ -211,7 +211,7 @@ endforeach;
|
||||||
<h2>相关数据</h2>
|
<h2>相关数据</h2>
|
||||||
<ul>
|
<ul>
|
||||||
<?php foreach ($this->related as $r) : ?>
|
<?php foreach ($this->related as $r) : ?>
|
||||||
<li><a href="/data/<?= $r['uuid']; ?>"><?= $r['title']; ?></a></li>
|
<li><a href="/data/<?= $r->uuid; ?>"><?= $r->title; ?></a></li>
|
||||||
<?php endforeach; ?>
|
<?php endforeach; ?>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
|
@ -221,14 +221,14 @@ endforeach;
|
||||||
<h2>相关文献</h2>
|
<h2>相关文献</h2>
|
||||||
<ul>
|
<ul>
|
||||||
<?php foreach ($this->literature as $r) :
|
<?php foreach ($this->literature as $r) :
|
||||||
$u=parse_url($r['url']);
|
$u=parse_url($r->url);
|
||||||
if ($u['host']=='hdl.handle.net')
|
if ($u['host']=='hdl.handle.net')
|
||||||
$url=$this->config->seekspace->handleurl.$u['path'];
|
$url=$this->config->seekspace->handleurl.$u['path'];
|
||||||
else
|
else
|
||||||
$url=$r['url'];
|
$url=$r->url;
|
||||||
echo '<li>';
|
echo '<li>';
|
||||||
if ($url) echo '<a href="'.$url.'" target="_blank">';
|
if ($url) echo '<a href="'.$url.'" target="_blank">';
|
||||||
echo $r['title'];
|
echo $r->title;
|
||||||
if ($url) echo '</a>';
|
if ($url) echo '</a>';
|
||||||
echo '</li>';
|
echo '</li>';
|
||||||
?>
|
?>
|
||||||
|
@ -241,7 +241,7 @@ echo '</li>';
|
||||||
<h2>相关文档</h2>
|
<h2>相关文档</h2>
|
||||||
<ul>
|
<ul>
|
||||||
<?php foreach ($this->documents as $r) : ?>
|
<?php foreach ($this->documents as $r) : ?>
|
||||||
<li><a href="/data/<?= $r['uuid']; ?>"><?= $r['title']; ?></a></li>
|
<li><a href="/data/<?= $r->uuid; ?>"><?= $r->title; ?></a></li>
|
||||||
<?php endforeach; ?>
|
<?php endforeach; ?>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
|
|
Loading…
Reference in New Issue