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
d4b1a742
Commit
d4b1a742
authored
Mar 12, 2020
by
Phạm Văn Đoan
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'dev' of
http://git.dcv.vn/doanpv/vmusicchart-cms
into dev
parents
8d3c5cc8
8f1fe15f
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
171 additions
and
14 deletions
+171
-14
CmsTrack.php
application/controllers/backend/CmsTrack.php
+40
-4
add_track_view.php
application/views/backend/cms_track/add_track_view.php
+120
-7
show_track_view.php
application/views/backend/cms_track/show_track_view.php
+11
-3
No files found.
application/controllers/backend/CmsTrack.php
View file @
d4b1a742
...
...
@@ -86,11 +86,13 @@ class CmsTrack extends CI_Controller
// $this->_data['date_limit'] = $this->input->post('name');
$this
->
_data
[
'title'
]
=
$this
->
input
->
post
(
'title'
);
$this
->
_data
[
'update_singer'
]
=
$this
->
input
->
post
(
'update_singer'
);
$this
->
_data
[
'singer'
]
=
$this
->
input
->
post
(
'singer'
);
$this
->
_data
[
'artist'
]
=
$this
->
input
->
post
(
'artist'
);
$this
->
_data
[
'update_artist'
]
=
$this
->
input
->
post
(
'update_artist'
);
//
// error_log('abv: '.$this->input->post('src_option'));
die
(
'abv: '
.
$this
->
input
->
post
(
'src_option'
));
$this
->
_data
[
'functionName'
]
=
'Cập nhật thông tin'
;
$this
->
_data
[
'action'
]
=
'editTrack'
;
$this
->
_data
[
'titlePage'
]
=
'Cập nhật thông tin'
;
...
...
@@ -162,6 +164,11 @@ class CmsTrack extends CI_Controller
'Sáng tác'
,
'trim|required|callback_check_default|xss_clean'
);
$this
->
form_validation
->
set_rules
(
'nct_id'
,
'ID bài hát trên nhạc của tui'
,
'callback_check_nct_id|xss_clean'
);
$this
->
form_validation
->
set_message
(
'required'
,
'<li class="list-unstyled">Bắt buộc nhập, chọn.</li>'
);
$this
->
form_validation
->
set_message
(
'is_unique'
,
'<li class="list-unstyled">Đã tồn tại.</li>'
);
...
...
@@ -171,7 +178,12 @@ class CmsTrack extends CI_Controller
$this
->
_data
[
'singer'
]
=
$this
->
input
->
post
(
'singer'
);
$this
->
_data
[
'artist'
]
=
$this
->
input
->
post
(
'artist'
);
$this
->
_data
[
'avatar'
]
=
$this
->
input
->
post
(
'avatar'
);
$this
->
_data
[
'source'
]
=
$this
->
input
->
post
(
'source'
);
$this
->
_data
[
'src_option'
]
=
$this
->
input
->
post
(
'src_option'
);
$this
->
_data
[
'link'
]
=
$this
->
input
->
post
(
'link'
);
$this
->
_data
[
'nct_id'
]
=
$this
->
input
->
post
(
'nct_id'
);
//
error_log
(
'avc: '
.
$this
->
input
->
post
(
'src_option'
));
$this
->
_data
[
'functionName'
]
=
'Tạo mới Bài hát'
;
$this
->
_data
[
'action'
]
=
'addTrack'
;
$this
->
_data
[
'titlePage'
]
=
'Tạo mới Bài hát'
;
...
...
@@ -182,17 +194,22 @@ class CmsTrack extends CI_Controller
$title
=
$this
->
input
->
post
(
'title'
);
$singer
=
$this
->
input
->
post
(
'singer'
);
$artist
=
$this
->
input
->
post
(
'artist'
);
if
(
$title
){
$link
=
$this
->
input
->
post
(
'link'
);
$source
=
$this
->
input
->
post
(
'source'
);
$nct_id
=
$this
->
input
->
post
(
'nct_id'
);
if
(
$title
){
$dataUpdate
=
array
(
'title'
=>
$title
,
'userid'
=>
$artist
,
// 'art' => $db_art_path,
'link'
=>
(
$source
==
'zing'
)
?
$link
:
''
,
'link_nct'
=>
(
$source
==
'nct'
)
?
$link
:
''
,
'link_keeng'
=>
(
$source
==
'keeng'
)
?
$link
:
''
,
'id_nct'
=>
$nct_id
,
'tag'
=>
'vmusic'
,
'genre'
=>
1
,
'time'
=>
time
()
);
// print_r($dataUpdate);
$insert_id
=
$this
->
track_model
->
add
(
$dataUpdate
);
if
(
$insert_id
)
{
// Xử lý upload: avatar
...
...
@@ -227,6 +244,11 @@ class CmsTrack extends CI_Controller
}
}
public
function
addSinger
(
$track_id
)
{
# code...
}
public
function
showTrack
(
$track_id
)
{
$this
->
_data
[
'track'
]
=
$this
->
track_model
->
getById
(
$track_id
);
...
...
@@ -238,6 +260,7 @@ class CmsTrack extends CI_Controller
$this
->
load
->
view
(
'backend/admin_template_view'
,
$this
->
_data
);
}
// Tên bài hát tồn tại hay chưa
public
function
check_title
(
$title
)
{
if
(
$this
->
input
->
post
(
'id'
))
{
...
...
@@ -255,6 +278,7 @@ class CmsTrack extends CI_Controller
}
}
// kiểm tra đã chọn ca sĩ/nhạc sĩ
public
function
check_default
(
$value
)
{
if
(
$value
==
'0'
)
{
...
...
@@ -264,4 +288,15 @@ class CmsTrack extends CI_Controller
return
TRUE
;
}
// kiểm tra id_nct khác null
public
function
check_nct_id
(
$nct_id
)
{
$source
=
$this
->
input
->
post
(
'source'
);
if
(
$nct_id
==
''
&&
$source
==
'nct'
)
{
$this
->
form_validation
->
set_message
(
'check_nct_id'
,
'<li class="list-unstyled">Vui lòng nhập ID bài hát trên NCT.</li>'
);
return
false
;
}
else
return
TRUE
;
}
}
\ No newline at end of file
application/views/backend/cms_track/add_track_view.php
View file @
d4b1a742
...
...
@@ -3,13 +3,61 @@ $input_title = array(
'name'
=>
'title'
,
'type'
=>
'text'
,
'value'
=>
isset
(
$title
)
?
$title
:
''
,
'placeholder'
=>
''
,
'placeholder'
=>
'Tên bài hát'
,
'checked'
=>
true
,
'class'
=>
''
,
'style'
=>
'width: 100%'
,
'min'
=>
1
,
'max'
=>
50
);
$input_link
=
array
(
'name'
=>
'link'
,
'type'
=>
'text'
,
'value'
=>
isset
(
$link
)
?
$link
:
''
,
'placeholder'
=>
'Nhập link bài hát'
,
'class'
=>
''
,
'style'
=>
'width: 100%'
,
'min'
=>
1
,
'max'
=>
50
);
$input_nct_id
=
array
(
'name'
=>
'nct_id'
,
'type'
=>
'text'
,
'value'
=>
isset
(
$nct_id
)
?
$nct_id
:
''
,
'placeholder'
=>
'Id bài hát trên NCT'
,
'class'
=>
''
,
'style'
=>
'width: 100%'
,
'min'
=>
1
,
'max'
=>
50
);
$input_zing
=
array
(
'name'
=>
'source'
,
'id'
=>
'zing'
,
'type'
=>
'radio'
,
'value'
=>
'zing'
,
'min'
=>
1
,
'max'
=>
50
);
$input_nct
=
array
(
'name'
=>
'source'
,
'type'
=>
'radio'
,
'id'
=>
'nct'
,
'value'
=>
'nct'
,
'min'
=>
1
,
'max'
=>
50
);
$input_keeng
=
array
(
'name'
=>
'source'
,
'type'
=>
'radio'
,
'id'
=>
'keeng'
,
'value'
=>
'keeng'
,
'max'
=>
50
);
$check
=
"checked => 1"
;
(
isset
(
$source
)
&&
$source
==
'zing'
)
?
array_push
(
$input_zing
,
$check
)
:
''
;
?>
<div
class=
"row"
>
<div
class=
"widget-box"
>
...
...
@@ -43,13 +91,14 @@ $input_title = array(
<div
class=
"form-group"
>
<label
class=
"col-lg-3"
>
Tên Ca sĩ (*)
</label>
<div
class=
"col-lg-3"
>
<select
id=
'form-field-select-3'
name=
"singer"
style=
'width: 200px;'
class=
"chosen-select form-control"
data-placeholder=
"Choose a State..."
>
<select
id=
'form-field-select-3'
name=
"singer"
style=
'width: 200px;'
class=
"chosen-select form-control"
data-placeholder=
"Choose a State..."
>
<?php
if
(
!
$singer
)
:?>
<
option
value
=
"0"
>
Chọn
ca
sĩ
</
option
>
<?
php
endif
;
?>
<?php
foreach
(
$list_user
as
$singers
)
:
?>
<option
value=
"
<?php
echo
$singers
[
'id'
];
?>
"
<?php
if
(
$singer
&&
$singer
==
$singers
[
'id'
]){
echo
'selected="selected"'
;}
else
echo
''
;
?>
>
<option
value=
"
<?php
echo
$singers
[
'id'
];
?>
"
<?php
if
(
$singer
&&
$singer
==
$singers
[
'id'
]){
echo
'selected="selected"'
;}
else
echo
''
;
?>
>
<?php
echo
$singers
[
'full_name'
];
?>
</option>
<?php
endforeach
;
...
...
@@ -58,14 +107,16 @@ $input_title = array(
<?php
if
(
validation_errors
()){
echo
form_error
(
'singer'
,
'<div class="error">'
,
'</div>'
);}
?>
</div>
</div>
<div
class=
"form-group"
>
<label
class=
"col-lg-3"
>
Tên Người sáng tác (*)
</label>
<div
class=
"col-lg-3"
>
<select
id=
'form-field-select-3'
name=
"artist"
style=
'width: 200px;'
class=
"chosen-select form-control"
data-placeholder=
"Choose a State..."
>
<select
id=
'form-field-select-3'
name=
"artist"
style=
'width: 200px;'
class=
"chosen-select form-control"
data-placeholder=
"Choose a State..."
>
<option
value=
"0"
>
Chọn người sáng tác
</option>
<?php
foreach
(
$list_user
as
$artists
)
:
?>
<option
value=
"
<?php
echo
$artists
[
'id'
];
?>
"
<?php
if
(
$artist
&&
$artist
==
$artists
[
'id'
]){
echo
'selected="selected"'
;}
else
echo
''
;
?>
>
<option
value=
"
<?php
echo
$artists
[
'id'
];
?>
"
<?php
if
(
$artist
&&
$artist
==
$artists
[
'id'
]){
echo
'selected="selected"'
;}
else
echo
''
;
?>
>
<?php
echo
$artists
[
'full_name'
];
?>
</option>
<?php
endforeach
;
?>
...
...
@@ -82,6 +133,49 @@ $input_title = array(
</div>
<div
class=
"form-group"
>
<label
class=
"col-lg-3"
>
Nguồn nhạc
<?php
isset
(
$src_option
)
?
$src_option
:
''
;
?>
</label>
<div
class=
"col-lg-3"
id=
"source"
>
<div
class=
"row"
>
<div
class=
"col-lg-4"
>
<input
name=
"source"
id=
"zing"
value=
"zing"
type=
"radio"
<?php
if
(
$source
==
'zing'
||
$source
!=
'nct'
||
$source
!=
'keeng'
)
echo
'checked'
;
?>
>
Zing
</div>
<div
class=
"col-lg-4"
>
<input
name=
"source"
id=
"nct"
value=
"nct"
type=
"radio"
<?php
if
(
$source
==
'nct'
)
echo
'checked'
;
?>
>
NCT
</div>
<div
class=
"col-lg-4"
>
<input
name=
"source"
id=
"keeng"
value=
"keeng"
type=
"radio"
<?php
if
(
$source
==
'keeng'
)
echo
'checked'
;
?>
>
Keeng
</div>
</div>
<?php
if
(
validation_errors
()){
echo
form_error
(
'nct_id'
,
'<div class="error">'
,
'</div>'
);}
?>
</div>
</div>
<div
class=
"form-group"
id=
"nct_id"
style=
"display: none;"
>
<label
class=
"col-lg-3"
>
ID Nhạc của tui
</label>
<div
class=
"col-lg-3"
>
<?php
echo
form_input
(
$input_nct_id
);
?>
</div>
<input
type=
"hidden"
name=
"src_option"
value=
"
<?php
echo
isset
(
$src_option
)
?
$src_option
:
'zing'
;
?>
"
id=
"src_option"
>
</div>
<div
class=
"form-group"
>
<label
class=
"col-lg-3"
>
Link nhạc
</label>
<div
class=
"col-lg-3"
>
<?php
echo
form_input
(
$input_link
);
?>
</div>
</div>
<div
class=
"form-group"
>
<div
class=
"col-lg-3"
>
<a
href=
"
<?php
echo
base_url
(
'backend/cmsTrack/listTrack'
);
?>
"
onclick=
"return confirm('Bạn có chắc chắn muốn quay lại Danh sách không?')"
>
...
...
@@ -108,6 +202,16 @@ $input_title = array(
</div>
<!-- /.row -->
<script>
$
(
document
).
ready
(
function
()
{
show_src_option
(
$
(
'#src_option'
).
val
());
// Hiện ẩn option khi click nct
$
(
'input[type="radio"]'
).
click
(
function
()
{
show_src_option
(
$
(
this
).
val
());
});
$
(
'input[name="source"]'
).
click
(
function
()
{
$
(
'#src_option'
).
val
(
$
(
this
).
val
());
})
$
(
'.chosen-select'
).
chosen
({
allow_single_deselect
:
true
,
no_results_text
:
"Không có kết quả cần tìm"
...
...
@@ -132,5 +236,13 @@ $(document).ready(function() {
});
})
});
});
function
show_src_option
(
status
)
{
if
(
status
==
'nct'
)
{
$
(
'#nct_id'
).
show
();
}
else
$
(
'#nct_id'
).
hide
();
}
</script>
\ No newline at end of file
application/views/backend/cms_track/show_track_view.php
View file @
d4b1a742
...
...
@@ -22,6 +22,12 @@
<?php
endif
;
?>
<?php
if
(
isset
(
$track
[
0
]))
:
?>
<div
class=
"row"
>
<div
class=
"col-lg-2"
>
<a
class=
"btn btn-sm btn-success"
href=
"
<?php
echo
base_url
(
'backend/cmsTrack/addTrack'
);
?>
"
><i
class=
"glyphicon-plus"
>
Thêm ca sĩ
</i></a>
</div>
</div>
<br>
<div
class=
"row"
>
<div
class=
"profile-user-info profile-user-info-striped"
>
<div
class=
"profile-info-row"
>
<div
class=
"profile-info-name"
>
ID
</div>
...
...
@@ -65,9 +71,8 @@
<div
class=
"profile-info-name"
>
Biểu diễn
</div>
<div
class=
"profile-info-value"
>
<?php
if
(
count
(
$track
)
>
0
)
:
foreach
(
$track
as
$key
=>
$tracks
)
:
?>
<div
style=
"
<?php
if
(
count
(
$track
)
>
1
)
echo
'width: 50%; float:left; text-align: center;'
;
?>
<?php
if
(
count
(
$track
)
-
1
>
$key
)
echo
'border-right: solid #dddddd 2px;'
;
?>
"
>
<div
style=
"
<?php
if
(
count
(
$track
)
>
1
)
:
echo
'width: 50%; float:left; text-align: center;'
;
endif
;
if
(
count
(
$track
)
-
1
>
$key
)
:
echo
'border-right: solid #dddddd 2px;'
;
endif
;
?>
"
>
<?php
echo
$tracks
[
'name_singer'
];
?>
<a
href=
"
<?php
echo
base_url
(
'backend/cmsTrack/editTrack/'
.
$track
[
0
][
'id'
]
.
'/'
.
$tracks
[
'id_singer'
]
.
'/'
.
$tracks
[
'id_track_artist'
]);
?>
"
>
...
...
@@ -80,6 +85,9 @@
</div>
</div>
</div>
</div>
<br>
<div
class=
"row"
>
<div
class=
"col-lg-3"
>
<a
href=
"
<?php
echo
base_url
(
'backend/cmsTrack/listTrack'
);
?>
"
onclick=
"return confirm('Bạn có chắc chắn muốn quay lại Danh sách không?')"
>
...
...
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