2013-10-15 01:36:49 +00:00
|
|
|
<?php
|
|
|
|
namespace Reference\Handler;
|
|
|
|
|
|
|
|
use \Helpers\View as view;
|
|
|
|
use \Helpers\dbh;
|
|
|
|
use \Helpers\Table;
|
|
|
|
use \Files\Files;
|
|
|
|
use \Reference\Reference;
|
|
|
|
|
|
|
|
//事件中存在的操作
|
|
|
|
class RisHandler implements \Reference\Event\RisEvent
|
|
|
|
{
|
|
|
|
private $db; //传入PDO对象误
|
|
|
|
private $config; //全局配置
|
|
|
|
|
|
|
|
public $table;
|
|
|
|
public $tbl_maillog = ""; //邮件日志表
|
|
|
|
|
|
|
|
function __construct($db = NULL)
|
|
|
|
{
|
|
|
|
if(empty($db))
|
|
|
|
{
|
|
|
|
$this->db = \Zend_Registry::get('db');
|
|
|
|
}else{
|
|
|
|
$this->db = $db;
|
|
|
|
}
|
|
|
|
|
|
|
|
$this->config = \Zend_Registry::get('config');
|
|
|
|
$this->table = new Table();
|
|
|
|
}
|
|
|
|
|
|
|
|
//检查ris中的文献是否已经存在
|
|
|
|
public function checkRisReference(\Zend_EventManager_Event $e)
|
|
|
|
{
|
|
|
|
$ref = $e->getParam('ref');
|
|
|
|
|
|
|
|
$wheresql = array();
|
|
|
|
|
2013-11-01 09:14:13 +00:00
|
|
|
$wheresql[] = " lower(title)=lower('{$ref['title']}') ";
|
2013-10-15 01:36:49 +00:00
|
|
|
$wheresql[] = " year='{$ref['year']}' ";
|
2013-11-01 09:14:13 +00:00
|
|
|
|
|
|
|
//暂时不使用期刊限制
|
|
|
|
/*if(isset($ref['publisher']))
|
2013-10-15 01:36:49 +00:00
|
|
|
{
|
|
|
|
$wheresql[] = " publisher='{$ref['publisher']}' ";
|
2013-11-01 09:14:13 +00:00
|
|
|
}*/
|
2013-10-15 01:36:49 +00:00
|
|
|
|
|
|
|
if(count($wheresql) > 0)
|
|
|
|
{
|
|
|
|
$wheresql = " WHERE ".join(" and ",$wheresql);
|
|
|
|
}else{
|
|
|
|
$wheresql = "";
|
|
|
|
}
|
|
|
|
|
|
|
|
$sql="select * from {$this->table->reference} $wheresql";
|
|
|
|
$sth=$this->db->query($sql);
|
|
|
|
$row=$sth->fetch();
|
|
|
|
$id=$row['id'];
|
|
|
|
|
|
|
|
if(!empty($row['id']))
|
|
|
|
{
|
|
|
|
return $id;
|
|
|
|
}else{
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//删除作者
|
|
|
|
public function deleteAuthor(\Zend_EventManager_Event $e)
|
|
|
|
{
|
|
|
|
$id = $e->getParam('id');
|
|
|
|
|
|
|
|
$ref = new Reference();
|
|
|
|
|
2013-10-15 06:30:51 +00:00
|
|
|
return $ref->deleteReferenceAuthor($id);
|
2013-10-15 01:36:49 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
public function deleteTag(\Zend_EventManager_Event $e)
|
|
|
|
{
|
|
|
|
$id = $e->getParam('id');
|
|
|
|
|
|
|
|
$ref = new Reference();
|
|
|
|
|
2013-10-15 06:30:51 +00:00
|
|
|
return $ref->deleteReferenceTag($id);
|
2013-10-15 01:36:49 +00:00
|
|
|
}
|
|
|
|
}
|