增加了后台拉去管理消息的功能

This commit is contained in:
Li Jianxuan 2011-11-16 10:01:39 +00:00
parent 0fc6a846f1
commit 1d4603573c
4 changed files with 239 additions and 61 deletions

View File

@ -164,45 +164,118 @@ class Admin_SysController extends Zend_Controller_Action
}//emailtextAction 邮件模板管理
function seekspaceAction()
{
set_time_limit(0);
$submit = $this->_request->getParam('submit');
if (!empty($submit))
{
$sql="select item_id from knl_article order by id desc";
$row=$this->db->fetchRow($sql);
try {
$this->db->beginTransaction();
$sql="insert into knl_article (item_id) select item_id from knl_dcvalue where dc_type_id=66 and text_value='Article' and item_id>".$row['item_id'];
$this->db->query($sql);
$sql="update knl_article k set title=t.text_value from (select text_value,item_id from knl_dcvalue where dc_type_id=64) as t where k.item_id=t.item_id and k.item_id>".$row['item_id'];
$this->db->query($sql);
$sql="update knl_article k set url=t.text_value from (select text_value,item_id from knl_dcvalue where dc_type_id=25) as t where k.item_id=t.item_id and k.item_id>".$row['item_id'];
$this->db->query($sql);
$sql="update knl_article k set publisher=t.text_value from (select text_value,item_id from knl_dcvalue where dc_type_id=39) as t where k.item_id=t.item_id and k.item_id>".$row['item_id'];
$this->db->query($sql);
$sql="update knl_article k set ts_issued=t.text_value from (select text_value,item_id from knl_dcvalue where dc_type_id=15) as t where k.item_id=t.item_id and k.item_id>".$row['item_id'];
$this->db->query($sql);
$sql="update knl_article k set ts_created=cast(t.text_value as timestamp without time zone) from (select text_value,item_id from knl_dcvalue where dc_type_id=12) as t where k.item_id=t.item_id and k.item_id>".$row['item_id'];
$this->db->query($sql);
$sql="update knl_article k set keywords[t.place]=t.text_value from (select text_value,item_id,place from knl_dcvalue where dc_type_id=57) as t where k.item_id=t.item_id and k.item_id>".$row['item_id'];
$this->db->query($sql);
$sql="insert into knl_keyword (keyword,item_id,place) select text_value,item_id,place from knl_dcvalue where dc_type_id=57 and item_id>".$row['item_id'];
$this->db->query($sql);
$sql="insert into knl_author (author,item_id,place) select text_value,item_id,place from knl_dcvalue where dc_type_id=3 and item_id>".$row['item_id'];
$this->db->query($sql);
$this->db->query("delete from knl_keyword where item_id not in (select item_id from knl_article)");
$this->db->query("delete from knl_author where item_id not in (select item_id from knl_article)");
$this->db->commit();
} catch(Exception $e) {
$this->db->rollBack();
$this->view->msg=$e->getMessage();
}
$this->view->msg='与文献平台同步成功!';
}
$sql="select (select count(*) from knl_article) as westdccount,(select count(*) from knl_dcvalue where dc_type_id=66 and text_value='Article') as seekcount";
$this->view->count=$this->db->fetchRow($sql);
function seekspaceAction()
{
set_time_limit(0);
$submit = $this->_request->getParam('submit');
if (!empty($submit))
{
$sql="select item_id from knl_article order by id desc";
$row=$this->db->fetchRow($sql);
try {
$this->db->beginTransaction();
$sql="insert into knl_article (item_id) select item_id from knl_dcvalue where dc_type_id=66 and text_value='Article' and item_id>".$row['item_id'];
$this->db->query($sql);
$sql="update knl_article k set title=t.text_value from (select text_value,item_id from knl_dcvalue where dc_type_id=64) as t where k.item_id=t.item_id and k.item_id>".$row['item_id'];
$this->db->query($sql);
$sql="update knl_article k set url=t.text_value from (select text_value,item_id from knl_dcvalue where dc_type_id=25) as t where k.item_id=t.item_id and k.item_id>".$row['item_id'];
$this->db->query($sql);
$sql="update knl_article k set publisher=t.text_value from (select text_value,item_id from knl_dcvalue where dc_type_id=39) as t where k.item_id=t.item_id and k.item_id>".$row['item_id'];
$this->db->query($sql);
$sql="update knl_article k set ts_issued=t.text_value from (select text_value,item_id from knl_dcvalue where dc_type_id=15) as t where k.item_id=t.item_id and k.item_id>".$row['item_id'];
$this->db->query($sql);
$sql="update knl_article k set ts_created=cast(t.text_value as timestamp without time zone) from (select text_value,item_id from knl_dcvalue where dc_type_id=12) as t where k.item_id=t.item_id and k.item_id>".$row['item_id'];
$this->db->query($sql);
$sql="update knl_article k set keywords[t.place]=t.text_value from (select text_value,item_id,place from knl_dcvalue where dc_type_id=57) as t where k.item_id=t.item_id and k.item_id>".$row['item_id'];
$this->db->query($sql);
$sql="insert into knl_keyword (keyword,item_id,place) select text_value,item_id,place from knl_dcvalue where dc_type_id=57 and item_id>".$row['item_id'];
$this->db->query($sql);
$sql="insert into knl_author (author,item_id,place) select text_value,item_id,place from knl_dcvalue where dc_type_id=3 and item_id>".$row['item_id'];
$this->db->query($sql);
$this->db->query("delete from knl_keyword where item_id not in (select item_id from knl_article)");
$this->db->query("delete from knl_author where item_id not in (select item_id from knl_article)");
$this->db->commit();
} catch(Exception $e) {
$this->db->rollBack();
$this->view->msg=$e->getMessage();
}
$this->view->msg='与文献平台同步成功!';
}
$sql="select (select count(*) from knl_article) as westdccount,(select count(*) from knl_dcvalue where dc_type_id=66 and text_value='Article') as seekcount";
$this->view->count=$this->db->fetchRow($sql);
}
function getmsgAction(){
$this->_helper->layout()->disableLayout();
$this->_helper->viewRenderer->setNoRender();
$msg = array();
$auth = Zend_Auth::getInstance();
if($auth->hasIdentity())
{
$user = $auth->getIdentity();
$userid = $user->id;
if($user->usertype == "administrator")
{
include_once("message.php");
$rs = message::getNew($this->db,$userid,"admin");
echo Zend_Json::encode($rs);
exit();
}else{
$msg['error'] = "您没有权限";
echo Zend_Json::encode($msg);
exit();
}
}else{
$msg['error'] = "您没有权限";
echo Zend_Json::encode($msg);
exit();
}
}
function messageAction(){
$do = $this->_request->getParam('do');
$id = $this->_request->getParam('id');
if($do=='read' && !empty($id))
{
$this->_helper->viewRenderer('messageview');
$auth = Zend_Auth::getInstance();
if($auth->hasIdentity())
{
$user = $auth->getIdentity();
$userid = $user->id;
if($user->usertype == "administrator")
{
include_once("message.php");
$rs = message::getOne($this->db,$userid,$id);
$this->view->info = $rs['info'];
}
}
}
//拉取新消息
else
{
$auth = Zend_Auth::getInstance();
if($auth->hasIdentity())
{
$user = $auth->getIdentity();
$userid = $user->id;
if($user->usertype == "administrator")
{
include_once("message.php");
$rs = message::getNew($this->db,$userid,"admin");
$this->view->totle = $rs['count'];
$paginator = Zend_Paginator::factory($rs['rows']);
$paginator->setCurrentPageNumber($this->_getParam('page'));
$paginator->setItemCountPerPage($this->view->config->page->max);
$paginator->setView($this->view);
Zend_View_Helper_PaginationControl::setDefaultViewPartial('pagination_param.phtml');
$this->view->paginator=$paginator;
}
}
}//end
}//getmessageAction() 获取站内消息
}

