From f0e12ab9f553816421dcdef410e5a53e251d4f1c Mon Sep 17 00:00:00 2001 From: wlx Date: Mon, 20 May 2013 15:04:29 +0000 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E5=8F=91=E5=B8=83=E6=97=B6?= =?UTF-8?q?=E9=97=B4=E7=9A=84=E9=80=89=E6=8B=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../default/controllers/ServiceController.php | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/application/default/controllers/ServiceController.php b/application/default/controllers/ServiceController.php index dc2c3a05..77723fda 100644 --- a/application/default/controllers/ServiceController.php +++ b/application/default/controllers/ServiceController.php @@ -1387,7 +1387,7 @@ class ServiceController extends Zend_Controller_Action $ris=''; if ($lang=='cn' && !empty($uuid)) { - $sql="select d.*,m.description from datadoi d left join metadata m on d.uuid=m.uuid where d.uuid='$uuid' and d.ts_published is not null"; + $sql="select d.*,m.description,m.ts_published as publish_year from datadoi d left join metadata m on d.uuid=m.uuid where d.uuid='$uuid' and d.ts_published is not null"; $row=$this->db->fetchRow($sql); $authors=explode(',',str_replace('"','',substr($row['authors'],1,-1))); $ris.='TY - JOUR'."\r\n"; @@ -1396,7 +1396,7 @@ class ServiceController extends Zend_Controller_Action { $ris.='A1 - '.$a."\r\n"; } - $ris.='Y1 - '.date('Y/m/d',strtotime($row['ts_published']))."\r\n"; + $ris.='Y1 - '.(empty($row['publish_year'])?date('Y/m/d',strtotime($row['ts_published'])):date('Y/m/d',strtotime($row['publish_year'])))."\r\n"; $ris.='JF - '.$row['publisher']."\r\n"; $ris.='JA - '.$row['publisher']."\r\n"; $ris.='UR - http://dx.doi.org/'.$row['doi']."\r\n"; @@ -1407,7 +1407,7 @@ class ServiceController extends Zend_Controller_Action } else if ($lang=='en' && !empty($uuid)) { - $sql="select d.*,m.description from datadoi d left join metadata m on d.uuid=m.uuid where d.uuid='$uuid' and d.ts_published is not null"; + $sql="select d.*,m.description,m.ts_published as publish_year from datadoi d left join metadata m on d.uuid=m.uuid where d.uuid='$uuid' and d.ts_published is not null"; $row=$this->db->fetchRow($sql); $authors=explode(',',str_replace('"','',substr($row['author_en'],1,-1))); $ris.='TY - JOUR'."\r\n"; @@ -1416,7 +1416,7 @@ class ServiceController extends Zend_Controller_Action { $ris.='A1 - '.$a."\r\n"; } - $ris.='Y1 - '.date('Y/m/d',strtotime($row['ts_published']))."\r\n"; + $ris.='Y1 - '.(empty($row['publish_year'])?date('Y/m/d',strtotime($row['ts_published'])):date('Y/m/d',strtotime($row['publish_year'])))."\r\n"; $ris.='JF - '.$row['publisher_en']."\r\n"; $ris.='JA - '.$row['publisher_en']."\r\n"; $ris.='UR - http://dx.doi.org/'.$row['doi']."\r\n"; @@ -1443,30 +1443,30 @@ class ServiceController extends Zend_Controller_Action $bib=''; if ($lang=='cn' && !empty($uuid)) { - $sql="select d.*,m.description from datadoi d left join metadata m on d.uuid=m.uuid where d.uuid='$uuid' and d.ts_published is not null"; + $sql="select d.*,m.description,m.ts_published as publish_year from datadoi d left join metadata m on d.uuid=m.uuid where d.uuid='$uuid' and d.ts_published is not null"; $row=$this->db->fetchRow($sql); $bib.='@article{'.$row['doi'].",\r\n"; $bib.=' author = '.str_replace('"','',str_replace(',',' and ',$row['authors'])).",\r\n"; $bib.=' journal = {'.$row['publisher']."},\r\n"; $bib.=' publisher = {'.$row['publisher']."},\r\n"; $bib.=' title = {'.$row['title']."},\r\n"; - $bib.=' year = {'.date('Y',strtotime($row['ts_published']))."},\r\n"; - $bib.=' month = {'.date('m',strtotime($row['ts_published']))."},\r\n"; + $bib.=' year = {'.(empty($row['publish_year'])?date('Y',strtotime($row['ts_published'])):date('Y',strtotime($row['publish_year'])))."},\r\n"; + $bib.=' month = {'.(empty($row['publish_year'])?date('m',strtotime($row['ts_published'])):date('m',strtotime($row['publish_year'])))."},\r\n"; $bib.=' url = {http://dx.doi.org/'.$row['doi']."},\r\n"; $bib.=' doi = {'.$row['doi']."}\r\n"; $bib.="}\r\n"; } else if ($lang=='en' && !empty($uuid)) { - $sql="select d.*,m.description from datadoi d left join metadata m on d.uuid=m.uuid where d.uuid='$uuid' and d.ts_published is not null"; + $sql="select d.*,m.description,m.ts_published as publish_year from datadoi d left join metadata m on d.uuid=m.uuid where d.uuid='$uuid' and d.ts_published is not null"; $row=$this->db->fetchRow($sql); $bib.='@article{'.$row['doi'].",\r\n"; $bib.=' author = '.str_replace('"','',str_replace(',',' and ',$row['author_en'])).",\r\n"; $bib.=' journal = {'.$row['publisher_en']."},\r\n"; $bib.=' publisher = {'.$row['publisher_en']."},\r\n"; $bib.=' title = {'.$row['title']."},\r\n"; - $bib.=' year = {'.date('Y',strtotime($row['ts_published']))."},\r\n"; - $bib.=' month = {'.date('m',strtotime($row['ts_published']))."},\r\n"; + $bib.=' year = {'.(empty($row['publish_year'])?date('Y',strtotime($row['ts_published'])):date('Y',strtotime($row['publish_year'])))."},\r\n"; + $bib.=' month = {'.(empty($row['publish_year'])?date('m',strtotime($row['ts_published'])):date('m',strtotime($row['publish_year'])))."},\r\n"; $bib.=' url = {http://dx.doi.org/'.$row['doi']."},\r\n"; $bib.=' doi = {'.$row['doi']."}\r\n"; $bib.="}\r\n";