修改参考文献格式生成代码;修改批量导入

This commit is contained in:
wlx 2013-11-01 09:13:35 +00:00
parent e3a6acc635
commit fff01b40ce
2 changed files with 17 additions and 15 deletions

View File

@ -453,7 +453,7 @@ class Reference
public function referenceType() public function referenceType()
{ {
return array( return array(
0 => '相关文献', 0 => '相关文献',//作者建议的文献或数据中心建议的文献
1 => '施引文献', 1 => '施引文献',
2 => '参考文献', 2 => '参考文献',
3 => '多篇文献', 3 => '多篇文献',

View File

@ -174,18 +174,20 @@ class Ris
$results = $this->events()->trigger('checkLoad', $this, compact('ref')); $results = $this->events()->trigger('checkLoad', $this, compact('ref'));
$id = $results->bottom(); $id = $results->bottom();
$this->unsetVar($ref);
if ($id > 0) if ($id > 0)
{ {
$this->unsetVar($ref);
$this->events()->trigger('deleteAuthor', $this, compact('id')); $this->events()->trigger('deleteAuthor', $this, compact('id'));
$this->events()->trigger('deleteTag', $this, compact('id')); $this->events()->trigger('deleteTag', $this, compact('id'));
unset($ref['reference']); unset($ref['reference']);
$dbh->update($this->table->reference,$ref," id=$id "); $dbh->update($this->table->reference,$ref," id=$id ");
} else { } else {
$ref['reference'] = $this->makeReferenceFlag($ref); $ref['reference'] = $this->makeReferenceFlag($ref);
$this->unsetVar($ref);
$id = $dbh->insert($this->table->reference,$ref,true); $id = $dbh->insert($this->table->reference,$ref,true);
} }
@ -272,17 +274,17 @@ class Ris
//创建reference 字段 //创建reference 字段
public function makeReferenceFlag($ref){ public function makeReferenceFlag($ref){
$str = array(); $str = join(', ',$ref['author']).'. ';
isset($ref['author']) ? $str[] = join(",",$ref['author']):""; $str .= $ref['title'].'. ';
isset($ref['title']) ? $str[] = $ref['title']:""; $str .= $ref['publisher'].', ';
isset($ref['year']) ? $str[] = $ref['year']:""; isset($ref['year']) ? $str .= $ref['year'].', ':"";
isset($ref['volume']) ? $str[] = $ref['volume']:""; isset($ref['volume']) ? $str .= $ref['volume']:"";
isset($ref['issue']) ? $str[] = $ref['issue']:""; isset($ref['issue']) ? $str .= '('.$ref['issue'].')':"";
isset($ref['pages']) ? $str[] = $ref['pages']:""; isset($ref['pages']) ? $str .= ':'.$ref['pages']:"";
isset($ref['endpage'])? $str[] = $ref['endpage']:""; isset($ref['endpage'])? $str .= '-'.$ref['endpage']:"";
isset($ref['doi']) ? $str[] = $ref['doi'] : ""; isset($ref['doi']) ? $str .= '. doi:'.$ref['doi'] : "";
return join(",",$str); return $str;
} }
//卸载不需要的变量 //卸载不需要的变量