View File

@ -1,22 +1,31 @@
<?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('后台管理首页');
$this->breadcrumb()->setSeparator(' > ');
?>
<div id="OneColumn">
<?= $this->partial('data/left.phtml'); ?>
<?= $this->partial('down/left.phtml'); ?>
<?= $this->partial('user/left.phtml'); ?>
<?= $this->partial('review/left.phtml'); ?>
<?= $this->partial('stat/left.phtml'); ?>
<?= $this->partial('sys/left.phtml'); ?>
<ul>
<li class="title">其他工具</a></li>
<li><a href="/admin/watermd">WATER元数据处理工具</a></li>
<li><a href="/admin/test">数据测试管理</a></li>
</ul>
</div>
<?php
$this->headTitle($this->config->title->site);
$this->headTitle('后台管理');
$this->headTitle()->setSeparator(' - ');
$this->headLink()->appendStylesheet('/css/admin.css');
$this->headLink()->appendStylesheet('/static/css/jquery.jgrowl.css');
$this->headScript()->appendFile('/js/jquery-1.7.min.js');
$this->headScript()->appendFile('/static/js/jquery.jgrowl_minimized.js');
$this->breadcrumb('<a href="/">首页</a>');
$this->breadcrumb('后台管理首页');
$this->breadcrumb()->setSeparator(' > ');
?>
<div id="OneColumn">
<?= $this->partial('data/left.phtml'); ?>
<?= $this->partial('down/left.phtml'); ?>
<?= $this->partial('user/left.phtml'); ?>
<?= $this->partial('review/left.phtml'); ?>
<?= $this->partial('stat/left.phtml'); ?>
<?= $this->partial('sys/left.phtml'); ?>
<ul>
<li class="title">其他工具</a></li>
<li><a href="/admin/watermd">WATER元数据处理工具</a></li>
<li><a href="/admin/test">数据测试管理</a></li>
</ul>
</div>
<script>
$.getJSON("/admin/sys/getmsg", function(data) {
var msg = data.count;
if(msg>0){$.jGrowl('<a href="/admin/sys/message/" style="color:#FFF;text-decoration:underline;font-weight:bold;">有'+data.count+'条新消息</a>', { sticky: true });}
})
</script>

