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

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

@ -204,5 +204,78 @@ class Admin_SysController extends Zend_Controller_Action
$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"; $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); $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

@ -3,6 +3,9 @@
$this->headTitle('后台管理'); $this->headTitle('后台管理');
$this->headTitle()->setSeparator(' - '); $this->headTitle()->setSeparator(' - ');
$this->headLink()->appendStylesheet('/css/admin.css'); $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('<a href="/">首页</a>');
$this->breadcrumb('后台管理首页'); $this->breadcrumb('后台管理首页');
$this->breadcrumb()->setSeparator(' > '); $this->breadcrumb()->setSeparator(' > ');
@ -20,3 +23,9 @@
<li><a href="/admin/test">数据测试管理</a></li> <li><a href="/admin/test">数据测试管理</a></li>
</ul> </ul>
</div> </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>