update the Doi class
This commit is contained in:
parent
113682bfb7
commit
e2c2cfe776
|
@ -1,36 +1,49 @@
|
||||||
<?php
|
<?php
|
||||||
class Doi
|
class Doi extends Zend_Controller_Plugin_Abstract
|
||||||
{
|
{
|
||||||
private $db; //传入PDO对象.
|
private $db; //传入PDO对象.
|
||||||
private $auth = NULL; //Zend_Auth 对象
|
private $auth = NULL; //Zend_Auth 对象
|
||||||
|
|
||||||
//使用到的公共变量
|
//使用到的公共变量
|
||||||
public $tbl_doi = "datadoi";
|
public $tbl_doi = "datadoi";
|
||||||
|
|
||||||
function __construct($db)
|
function __construct($db)
|
||||||
{
|
{
|
||||||
$this->db = $db;
|
$this->db = $db;
|
||||||
}
|
}
|
||||||
|
|
||||||
function fetch()
|
function fetch()
|
||||||
{
|
{
|
||||||
$sql = "SELECT * FROM ".$this->tbl_doi." ORDER BY id DESC";
|
$sql = "SELECT * FROM ".$this->tbl_doi." ORDER BY id DESC";
|
||||||
$rs = $this->db->query($sql);
|
$rs = $this->db->query($sql);
|
||||||
$rows = $rs->fetchAll();
|
$rows = $rs->fetchAll();
|
||||||
return $rows;
|
return $rows;
|
||||||
}
|
}
|
||||||
|
|
||||||
function view($id)
|
function view($id)
|
||||||
{
|
{
|
||||||
if(is_numeric($id))
|
if(is_numeric($id))
|
||||||
{
|
{
|
||||||
$sql = "SELECT * FROM ".$this->tbl_doi." WHERE id=$id";
|
$sql = "SELECT * FROM ".$this->tbl_doi." WHERE id=$id";
|
||||||
}else{
|
}else{
|
||||||
$sql = "SELECT * FROM ".$this->tbl_doi." WHERE uuid='$id'";
|
$sql = "SELECT * FROM ".$this->tbl_doi." WHERE uuid='$id'";
|
||||||
}
|
}
|
||||||
$rs = $this->db->query($sql);
|
$rs = $this->db->query($sql);
|
||||||
$row = $rs->fetch();
|
$row = $rs->fetch();
|
||||||
return $row;
|
return $row;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
function _getParams(Zend_Controller_Request_Abstract $request)
|
||||||
|
{
|
||||||
|
$data = array(
|
||||||
|
'doi' => trim($request->getParam('doi')),
|
||||||
|
'uuid' => trim($request->getParam('uuid')),
|
||||||
|
'publisher' => trim($request->getParam('publisher')),
|
||||||
|
'url' => trim($request->getParam('url')),
|
||||||
|
'title' => trim($request->getParam('title')),
|
||||||
|
'info'=>$_POST['info']
|
||||||
|
);
|
||||||
|
return $data;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue