优化后台文献功能

This commit is contained in:
wlx 2014-05-18 04:49:12 +00:00
parent 3ba5060d26
commit ad9d92de67
3 changed files with 35 additions and 4 deletions

View File

@ -99,8 +99,8 @@ table thead tr th {background:#EBF2F6;}
<td><?= $this->referenceType[$item['reftype']] ?></td> <td><?= $this->referenceType[$item['reftype']] ?></td>
<td><?= $item['place'] ?></td> <td><?= $item['place'] ?></td>
<td> <td>
<a href="javascript:void(0);" onclick="$('#mdref')[0].reset();mdref.edit('',<?= $item['id']?>,'<?= $this->uuid; ?>',<?= $item['reftype']?>,<?= $item['place']?>)">编辑</a> <a href="javascript:void(0);" onclick="$('#mdref')[0].reset();mdref.edit(<?= $item['mrid']?>,<?= $item['id']?>,'<?= $this->uuid; ?>',<?= $item['reftype']?>,<?= $item['place']?>)">编辑</a>
<a href="/admin/data/ref/ac/deletemdref/mrid/<?= $item['mrid']?>"></a> <a href="/admin/data/ref/ac/deletemdref/mrid/<?= $item['mrid']?>"></a>
</td> </td>
</tr> </tr>
<?php endforeach; ?> <?php endforeach; ?>

View File

@ -1,6 +1,6 @@
<ul class="nav nav-tabs"> <ul class="nav nav-tabs">
<?php if (!empty($this->uuid)) : ?> <?php if (!empty($this->uuid)) : ?>
<li class="active"><a href="/admin/data/ref">数据文献</a></li> <li class="active"><a href="/admin/data/ref/uuid/<?= $this->uuid ?>">数据文献</a></li>
<?php endif; ?> <?php endif; ?>
<li <?= empty($this->ac) && empty($this->uuid) ? 'class="active"':"" ?>><a href="/admin/data/ref">浏览所有</a></li> <li <?= empty($this->ac) && empty($this->uuid) ? 'class="active"':"" ?>><a href="/admin/data/ref">浏览所有</a></li>
<li <?= $this->ac=="water" ? 'class="active"':"" ?>><a href="/admin/data/ref/ac/water">WATER文献</a></li> <li <?= $this->ac=="water" ? 'class="active"':"" ?>><a href="/admin/data/ref/ac/water">WATER文献</a></li>

View File

@ -332,7 +332,38 @@ class Reference
$order = "ref.{$this->order} {$this->sort}"; $order = "ref.{$this->order} {$this->sort}";
} }
$sql="select distinct ref.*,r.reftype,r.place,r.id as mrid from {$this->table->reference} ref left join mdref r on ref.id=r.refid $sql="select distinct ref.*,r.reftype,r.place,r.id as mrid from {$this->table->reference} ref left join {$this->table->metadata_reference} r on ref.id=r.refid
$wheresql
ORDER BY $order";
$rs=$this->db->query($sql);
return $rs->fetchAll();
}
//Get references with data UUID
public function fetchReferencesWithUUID($uuid)
{
$wheresql = array();
//$wheresql[]=" r.uuid='$uuid' ";
if(!empty($this->keyword))
{
$wheresql[] = " (ref.title LIKE '%{$this->keyword}%' OR ref.reference LIKE '%{$this->keyword}%') ";
}
if(count($wheresql)>0)
{
$wheresql = " WHERE ".join(" AND ",$wheresql);
}else{
$wheresql = "";
}
if(empty($this->order))
{
$order = "ref.year,ref.title";
}else{
$order = "ref.{$this->order} {$this->sort}";
}
$sql="select distinct ref.*,r.reftype,r.place,r.id as mrid from {$this->table->reference} ref left join
(select * from {$this->table->metadata_reference} r where uuid='$uuid') r on ref.id=r.refid
$wheresql $wheresql
ORDER BY $order"; ORDER BY $order";
$rs=$this->db->query($sql); $rs=$this->db->query($sql);