Ticket #174 增加了项目来源管理功能
This commit is contained in:
parent
45abb67c08
commit
47089e9a57
|
@ -68,7 +68,7 @@ class Admin_DataController extends Zend_Controller_Action
|
||||||
$sql="select m.uuid,m.source,x.data from metadata m left join xml x on m.id=x.id where m.uuid in (select uuid from geonetworkmetadata)";
|
$sql="select m.uuid,m.source,x.data from metadata m left join xml x on m.id=x.id where m.uuid in (select uuid from geonetworkmetadata)";
|
||||||
$rs=$this->db->fetchAll($sql);
|
$rs=$this->db->fetchAll($sql);
|
||||||
foreach($rs as $gmd) {
|
foreach($rs as $gmd) {
|
||||||
$sql="update geonetworkmetadata set source='".$gmd->source."',data=".$this->db->quote($gmd->data)." where uuid='".$gmd->uuid."'";
|
$sql="update geonetworkmetadata set source='".$gmd->source."',data=".$this->db->quote($gmd->data)." where uuid='".$gmd->uuid."'";
|
||||||
$this->db->exec($sql);
|
$this->db->exec($sql);
|
||||||
}
|
}
|
||||||
$this->view->msg='成功同步WESTDC元数据到GEONETWORK!';
|
$this->view->msg='成功同步WESTDC元数据到GEONETWORK!';
|
||||||
|
@ -76,7 +76,7 @@ class Admin_DataController extends Zend_Controller_Action
|
||||||
//同步单条元数据
|
//同步单条元数据
|
||||||
$sql=$this->db->quoteInto("select data,source from geonetworkmetadata where uuid=?",$uuid);
|
$sql=$this->db->quoteInto("select data,source from geonetworkmetadata where uuid=?",$uuid);
|
||||||
if ($rs=$this->db->fetchRow($sql)) {
|
if ($rs=$this->db->fetchRow($sql)) {
|
||||||
$this->import($rs->data);
|
$this->import($rs->data);
|
||||||
$this->db->exec($this->db->quoteInto("update metadata set source=? where uuid='$uuid'",$rs->source));
|
$this->db->exec($this->db->quoteInto("update metadata set source=? where uuid='$uuid'",$rs->source));
|
||||||
$this->view->msg='成功同步元数据:'.$uuid;
|
$this->view->msg='成功同步元数据:'.$uuid;
|
||||||
} else $this->view->msg='不存在此元数据:'.$uuid;
|
} else $this->view->msg='不存在此元数据:'.$uuid;
|
||||||
|
@ -96,7 +96,7 @@ class Admin_DataController extends Zend_Controller_Action
|
||||||
//同步单条元数据
|
//同步单条元数据
|
||||||
$sql=$this->db->quoteInto("select data,source from watergn where uuid=?",$uuid);
|
$sql=$this->db->quoteInto("select data,source from watergn where uuid=?",$uuid);
|
||||||
if ($rs=$this->db->fetchRow($sql)) {
|
if ($rs=$this->db->fetchRow($sql)) {
|
||||||
$this->import($rs->data);
|
$this->import($rs->data);
|
||||||
$this->db->query("update metadata set source=? where uuid=?",array($rs->source,$uuid));
|
$this->db->query("update metadata set source=? where uuid=?",array($rs->source,$uuid));
|
||||||
$this->view->msg='成功同步元数据:'.$uuid;
|
$this->view->msg='成功同步元数据:'.$uuid;
|
||||||
} else $this->view->msg='不存在此元数据:'.$uuid;
|
} else $this->view->msg='不存在此元数据:'.$uuid;
|
||||||
|
@ -104,7 +104,7 @@ class Admin_DataController extends Zend_Controller_Action
|
||||||
//同步单条元数据
|
//同步单条元数据
|
||||||
$sql=$this->db->quoteInto("select data,source from geonetworkmetadata where uuid=?",$uuid);
|
$sql=$this->db->quoteInto("select data,source from geonetworkmetadata where uuid=?",$uuid);
|
||||||
if ($rs=$this->db->fetchRow($sql)) {
|
if ($rs=$this->db->fetchRow($sql)) {
|
||||||
$this->import($rs->data);
|
$this->import($rs->data);
|
||||||
$this->db->query("update metadata set source=? where uuid=?",array($rs->source,$uuid));
|
$this->db->query("update metadata set source=? where uuid=?",array($rs->source,$uuid));
|
||||||
$this->view->msg='成功同步元数据:'.$uuid;
|
$this->view->msg='成功同步元数据:'.$uuid;
|
||||||
} else $this->view->msg='不存在此元数据:'.$uuid;
|
} else $this->view->msg='不存在此元数据:'.$uuid;
|
||||||
|
@ -115,14 +115,14 @@ class Admin_DataController extends Zend_Controller_Action
|
||||||
$sql="delete from metadata where uuid not in (select uuid from geonetworkmetadata where schemaid='iso19115')";
|
$sql="delete from metadata where uuid not in (select uuid from geonetworkmetadata where schemaid='iso19115')";
|
||||||
$this->db->query($sql);
|
$this->db->query($sql);
|
||||||
$this->view->msg='已删除WESTDC中多出的元数据!';
|
$this->view->msg='已删除WESTDC中多出的元数据!';
|
||||||
} elseif ($delete=='geonetwork') {
|
} elseif ($delete=='geonetwork') {
|
||||||
//dblink view中删除多条有问题,暂时用单条删除替代
|
//dblink view中删除多条有问题,暂时用单条删除替代
|
||||||
//$sql="delete from geonetworkmetadata where uuid not in (select uuid from metadata)";
|
//$sql="delete from geonetworkmetadata where uuid not in (select uuid from metadata)";
|
||||||
$sql="select uuid from geonetworkmetadata where uuid not in (select uuid from metadata)";
|
$sql="select uuid from geonetworkmetadata where uuid not in (select uuid from metadata)";
|
||||||
$rows=$this->db->fetchAll($sql);
|
$rows=$this->db->fetchAll($sql);
|
||||||
foreach($rows as $row)
|
foreach($rows as $row)
|
||||||
{
|
{
|
||||||
$this->db->exec($this->db->quoteInto("delete from geonetworkmetadata where uuid=?",$row->uuid));
|
$this->db->exec($this->db->quoteInto("delete from geonetworkmetadata where uuid=?",$row->uuid));
|
||||||
}
|
}
|
||||||
$this->view->msg='已删除GEONETWORK中多出的元数据!';
|
$this->view->msg='已删除GEONETWORK中多出的元数据!';
|
||||||
} elseif ($delete=='water') {
|
} elseif ($delete=='water') {
|
||||||
|
@ -795,23 +795,117 @@ class Admin_DataController extends Zend_Controller_Action
|
||||||
|
|
||||||
function sourceAction()
|
function sourceAction()
|
||||||
{
|
{
|
||||||
|
$do = $this->_request->getParam('do');
|
||||||
$add=(int)$this->_getParam('add');
|
$uuid = $this->_request->getParam('uuid');
|
||||||
$edit=(int)$this->_getParam('edit');
|
$id = $this->_request->getParam('id');
|
||||||
$delete=(int)$this->_getParam('delete');
|
$q = $this->_request->getParam('q');
|
||||||
$search=$this->_getParam('search');
|
$search = $this->_request->getParam('search');
|
||||||
$keyword=$this->_getParam('keyword');
|
|
||||||
|
|
||||||
if ($add) {
|
if ($do == 'add') {
|
||||||
|
|
||||||
|
$redirect = "/admin/data/source/";
|
||||||
|
|
||||||
if(!empty($_POST['submit']))
|
if(!empty($_POST['submit']))
|
||||||
{
|
{
|
||||||
|
try{
|
||||||
|
$title = $this->_request->getParam('title');
|
||||||
|
$uuid = $this->_request->getParam('uuid');
|
||||||
|
$code = $this->_request->getParam('code');
|
||||||
|
$description = $this->_request->getParam('description');
|
||||||
|
$has_pages = $this->_request->getParam('has_pages');
|
||||||
|
$has_agreement = $this->_request->getParam('has_agreement');
|
||||||
|
|
||||||
|
$data = array(
|
||||||
|
'title' => $title,
|
||||||
|
'uuid' => $uuid,
|
||||||
|
'code' => $code,
|
||||||
|
'description' => $description,
|
||||||
|
'has_pages' => $has_pages,
|
||||||
|
'has_agreement' => $has_agreement
|
||||||
|
);
|
||||||
|
|
||||||
|
if($this->db->insert('source',$data))
|
||||||
|
{
|
||||||
|
$this->messenger->addMessage('添加来源信息成功');
|
||||||
|
$this->_redirect($redirect);
|
||||||
|
}
|
||||||
|
}catch(Exception $e){
|
||||||
|
$this->messenger->addMessage('添加来源信息失败:'.$e->getMessage());
|
||||||
|
$this->_redirect('/admin/data/source/do/add');
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->_helper->viewRenderer('sourceadd');
|
$this->_helper->viewRenderer('sourceadd');
|
||||||
}// 添加项目来源
|
}// 添加项目来源
|
||||||
|
|
||||||
|
else if($do == 'edit' && !empty($id))
|
||||||
|
{
|
||||||
|
|
||||||
|
if(!empty($_POST['submit']))
|
||||||
|
{
|
||||||
|
try{
|
||||||
|
$title = $this->_request->getParam('title');
|
||||||
|
$uuid = $this->_request->getParam('uuid');
|
||||||
|
$code = $this->_request->getParam('code');
|
||||||
|
$description = $this->_request->getParam('description');
|
||||||
|
$has_pages = $this->_request->getParam('has_pages');
|
||||||
|
$has_agreement = $this->_request->getParam('has_agreement');
|
||||||
|
|
||||||
|
$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)
|
||||||
|
{
|
||||||
|
$this->messenger->addMessage('修改来源信息成功');
|
||||||
|
$this->_redirect("/admin/data/source/do/edit/id/$id");
|
||||||
|
}
|
||||||
|
}catch(Exception $e){
|
||||||
|
$this->messenger->addMessage('修改来源信息失败:'.$e->getMessage());
|
||||||
|
$this->_redirect("/admin/data/source/do/edit/id/$id");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
$sql = "select * from source where id='$id'";
|
||||||
|
$rs = $this->db->query($sql);
|
||||||
|
$row = $rs->fetch();
|
||||||
|
|
||||||
|
$this->view->info = $row;
|
||||||
|
|
||||||
|
$this->_helper->viewRenderer('sourceadd');
|
||||||
|
|
||||||
|
}// 编辑单条信息
|
||||||
|
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$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;
|
||||||
|
}// 项目来源管理
|
||||||
|
|
||||||
|
|
||||||
}//function sourceAction
|
}//function sourceAction
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,63 @@
|
||||||
|
<?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; ?>
|
||||||
|
|
||||||
|
<div class="ctrlplan">
|
||||||
|
<a href="/admin/data/source">项目来源管理</a>
|
||||||
|
<a href="/admin/data/source/do/add">添加项目来源</a>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<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 -->
|
||||||
|
|
||||||
|
<table class="stylized" width="700">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<td width='40%'>标题</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><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>
|
||||||
|
<div class="pagenavi"><?= $this->paginator; ?></div>
|
||||||
|
</div>
|
||||||
|
<script>$("#list tr").mouseover(function(){$(this).addClass("high")}).mouseout(function(){$(this).removeClass("high")})</script>
|
|
@ -0,0 +1,64 @@
|
||||||
|
<?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; ?>
|
||||||
|
|
||||||
|
<div class="ctrlplan">
|
||||||
|
<a href="/admin/data/source/">项目来源管理</a>
|
||||||
|
<a href="/admin/data/source/do/add">添加项目来源</a>
|
||||||
|
</div>
|
||||||
|
<form method="post" action="/admin/data/source">
|
||||||
|
<p>
|
||||||
|
<label>标题:</label><br />
|
||||||
|
<input type="text" name="title" value="<?php echo $this->info['title'];?>" />
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
<label class="required">uuid:</label><br />
|
||||||
|
<input type="text" name="uuid" value="<?php echo $this->info['uuid'];?>" />
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
<label class="required">Code:</label><br />
|
||||||
|
<input type="text" name="code" value="<?php echo $this->info['code'];?>" />
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
<label>描述</label><br />
|
||||||
|
<textarea id="description" class="samll half" name="description"><?php echo $this->info['description'];?></textarea>
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
<label>has_pages</label><br />
|
||||||
|
<input type="radio" name="has_pages" value="true" <?php if($this->info['has_pages']) echo 'checked="checked"';?> />True <input type="radio" name="has_pages" value="false" <?php if(!$this->info['has_pages']) echo 'checked="checked"';?> />False
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
<label>has_agreement</label><br />
|
||||||
|
<input type="radio" name="has_agreement" value="true" <?php if($this->info['has_agreement']) echo 'checked="checked"';?> />True <input type="radio" name="has_agreement" value="false" <?php if(!$this->info['has_agreement']) echo 'checked="checked"';?> />False
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
<input type="hidden" name="id" value="<?php echo $this->info['id'];?>" />
|
||||||
|
<input type="hidden" name="do" value="<?php if($this->info['uuid']!='') echo 'edit';else echo 'add';?>" />
|
||||||
|
<input type="hidden" name="submit" value="1" />
|
||||||
|
<input type="submit" value="提交" />
|
||||||
|
</p>
|
||||||
|
</form>
|
||||||
|
</div>
|
Loading…
Reference in New Issue