#490 添加数据相关选项,修改tab导航的显示

This commit is contained in:
Li Jianxuan 2013-05-22 07:06:30 +00:00
parent 1eea4d1994
commit 00f0609eeb
5 changed files with 393 additions and 188 deletions

View File

@ -3833,6 +3833,25 @@ class AuthorController extends Zend_Controller_Action
return true; return true;
} }
if($ac == 'data')
{
$this->_helper->viewRenderer('fund-data');
$uuid = $this->_getParam('uuid');
$this->view->q = $q = $this->_getParam('q');
if(empty($uuid))
{
$rows = $fund->fetchFormData($uid,$q);
view::addPaginator($rows,$this->view,$this->_request);
}else{
include('data/Metadata.php');
$md = new Metadata($this->db);
$this->view->md = $md->view($uuid);
$rows = $fund->fetch($uuid);
view::addPaginator($rows,$this->view,$this->_request);
}
return true;
}
if($ac == "add") if($ac == "add")
{ {
$this->_helper->viewRenderer('fund-add'); $this->_helper->viewRenderer('fund-add');

View File

@ -0,0 +1,113 @@
<?php
$this->headTitle($this->config->title->site);
$this->headTitle($this->config->title->author);
$this->headTitle()->setSeparator(' - ');
$this->breadcrumb('<a href="/">首页</a>');
$this->breadcrumb('<a href="/author">数据作者</a>');
$this->headLink()->appendStylesheet('/css/author.css');
$this->breadcrumb('申请成为元数据作者');
$this->breadcrumb()->setSeparator(' > ');
$this->theme->AppendPlus($this,'colorbox');
$this->theme->AppendPlus($this,'admin_plugin');
?>
<style>
table thead tr th {background:#EBF2F6;}
</style>
<div class="row-fluid">
<div class="span3">
<?= $this->partial('author/navi.phtml'); ?>
</div>
<div class="span9">
<div>
<ul class="nav nav-tabs">
<li class="active"><a href="/author/fund/ac/data">数据相关</a></li>
<li><a href="/author/fund/">所有项目</a></li>
<li><a href="/author/fund/ac/add">添加新项目</a></li>
</ul>
</div>
<?php if(!empty($this->md)) { ?>
<div>
<?php if(empty($this->ct)) { ?>
<a class="btn btn-primary pull-right" href="/author/fund/ac/formd/uuid/<?= $this->md['uuid'] ?>"><i class="icon-plus"></i>为此数据添加项目</a>
<?php }else{ ?>
<a class="pull-right btn" href="/author/fund/uuid/<?= $this->md['uuid'] ?>">返回</a>
<div class="pull-right label label-info">点击“添加此项目”即可将项目添加到元数据</div>
<?php } ?>
<h3><?= $this->md['title'] ?>》 的支持项目</h3>
<hr />
</div>
<?php } ?>
<div>
<div class="input-append">
<form id="datasearch" class="search_form" action="">
<input type="text" id="keyword" name="q" value="<?php if(!empty($this->q)) echo $this->q; ?>" />
<button type="submit" class="btn" id="search_btn">搜索</button>
</form>
</div>
</div>
<?php if(!empty($this->error)) { ?>
<?php if(empty($this->AlertType)) $AlertType = "alert-error";else $AlertType = $this->AlertType;?>
<div class="alert alert-block fade in <?= $AlertType ?>" id="Alert-error-box">
<a class="close" data-dismiss="alert" href="#">×</a>
<?php if(!is_array($this->error)) { ?><h4 class="alert-heading"><?= $this->error ?></h4><?php } else { ?>
<ul>
<?php foreach($this->error as $v) { ?>
<li><?= $v ?></li>
<?php } ?>
</ul>
<?php } ?>
</div>
<?php } ?>
<?php if(!empty($this->msg)) { ?>
<div class="alert <?= $this->AlertType;?>">
<a data-dismiss="alert" class="close">×</a>
<?php echo $this->msg ?>
</div>
<?php if(!empty($this->jump_url)) { ?>
<script language="javascript">setTimeout("self.location='<?php echo $this->jump_url ?>'",3000);</script>
<?php } ?>
<?php } else{ ?>
<div id="datalist">
<?php if (count($this->paginator)): ?>
<table class="table table-bordered table-striped">
<thead>
<tr>
<th>数据</th>
<th>名称</th>
<th>编号</th>
<th width="70">操作</th>
</tr>
</thead>
<tbody>
<?php $autoindex=0;
foreach ($this->paginator as $item):
$autoindex++;?>
<?php if(empty($this->md)) { ?>
<tr id="DataLine_<?= $item['id']?>">
<?php }else{?>
<tr id="DataLine_<?= $item['mfid']?>">
<?php }?>
<td><?= $item['mdtitle'] ?></td>
<td><?= $item['title'] ?></td>
<td><?= $item['fund_id'] ?></td>
<td>
<a href="javascript:void(0);" onclick="onedel(<?= $item['mfid']?>)" id="delbtn_<?= $item['mfid']?>">移除</a>
</td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
<?php endif; ?>
<div class="pagenavi"><?= $this->paginator; ?></div>
</div>
<?php } ?>
</div>
</div>
<!-- //页面内容 -->
<script>
var info = {
btn_prefix : "delbtn_",
item_prefix : "DataLine_",
url : "/author/fund/ac/mdfunddel/uuid/<?= $this->md['uuid'] ?>"
}
</script>

View File

@ -1,163 +1,167 @@
<?php <?php
$this->headTitle($this->config->title->site); $this->headTitle($this->config->title->site);
$this->headTitle($this->config->title->author); $this->headTitle($this->config->title->author);
$this->headTitle()->setSeparator(' - '); $this->headTitle()->setSeparator(' - ');
$this->breadcrumb('<a href="/">首页</a>'); $this->breadcrumb('<a href="/">首页</a>');
$this->breadcrumb('<a href="/author">数据作者</a>'); $this->breadcrumb('<a href="/author">数据作者</a>');
$this->headLink()->appendStylesheet('/css/author.css'); $this->headLink()->appendStylesheet('/css/author.css');
$this->breadcrumb('申请成为元数据作者'); $this->breadcrumb('申请成为元数据作者');
$this->breadcrumb()->setSeparator(' > '); $this->breadcrumb()->setSeparator(' > ');
$this->theme->AppendPlus($this,'colorbox'); $this->theme->AppendPlus($this,'colorbox');
$this->theme->AppendPlus($this,'admin_plugin'); $this->theme->AppendPlus($this,'admin_plugin');
?> ?>
<style> <style>
table thead tr th {background:#EBF2F6;} table thead tr th {background:#EBF2F6;}
</style> </style>
<div class="row-fluid"> <div class="row-fluid">
<div class="span3"> <div class="span3">
<?= $this->partial('author/navi.phtml'); ?> <?= $this->partial('author/navi.phtml'); ?>
</div> </div>
<div class="span9"> <div class="span9">
<div> <div>
<ul class="nav nav-tabs"> <ul class="nav nav-tabs">
<li class="active"><a href="/author/fund/">所有项目</a></li> <li><a href="/author/fund/ac/data">数据相关</a></li>
<li><a href="/author/fund/ac/add">添加新项目</a></li> <li <?php if(empty($this->md)) { ?>class="active"<?php } ?>><a href="/author/fund/">所有项目</a></li>
</ul> <li><a href="/author/fund/ac/add">添加新项目</a></li>
</div> <?php if(!empty($this->md)) { ?>
<?php if(!empty($this->md)) { ?> <li class="active"><a href="/author/fund/">按数据查看</a></li>
<div> <?php } ?>
<?php if(empty($this->ct)) { ?> </ul>
<a class="btn btn-primary pull-right" href="/author/fund/ac/formd/uuid/<?= $this->md['uuid'] ?>"><i class="icon-plus"></i>为此数据添加项目</a> </div>
<?php }else{ ?> <?php if(!empty($this->md)) { ?>
<a class="pull-right btn" href="/author/fund/uuid/<?= $this->md['uuid'] ?>">返回</a> <div>
<div class="pull-right label label-info">点击“添加此项目”即可将项目添加到元数据</div> <?php if(empty($this->ct)) { ?>
<?php } ?> <a class="btn btn-primary pull-right" href="/author/fund/ac/formd/uuid/<?= $this->md['uuid'] ?>"><i class="icon-plus"></i>为此数据添加项目</a>
<h3><?= $this->md['title'] ?>》 的支持项目</h3> <?php }else{ ?>
<hr /> <a class="pull-right btn" href="/author/fund/uuid/<?= $this->md['uuid'] ?>">返回</a>
</div> <div class="pull-right label label-info">点击“添加此项目”即可将项目添加到元数据</div>
<?php } ?> <?php } ?>
<div> <h3><?= $this->md['title'] ?>》 的支持项目</h3>
<div class="input-append"> <hr />
<form id="datasearch" class="search_form" action=""> </div>
<input type="text" id="keyword" name="q" value="<?php if(!empty($this->q)) echo $this->q; ?>" /> <?php } ?>
<button type="submit" class="btn" id="search_btn">搜索</button> <div>
</form> <div class="input-append">
</div> <form id="datasearch" class="search_form" action="">
</div> <input type="text" id="keyword" name="q" value="<?php if(!empty($this->q)) echo $this->q; ?>" />
<?php if(!empty($this->error)) { ?> <button type="submit" class="btn" id="search_btn">搜索</button>
<?php if(empty($this->AlertType)) $AlertType = "alert-error";else $AlertType = $this->AlertType;?> </form>
<div class="alert alert-block fade in <?= $AlertType ?>" id="Alert-error-box"> </div>
<a class="close" data-dismiss="alert" href="#">×</a> </div>
<?php if(!is_array($this->error)) { ?><h4 class="alert-heading"><?= $this->error ?></h4><?php } else { ?> <?php if(!empty($this->error)) { ?>
<ul> <?php if(empty($this->AlertType)) $AlertType = "alert-error";else $AlertType = $this->AlertType;?>
<?php foreach($this->error as $v) { ?> <div class="alert alert-block fade in <?= $AlertType ?>" id="Alert-error-box">
<li><?= $v ?></li> <a class="close" data-dismiss="alert" href="#">×</a>
<?php } ?> <?php if(!is_array($this->error)) { ?><h4 class="alert-heading"><?= $this->error ?></h4><?php } else { ?>
</ul> <ul>
<?php } ?> <?php foreach($this->error as $v) { ?>
</div> <li><?= $v ?></li>
<?php } ?> <?php } ?>
<?php if(!empty($this->msg)) { ?> </ul>
<div class="alert <?= $this->AlertType;?>"> <?php } ?>
<a data-dismiss="alert" class="close">×</a> </div>
<?php echo $this->msg ?> <?php } ?>
</div> <?php if(!empty($this->msg)) { ?>
<?php if(!empty($this->jump_url)) { ?> <div class="alert <?= $this->AlertType;?>">
<script language="javascript">setTimeout("self.location='<?php echo $this->jump_url ?>'",3000);</script> <a data-dismiss="alert" class="close">×</a>
<?php } ?> <?php echo $this->msg ?>
<?php } else{ ?> </div>
<div id="datalist"> <?php if(!empty($this->jump_url)) { ?>
<?php if (count($this->paginator)): ?> <script language="javascript">setTimeout("self.location='<?php echo $this->jump_url ?>'",3000);</script>
<table class="table table-bordered table-striped"> <?php } ?>
<thead> <?php } else{ ?>
<tr> <div id="datalist">
<th>名称</th> <?php if (count($this->paginator)): ?>
<th>编号</th> <table class="table table-bordered table-striped">
<th>类型</th> <thead>
<?php if($this->md) { ?> <tr>
<th width="80">排序</th> <th>名称</th>
<?php }else{ ?> <th>编号</th>
<th>英文标题</th> <th>类型</th>
<th>英文类型</th> <?php if($this->md) { ?>
<?php } ?> <th width="80">排序</th>
<th width="70">操作</th> <?php }else{ ?>
</tr> <th>英文标题</th>
</thead> <th>英文类型</th>
<tbody> <?php } ?>
<?php $autoindex=0; <th width="70">操作</th>
foreach ($this->paginator as $item): </tr>
$autoindex++;?> </thead>
<?php if(empty($this->md)) { ?> <tbody>
<tr id="DataLine_<?= $item['id']?>"> <?php $autoindex=0;
<?php }else{?> foreach ($this->paginator as $item):
<tr id="DataLine_<?= $item['mfid']?>"> $autoindex++;?>
<?php }?> <?php if(empty($this->md)) { ?>
<td><?= $item['title'] ?></td> <tr id="DataLine_<?= $item['id']?>">
<td><?= $item['fund_id'] ?></td> <?php }else{?>
<td><?= $item['fund_type'] ?></td> <tr id="DataLine_<?= $item['mfid']?>">
<?php if($this->md) { ?> <?php }?>
<?php if($this->ct) { ?> <td><?= $item['title'] ?></td>
<td><input type="text" name="order" id="order_<?= $item['id']?>" class="span12" /></td> <td><?= $item['fund_id'] ?></td>
<?php }else{ ?> <td><?= $item['fund_type'] ?></td>
<td><input type="text" name="order" id="order_<?= $item['mfid']?>" class="span12" value="<?= $item['place'] ?>" /></td> <?php if($this->md) { ?>
<?php }?> <?php if($this->ct) { ?>
<?php }else{ ?> <td><input type="text" name="order" id="order_<?= $item['id']?>" class="span12" /></td>
<td><?= $item['title_en'] ?></td> <?php }else{ ?>
<td><?= $item['fund_type_en'] ?></td> <td><input type="text" name="order" id="order_<?= $item['mfid']?>" class="span12" value="<?= $item['place'] ?>" /></td>
<?php } ?> <?php }?>
<td> <?php }else{ ?>
<?php if(empty($this->md)) { ?> <td><?= $item['title_en'] ?></td>
<a href="/author/fund/ac/edit/id/<?= $item['id']?>">编辑</a> <td><?= $item['fund_type_en'] ?></td>
<a href="javascript:void(0);" onclick="onedel(<?= $item['id']?>)" id="delbtn_<?= $item['id']?>">删除</a> <?php } ?>
<?php }else{ ?> <td>
<?php if(empty($this->ct)) { ?> <?php if(empty($this->md)) { ?>
<a href="javascript:void(0);" class="changeorder" rel="<?= $item['mfid']?>">排序</a> <a href="/author/fund/ac/edit/id/<?= $item['id']?>">编辑</a>
<a href="javascript:void(0);" onclick="onedel(<?= $item['mfid']?>)" id="delbtn_<?= $item['mfid']?>">移除</a> <a href="javascript:void(0);" onclick="onedel(<?= $item['id']?>)" id="delbtn_<?= $item['id']?>">删除</a>
<?php }else{ ?> <?php }else{ ?>
<a href="javascript:void(0);" class="addtomd" rel="<?= $item['id']?>">添加此项目</a> <?php if(empty($this->ct)) { ?>
<?php } ?> <a href="javascript:void(0);" class="changeorder" rel="<?= $item['mfid']?>">排序</a>
<?php } ?> <a href="javascript:void(0);" onclick="onedel(<?= $item['mfid']?>)" id="delbtn_<?= $item['mfid']?>">移除</a>
</td> <?php }else{ ?>
</tr> <a href="javascript:void(0);" class="addtomd" rel="<?= $item['id']?>">添加此项目</a>
<?php endforeach; ?> <?php } ?>
</tbody> <?php } ?>
</table> </td>
<?php endif; ?> </tr>
<div class="pagenavi"><?= $this->paginator; ?></div> <?php endforeach; ?>
</div> </tbody>
<?php } ?> </table>
</div> <?php endif; ?>
</div> <div class="pagenavi"><?= $this->paginator; ?></div>
<!-- //页面内容 --> </div>
<script> <?php } ?>
<?php if(!empty($this->ct)) { ?> </div>
$('.addtomd').each(function(index, element) { </div>
$(this).click(function(){ <!-- //页面内容 -->
id = $(this).attr('rel'); <script>
order = $('#order_'+id).val(); <?php if(!empty($this->ct)) { ?>
self.location='/author/fund/ac/formd/uuid/<?= $this->md['uuid'] ?>/id/'+id+'/order/'+ order $('.addtomd').each(function(index, element) {
}); $(this).click(function(){
}); id = $(this).attr('rel');
<?php }else{ ?> order = $('#order_'+id).val();
$('.changeorder').each(function(index, element) { self.location='/author/fund/ac/formd/uuid/<?= $this->md['uuid'] ?>/id/'+id+'/order/'+ order
$(this).click(function(){ });
id = $(this).attr('rel'); });
order = $('#order_'+id).val(); <?php }else{ ?>
self.location='/author/fund/ac/formd/uuid/<?= $this->md['uuid'] ?>/mfid/'+id+'/order/'+ order $('.changeorder').each(function(index, element) {
}); $(this).click(function(){
}); id = $(this).attr('rel');
<?php } ?> order = $('#order_'+id).val();
<?php if(empty($this->md)) { ?> self.location='/author/fund/ac/formd/uuid/<?= $this->md['uuid'] ?>/mfid/'+id+'/order/'+ order
var info = { });
btn_prefix : "delbtn_", });
item_prefix : "DataLine_", <?php } ?>
url : "/author/fund/ac/del" <?php if(empty($this->md)) { ?>
} var info = {
<?php }else{ ?> btn_prefix : "delbtn_",
var info = { item_prefix : "DataLine_",
btn_prefix : "delbtn_", url : "/author/fund/ac/del"
item_prefix : "DataLine_", }
url : "/author/fund/ac/mdfunddel/uuid/<?= $this->md['uuid'] ?>" <?php }else{ ?>
} var info = {
<?php } ?> btn_prefix : "delbtn_",
</script> item_prefix : "DataLine_",
url : "/author/fund/ac/mdfunddel/uuid/<?= $this->md['uuid'] ?>"
}
<?php } ?>
</script>

View File

@ -1,20 +1,20 @@
<div class="sidebar-nav bs-review-nav"> <div class="sidebar-nav bs-review-nav">
<ul class="nav nav-list bs-review-sidenav"> <ul class="nav nav-list bs-review-sidenav">
<li id="Nav-author-index"><a href="/author/"><i class="icon-chevron-right"></i>介绍</a></li> <li id="Nav-author-index"><a href="/author/"><i class="icon-chevron-right"></i>介绍</a></li>
<li id="Nav-author-newdata"><a href="/author/newdata"><i class="icon-chevron-right"></i>新建数据</a></li> <li id="Nav-author-newdata"><a href="/author/newdata"><i class="icon-chevron-right"></i>新建数据</a></li>
<li id="Nav-author-apply"><a href="/author/apply"><i class="icon-chevron-right"></i>数据认证</a></li> <li id="Nav-author-apply"><a href="/author/apply"><i class="icon-chevron-right"></i>数据认证</a></li>
<li id="Nav-author-accept"><a href="/author/accept"><i class="icon-chevron-right"></i>我的数据</a></li> <li id="Nav-author-accept"><a href="/author/accept"><i class="icon-chevron-right"></i>我的数据</a></li>
<li id="Nav-author-inauthor"><a href="/author/inauthor"><i class="icon-chevron-right"></i>数据申请管理</a></li> <li id="Nav-author-inauthor"><a href="/author/inauthor"><i class="icon-chevron-right"></i>数据申请管理</a></li>
<li id="Nav-author-comment"><a href="/author/comment"><i class="icon-chevron-right"></i>数据反馈管理</a></li> <li id="Nav-author-comment"><a href="/author/comment"><i class="icon-chevron-right"></i>数据反馈管理</a></li>
<li id="Nav-author-literature"><a href="/author/literature"><i class="icon-chevron-right"></i>数据文献管理</a></li> <li id="Nav-author-literature"><a href="/author/literature"><i class="icon-chevron-right"></i>数据文献管理</a></li>
<li id="Nav-author-document"><a href="/author/document"><i class="icon-chevron-right"></i>数据文档管理</a></li> <li id="Nav-author-document"><a href="/author/document"><i class="icon-chevron-right"></i>数据文档管理</a></li>
<li id="Nav-author-news"><a href="/author/news"><i class="icon-chevron-right"></i>数据新闻管理</a></li> <li id="Nav-author-news"><a href="/author/news"><i class="icon-chevron-right"></i>数据新闻管理</a></li>
<li id="Nav-author-version"><a href="/author/version"><i class="icon-chevron-right"></i>数据版本管理</a></li> <li id="Nav-author-version"><a href="/author/version"><i class="icon-chevron-right"></i>数据版本管理</a></li>
<li id="Nav-author-fund"><a href="/author/fund"><i class="icon-chevron-right"></i>支持项目</a></li> <li id="Nav-author-fund"><a href="/author/fund/ac/data"><i class="icon-chevron-right"></i>支持项目</a></li>
<li id="Nav-author-doi"><a href="/author/doi"><i class="icon-chevron-right"></i>DOI</a></li> <li id="Nav-author-doi"><a href="/author/doi"><i class="icon-chevron-right"></i>DOI</a></li>
<!-- <!--
<li><a href="/author/survey">数据调查</a></li> <li><a href="/author/survey">数据调查</a></li>
<li><a href="/author/qa">数据QA</a></li> --> <li><a href="/author/qa">数据QA</a></li> -->
<li id="Nav-author-statics"><a href="/author/statics"><i class="icon-chevron-right"></i>信息统计</a></li> <li id="Nav-author-statics"><a href="/author/statics"><i class="icon-chevron-right"></i>信息统计</a></li>
</ul> </ul>
</div> </div>

View File

@ -15,15 +15,34 @@ class Fund extends Zend_Controller_Plugin_Abstract
$this->auth = $auth; $this->auth = $auth;
} }
function fetch($uuid = "",$include = true,$uid=0){ function fetch($uuid = "",$include = true,$uid=0,$keyword=""){
if(empty($uuid)) if(empty($uuid))
{ {
if(empty($uid)) $wheresql = array();
if(!empty($keyword))
{ {
$sql = "SELECT * FROM ".$this->tbl_fund." ORDER BY id desc"; if(preg_match("/\'/",$keyword))
}else{ {
$sql = "SELECT * FROM ".$this->tbl_fund." WHERE userid=$uid ORDER BY id desc"; $keyword = preg_replace("/\'/","''",$keyword);
}
$wheresql[] = " title LIKE '%$keyword%'";
} }
if(!empty($uid))
{
$wheresql[] = " userid=$uid ";
}
if(count($wheresql)>0)
{
$wheresql = " WHERE ".join(" AND ",$wheresql);
}else{
$wheresql = "";
}
$sql = "SELECT * FROM ".$this->tbl_fund." $wheresql ORDER BY id desc";
$rs = $this->db->query($sql); $rs = $this->db->query($sql);
$rows = $rs->fetchAll(); $rows = $rs->fetchAll();
return $rows; return $rows;
@ -44,6 +63,15 @@ class Fund extends Zend_Controller_Plugin_Abstract
{ {
$wheresql[] = " f.userid='$uid' "; $wheresql[] = " f.userid='$uid' ";
} }
if(!empty($keyword))
{
if(preg_match("/\'/",$keyword))
{
$keyword = preg_replace("/\'/","''",$keyword);
}
$wheresql[] = " f.title LIKE '%$keyword%'";
}
if(count($wheresql)>0) if(count($wheresql)>0)
{ {
@ -52,7 +80,7 @@ class Fund extends Zend_Controller_Plugin_Abstract
$wheresql = ""; $wheresql = "";
} }
if($include) if($include === true)
{ {
$sql = "SELECT f.*,mf.place,mf.id as mfid FROM ".$this->tbl_fund." f $sql = "SELECT f.*,mf.place,mf.id as mfid FROM ".$this->tbl_fund." f
LEFT JOIN ".$this->tbl_mdfund." mf ON mf.fid=f.id LEFT JOIN ".$this->tbl_mdfund." mf ON mf.fid=f.id
@ -67,6 +95,43 @@ class Fund extends Zend_Controller_Plugin_Abstract
} }
} }
function fetchFormData($uid,$keyword){
$wheresql = array();
if(!empty($uid) && is_int($uid))
{
$wheresql[] = " f.userid='$uid' ";
}
if(!empty($keyword))
{
if(preg_match("/\'/",$keyword))
{
$keyword = preg_replace("/\'/","''",$keyword);
}
$wheresql[] = " f.title LIKE '%$keyword%'";
}
$wheresql[] = " md.title IS NOT NULL ";
if(count($wheresql)>0)
{
$wheresql = " WHERE ".join(" AND ",$wheresql);
}else{
$wheresql = "";
}
$sql = "SELECT f.*,mf.place,mf.id as mfid,md.title as mdtitle,md.uuid FROM ".$this->tbl_fund." f
LEFT JOIN ".$this->tbl_mdfund." mf ON mf.fid=f.id
LEFT JOIN metadata md ON md.uuid=mf.uuid
$wheresql
ORDER BY mf.place";
$rs = $this->db->query($sql);
$rows = $rs->fetchAll(PDO::FETCH_BOTH);
return $rows;
}
function add($data) function add($data)
{ {
include_once("helper/dbh.php"); include_once("helper/dbh.php");
@ -205,6 +270,10 @@ class Fund extends Zend_Controller_Plugin_Abstract
$search = ""; $search = "";
if(!empty($keyword)) if(!empty($keyword))
{ {
if(preg_match("/\'/",$keyword))
{
$keyword = preg_replace("/\'/","''",$keyword);
}
$search = " AND md.title LIKE '%$keyword%' "; $search = " AND md.title LIKE '%$keyword%' ";
} }
$sql = "SELECT md.title,mf.id FROM ".$this->tbl_mdfund." mf $sql = "SELECT md.title,mf.id FROM ".$this->tbl_mdfund." mf