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(); if(preg_match("/\'/",$ref['title'])) { $ref['title'] = preg_replace("/\'/","''",$ref['title']); } $wheresql[] = " lower(title)=lower('{$ref['title']}') "; $wheresql[] = " year='{$ref['year']}' "; //暂时不使用期刊限制 /*if(isset($ref['publisher'])) { $wheresql[] = " publisher='{$ref['publisher']}' "; }*/ 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(); return $ref->deleteReferenceAuthor($id); } public function deleteTag(\Zend_EventManager_Event $e) { $id = $e->getParam('id'); $ref = new Reference(); return $ref->deleteReferenceTag($id); } }