实现用户信息自动提取和显示功能 ticket #118
This commit is contained in:
parent
782fd74ef4
commit
58cdf91bef
|
@ -606,7 +606,7 @@ class Admin_DataController extends Zend_Controller_Action
|
|||
$row->citation=$iso->citation;
|
||||
$row->fileformat=$iso->fileformat;
|
||||
$row->projection=$iso->projection;
|
||||
$row->author=$iso->author;
|
||||
//$row->author=$iso->author;
|
||||
$row->datatype=$iso->datatype;
|
||||
$row->filesize=$iso->filesize;
|
||||
$row->ts_created=$iso->mdDateSt;
|
||||
|
@ -705,6 +705,31 @@ class Admin_DataController extends Zend_Controller_Action
|
|||
//$db->query($sql);
|
||||
}
|
||||
}
|
||||
//处理联系人信息
|
||||
//先查询再进行处理
|
||||
//若用户信息发生变化,则存在问题
|
||||
//无法保证数据的更新状态
|
||||
foreach($iso->author as $au)
|
||||
{
|
||||
$inds=explode(",",$au['individual']);
|
||||
foreach($inds as $ind)
|
||||
{
|
||||
$sql="select id from responsible where individual=? and organisation=?";
|
||||
$row=$this->db->fetchRow($sql,array($ind,$au['organisation']));
|
||||
if (!$row)
|
||||
{
|
||||
$sql="insert into responsible (individual,organisation,position,delivery,phone,email,city,country,administrative,postal) values(?,?,?,?,?,?,?,?,?,?)";
|
||||
$this->db->query($sql,array($ind,$au['organisation'],$au['position'],$au['delivery'],$au['phone'],$au['email'],$au['city'],$au['country'],$au['administrative'],$au['postal']));
|
||||
}
|
||||
$sql="select id from responsible where individual=? and organisation=?";
|
||||
$row=$this->db->fetchRow($sql,array($ind,$au['organisation']));
|
||||
if ($row->id>0)
|
||||
{
|
||||
$sql="insert into role (resid,uuid,role) values(?,?,?)";
|
||||
$this->db->query($sql,array($row->id,$iso->uuid,$au['role']));
|
||||
}
|
||||
}
|
||||
}
|
||||
$iso->save("../data/import/$iso->uuid.xml");
|
||||
} catch (Exception $e) {
|
||||
//数据重复插入,此处忽略所有错误
|
||||
|
|
|
@ -536,6 +536,9 @@ class DataController extends Zend_Controller_Action
|
|||
$sql=$db->quoteInto($sql,$uuid);
|
||||
$row=$db->fetchRow($sql);
|
||||
if ($row) $this->view->doc=$row['linkage'];
|
||||
//相关用户
|
||||
$sql="select p.individual,p.organisation,r.role from role r left join responsible p on r.resid=p.id where r.uuid=?";
|
||||
$this->view->authors=$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 kw.id<>? limit 10";
|
||||
|
|
|
@ -81,9 +81,13 @@ else
|
|||
<div id="authors">
|
||||
<h2>联系人</h2>
|
||||
<ul>
|
||||
<li>数据贡献者:<strong><?php echo $md->author; ?></li></strong>
|
||||
<li>元数据撰写者:吴立宗</li>
|
||||
<li>数据分发者:<a href="/about/contact">李红星</a></li></ul><h2>其他信息</h2><ul>
|
||||
<?php
|
||||
$party_zh=array('resourceProvider'=>'资源提供者','custodian'=>'维护者','owner'=>'拥有者','user'=>'用户','distributor'=>'分发者','originator'=>'创建者','poinrOfContact'=>'联系人','principalInvestigator'=>'调查者','processor'=>'处理者','publisher'=>'发布者','author'=>'元数据作者');
|
||||
foreach($this->authors as $author) :
|
||||
?>
|
||||
<li title="<?php echo $author['organisation'];?>"><?php echo $party_zh[$author['role']]; ?>:<strong><?php echo $author['individual']; ?></strong></li>
|
||||
<?php endforeach; ?>
|
||||
</ul><h2>其他信息</h2><ul>
|
||||
<li>元数据更新时间:<?php print date('Y-m-d',strtotime($md->ts_created)); ?></li>
|
||||
<li><a href="/data/detail/id/<?php echo $md->id;?>">详细元数据</a></li>
|
||||
<li><a href="/data/xml/id/<?php echo $md->id;?>"><img src="/images/xml.gif" alt="查看XML源文件"></a></li>
|
||||
|
|
|
@ -120,6 +120,7 @@ class ISO19115
|
|||
|
||||
private $dom;
|
||||
public $keytypecode=array(1=>'discipline','place','stratum','temporal','theme');
|
||||
public $author;
|
||||
|
||||
function __construct()
|
||||
{
|
||||
|
@ -182,6 +183,54 @@ class ISO19115
|
|||
@$this->projection=$this->dom->getElementsByTagName('identCode')->item(0)->nodeValue;
|
||||
//数据作者
|
||||
$authors=$this->dom->getElementsByTagName('citRespParty');
|
||||
$cnt=count($authors);
|
||||
foreach($authors as $k=>$author)
|
||||
{
|
||||
$this->author[$k]['individual']=$author->getElementsByTagName('rpIndName')->item(0)->nodeValue;
|
||||
$this->author[$k]['organisation']=$author->getElementsByTagName('rpOrgName')->item(0)->nodeValue;
|
||||
$this->author[$k]['position']=$author->getElementsByTagName('rpPosName')->item(0)->nodeValue;
|
||||
$this->author[$k]['delivery']=$author->getElementsByTagName('delPoint')->item(0)->nodeValue;
|
||||
$this->author[$k]['phone']=$author->getElementsByTagName('voiceNum')->item(0)->nodeValue;
|
||||
$this->author[$k]['email']=$author->getElementsByTagName('eMailAdd')->item(0)->nodeValue;
|
||||
$this->author[$k]['postal']=$author->getElementsByTagName('postCode')->item(0)->nodeValue;
|
||||
$this->author[$k]['city']=$author->getElementsByTagName('city')->item(0)->nodeValue;
|
||||
$this->author[$k]['administrative']=$author->getElementsByTagName('adminArea')->item(0)->nodeValue;
|
||||
$this->author[$k]['country']=$author->getElementsByTagName('country')->item(0)->nodeValue;
|
||||
$this->author[$k]['role']=$author->getElementsByTagName('RoleCd')->item(0)->attributes->getNamedItem('value')->nodeValue;
|
||||
}
|
||||
$authors=$this->dom->getElementsByTagName('mdContact');
|
||||
$cnt+=count($authors);
|
||||
foreach($authors as $j=>$author)
|
||||
{
|
||||
$this->author[$cnt+$j+1]['individual']=$author->getElementsByTagName('rpIndName')->item(0)->nodeValue;
|
||||
$this->author[$cnt+$j+1]['organisation']=$author->getElementsByTagName('rpOrgName')->item(0)->nodeValue;
|
||||
$this->author[$cnt+$j+1]['position']=$author->getElementsByTagName('rpPosName')->item(0)->nodeValue;
|
||||
$this->author[$cnt+$j+1]['delivery']=$author->getElementsByTagName('delPoint')->item(0)->nodeValue;
|
||||
$this->author[$cnt+$j+1]['phone']=$author->getElementsByTagName('voiceNum')->item(0)->nodeValue;
|
||||
$this->author[$cnt+$j+1]['email']=$author->getElementsByTagName('eMailAdd')->item(0)->nodeValue;
|
||||
$this->author[$cnt+$j+1]['postal']=$author->getElementsByTagName('postCode')->item(0)->nodeValue;
|
||||
$this->author[$cnt+$j+1]['city']=$author->getElementsByTagName('city')->item(0)->nodeValue;
|
||||
$this->author[$cnt+$j+1]['administrative']=$author->getElementsByTagName('adminArea')->item(0)->nodeValue;
|
||||
$this->author[$cnt+$j+1]['country']=$author->getElementsByTagName('country')->item(0)->nodeValue;
|
||||
$this->author[$cnt+$j+1]['role']=$author->getElementsByTagName('RoleCd')->item(0)->attributes->getNamedItem('value')->nodeValue;
|
||||
}
|
||||
$authors=$this->dom->getElementsByTagName('distorCont');
|
||||
$cnt+=count($authors);
|
||||
foreach($authors as $m=>$author)
|
||||
{
|
||||
$this->author[$cnt+$m+2]['individual']=$author->getElementsByTagName('rpIndName')->item(0)->nodeValue;
|
||||
$this->author[$cnt+$m+2]['organisation']=$author->getElementsByTagName('rpOrgName')->item(0)->nodeValue;
|
||||
$this->author[$cnt+$m+2]['position']=$author->getElementsByTagName('rpPosName')->item(0)->nodeValue;
|
||||
$this->author[$cnt+$m+2]['delivery']=$author->getElementsByTagName('delPoint')->item(0)->nodeValue;
|
||||
$this->author[$cnt+$m+2]['phone']=$author->getElementsByTagName('voiceNum')->item(0)->nodeValue;
|
||||
$this->author[$cnt+$m+2]['email']=$author->getElementsByTagName('eMailAdd')->item(0)->nodeValue;
|
||||
$this->author[$cnt+$m+2]['postal']=$author->getElementsByTagName('postCode')->item(0)->nodeValue;
|
||||
$this->author[$cnt+$m+2]['city']=$author->getElementsByTagName('city')->item(0)->nodeValue;
|
||||
$this->author[$cnt+$m+2]['administrative']=$author->getElementsByTagName('adminArea')->item(0)->nodeValue;
|
||||
$this->author[$cnt+$m+2]['country']=$author->getElementsByTagName('country')->item(0)->nodeValue;
|
||||
$this->author[$cnt+$m+2]['role']=$author->getElementsByTagName('RoleCd')->item(0)->attributes->getNamedItem('value')->nodeValue;
|
||||
}
|
||||
/*
|
||||
foreach($authors as $author)
|
||||
{
|
||||
if($author->getElementsByTagName('rpIndName')->item(0) &&
|
||||
|
@ -228,7 +277,7 @@ class ISO19115
|
|||
break;
|
||||
}
|
||||
}
|
||||
|
||||
*/
|
||||
//数据类型,在线或离线
|
||||
$this->datatype=0;
|
||||
$onlinesrc=$this->dom->getElementsByTagName('onLineSrc');
|
||||
|
|
Loading…
Reference in New Issue