rename RisOutput as RisExport ,and update to a service,add simpleFetch() in Metadata service
This commit is contained in:
parent
649edb70b5
commit
1dd78e14f6
|
@ -34,7 +34,19 @@ class Metadata extends AbstractEventManager implements ServiceManagerAwareInterf
|
|||
}
|
||||
|
||||
|
||||
public function simpleFetch($uuid)
|
||||
{
|
||||
$sql="select * from metadata where uuid='$uuid'";
|
||||
$rs = $this->db->query($sql);
|
||||
|
||||
return $rs->fetch();
|
||||
}//simpleFetch
|
||||
|
||||
/**
|
||||
* 通过UUID删除元数据
|
||||
* @param $uuid
|
||||
* @return bool|string
|
||||
*/
|
||||
public function delete($uuid)
|
||||
{
|
||||
|
||||
|
|
|
@ -1,54 +1,40 @@
|
|||
<?php
|
||||
namespace Reference;
|
||||
namespace Westdc\Reference;
|
||||
|
||||
use \Helpers\View as view;
|
||||
use \Helpers\dbh;
|
||||
//use \Reference\Listener\RisOutputListener as Listener;
|
||||
use \Files\Files;
|
||||
use \Reference\Reference;
|
||||
use \Reference\Ris;
|
||||
use \LibRIS\RISReader;
|
||||
use \LibRIS\RISTags;
|
||||
use \LibRIS\RISWriter;
|
||||
use Zend\ServiceManager\ServiceManager;
|
||||
use Zend\ServiceManager\ServiceManagerAwareInterface;
|
||||
use LibRIS\RISReader;
|
||||
use LibRIS\RISTags;
|
||||
use LibRIS\RISWriter;
|
||||
|
||||
class RisOutput
|
||||
class RisExport implements ServiceManagerAwareInterface
|
||||
{
|
||||
private $db; //传入PDO对象.
|
||||
private $config; //站点设置
|
||||
private $dbh;
|
||||
protected $serviceManager;
|
||||
private $table;
|
||||
private $db;
|
||||
|
||||
protected $events = NULL;
|
||||
public $table;
|
||||
public $ris_records = NULL;
|
||||
protected $ris;
|
||||
public $attr;
|
||||
public $attr_flip;
|
||||
|
||||
function __construct($db = NULL,$mail = NULL)
|
||||
{
|
||||
if(empty($db))
|
||||
{
|
||||
$this->db = \Zend_Registry::get('db');
|
||||
}else{
|
||||
$this->db = $db;
|
||||
}
|
||||
|
||||
$this->config = \Zend_Registry::get('config');
|
||||
|
||||
//$Listener = new Listener();
|
||||
//@$this->events()->attachAggregate($Listener);
|
||||
|
||||
$this->table = new \Helpers\Table();
|
||||
}
|
||||
|
||||
public function events(\Zend_EventManager_EventCollection $events = NULL)
|
||||
public function setServiceManager(ServiceManager $serviceManager)
|
||||
{
|
||||
if ($events !== NULL) {
|
||||
$this->events = $events;
|
||||
} elseif ($this->events === NULL) {
|
||||
$this->events = new \Zend_EventManager_EventManager(__CLASS__);
|
||||
}
|
||||
return $this->events;
|
||||
$this->serviceManager = $serviceManager;
|
||||
|
||||
$this->init();
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function init()
|
||||
{
|
||||
$this->table = new \stdClass;
|
||||
$this->table->reference = "reference";
|
||||
|
||||
$dbService = $this->serviceManager->get('Db');
|
||||
$this->db = $dbService->getPdo();
|
||||
}
|
||||
|
||||
//读取数据
|
||||
|
@ -79,12 +65,12 @@ class RisOutput
|
|||
$risReader = new RISReader();
|
||||
}
|
||||
|
||||
$this->ris = new Ris();
|
||||
$this->ris = $this->serviceManager->get('Reference/Ris');
|
||||
$this->attr = $this->ris->attr;
|
||||
$this->attr_flip = array_flip($this->ris->attr);
|
||||
unset($this->ris);
|
||||
|
||||
$this->reference = new Reference();
|
||||
$this->reference = $this->serviceManager->get('Reference');
|
||||
|
||||
foreach($arrayData as $k=>$v)
|
||||
{
|
Loading…
Reference in New Issue