View File

@ -0,0 +1,52 @@
<?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/sys">系统管理</a>');
$this->breadcrumb('邮件模板管理');
$this->breadcrumb()->setSeparator(' > ');
?>
<div id="leftPanel">
<?= $this->partial('sys/left.phtml'); ?>
</div>
<div id="rightPanel">
<div class="ctrlplan">
<a href="/admin/sys/message/do/listall">查看所有消息</a>
<a href="/admin/sys/message/">查看新消息</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>
<?php if($this->totle > 0) echo '共 <strong style="font-weight:bold;color:red;">'.$this->totle.'</strong> 条未读消息';?>
<table class="stylized">
<thead>
<tr>
<td width='400'>标题</td>
<td width="120">时间</td>
<td width='180'>操作</td>
</tr>
</thead>
<?php if (count($this->paginator)): ?>
<tbody id="list">
<?php foreach ($this->paginator as $item): ?>
<tr>
<td><a href="/admin/sys/message/do/read/id/<?php echo $item['id'];?>"><?php if(!empty($item['title'])) echo $item['title']; else echo "无标题"; ?></a></td>
<td><?php echo date("Y-m-d H:i",strtotime($item['sendtime'])); ?></td>
<td>[<a href="/admin/sys/message/do/read/id/<?php echo $item['id'];?>">查看</a>] [<a href="">标记为已读</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>

View File

@ -0,0 +1,44 @@
<?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/sys">系统管理</a>');
$this->breadcrumb('邮件模板管理');
$this->breadcrumb()->setSeparator(' > ');
?>
<div id="leftPanel">
<?= $this->partial('sys/left.phtml'); ?>
</div>
<div id="rightPanel">
<div class="ctrlplan">
<a href="/admin/sys/message/do/listall">查看所有消息</a>
<a href="/admin/sys/message/">查看新消息</a>
</div>
<div class="form">
<form>
<p>
<label>标题:</label>
<?php if(!empty($this->info['title']))echo $this->info['title'];else echo "无标题";?>
</p>
<p>
<label>发件人:</label>
<?php if($this->info['pid']==0) echo "系统";else echo $this->info['realname'];?>
</p>
<p>
<label>发送时间:</label>
<?php echo date("Y-m-d H:i:s",strtotime($this->info['sendtime']));?>
</p>
<p>
<label>内容:</label><br />
<?php echo $this->info['body'];?>
</p>
</form>
</div>
<div class="pagenavi"></div>
</div>