fixed bugs in Reference module

This commit is contained in:
Jianxuan Li 2014-12-30 17:34:30 +08:00
parent 39fb5b515b
commit 6f6b0ecb9a
1 changed files with 11 additions and 23 deletions

View File

@ -45,6 +45,7 @@ class Reference extends AbstractEventManager implements ServiceManagerAwareInter
$this->table->source = "source"; $this->table->source = "source";
$this->table->metadata_reference = "mdref"; $this->table->metadata_reference = "mdref";
$this->table->reference_tag = "ref_tag"; $this->table->reference_tag = "ref_tag";
$this->table->metadata = "metadata";
} }
/** /**
@ -461,8 +462,9 @@ class Reference extends AbstractEventManager implements ServiceManagerAwareInter
{ {
return "参数错误"; return "参数错误";
} }
if(!view::isUuid($uuid)) $tools = $this->serviceManager->get('Tools');
if(!$tools->isUuid($uuid))
{ {
return "参数错误"; return "参数错误";
} }
@ -473,8 +475,9 @@ class Reference extends AbstractEventManager implements ServiceManagerAwareInter
'reftype'=>$reftype, 'reftype'=>$reftype,
'place'=>$place 'place'=>$place
); );
$dbh = new dbh(); $dbService = $this->serviceManager->get('Db');
$dbh = $dbService->getDbh();
if(empty($id)) if(empty($id))
{ {
@ -545,25 +548,10 @@ class Reference extends AbstractEventManager implements ServiceManagerAwareInter
); );
} }
//数据文献参数
public function getMdrefParam(\Zend_Controller_Request_Abstract $request = NULL)
{
$request = new \Zend_Controller_Request_Http();
$data = array(
'uuid' => trim($request->getParam('uuid')),
'refid' => (int)$request->getParam('refid'),
'place' => (int)$request->getParam('place'),
'reftype' => (int)$request->getParam('reftype'),
);
return $data;
}
//写入数据文献 //写入数据文献
public function makeMdref($id = NULL) public function makeMdref($data,$id = NULL)
{ {
$data = $this->getMdrefParam(); $results = $this->getEventManager()->trigger('mdref.pre', $this, compact('data'));
$results = $this->events()->trigger('mdref.checkParam', $this, compact('data'));
$cache_data = $results->bottom(); $cache_data = $results->bottom();
if($cache_data !== true) if($cache_data !== true)
@ -571,8 +559,8 @@ class Reference extends AbstractEventManager implements ServiceManagerAwareInter
return $cache_data; return $cache_data;
} }
$results = $this->events()->trigger('mdref.processData', $this, compact('data')); $results = $this->getEventManager()->trigger('mdref.processData', $this, compact('data'));
$data = $results->bottom(); $data = $results->last();
$id = $this->createRelationFromReferenceToData($data['refid'],$data['uuid'],$data['reftype'],$data['place'],$id); $id = $this->createRelationFromReferenceToData($data['refid'],$data['uuid'],$data['reftype'],$data['place'],$id);