增加了新闻删除功能,修改了新闻列表,添加了按分类查看功能
This commit is contained in:
parent
ca61a45fe5
commit
e2a7af787a
|
@ -26,10 +26,10 @@ class Admin_NewsController extends Zend_Controller_Action
|
||||||
|
|
||||||
if(!empty($type))
|
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
|
}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);
|
$rs = $this->db->query($sql);
|
||||||
$rows = $rs->fetchAll();
|
$rows = $rs->fetchAll();
|
||||||
|
@ -41,6 +41,12 @@ class Admin_NewsController extends Zend_Controller_Action
|
||||||
Zend_View_Helper_PaginationControl::setDefaultViewPartial('pagination_param.phtml');
|
Zend_View_Helper_PaginationControl::setDefaultViewPartial('pagination_param.phtml');
|
||||||
$this->view->paginator=$paginator;
|
$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 新闻列表
|
}//newslistAction 新闻列表
|
||||||
|
|
||||||
function catlogAction()
|
function catlogAction()
|
||||||
|
@ -393,6 +399,17 @@ class Admin_NewsController extends Zend_Controller_Action
|
||||||
|
|
||||||
function deleteAction(){
|
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; ?>
|
<?php endforeach;endif; ?>
|
||||||
</div>
|
</div>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
|
|
||||||
<div>
|
<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>
|
<a href="/admin/news/newslist">所有新闻列表</a>
|
||||||
|
|
||||||
</div>
|
</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;">
|
<table id="report" class="stylized full" style="width:650px;">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
|
@ -80,8 +78,9 @@ setTimeout('$(".box-info").remove()',5000);
|
||||||
</td>
|
</td>
|
||||||
<td><a href="/admin/news/newslist/type/'.$v['typeid'].'">'.$v['catlog'].'</a></td>
|
<td><a href="/admin/news/newslist/type/'.$v['typeid'].'">'.$v['catlog'].'</a></td>
|
||||||
<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/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>
|
</tr>
|
||||||
';
|
';
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue