diff --git a/res/js/admin/news.js b/res/js/admin/news.js index b8d123d..cce5572 100644 --- a/res/js/admin/news.js +++ b/res/js/admin/news.js @@ -11,6 +11,11 @@ define('admin/news',function(require, exports) var upload = require('admin/upload'); var json = require("lib/util/json"); require('lib/ui/jquery.form'); + $("#choose_tag").bind("change",function() + { + var tag = $(this).val(); + window.location.href ="/admin/news/index/tag/"+tag; + }); //绑定统一的AJAX页面操作 $('button[model="ajax"]').click(function() { diff --git a/website/controller/admin/News.class.php b/website/controller/admin/News.class.php index ac0b9f8..889d1e6 100644 --- a/website/controller/admin/News.class.php +++ b/website/controller/admin/News.class.php @@ -11,11 +11,12 @@ class Controller_Admin_News extends Controller_Admin_Base public function indexAction() { $limit = 15 ; - $url_args = $conditions = array(); - $total = Facade_News::getTotal($conditions); + $tag = $this->_request->query('tag',''); + $url_args = $conditions = array('tag'=> $tag); + $total = Facade_News::getTotal($tag); $pagination = new Lib_Helper_Pagination($total,$limit); $pagination->setParames($url_args); - $list = Facade_News::getList($conditions, $pagination->getOffset(), $limit); + $list = Facade_News::getList($tag, $pagination->getOffset(), $limit); foreach ($list as $k => $v) { $list[$k]['content'] = str_replace(array("\n","\r","\t"),'', Util_StringHelper::substr_cn(strip_tags($v['content']),30)); @@ -34,6 +35,7 @@ class Controller_Admin_News extends Controller_Admin_Base $this->_view['pagination'] = $pagination->getPagination() ; $this->_view['base_dir'] = $this->_request->baseDir() ; $this->_view['tags'] = array() ; + $this->_view['tag'] = $tag; } public function createAction() diff --git a/website/view/script/admin/news/index.php b/website/view/script/admin/news/index.php index 6db0203..6d39a4d 100644 --- a/website/view/script/admin/news/index.php +++ b/website/view/script/admin/news/index.php @@ -1,18 +1,24 @@ <?php $this->_extends('layout/admin_layout');?> - - <?php $this->_block('main');?> +<div> +<h4 style="float: left;">资讯列表</h4> +<select name="tag" style="margin-left: 20px;margin-top:10px;width:150px;" id="choose_tag"> + <option value="" <?php '' == $this->view->tag ? 'selected':''?>>全部资讯</option> + <?php + $tags = array('品牌资讯', '现场活动','独家合作','主理人','明星','限量产品','票务','视频','手机视频','专题'); + foreach($tags as $tag) + { + echo sprintf('<option value="%s" %s>%s</option>', $tag, $tag == $this->view->tag ? 'selected':'', $tag); + } + ?> - -<h4>资讯列表</h4> - +</div> +</select> <table class="table"> <caption style="text-align:left; padding-bottom:5px;"> <button class="btn" style="float:left;" onclick="location.href='<?php echo url('news/create',array('type' => $this->view->currentType))?>'"> 添加资讯 </button> - - </caption> <thead> <td>资讯ID</td> diff --git a/website/view/widget/news/list.php b/website/view/widget/news/list.php index 3b3c1e2..4be7c08 100644 --- a/website/view/widget/news/list.php +++ b/website/view/widget/news/list.php @@ -29,8 +29,9 @@ else ?> <div class="<?php !isset($video) ?'fluid-item':'';?>layout-item tiled"> <div class="image-box"> - <a href="<?php echo url('news/detail' ,array('id' => $news['id']))?>" target="_blank" title="<?php echo $news['title'];?>" style="<?php echo sprintf("height:%spx;width:%spx;overflow: hidden;", $height, $width);?>"> - <img src="<?php echo $thumb;?>" alt="" style="<?php echo sprintf("height:%spx;width:%spx;", $height, $width);?>"> + <a href="<?php echo url('news/detail' ,array('id' => $news['id']))?>" target="_blank" title="<?php echo $news['title'];?>" + <?php echo $video !=1 ? sprintf("style=\"height:%spx;width:%spx;overflow: hidden;\"", $height, $width):''; ?> + <img src="<?php echo $thumb;?>" alt="" <?php echo $video !=1 ? sprintf("style=\"height:%spx;width:%spx;\"", $height, $width):''; ?>> <?php if(trim($news['tag']) == '视频'):?> <i class="play-icon"></i> <?php endif;?>