From 54ea3edac5009b0f3ac2cda9e84c0e9880458e43 Mon Sep 17 00:00:00 2001 From: wlx Date: Mon, 20 May 2013 06:56:50 +0000 Subject: [PATCH] add refdate import in ISO 19115 --- application/models/ISO19115.php | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/application/models/ISO19115.php b/application/models/ISO19115.php index 72d3138f..00bcf451 100755 --- a/application/models/ISO19115.php +++ b/application/models/ISO19115.php @@ -191,11 +191,20 @@ class ISO19115 $db->setFetchMode(Zend_Db::FETCH_OBJ); //save metadata into database try { - $sql="insert into metadata (uuid,title,title_en,description,citation,suppinfo,fileformat,projection,datatype,filesize,ts_created, - timebegin,timeend,west,south,north,east,doi) values(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)"; - $db->query($sql,array($this->uuid,$this->resTitle,$this->resAltTitle,$this->idAbs,$this->citation,$this->suppinfo,$this->fileformat, + if ($this->refDate) + { + $sql="insert into metadata (uuid,title,title_en,description,citation,suppinfo,fileformat,projection,datatype,filesize,ts_created, + timebegin,timeend,west,south,north,east,doi,ts_published) values(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)"; + $db->query($sql,array($this->uuid,$this->resTitle,$this->resAltTitle,$this->idAbs,$this->citation,$this->suppinfo,$this->fileformat, + $this->projection,$this->datatype,$this->filesize,$this->mdDateSt,$this->timebegin,$this->timeend,$this->geoBox['w'], + $this->geoBox['s'],$this->geoBox['n'],$this->geoBox['e'],$this->doi,$this->refDate)); + } else { + $sql="insert into metadata (uuid,title,title_en,description,citation,suppinfo,fileformat,projection,datatype,filesize,ts_created, + timebegin,timeend,west,south,north,east,doi) values(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)"; + $db->query($sql,array($this->uuid,$this->resTitle,$this->resAltTitle,$this->idAbs,$this->citation,$this->suppinfo,$this->fileformat, $this->projection,$this->datatype,$this->filesize,$this->mdDateSt,$this->timebegin,$this->timeend,$this->geoBox['w'], $this->geoBox['s'],$this->geoBox['n'],$this->geoBox['e'],$this->doi)); + } $id=$db->lastInsertId('metadata','id'); //处理在线资源 if ($this->onlineresource) foreach($this->onlineresource as $resource) @@ -549,6 +558,15 @@ class ISO19115 } } } + //resRefDate + $refdates=$this->dom->getElementsByTagName('resRefDate'); + foreach($refdates as $refdate) + { + if ($refdate->getElementsByTagName('DateTypCd')->item(0) && $refdate->getElementsByTagName('DateTypCd')->item(0)->hasAttributes() && $refdate->getElementsByTagName('DateTypCd')->item(0)->attributes->getNamedItem('value')->nodeValue=="publication") + { + $this->refDate=$refdate->getElementsByTagName('refDate'); + } + } //in ISO 19115 draft. $ds=$this->dom->getElementsByTagName('datasetSeries'); foreach($ds as $k=>$dataset)