westdc-zf1/application/default/views/scripts/author/news.phtml

89 lines
3.4 KiB
PHTML

<?php
$this->headTitle($this->config->title->site);
$this->headTitle($this->config->title->author);
$this->headTitle()->setSeparator(' - ');
$this->headLink()->appendStylesheet('/css/author.css');
$this->theme->AppendPlus($this,'colorbox');
$this->breadcrumb('<a href="/">首页</a>');
$this->breadcrumb('<a href="/author">数据作者</a>');
$this->breadcrumb('数据新闻');
$this->breadcrumb()->setSeparator(' > ');
?>
<div class="row">
<div class="span3">
<?= $this->partial('author/navi.phtml'); ?>
</div>
<div class="span9">
<div>
<ul class="nav nav-pills">
<li class="active"><a class="" href="/author/news">数据新闻</a></li>
<li class=""><a class="" href="/author/news/ac/add">新闻发布</a></li>
</ul>
</div>
<div class="input-append">
<form id="datasearch" class="search_form" action="/author/news/">
<input type="text" class="span2" id="keyword" name="q" value="<?php if(!empty($this->q)) echo $this->q; ?>" />
<button type="submit" class="btn" id="search_btn">搜索</button>
</form>
</div>
<div>
<?php
if (count($this->paginator)):
echo '<ul class="unstyled">';
$autoindex=0;
foreach ($this->paginator as $item):
$autoindex++;
?>
<li class="well" id="item_<?= $item['id'] ?>">
<p><a href="<?php echo $item['url'];?>" class="title"><?php echo $item['title'];?></a></p>
<p>
作者:<?php echo $item['realname'];?> |
发布时间:<?php echo date("Y-m-d",strtotime($item['ts_published']));?> |
关联数据:<?php echo $item['datacount'];?>条 |
操作:<a href="/author/news/ac/edit/aid/<?= $item['id']?>/">编辑</a> ·
<a href="javascript:;" onclick="del(<?= $item['id'] ?>)" id="delBtn_<?= $item['id'] ?>">删除</a></p>
<p><?php echo $item['description'];?></p>
</li>
<?php
endforeach;
echo "</ul>";
endif; ?>
</div>
<div class="pagenavi"><?= $this->paginator; ?></div>
</div>
</div>
<script>
function del(id){
var dom = "#delBtn_"+id;
var html = $(dom).html();
$.ajax({
'type':"POST",
'url':'/author/news/ac/del',
'data':'aid='+id,
'success':function(data){
if (typeof(data)=='object')
{
if(typeof(data.error)!='undefined')
{Alert(data.error);return false;}
if(typeof(data.msg)!='undefined')
{Alert(data.msg);}
if(typeof(data.deleted)!='undefined')
{$('#item_'+id).fadeOut(function(){$(this).remove();});}
}
else{
Alert('出现错误,请稍后再试');
}
},
'timeout': 30000,
'error': function(){Alert('处理中出现错误,请刷新页面后重试');},
'beforeSend':function(){$(dom).html('<img src="/images/ajax-load-small.gif" />');$(dom).attr("disabled","disabled")},
'complete':function(){$(dom).html(html);$(dom).removeAttr("disabled");dom = null;}
});
}
function Alert(html){
$.colorbox({'innerWidth':'50%','html':'<h4>'+html+'</h4>'});
}
</script>