添加了元数据项目来源编辑功能
This commit is contained in:
parent
f428d443d8
commit
0e13e997e4
|
@ -854,7 +854,7 @@ class Admin_DataController extends Zend_Controller_Action
|
|||
|
||||
$sql = "update source set title='$title',uuid='$uuid',code='$code',description='$description',has_pages='$has_pages',has_agreement='$has_agreement' where id='$id'";
|
||||
|
||||
if($this->db->exec($sql)>1)
|
||||
if($this->db->exec($sql))
|
||||
{
|
||||
$this->messenger->addMessage('修改来源信息成功');
|
||||
$this->_redirect("/admin/data/source/do/edit/id/$id");
|
||||
|
@ -876,6 +876,87 @@ class Admin_DataController extends Zend_Controller_Action
|
|||
|
||||
}// 编辑单条信息
|
||||
|
||||
else if($do == 'datasource' && !empty($uuid))
|
||||
{
|
||||
$redirect = "/admin/data/source/do/datasource/uuid/$uuid";
|
||||
|
||||
$this->view->uuid = $uuid;
|
||||
$sql = "select md.title,ds.id,ds.sourceid,s.title as stitle,s.code from metadata md
|
||||
left join datasource ds on ds.uuid=md.uuid
|
||||
left join source s on s.id=ds.sourceid
|
||||
where md.uuid='$uuid'";
|
||||
$rs = $this->db->query($sql);
|
||||
$row = $rs->fetch();
|
||||
|
||||
$this->view->info = $row;
|
||||
|
||||
if(!empty($_POST['submit']))
|
||||
{
|
||||
$sourceid = $this->_request->getParam('sourceid');
|
||||
if(empty($sourceid))
|
||||
{
|
||||
$this->messenger->addMessage('请选择项目来源');
|
||||
$this->_redirect($redirect);
|
||||
}
|
||||
|
||||
$sql="";
|
||||
if(empty($row['id']))
|
||||
{
|
||||
$sql = "insert into datasource (uuid,sourceid) values ('$uuid','$sourceid')";
|
||||
}else
|
||||
{
|
||||
$sql = "update datasource set uuid='$uuid',sourceid='$sourceid' where id='{$row['id']}'";
|
||||
}
|
||||
try{
|
||||
if($this->db->exec($sql))
|
||||
{
|
||||
$this->messenger->addMessage('修改项目来源成功');
|
||||
$this->_redirect($redirect);
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->messenger->addMessage('修改项目来源失败');
|
||||
$this->_redirect($redirect);
|
||||
}
|
||||
}catch (Exception $e){
|
||||
$this->messenger->addMessage('修改项目来源失败:'.$e->getMessage());
|
||||
$this->_redirect($redirect);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
$wheresql = array();
|
||||
|
||||
if(!empty($q) && !empty($search))
|
||||
{
|
||||
$this->view->q = $q;
|
||||
$wheresql[] = " title like '%$q%' ";
|
||||
}
|
||||
|
||||
if(count($wheresql>0))$wheresql = join(' and ',$wheresql);
|
||||
else $wheresql='';
|
||||
|
||||
if($wheresql!='')
|
||||
{
|
||||
$wheresql = 'where '.$wheresql;
|
||||
}
|
||||
|
||||
$sql = "select * from source $wheresql order by id desc";
|
||||
$rs = $this->db->query($sql);
|
||||
$rows = $rs->fetchAll();
|
||||
|
||||
$paginator = Zend_Paginator::factory($rows);
|
||||
$paginator->setCurrentPageNumber($this->_getParam('page'));
|
||||
$paginator->setItemCountPerPage(30);
|
||||
$paginator->setView($this->view);
|
||||
Zend_View_Helper_PaginationControl::setDefaultViewPartial('pagination_param.phtml');
|
||||
$this->view->paginator=$paginator;
|
||||
|
||||
$this->_helper->viewRenderer('sourceselect');
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
$wheresql = array();
|
||||
|
|
|
@ -0,0 +1,76 @@
|
|||
<?php
|
||||
$this->headTitle($this->config->title->site);
|
||||
$this->headTitle('后台管理');
|
||||
$this->headTitle()->setSeparator(' - ');
|
||||
$this->headLink()->appendStylesheet('/css/admin.css');
|
||||
$this->headScript()->appendFile('/js/jquery-1.6.4.min.js');
|
||||
$this->breadcrumb('<a href="/">首页</a>');
|
||||
$this->breadcrumb('<a href="/admin">后台首页</a>');
|
||||
$this->breadcrumb('<a href="/admin/data">数据管理</a>');
|
||||
$this->breadcrumb('项目来源管理');
|
||||
$this->breadcrumb()->setSeparator(' > ');
|
||||
?>
|
||||
<div id="leftPanel">
|
||||
<?= $this->partial('data/left.phtml'); ?>
|
||||
</div>
|
||||
<div id="rightPanel">
|
||||
|
||||
<?php if ($this->msg or $this->messages) :?>
|
||||
<div id="message">
|
||||
<?php if ($this->msg) : ?>
|
||||
<p><?php echo $this->msg; ?></p>
|
||||
<?php endif; if ($this->messages): foreach($this->messages as $msg): ?>
|
||||
<p><?php echo $msg; ?></p>
|
||||
<?php endforeach;endif; ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
为元数据《<?php echo $this->info['title'];?>》选择项目来源
|
||||
|
||||
<div class="search">
|
||||
<form action="" method="get">
|
||||
<input type="hidden" name="search" value='1' />
|
||||
<input type="hidden" name="id" value='<?php echo $this->id;?>' />
|
||||
<label>搜索关键字</label><input type="text" class="q" name="q" value="<?php echo $this->q; ?>" />
|
||||
<input type="submit" class="btn" value="搜索" />
|
||||
</form>
|
||||
</div><!-- search DIV -->
|
||||
|
||||
|
||||
<form method="post">
|
||||
<table class="stylized" width="700">
|
||||
<thead>
|
||||
<tr>
|
||||
<td width='10%'>选择</td>
|
||||
<td width='30%'>标题</td>
|
||||
<td width='30%'>Code字符</td>
|
||||
<td width='30%'>操作</td>
|
||||
</tr>
|
||||
</thead>
|
||||
<?php if (count($this->paginator)): ?>
|
||||
<tbody id="list">
|
||||
<?php foreach ($this->paginator as $item): ?>
|
||||
<tr>
|
||||
<td><input type="radio" name="sourceid" value="<?php echo $item['id'];?>" <?php if($item['id']==$this->info['sourceid']) echo 'checked="checked"'; ?> /></td>
|
||||
<td><a href="/data/<?php echo $item['uuid'];?>"><?php echo $item['title']; ?></a></td>
|
||||
<td><?php echo $item['code'];?></td>
|
||||
<td><a href="/admin/data/source/do/edit/id/<?php echo $item['id']?>">查看编辑</a></td>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
</tbody>
|
||||
<?php endif; ?>
|
||||
</table>
|
||||
<input type="hidden" name="uuid" value="<?php echo $this->uuid;?>" />
|
||||
<input type="hidden" name="do" value="datasource" />
|
||||
<input type="hidden" name="submit" value="1" />
|
||||
<?php
|
||||
if(!empty($this->info['id']))
|
||||
{
|
||||
echo "此元数据已经选择了项目来源:".$this->info['stitle']."[".$this->info['code']."],操作将更改此元数据现有的项目来源<br />";
|
||||
}
|
||||
?>
|
||||
<input type="submit" value="提交" />
|
||||
</form>
|
||||
<div class="pagenavi"><?= $this->paginator; ?></div>
|
||||
</div>
|
||||
<script>$("#list tr").mouseover(function(){$(this).addClass("high")}).mouseout(function(){$(this).removeClass("high")})</script>
|
Loading…
Reference in New Issue