Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
V
vmusicchart-cms
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Phạm Văn Đoan
vmusicchart-cms
Commits
a418033c
Commit
a418033c
authored
Apr 07, 2020
by
Phạm Văn Đoan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
thêm lọc theo nguồn ở quản lý bài hát
parent
641878e6
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
53 additions
and
10 deletions
+53
-10
CmsTrack.php
application/controllers/backend/CmsTrack.php
+3
-2
Track_model.php
application/models/Track_model.php
+34
-2
list_track_view.php
application/views/backend/cms_track/list_track_view.php
+16
-6
No files found.
application/controllers/backend/CmsTrack.php
View file @
a418033c
...
...
@@ -32,6 +32,7 @@ class CmsTrack extends CI_Controller
{
$data
=
array
();
$fByName
=
$this
->
input
->
post
(
'fByName'
);
$fBySource
=
$this
->
input
->
post
(
'fBySource'
);
$fBySinger
=
$this
->
input
->
post
(
'fBySinger'
);
$fByComposer
=
$this
->
input
->
post
(
'fByComposer'
);
$pageId
=
$this
->
input
->
post
(
'pageId'
);
...
...
@@ -41,9 +42,9 @@ class CmsTrack extends CI_Controller
$limit
=
100
;
$offset
=
(
$pageId
-
1
)
*
$limit
;
$data
[
'offset'
]
=
(
$pageId
-
1
)
*
$limit
;
$totalRecord
=
$this
->
track_model
->
cmsCountAll
(
$fByName
,
$fBySinger
,
$fByComposer
);
$totalRecord
=
$this
->
track_model
->
cmsCountAll
(
$fByName
,
$fBySinger
,
$fByComposer
,
$fBySource
);
$data
[
'pagination'
]
=
MyHelper
::
genPaginationLink
(
$totalRecord
,
$limit
,
$pageId
);
$data
[
'listData'
]
=
$this
->
track_model
->
cmsGetPagination
(
$limit
,
$offset
,
$fByName
,
$fBySinger
,
$fByComposer
);
$data
[
'listData'
]
=
$this
->
track_model
->
cmsGetPagination
(
$limit
,
$offset
,
$fByName
,
$fBySinger
,
$fByComposer
,
$fBySource
);
//
$this
->
load
->
view
(
'backend/ajax/cms_track/list_track_view'
,
$data
);
}
...
...
application/models/Track_model.php
View file @
a418033c
...
...
@@ -130,7 +130,7 @@ class Track_model extends CI_Model
return
$query
->
result_array
();
}
public
function
cmsCountAll
(
$name
=
null
,
$fBySinger
=
null
,
$fByComposer
=
null
)
public
function
cmsCountAll
(
$name
=
null
,
$fBySinger
=
null
,
$fByComposer
=
null
,
$fBySource
=
null
)
{
$this
->
db
->
select
(
'COUNT(*) AS totalResults'
);
$this
->
db
->
from
(
$this
->
_table
);
...
...
@@ -142,6 +142,22 @@ class Track_model extends CI_Model
$this
->
db
->
or_like
(
'tag'
,
$name
,
'both'
);
$this
->
db
->
or_where
(
'id'
,
intval
(
$name
));
}
if
(
!
empty
(
$fBySource
))
{
switch
(
$fBySource
)
{
case
'ZING'
:
$this
->
db
->
where
(
'id_zing is NOT NULL'
,
null
,
false
);
$this
->
db
->
where
(
'id_zing !='
,
''
);
break
;
case
'NCT'
:
$this
->
db
->
where
(
'id_nct is NOT NULL'
,
null
,
false
);
$this
->
db
->
where
(
'id_nct !='
,
''
);
break
;
case
'KEENG'
:
$this
->
db
->
where
(
'id_keeng is NOT NULL'
,
null
,
false
);
$this
->
db
->
where
(
'id_keeng !='
,
''
);
break
;
}
}
if
(
$fBySinger
==
1
)
{
$this
->
db
->
where
(
'singer_list is NOT NULL'
,
null
,
false
);
}
else
if
(
$fBySinger
==
2
)
{
...
...
@@ -186,7 +202,7 @@ class Track_model extends CI_Model
return
$query
->
result_array
();
}
public
function
cmsGetPagination
(
$record
,
$start
,
$name
=
null
,
$fBySinger
=
null
,
$fByComposer
=
null
)
public
function
cmsGetPagination
(
$record
,
$start
,
$name
=
null
,
$fBySinger
=
null
,
$fByComposer
=
null
,
$fBySource
=
null
)
{
$this
->
db
->
select
(
$this
->
_table
.
'.*'
);
$this
->
db
->
from
(
$this
->
_table
);
...
...
@@ -198,6 +214,22 @@ class Track_model extends CI_Model
$this
->
db
->
or_like
(
'tracks.tag'
,
$name
,
'both'
);
$this
->
db
->
or_where
(
'id'
,
intval
(
$name
));
}
if
(
!
empty
(
$fBySource
))
{
switch
(
$fBySource
)
{
case
'ZING'
:
$this
->
db
->
where
(
'id_zing is NOT NULL'
,
null
,
false
);
$this
->
db
->
where
(
'id_zing !='
,
''
);
break
;
case
'NCT'
:
$this
->
db
->
where
(
'id_nct is NOT NULL'
,
null
,
false
);
$this
->
db
->
where
(
'id_nct !='
,
''
);
break
;
case
'KEENG'
:
$this
->
db
->
where
(
'id_keeng is NOT NULL'
,
null
,
false
);
$this
->
db
->
where
(
'id_keeng !='
,
''
);
break
;
}
}
if
(
$fBySinger
==
1
)
{
$this
->
db
->
where
(
'singer_list is NOT NULL'
,
null
,
false
);
}
else
if
(
$fBySinger
==
2
)
{
...
...
application/views/backend/cms_track/list_track_view.php
View file @
a418033c
...
...
@@ -22,13 +22,21 @@
<?php
endif
;
?>
<div
class=
"row"
>
<?php
//echo form_open(base_url().'backend/cmsTrack/listTrackAjax'); ?>
<!-- Tìm kiếm theo tên bài hát -->
<div
class=
"col-lg-3"
>
<input
class=
"form-control"
type=
"text"
name=
"input-name"
id=
"input-name"
placeholder=
"Nhập #ID, tên bài hát..."
/>
</div>
<!-- Lọc theo nguồn cung cấp nhạc -->
<div
class=
"col-lg-2"
>
<select
class=
"form-control"
name=
"fBySource"
id=
"fBySource"
>
<option
value=
""
>
Tất cả nguồn
</option>
<option
value=
"ZING"
>
Nguồn Zing
</option>
<option
value=
"NCT"
>
Nguồn NCT
</option>
<option
value=
"KEENG"
>
Nguồn Keeng
</option>
</select>
</div>
<!-- Lọc theo thông tin ca sĩ -->
<
div
class
="
col
-
lg
-
3
">
<div
class=
"col-lg-
2
"
>
<select
class=
"form-control"
name=
"fBySinger"
id=
"fBySinger"
>
<option
value=
"-1"
>
Thông tin ca sĩ
</option>
<option
value=
"1"
>
Đã cập nhật
</option>
...
...
@@ -36,18 +44,18 @@
</select>
</div>
<!-- Lọc theo thông tin nhạc sĩ -->
<div class="
col
-
lg
-
3
">
<div
class=
"col-lg-
2
"
>
<select
class=
"form-control"
name=
"fByComposer"
id=
"fByComposer"
>
<option
value=
"-1"
>
Thông tin nhạc sĩ
</option>
<option
value=
"1"
>
Đã cập nhật
</option>
<option
value=
"2"
>
Chưa cập nhật
</option>
</select>
</div>
<
div class="
col
-
lg
-
3
"></div
>
<
!-- Xóa bộ lọc --
>
<div
class=
"col-lg-1"
>
<button
class=
"btn btn-sm btn-default"
id=
"delete-filter"
>
Xóa bộ lọc
</button>
</div>
<
?php //echo form_close(); ?
>
<
!-- Thêm mới bài hát --
>
<div
class=
"col-lg-1"
style=
"float:right;"
>
<a
class=
"btn btn-sm btn-success"
href=
"
<?php
echo
base_url
(
'backend/cmsTrack/addTrack'
);
?>
"
>
<i
class=
"glyphicon-plus"
></i>
Thêm
</a>
...
...
@@ -65,7 +73,6 @@
</div>
<script
type=
"text/javascript"
>
//Thuc hien viec ve bieu do$data
$
(
document
).
ready
(
function
()
{
var
url
=
'
<?php
echo
base_url
(
"backend/cmsTrack/listTrackAjax"
);
?>
'
;
...
...
@@ -78,6 +85,7 @@ $(document).ready(function() {
},
250
);
});
loadDataByAjaxFromSelectBox
(
'fBySource'
,
url
);
loadDataByAjaxFromSelectBox
(
'fBySinger'
,
url
);
loadDataByAjaxFromSelectBox
(
'fByComposer'
,
url
);
...
...
@@ -123,11 +131,13 @@ function changePagination(pageId) {
function
callAjax
(
pageId
,
url
)
{
var
csrf_value
=
'
<?php
echo
$this
->
security
->
get_csrf_hash
();
?>
'
;
var
fByName
=
$
(
"#input-name"
).
val
();
var
fBySource
=
$
(
"#fBySource"
).
val
();
var
fBySinger
=
$
(
"#fBySinger"
).
val
();
var
fByComposer
=
$
(
"#fByComposer"
).
val
();
var
dataReq
=
{
csrf_name
:
csrf_value
,
fByName
:
fByName
,
fBySource
:
fBySource
,
fBySinger
:
fBySinger
,
fByComposer
:
fByComposer
,
pageId
:
pageId
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment