Showing
4 changed files
with
26 additions
and
12 deletions
@@ -11,6 +11,11 @@ define('admin/news',function(require, exports) | @@ -11,6 +11,11 @@ define('admin/news',function(require, exports) | ||
11 | var upload = require('admin/upload'); | 11 | var upload = require('admin/upload'); |
12 | var json = require("lib/util/json"); | 12 | var json = require("lib/util/json"); |
13 | require('lib/ui/jquery.form'); | 13 | require('lib/ui/jquery.form'); |
14 | + $("#choose_tag").bind("change",function() | ||
15 | + { | ||
16 | + var tag = $(this).val(); | ||
17 | + window.location.href ="/admin/news/index/tag/"+tag; | ||
18 | + }); | ||
14 | //绑定统一的AJAX页面操作 | 19 | //绑定统一的AJAX页面操作 |
15 | $('button[model="ajax"]').click(function() | 20 | $('button[model="ajax"]').click(function() |
16 | { | 21 | { |
@@ -11,11 +11,12 @@ class Controller_Admin_News extends Controller_Admin_Base | @@ -11,11 +11,12 @@ class Controller_Admin_News extends Controller_Admin_Base | ||
11 | public function indexAction() | 11 | public function indexAction() |
12 | { | 12 | { |
13 | $limit = 15 ; | 13 | $limit = 15 ; |
14 | - $url_args = $conditions = array(); | ||
15 | - $total = Facade_News::getTotal($conditions); | 14 | + $tag = $this->_request->query('tag',''); |
15 | + $url_args = $conditions = array('tag'=> $tag); | ||
16 | + $total = Facade_News::getTotal($tag); | ||
16 | $pagination = new Lib_Helper_Pagination($total,$limit); | 17 | $pagination = new Lib_Helper_Pagination($total,$limit); |
17 | $pagination->setParames($url_args); | 18 | $pagination->setParames($url_args); |
18 | - $list = Facade_News::getList($conditions, $pagination->getOffset(), $limit); | 19 | + $list = Facade_News::getList($tag, $pagination->getOffset(), $limit); |
19 | foreach ($list as $k => $v) | 20 | foreach ($list as $k => $v) |
20 | { | 21 | { |
21 | $list[$k]['content'] = str_replace(array("\n","\r","\t"),'', Util_StringHelper::substr_cn(strip_tags($v['content']),30)); | 22 | $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 | @@ -34,6 +35,7 @@ class Controller_Admin_News extends Controller_Admin_Base | ||
34 | $this->_view['pagination'] = $pagination->getPagination() ; | 35 | $this->_view['pagination'] = $pagination->getPagination() ; |
35 | $this->_view['base_dir'] = $this->_request->baseDir() ; | 36 | $this->_view['base_dir'] = $this->_request->baseDir() ; |
36 | $this->_view['tags'] = array() ; | 37 | $this->_view['tags'] = array() ; |
38 | + $this->_view['tag'] = $tag; | ||
37 | } | 39 | } |
38 | 40 | ||
39 | public function createAction() | 41 | public function createAction() |
1 | <?php $this->_extends('layout/admin_layout');?> | 1 | <?php $this->_extends('layout/admin_layout');?> |
2 | - | ||
3 | - | ||
4 | <?php $this->_block('main');?> | 2 | <?php $this->_block('main');?> |
3 | +<div> | ||
4 | +<h4 style="float: left;">资讯列表</h4> | ||
5 | +<select name="tag" style="margin-left: 20px;margin-top:10px;width:150px;" id="choose_tag"> | ||
6 | + <option value="" <?php '' == $this->view->tag ? 'selected':''?>>全部资讯</option> | ||
7 | + <?php | ||
8 | + $tags = array('品牌资讯', '现场活动','独家合作','主理人','明星','限量产品','票务','视频','手机视频','专题'); | ||
9 | + foreach($tags as $tag) | ||
10 | + { | ||
11 | + echo sprintf('<option value="%s" %s>%s</option>', $tag, $tag == $this->view->tag ? 'selected':'', $tag); | ||
12 | + } | ||
13 | + ?> | ||
5 | 14 | ||
6 | - | ||
7 | -<h4>资讯列表</h4> | ||
8 | - | 15 | +</div> |
16 | +</select> | ||
9 | <table class="table"> | 17 | <table class="table"> |
10 | <caption style="text-align:left; padding-bottom:5px;"> | 18 | <caption style="text-align:left; padding-bottom:5px;"> |
11 | <button class="btn" style="float:left;" onclick="location.href='<?php echo url('news/create',array('type' => $this->view->currentType))?>'"> | 19 | <button class="btn" style="float:left;" onclick="location.href='<?php echo url('news/create',array('type' => $this->view->currentType))?>'"> |
12 | 添加资讯 | 20 | 添加资讯 |
13 | </button> | 21 | </button> |
14 | - | ||
15 | - | ||
16 | </caption> | 22 | </caption> |
17 | <thead> | 23 | <thead> |
18 | <td>资讯ID</td> | 24 | <td>资讯ID</td> |
@@ -29,8 +29,9 @@ else | @@ -29,8 +29,9 @@ else | ||
29 | ?> | 29 | ?> |
30 | <div class="<?php !isset($video) ?'fluid-item':'';?>layout-item tiled"> | 30 | <div class="<?php !isset($video) ?'fluid-item':'';?>layout-item tiled"> |
31 | <div class="image-box"> | 31 | <div class="image-box"> |
32 | - <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);?>"> | ||
33 | - <img src="<?php echo $thumb;?>" alt="" style="<?php echo sprintf("height:%spx;width:%spx;", $height, $width);?>"> | 32 | + <a href="<?php echo url('news/detail' ,array('id' => $news['id']))?>" target="_blank" title="<?php echo $news['title'];?>" |
33 | + <?php echo $video !=1 ? sprintf("style=\"height:%spx;width:%spx;overflow: hidden;\"", $height, $width):''; ?>> | ||
34 | + <img src="<?php echo $thumb;?>" alt="" <?php echo $video !=1 ? sprintf("style=\"height:%spx;width:%spx;\"", $height, $width):''; ?>> | ||
34 | <?php if(trim($news['tag']) == '视频'):?> | 35 | <?php if(trim($news['tag']) == '视频'):?> |
35 | <i class="play-icon"></i> | 36 | <i class="play-icon"></i> |
36 | <?php endif;?> | 37 | <?php endif;?> |
-
Please register or login to post a comment