添加可视化要素后台管理功能

This commit is contained in:
Li Jianxuan 2014-05-26 03:38:36 +00:00
parent b9a9e44746
commit 4120cda7aa
8 changed files with 4440 additions and 4201 deletions

File diff suppressed because it is too large Load Diff

View File

@ -18,4 +18,5 @@
<li><a href="/admin/data/feature">特色推荐</a></li> --> <li><a href="/admin/data/feature">特色推荐</a></li> -->
<li><a href="/admin/data/source">专题管理</a></li> <li><a href="/admin/data/source">专题管理</a></li>
<li><a href="/admin/data/fund">支持项目</a></li> <li><a href="/admin/data/fund">支持项目</a></li>
<li><a href="/admin/data/visual">可视化数据</a></li>
</ul> </ul>

View File

@ -66,7 +66,8 @@
<?php endif;?> <?php endif;?>
<a href="/admin/down/sendmail/uuid/<?php echo $item['uuid'];?>" title="向数据下载者发送通知邮件">邮件通知</a> | <a href="/admin/down/sendmail/uuid/<?php echo $item['uuid'];?>" title="向数据下载者发送通知邮件">邮件通知</a> |
<a href="/admin/data/fund/uuid/<?php echo $item['uuid'];?>">支持项目</a> | <a href="/admin/data/fund/uuid/<?php echo $item['uuid'];?>">支持项目</a> |
<a href="/admin/data/doi/uuid/<?php echo $item['uuid'];?>">DOI</a> <a href="/admin/data/doi/uuid/<?php echo $item['uuid'];?>">DOI</a> |
<a href="/admin/data/visual/uuid/<?php echo $item['uuid'];?>">数据可视化</a>
</p> </p>
<?php if($item['author']) :?> <?php if($item['author']) :?>
<p>数据贡献者:<?= $item['author']; ?></p> <p>数据贡献者:<?= $item['author']; ?></p>

View File

@ -0,0 +1,45 @@
<?php
$this->headTitle($this->config->title->site);
$this->headTitle('后台管理');
$this->headTitle()->setSeparator(' - ');
$this->breadcrumb('<a href="/">首页</a>');
$this->breadcrumb('<a href="/admin">后台首页</a>');
$this->breadcrumb('<a href="/admin/data">数据管理</a>');
$this->breadcrumb('同步GEONETWORK元数据</a>');
$this->breadcrumb()->setSeparator(' > ');
?>
<div class="row">
<div class="span3">
<?= $this->partial('data/left.phtml'); ?>
</div>
<div class="span9">
<h3>添加可视化要素</h3>
<hr />
<form class="form-horizontal">
<div class="control-group">
<label class="control-label" for="inputUUID">UUID</label>
<div class="controls">
<input type="text" id="inputUUID" placeholder="UUID" value="<?= $this->data['uuid'] ?>" class="input-block-level">
</div>
</div>
<div class="control-group">
<label class="control-label" for="inputVariable">可视化要素</label>
<div class="controls">
<input type="text" id="inputVariable" placeholder="Variable" class="input-block-level">
</div>
</div>
<div class="control-group" id="last-control-group">
<div class="controls">
<button type="button" class="btn btn-defualt" id="addVariable">添加要素</button>
<button type="submit" class="btn btn-primary">提交</button>
</div>
</div>
</form>
</div>
</div>
<script type="text/javascript">
$('#addVariable').click(function(e) {
});
</script>

View File

@ -0,0 +1,20 @@
<?php
$this->headTitle($this->config->title->site);
$this->headTitle('后台管理');
$this->headTitle()->setSeparator(' - ');
$this->headLink()->appendStylesheet('/css/admin.css');
$this->breadcrumb('<a href="/">首页</a>');
$this->breadcrumb('<a href="/admin">后台首页</a>');
$this->breadcrumb('<a href="/admin/data">数据管理</a>');
$this->breadcrumb('同步GEONETWORK元数据</a>');
$this->breadcrumb()->setSeparator(' > ');
?>
<div class="row">
<div class="span3">
<?= $this->partial('data/left.phtml'); ?>
</div>
<div class="span9">
</div>
</div>

View File

@ -0,0 +1,43 @@
<?php
namespace Westdc\Visual\Handle;
use \Helpers\View as view;
use \Helpers\dbh;
use \Helpers\Table;
//事件中存在的操作
class VisualHandler
{
private $db; //传入PDO对象误
private $config; //全局配置
public $table;
public $tbl_maillog = ""; //邮件日志表
function __construct()
{
$this->db = \Zend_Registry::get('db');
$this->config = \Zend_Registry::get('config');
$this->table = new Table();
}
public function deleteAuthor(\Zend_EventManager_Event $e)
{
$id = $e->getParam('id');
$ref = new Reference();
return $ref->deleteReferenceAuthor($id);
}
public function deleteTag(\Zend_EventManager_Event $e)
{
$id = $e->getParam('id');
$ref = new Reference();
return $ref->deleteReferenceTag($id);
}
}

View File

@ -0,0 +1,27 @@
<?php
namespace Westdc\Visual\Listener;
class VisualListener implements \Zend_EventManager_ListenerAggregate
{
private $event;
function __construct()
{
$this->event = new \Zend_EventManager_EventManager();
}
public function attach(\Zend_EventManager_EventCollection $events)
{
$Handler = new ReferenceHandler();
$events->attach('submit.checkParam', array($Handler, 'checkReferenceParam'), 100);
$events->attach('submit.processData', array($Handler, 'processReferenceData'), 100);
$events->attach('submit.recordPosted', array($Handler, 'recordPosted'), 100);
$events->attach('submit.recordChanged', array($Handler, 'recordChanged'), 100);
}
public function detach(\Zend_EventManager_EventCollection $events)
{
}
}

View File

@ -0,0 +1,86 @@
<?php
namespace Westdc\Visual;
use Westdc\Visual\VisualListener;
class Visual
{
public $db;
function __construct($recordType)
{
$this->db = \Zend_Registry::get('db');
$Listener = new Listener();
@$this->getEventManager()->attachAggregate($Listener);
}
public function getEventManager(\Zend_EventManager_EventCollection $events = NULL)
{
if ($events !== NULL) {
$this->events = $events;
} elseif ($this->events === NULL) {
$this->events = new \Zend_EventManager_EventManager(__CLASS__);
}
return $this->events;
}
//添加
public function add($data,$id = 0)
{
$params = compact('data');
$results = $this->getEventManager()->trigger('submit.checkParam', $this, $params);
$cache_data = $results->last();
if($cache_data !== true)
{
return $cache_data;
}
$results = $this->getEventManager()->trigger('submit.processData', $this, $params);
$data = $results->last();
$dbh = new dbh();
if(empty($id))
{
$id = $dbh->insert($this->mainTable,$data,true);
if(!empty($id) && is_numeric($id))
{
$this->getEventManager()->trigger('submit.recordPosted', $this, $params);
return true;
}else{
if($id === false)
{
return '服务器开小差了,请稍后再试';
}else{
return '服务器处理中遇到错误,请联系管理员';
}
}
}//add
else{
if(!$dbh->update($this->mainTable,$data," id=$id ",true))
{
$this->getEventManager()->trigger('submit.recordChanged', $this, $params);
return "修改失败!请重试";
}else{
return true;
}
}//edit
}// add()
//删除
public function del($id)
{
if(!is_numeric($id) || empty($id) || $id< 0)
{
return false;
}
$sql = "DELETE FROM {$this->mainTable} WHERE id=$id";
return $this->db->exec($sql);
}
}