From e2c2cfe776984134865c8da21c45f132cb3d5ba7 Mon Sep 17 00:00:00 2001 From: Li Jianxuan Date: Mon, 22 Apr 2013 15:16:05 +0000 Subject: [PATCH] update the Doi class --- application/models/data/Doi.php | 85 +++++++++++++++++++-------------- 1 file changed, 49 insertions(+), 36 deletions(-) diff --git a/application/models/data/Doi.php b/application/models/data/Doi.php index 2af78919..89a8bfab 100644 --- a/application/models/data/Doi.php +++ b/application/models/data/Doi.php @@ -1,36 +1,49 @@ -db = $db; - } - - function fetch() - { - $sql = "SELECT * FROM ".$this->tbl_doi." ORDER BY id DESC"; - $rs = $this->db->query($sql); - $rows = $rs->fetchAll(); - return $rows; - } - - function view($id) - { - if(is_numeric($id)) - { - $sql = "SELECT * FROM ".$this->tbl_doi." WHERE id=$id"; - }else{ - $sql = "SELECT * FROM ".$this->tbl_doi." WHERE uuid='$id'"; - } - $rs = $this->db->query($sql); - $row = $rs->fetch(); - return $row; - } - -} +db = $db; + } + + function fetch() + { + $sql = "SELECT * FROM ".$this->tbl_doi." ORDER BY id DESC"; + $rs = $this->db->query($sql); + $rows = $rs->fetchAll(); + return $rows; + } + + function view($id) + { + if(is_numeric($id)) + { + $sql = "SELECT * FROM ".$this->tbl_doi." WHERE id=$id"; + }else{ + $sql = "SELECT * FROM ".$this->tbl_doi." WHERE uuid='$id'"; + } + $rs = $this->db->query($sql); + $row = $rs->fetch(); + 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; + } + +}