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
8f1fe15f
Commit
8f1fe15f
authored
Mar 12, 2020
by
Trần Văn Minh
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Thêm mới bài hát theo nguồn nhạc zing/nct/keeng
parent
0a5c6670
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 @
8f1fe15f
...
@@ -84,11 +84,13 @@ class CmsTrack extends CI_Controller
...
@@ -84,11 +84,13 @@ class CmsTrack extends CI_Controller
// $this->_data['date_limit'] = $this->input->post('name');
// $this->_data['date_limit'] = $this->input->post('name');
$this
->
_data
[
'title'
]
=
$this
->
input
->
post
(
'title'
);
$this
->
_data
[
'title'
]
=
$this
->
input
->
post
(
'title'
);
$this
->
_data
[
'update_singer'
]
=
$this
->
input
->
post
(
'update_singer'
);
$this
->
_data
[
'update_singer'
]
=
$this
->
input
->
post
(
'update_singer'
);
$this
->
_data
[
'singer'
]
=
$this
->
input
->
post
(
'singer'
);
$this
->
_data
[
'singer'
]
=
$this
->
input
->
post
(
'singer'
);
$this
->
_data
[
'artist'
]
=
$this
->
input
->
post
(
'artist'
);
$this
->
_data
[
'artist'
]
=
$this
->
input
->
post
(
'artist'
);
$this
->
_data
[
'update_artist'
]
=
$this
->
input
->
post
(
'update_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
[
'functionName'
]
=
'Cập nhật thông tin'
;
$this
->
_data
[
'action'
]
=
'editTrack'
;
$this
->
_data
[
'action'
]
=
'editTrack'
;
$this
->
_data
[
'titlePage'
]
=
'Cập nhật thông tin'
;
$this
->
_data
[
'titlePage'
]
=
'Cập nhật thông tin'
;
...
@@ -160,6 +162,11 @@ class CmsTrack extends CI_Controller
...
@@ -160,6 +162,11 @@ class CmsTrack extends CI_Controller
'Sáng tác'
,
'Sáng tác'
,
'trim|required|callback_check_default|xss_clean'
'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
(
'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>'
);
$this
->
form_validation
->
set_message
(
'is_unique'
,
'<li class="list-unstyled">Đã tồn tại.</li>'
);
...
@@ -169,7 +176,12 @@ class CmsTrack extends CI_Controller
...
@@ -169,7 +176,12 @@ class CmsTrack extends CI_Controller
$this
->
_data
[
'singer'
]
=
$this
->
input
->
post
(
'singer'
);
$this
->
_data
[
'singer'
]
=
$this
->
input
->
post
(
'singer'
);
$this
->
_data
[
'artist'
]
=
$this
->
input
->
post
(
'artist'
);
$this
->
_data
[
'artist'
]
=
$this
->
input
->
post
(
'artist'
);
$this
->
_data
[
'avatar'
]
=
$this
->
input
->
post
(
'avatar'
);
$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
[
'functionName'
]
=
'Tạo mới Bài hát'
;
$this
->
_data
[
'action'
]
=
'addTrack'
;
$this
->
_data
[
'action'
]
=
'addTrack'
;
$this
->
_data
[
'titlePage'
]
=
'Tạo mới Bài hát'
;
$this
->
_data
[
'titlePage'
]
=
'Tạo mới Bài hát'
;
...
@@ -180,17 +192,22 @@ class CmsTrack extends CI_Controller
...
@@ -180,17 +192,22 @@ class CmsTrack extends CI_Controller
$title
=
$this
->
input
->
post
(
'title'
);
$title
=
$this
->
input
->
post
(
'title'
);
$singer
=
$this
->
input
->
post
(
'singer'
);
$singer
=
$this
->
input
->
post
(
'singer'
);
$artist
=
$this
->
input
->
post
(
'artist'
);
$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
(
$dataUpdate
=
array
(
'title'
=>
$title
,
'title'
=>
$title
,
'userid'
=>
$artist
,
'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'
,
'tag'
=>
'vmusic'
,
'genre'
=>
1
,
'genre'
=>
1
,
'time'
=>
time
()
'time'
=>
time
()
);
);
// print_r($dataUpdate);
$insert_id
=
$this
->
track_model
->
add
(
$dataUpdate
);
$insert_id
=
$this
->
track_model
->
add
(
$dataUpdate
);
if
(
$insert_id
)
{
if
(
$insert_id
)
{
// Xử lý upload: avatar
// Xử lý upload: avatar
...
@@ -225,6 +242,11 @@ class CmsTrack extends CI_Controller
...
@@ -225,6 +242,11 @@ class CmsTrack extends CI_Controller
}
}
}
}
public
function
addSinger
(
$track_id
)
{
# code...
}
public
function
showTrack
(
$track_id
)
public
function
showTrack
(
$track_id
)
{
{
$this
->
_data
[
'track'
]
=
$this
->
track_model
->
getById
(
$track_id
);
$this
->
_data
[
'track'
]
=
$this
->
track_model
->
getById
(
$track_id
);
...
@@ -236,6 +258,7 @@ class CmsTrack extends CI_Controller
...
@@ -236,6 +258,7 @@ class CmsTrack extends CI_Controller
$this
->
load
->
view
(
'backend/admin_template_view'
,
$this
->
_data
);
$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
)
public
function
check_title
(
$title
)
{
{
if
(
$this
->
input
->
post
(
'id'
))
{
if
(
$this
->
input
->
post
(
'id'
))
{
...
@@ -253,6 +276,7 @@ class CmsTrack extends CI_Controller
...
@@ -253,6 +276,7 @@ class CmsTrack extends CI_Controller
}
}
}
}
// kiểm tra đã chọn ca sĩ/nhạc sĩ
public
function
check_default
(
$value
)
public
function
check_default
(
$value
)
{
{
if
(
$value
==
'0'
)
{
if
(
$value
==
'0'
)
{
...
@@ -262,4 +286,15 @@ class CmsTrack extends CI_Controller
...
@@ -262,4 +286,15 @@ class CmsTrack extends CI_Controller
return
TRUE
;
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 @
8f1fe15f
...
@@ -3,13 +3,61 @@ $input_title = array(
...
@@ -3,13 +3,61 @@ $input_title = array(
'name'
=>
'title'
,
'name'
=>
'title'
,
'type'
=>
'text'
,
'type'
=>
'text'
,
'value'
=>
isset
(
$title
)
?
$title
:
''
,
'value'
=>
isset
(
$title
)
?
$title
:
''
,
'placeholder'
=>
''
,
'placeholder'
=>
'Tên bài hát'
,
'checked'
=>
true
,
'class'
=>
''
,
'class'
=>
''
,
'style'
=>
'width: 100%'
,
'style'
=>
'width: 100%'
,
'min'
=>
1
,
'min'
=>
1
,
'max'
=>
50
'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=
"row"
>
<div
class=
"widget-box"
>
<div
class=
"widget-box"
>
...
@@ -43,13 +91,14 @@ $input_title = array(
...
@@ -43,13 +91,14 @@ $input_title = array(
<div
class=
"form-group"
>
<div
class=
"form-group"
>
<label
class=
"col-lg-3"
>
Tên Ca sĩ (*)
</label>
<label
class=
"col-lg-3"
>
Tên Ca sĩ (*)
</label>
<div
class=
"col-lg-3"
>
<div
class=
"col-lg-3"
>
<select
id=
'form-field-select-3'
name=
"singer"
style=
'width: 200px;'
class=
"chosen-select form-control"
<select
id=
'form-field-select-3'
name=
"singer"
style=
'width: 200px;'
data-placeholder=
"Choose a State..."
>
class=
"chosen-select form-control"
data-placeholder=
"Choose a State..."
>
<?php
if
(
!
$singer
)
:?>
<?php
if
(
!
$singer
)
:?>
<
option
value
=
"0"
>
Chọn
ca
sĩ
</
option
>
<
option
value
=
"0"
>
Chọn
ca
sĩ
</
option
>
<?
php
endif
;
?>
<?
php
endif
;
?>
<?php
foreach
(
$list_user
as
$singers
)
:
?>
<?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'
];
?>
<?php
echo
$singers
[
'full_name'
];
?>
</option>
</option>
<?php
endforeach
;
<?php
endforeach
;
...
@@ -58,14 +107,16 @@ $input_title = array(
...
@@ -58,14 +107,16 @@ $input_title = array(
<?php
if
(
validation_errors
()){
echo
form_error
(
'singer'
,
'<div class="error">'
,
'</div>'
);}
?>
<?php
if
(
validation_errors
()){
echo
form_error
(
'singer'
,
'<div class="error">'
,
'</div>'
);}
?>
</div>
</div>
</div>
</div>
<div
class=
"form-group"
>
<div
class=
"form-group"
>
<label
class=
"col-lg-3"
>
Tên Người sáng tác (*)
</label>
<label
class=
"col-lg-3"
>
Tên Người sáng tác (*)
</label>
<div
class=
"col-lg-3"
>
<div
class=
"col-lg-3"
>
<select
id=
'form-field-select-3'
name=
"artist"
style=
'width: 200px;'
class=
"chosen-select form-control"
<select
id=
'form-field-select-3'
name=
"artist"
style=
'width: 200px;'
data-placeholder=
"Choose a State..."
>
class=
"chosen-select form-control"
data-placeholder=
"Choose a State..."
>
<option
value=
"0"
>
Chọn người sáng tác
</option>
<option
value=
"0"
>
Chọn người sáng tác
</option>
<?php
foreach
(
$list_user
as
$artists
)
:
?>
<?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'
];
?>
<?php
echo
$artists
[
'full_name'
];
?>
</option>
</option>
<?php
endforeach
;
?>
<?php
endforeach
;
?>
...
@@ -82,6 +133,49 @@ $input_title = array(
...
@@ -82,6 +133,49 @@ $input_title = array(
</div>
</div>
<div
class=
"form-group"
>
<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"
>
<div
class=
"col-lg-3"
>
<a
href=
"
<?php
echo
base_url
(
'backend/cmsTrack/listTrack'
);
?>
"
<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?')"
>
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(
...
@@ -108,6 +202,16 @@ $input_title = array(
</div>
<!-- /.row -->
</div>
<!-- /.row -->
<script>
<script>
$
(
document
).
ready
(
function
()
{
$
(
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
({
$
(
'.chosen-select'
).
chosen
({
allow_single_deselect
:
true
,
allow_single_deselect
:
true
,
no_results_text
:
"Không có kết quả cần tìm"
no_results_text
:
"Không có kết quả cần tìm"
...
@@ -132,5 +236,13 @@ $(document).ready(function() {
...
@@ -132,5 +236,13 @@ $(document).ready(function() {
});
});
})
})
});
});
});
});
function
show_src_option
(
status
)
{
if
(
status
==
'nct'
)
{
$
(
'#nct_id'
).
show
();
}
else
$
(
'#nct_id'
).
hide
();
}
</script>
</script>
\ No newline at end of file
application/views/backend/cms_track/show_track_view.php
View file @
8f1fe15f
...
@@ -22,6 +22,12 @@
...
@@ -22,6 +22,12 @@
<?php
endif
;
?>
<?php
endif
;
?>
<?php
if
(
isset
(
$track
[
0
]))
:
?>
<?php
if
(
isset
(
$track
[
0
]))
:
?>
<div
class=
"row"
>
<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-user-info profile-user-info-striped"
>
<div
class=
"profile-info-row"
>
<div
class=
"profile-info-row"
>
<div
class=
"profile-info-name"
>
ID
</div>
<div
class=
"profile-info-name"
>
ID
</div>
...
@@ -65,9 +71,8 @@
...
@@ -65,9 +71,8 @@
<div
class=
"profile-info-name"
>
Biểu diễn
</div>
<div
class=
"profile-info-name"
>
Biểu diễn
</div>
<div
class=
"profile-info-value"
>
<div
class=
"profile-info-value"
>
<?php
if
(
count
(
$track
)
>
0
)
:
foreach
(
$track
as
$key
=>
$tracks
)
:
?>
<?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;'
;
?>
<div
<?php
if
(
count
(
$track
)
-
1
>
$key
)
echo
'border-right: solid #dddddd 2px;'
;
?>
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'
];
?>
<?php
echo
$tracks
[
'name_singer'
];
?>
<a
<a
href=
"
<?php
echo
base_url
(
'backend/cmsTrack/editTrack/'
.
$track
[
0
][
'id'
]
.
'/'
.
$tracks
[
'id_singer'
]
.
'/'
.
$tracks
[
'id_track_artist'
]);
?>
"
>
href=
"
<?php
echo
base_url
(
'backend/cmsTrack/editTrack/'
.
$track
[
0
][
'id'
]
.
'/'
.
$tracks
[
'id_singer'
]
.
'/'
.
$tracks
[
'id_track_artist'
]);
?>
"
>
...
@@ -80,6 +85,9 @@
...
@@ -80,6 +85,9 @@
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<br>
<div
class=
"row"
>
<div
class=
"col-lg-3"
>
<div
class=
"col-lg-3"
>
<a
href=
"
<?php
echo
base_url
(
'backend/cmsTrack/listTrack'
);
?>
"
<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?')"
>
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