修改了三江源元数据同步时的问题
This commit is contained in:
parent
e63849890b
commit
9af8314d14
|
@ -38,7 +38,7 @@ $(document).ready(function(e) {
|
|||
'url':"<?= $_SERVER['REQUEST_URI'] ?>",
|
||||
'data':'source=' + $(this).attr('rel'),
|
||||
'success':submited,
|
||||
'timeout': 30000,
|
||||
'timeout': 600000,
|
||||
'error': function(){
|
||||
$("#alert-info").attr('class','alert alert-danger');
|
||||
$("#alert-info").html("出现错误,请稍后重试");
|
||||
|
|
|
@ -4,6 +4,7 @@ namespace Westdc\MetadataSync\Plugin;
|
|||
use Sookon\Helpers\View as view;
|
||||
use Sookon\Helpers\Dbh as dbh;
|
||||
use Sookon\Helpers\PDO;
|
||||
use Sookon\Helpers\Db;
|
||||
use Sookon\Helpers\Config;
|
||||
use Sookon\Helpers\Table;
|
||||
use Zend\Http\PhpEnvironment\Request;
|
||||
|
@ -24,6 +25,8 @@ class Sanjiangyuan implements SyncPluginInterface
|
|||
function __construct($db)
|
||||
{
|
||||
$this->db = $db;
|
||||
new Db($this->target);
|
||||
ini_set("max_execution_time",600);
|
||||
}
|
||||
|
||||
public function check()
|
||||
|
|
|
@ -216,7 +216,9 @@ class ISO19115
|
|||
$id = $temp['id'];
|
||||
//$id=$db->lastInsertId('metadata','id');
|
||||
//处理在线资源
|
||||
if ($this->onlineresource) foreach($this->onlineresource as $resource)
|
||||
if (isset($this->onlineresource))
|
||||
{
|
||||
foreach($this->onlineresource as $resource)
|
||||
{
|
||||
$name = isset($resource['name']) ? $resource['name']:"";
|
||||
$sql="insert into onlineresource (uuid,linkage,protocol,name,description) values(?,?,?,?,?)";
|
||||
|
@ -229,6 +231,7 @@ class ISO19115
|
|||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
//处理缩略图
|
||||
if (!empty($this->thumbnail)) {
|
||||
$sql="insert into thumbnail (id,data,filetype) values(?,?,?)";
|
||||
|
@ -252,6 +255,8 @@ class ISO19115
|
|||
}*/
|
||||
//处理关键词
|
||||
//1:N relation
|
||||
if(isset($this->keyword))
|
||||
{
|
||||
foreach($this->keyword as $keytype=>$keys)
|
||||
{
|
||||
foreach($keys as $key)
|
||||
|
@ -264,6 +269,7 @@ class ISO19115
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
//处理数据集序列
|
||||
//M:N relation
|
||||
if ($this->datasetSeries) foreach($this->datasetSeries as $ds) if (!empty($ds['seriesName']))
|
||||
|
@ -351,6 +357,8 @@ class ISO19115
|
|||
}
|
||||
}
|
||||
//处理数据限制信息
|
||||
if(isset($this->limits))
|
||||
{
|
||||
foreach($this->limits as $uselimit)
|
||||
{
|
||||
$sql="select id from uselimit where uselimit=?";
|
||||
|
@ -373,6 +381,7 @@ class ISO19115
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
$this->save("data/import/$this->uuid.xml");
|
||||
//处理XML入库
|
||||
if (!empty($xml)) $this->xml=$xml;
|
||||
|
@ -472,7 +481,7 @@ class ISO19115
|
|||
$this->author[$k]['country']=$author->getElementsByTagName('country')->item(0)->nodeValue;
|
||||
@$this->author[$k]['role']=$author->getElementsByTagName('RoleCd')->item(0)->attributes->getNamedItem('value')->nodeValue;
|
||||
}
|
||||
$cnt=$k+1;
|
||||
@$cnt=$k+1;
|
||||
$authors=$this->dom->getElementsByTagName('mdContact');
|
||||
foreach($authors as $j=>$author)
|
||||
{
|
||||
|
@ -494,15 +503,15 @@ class ISO19115
|
|||
$authors=$this->dom->getElementsByTagName('distorCont');
|
||||
foreach($authors as $m=>$author)
|
||||
{
|
||||
$this->author[$cnt+$m]['individual']=$author->getElementsByTagName('rpIndName')->item(0)->nodeValue;
|
||||
@$this->author[$cnt+$m]['individual']=$author->getElementsByTagName('rpIndName')->item(0)->nodeValue;
|
||||
if(isset($author->getElementsByTagName('rpOrgName')->item(0)->nodeValue))
|
||||
$this->author[$cnt+$m]['organisation']=$author->getElementsByTagName('rpOrgName')->item(0)->nodeValue;
|
||||
if(isset($author->getElementsByTagName('rpPosName')->item(0)->nodeValue))
|
||||
$this->author[$cnt+$m]['position']=$author->getElementsByTagName('rpPosName')->item(0)->nodeValue;
|
||||
if(isset($author->getElementsByTagName('delPoint')->item(0)->nodeValue))
|
||||
$this->author[$cnt+$m]['delivery']=$author->getElementsByTagName('delPoint')->item(0)->nodeValue;
|
||||
$this->author[$cnt+$m]['phone']=$author->getElementsByTagName('voiceNum')->item(0)->nodeValue;
|
||||
$this->author[$cnt+$m]['email']=$author->getElementsByTagName('eMailAdd')->item(0)->nodeValue;
|
||||
@$this->author[$cnt+$m]['phone']=$author->getElementsByTagName('voiceNum')->item(0)->nodeValue;
|
||||
@$this->author[$cnt+$m]['email']=$author->getElementsByTagName('eMailAdd')->item(0)->nodeValue;
|
||||
if(isset($author->getElementsByTagName('postCode')->item(0)->nodeValue))
|
||||
$this->author[$cnt+$m]['postal']=$author->getElementsByTagName('postCode')->item(0)->nodeValue;
|
||||
if(isset($author->getElementsByTagName('city')->item(0)->nodeValue))
|
||||
|
@ -514,20 +523,20 @@ class ISO19115
|
|||
if(isset($author->getElementsByTagName('RoleCd')->item(0)->attributes->getNamedItem('value')->nodeValue))
|
||||
$this->author[$cnt+$m]['role']=$author->getElementsByTagName('RoleCd')->item(0)->attributes->getNamedItem('value')->nodeValue;
|
||||
}
|
||||
$cnt+=$m+1;
|
||||
@$cnt+=$m+1;
|
||||
$authors=$this->dom->getElementsByTagName('idPoC');
|
||||
foreach($authors as $m=>$author)
|
||||
{
|
||||
$this->author[$cnt+$m]['individual']=$author->getElementsByTagName('rpIndName')->item(0)->nodeValue;
|
||||
$this->author[$cnt+$m]['organisation']=$author->getElementsByTagName('rpOrgName')->item(0)->nodeValue;
|
||||
@$this->author[$cnt+$m]['position']=$author->getElementsByTagName('rpPosName')->item(0)->nodeValue;
|
||||
$this->author[$cnt+$m]['delivery']=$author->getElementsByTagName('delPoint')->item(0)->nodeValue;
|
||||
$this->author[$cnt+$m]['phone']=$author->getElementsByTagName('voiceNum')->item(0)->nodeValue;
|
||||
$this->author[$cnt+$m]['email']=$author->getElementsByTagName('eMailAdd')->item(0)->nodeValue;
|
||||
$this->author[$cnt+$m]['postal']=$author->getElementsByTagName('postCode')->item(0)->nodeValue;
|
||||
$this->author[$cnt+$m]['city']=$author->getElementsByTagName('city')->item(0)->nodeValue;
|
||||
$this->author[$cnt+$m]['administrative']=$author->getElementsByTagName('adminArea')->item(0)->nodeValue;
|
||||
$this->author[$cnt+$m]['country']=$author->getElementsByTagName('country')->item(0)->nodeValue;
|
||||
@$this->author[$cnt+$m]['delivery']=$author->getElementsByTagName('delPoint')->item(0)->nodeValue;
|
||||
@$this->author[$cnt+$m]['phone']=$author->getElementsByTagName('voiceNum')->item(0)->nodeValue;
|
||||
@$this->author[$cnt+$m]['email']=$author->getElementsByTagName('eMailAdd')->item(0)->nodeValue;
|
||||
@$this->author[$cnt+$m]['postal']=$author->getElementsByTagName('postCode')->item(0)->nodeValue;
|
||||
@$this->author[$cnt+$m]['city']=$author->getElementsByTagName('city')->item(0)->nodeValue;
|
||||
@$this->author[$cnt+$m]['administrative']=$author->getElementsByTagName('adminArea')->item(0)->nodeValue;
|
||||
@$this->author[$cnt+$m]['country']=$author->getElementsByTagName('country')->item(0)->nodeValue;
|
||||
$this->author[$cnt+$m]['role']=$author->getElementsByTagName('RoleCd')->item(0)->attributes->getNamedItem('value')->nodeValue;
|
||||
}
|
||||
/*
|
||||
|
@ -592,7 +601,7 @@ class ISO19115
|
|||
$this->onlineresource[$k]['linkage']=$src->getElementsByTagName('linkage')->item(0)->nodeValue;
|
||||
if ($src->getElementsByTagName('protocol')->item(0)) $this->onlineresource[$k]['protocol']=$src->getElementsByTagName('protocol')->item(0)->nodeValue;
|
||||
if ($src->getElementsByTagName('orName')->item(0)) $this->onlineresource[$k]['name']=$src->getElementsByTagName('orName')->item(0)->nodeValue;
|
||||
$this->onlineresource[$k]['description']=$src->getElementsByTagName('orDesc')->item(0)->nodeValue;
|
||||
@$this->onlineresource[$k]['description']=$src->getElementsByTagName('orDesc')->item(0)->nodeValue;
|
||||
}
|
||||
}
|
||||
$cats=$this->dom->getElementsByTagName('tpCat');
|
||||
|
@ -608,10 +617,13 @@ class ISO19115
|
|||
if ($keys->getElementsByTagName('KeyTypCd')->item(0) && $keys->getElementsByTagName('KeyTypCd')->item(0)->hasAttributes())
|
||||
$k=$keys->getElementsByTagName('KeyTypCd')->item(0)->attributes->getNamedItem('value')->nodeValue;
|
||||
if (is_numeric($k))
|
||||
if(isset($this->keytypecode[(int)$k]))
|
||||
$kt=$this->keytypecode[(int)$k];
|
||||
else
|
||||
$kt=$k;
|
||||
//如果没有找到类别,则默认为主题关键词
|
||||
if(isset($kt))
|
||||
{
|
||||
if (!$kt) $kt=$this->keytypecode[5];
|
||||
$ks=$keys->getElementsByTagName('keyword');
|
||||
foreach($ks as $key)
|
||||
|
@ -628,6 +640,7 @@ class ISO19115
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
//resRefDate
|
||||
$refdates=$this->dom->getElementsByTagName('resRefDate');
|
||||
foreach($refdates as $refdate)
|
||||
|
@ -643,7 +656,7 @@ class ISO19115
|
|||
$ds = $this->dom->getElementsByTagName('datasetSeries');
|
||||
foreach($ds as $k=>$dataset)
|
||||
{
|
||||
$this->datasetSeries[$k]['seriesName']=$dataset->getElementsByTagName('seriesName')->item(0)->nodeValue;
|
||||
@$this->datasetSeries[$k]['seriesName']=$dataset->getElementsByTagName('seriesName')->item(0)->nodeValue;
|
||||
if(isset($dataset->getElementsByTagName('issId')->item(0)->nodeValue))
|
||||
$this->datasetSeries[$k]['issId']=$dataset->getElementsByTagName('issId')->item(0)->nodeValue;
|
||||
if(isset($dataset->getElementsByTagName('artPage')->item(0)->nodeValue))
|
||||
|
@ -694,7 +707,7 @@ class ISO19115
|
|||
}
|
||||
}
|
||||
//提取时间信息
|
||||
$tm_period=$this->dom->getElementsByTagName('TM_Period');
|
||||
@$tm_period=$this->dom->getElementsByTagName('TM_Period');
|
||||
foreach($tm_period as $period)
|
||||
{
|
||||
$this->timebegin=$period->getElementsByTagName('begin')->item(0)->nodeValue;
|
||||
|
@ -722,9 +735,9 @@ class ISO19115
|
|||
foreach ($graphs as $g)
|
||||
{
|
||||
if ($g->getElementsByTagName('bgFileDesc')->item(0)->nodeValue=='thumbnail') {
|
||||
$this->graph['filename']=$g->getElementsByTagName('bgFileName')->item(0)->nodeValue;
|
||||
@$this->graph['filename']=$g->getElementsByTagName('bgFileName')->item(0)->nodeValue;
|
||||
$this->graph['filedesc']='thumbnail';
|
||||
$this->graph['filetype']=$g->getElementsByTagName('bgFileType')->item(0)->nodeValue;
|
||||
@$this->graph['filetype']=$g->getElementsByTagName('bgFileType')->item(0)->nodeValue;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue