Toggle navigation
Toggle navigation
This project
Loading...
Sign in
fe
/
YOHOOD
·
Commits
Go to a project
GitLab
Go to group
Project
Activity
Files
Commits
Pipelines
0
Builds
0
Graphs
Milestones
Issues
0
Merge Requests
0
Members
Labels
Wiki
Forks
Network
Create a new issue
Download as
Email Patches
Plain Diff
Browse Files
Authored by
whb
10 years ago
Commit
784f8c720648dbe7f49f1a0528b16686c6b66a1a
1 parent
0229ac75
修改问题
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
26 additions
and
12 deletions
res/js/admin/news.js
website/controller/admin/News.class.php
website/view/script/admin/news/index.php
website/view/widget/news/list.php
res/js/admin/news.js
View file @
784f8c7
...
...
@@ -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
()
{
...
...
website/controller/admin/News.class.php
View file @
784f8c7
...
...
@@ -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
()
...
...
website/view/script/admin/news/index.php
View file @
784f8c7
<?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>
...
...
website/view/widget/news/list.php
View file @
784f8c7
...
...
@@ -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;?>
...
...
Please
register
or
login
to post a comment