westdc-zf1/application/admin/views/scripts/sys/message.phtml

102 lines
4.1 KiB
PHTML

<?php
$this->headTitle($this->config->title->site);
$this->headTitle('后台管理');
$this->headTitle()->setSeparator(' - ');
$this->headLink()->appendStylesheet('/css/admin.css');
$this->headScript()->appendFile('/js/jquery-1.7.min.js');
$this->headScript()->appendFile('/static/js/jquery.jgrowl_minimized.js');
$this->headLink()->appendStylesheet('/static/css/jquery.jgrowl.css');
$this->breadcrumb('<a href="/">首页</a>');
$this->breadcrumb('<a href="/admin">后台首页</a>');
$this->breadcrumb('<a href="/admin/sys">系统管理</a>');
$this->breadcrumb('邮件模板管理');
$this->breadcrumb()->setSeparator(' > ');
?>
<div class="row">
<div class="hidden-sm hidden-xs col-md-2">
<?= $this->partial('sys/left.phtml'); ?>
</div>
<div class="col-md-10 col-sm-12">
<div class="form-group">
<a class="btn btn-primary" href="/admin/sys/message/do/listall">查看所有消息</a>
<a class="btn btn-primary" href="/admin/sys/message/">查看新消息</a>
</div>
<div class="input-group form-group">
<form action="" class="search_form input-group" id="datasearch" method="get">
<input type="text" placeholder="搜索关键字" class="form-control" value="<?php echo $this->q; ?>" name="q" id="keyword">
<input type="hidden" name="search" value='1' />
<input type="hidden" name="id" value='<?php echo $this->id;?>' />
<span class="input-group-btn"><button id="search_btn" class="btn btn-default" type="submit">搜索</button></span>
</form>
</div>
<p><?php if($this->totle > 0) echo '共 <span class="text-danger">'.$this->totle.'</span> 条未读消息';?></p>
<form id="messages">
<table class="stylized table table-bordered table-striped table-hover">
<thead><tr>
<td width='20'>选择</td>
<td width='380'>标题</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><input type="checkbox" name="id[]" value="<?php echo $item['id'];?>" /></td>
<td><a href="/admin/sys/message/do/read/id/<?php echo $item['id'];?>" <?php if (empty($item['uid'])) echo ' style="font-weight:bold"';?>><?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>] <?php if (empty($item['uid'])) echo '[<a href="/admin/sys/message/do/close/id/'.$item['id'].'">标记为已读</a>]'; ?></td>
</tr>
<?php endforeach; ?>
</tbody>
<?php endif; ?>
</table>
</form>
<button class="btn btn-info btn-sm" onclick="selall();">全选</button>
<button class="btn btn-info btn-sm" onclick="unsel();">反选</button>
<button class="btn btn-info btn-sm" onclick='unselall();'>全部取消</button>
<button class="btn btn-success btn-sm" onclick="oversel();">标记为已处理</button>
<div class="pagenavi"><?= $this->paginator; ?></div>
</div>
</div>
<script>
$("#list tr").mouseover(function(){$(this).addClass("high")}).mouseout(function(){$(this).removeClass("high")})
function selall(){
$("#messages :checkbox").attr('checked',true);
}
function unselall(){
$("#messages :checkbox").attr('checked',false);
}
function unsel(){
$("#messages :checkbox").each(function () {
$(this).attr("checked", !$(this).attr("checked"));
});
}
function getsel(){
var ids=new Array();
$("#messages :checkbox").each(function(){
if($(this).attr('checked')==true||$(this).attr('checked')=="checked")
{
ids.push($(this).val());
}
});
var allid=ids.join(',');
return allid;
}
function oversel(){
var id=getsel();if (id==null||id==''){alert('没有选择任何一项');return false;}
var d = confirm('确实要标记为已处理吗?标记后其他管理员将收不到该消息');
if(d==true){
$.ajax({
'type':"POST",
'url':"/admin/sys/message/do/over",
'data':'id='+id,
'success':function(html){
$.jGrowl(html, {"life":5000 });
}
});}
}
</script>