diff --git a/Westdc/Reference/Reference.php b/Westdc/Reference/Reference.php index 8ab3d66..68c3417 100644 --- a/Westdc/Reference/Reference.php +++ b/Westdc/Reference/Reference.php @@ -45,6 +45,7 @@ class Reference extends AbstractEventManager implements ServiceManagerAwareInter $this->table->source = "source"; $this->table->metadata_reference = "mdref"; $this->table->reference_tag = "ref_tag"; + $this->table->metadata = "metadata"; } /** @@ -461,8 +462,9 @@ class Reference extends AbstractEventManager implements ServiceManagerAwareInter { return "参数错误"; } - - if(!view::isUuid($uuid)) + + $tools = $this->serviceManager->get('Tools'); + if(!$tools->isUuid($uuid)) { return "参数错误"; } @@ -473,8 +475,9 @@ class Reference extends AbstractEventManager implements ServiceManagerAwareInter 'reftype'=>$reftype, 'place'=>$place ); - - $dbh = new dbh(); + + $dbService = $this->serviceManager->get('Db'); + $dbh = $dbService->getDbh(); 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->events()->trigger('mdref.checkParam', $this, compact('data')); + $results = $this->getEventManager()->trigger('mdref.pre', $this, compact('data')); $cache_data = $results->bottom(); if($cache_data !== true) @@ -571,8 +559,8 @@ class Reference extends AbstractEventManager implements ServiceManagerAwareInter return $cache_data; } - $results = $this->events()->trigger('mdref.processData', $this, compact('data')); - $data = $results->bottom(); + $results = $this->getEventManager()->trigger('mdref.processData', $this, compact('data')); + $data = $results->last(); $id = $this->createRelationFromReferenceToData($data['refid'],$data['uuid'],$data['reftype'],$data['place'],$id);