增加了新闻删除功能,修改了新闻列表,添加了按分类查看功能
This commit is contained in:
parent
ca61a45fe5
commit
e2a7af787a
|
@ -26,10 +26,10 @@ class Admin_NewsController extends Zend_Controller_Action
|
|||
|
||||
if(!empty($type))
|
||||
{
|
||||
$sql = "select n.*,c.title as catlog from news_archives n left join news_catlog c on n.typeid=c.id WHERE n.typeid='$type' order by n.writetime desc";
|
||||
$sql = "select n.*,c.title as catlog,c.url from news_archives n left join news_catlog c on n.typeid=c.id WHERE n.typeid='$type' order by n.writetime desc";
|
||||
}else
|
||||
{
|
||||
$sql = "select n.*,c.title as catlog from news_archives n left join news_catlog c on n.typeid=c.id order by n.writetime desc";
|
||||
$sql = "select n.*,c.title as catlog,c.url from news_archives n left join news_catlog c on n.typeid=c.id order by n.writetime desc";
|
||||
}
|
||||
$rs = $this->db->query($sql);
|
||||
$rows = $rs->fetchAll();
|
||||
|
@ -41,6 +41,12 @@ class Admin_NewsController extends Zend_Controller_Action
|
|||
Zend_View_Helper_PaginationControl::setDefaultViewPartial('pagination_param.phtml');
|
||||
$this->view->paginator=$paginator;
|
||||
|
||||
$sql="select * from news_catlog order by displayorder desc";
|
||||
$re = $this->db->query($sql);
|
||||
$types = $re->fetchAll();
|
||||
|
||||
$this->view->types=$types;
|
||||
$this->view->type = $type;
|
||||
}//newslistAction 新闻列表
|
||||
|
||||
function catlogAction()
|
||||
|
@ -393,6 +399,17 @@ class Admin_NewsController extends Zend_Controller_Action
|
|||
|
||||
function deleteAction(){
|
||||
|
||||
$id = $this->_request->getParam('id');
|
||||
|
||||
$sql = "DELETE FROM news_archives WHERE id='$id'";
|
||||
$sql2 = "DELETE FROM news_archivesaddon WHERE id='$id'";
|
||||
|
||||
if($this->db->exec($sql))
|
||||
$this->db->exec($sql2);
|
||||
|
||||
$this->messenger->addMessage('提示信息:文章删除成功!');
|
||||
$this->_redirect('/admin/news/newslist');
|
||||
|
||||
}//文章删除
|
||||
|
||||
}
|
||||
|
|
|
@ -25,27 +25,25 @@
|
|||
<?php endforeach;endif; ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
<div>
|
||||
<a href="javascript:;">按栏目查看</a>
|
||||
<select>
|
||||
<option>按栏目查看</option>
|
||||
<?php
|
||||
if(count($this->types))
|
||||
{
|
||||
foreach($this->types as $v)
|
||||
{
|
||||
if($this->type == $v['id'])
|
||||
echo '<option onclick="self.location=\'/admin/news/newslist/type/'.$v['id'].'\'" selected="selected">'.$v['title'].'</option>';
|
||||
else
|
||||
echo '<option onclick="self.location=\'/admin/news/newslist/type/'.$v['id'].'\'">'.$v['title'].'</option>';
|
||||
}
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
|
||||
<a href="/admin/news/newslist">所有新闻列表</a>
|
||||
|
||||
</div>
|
||||
|
||||
<?php if ($this->msg or $this->messages) :?>
|
||||
<div class="box box-info">
|
||||
<?php if ($this->msg) : ?>
|
||||
<?php echo $this->msg; ?>
|
||||
<?php endif; if ($this->messages): foreach($this->messages as $msg): ?>
|
||||
<?php echo $msg; ?>
|
||||
<?php endforeach;endif; ?>
|
||||
<script language="javascript">
|
||||
setTimeout('$(".box-info").remove()',5000);
|
||||
</script>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
<table id="report" class="stylized full" style="width:650px;">
|
||||
<thead>
|
||||
<tr>
|
||||
|
@ -80,8 +78,9 @@ setTimeout('$(".box-info").remove()',5000);
|
|||
</td>
|
||||
<td><a href="/admin/news/newslist/type/'.$v['typeid'].'">'.$v['catlog'].'</a></td>
|
||||
<td>
|
||||
<a href="/news/'.$v['url'].'/archive-'.$v['id'].'.html" target="_blank"><b>预览</b></a>
|
||||
<a href="/admin/news/newsedit/id/'.$v['id'].'"><b>编辑</b></a>
|
||||
<a href="/admin/news/delete/'.$v['id'].'" onclick="return confirm(\'是否确定删除该栏目\')">删除</a></td>
|
||||
<a href="/admin/news/delete/id/'.$v['id'].'" onclick="return confirm(\'是否确定删除该栏目\')">删除</a></td>
|
||||
</tr>
|
||||
';
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue