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
123bc1cd
Commit
123bc1cd
authored
Mar 14, 2020
by
Trần Văn Minh
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
cập nhật thêm mới nghệ sĩ ở view thêm mới bài hát và sửa bài hát
parent
ad6be874
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
653 additions
and
26 deletions
+653
-26
config.php
application/config/config.php
+2
-0
CmsArtist.php
application/controllers/backend/CmsArtist.php
+47
-3
CmsTrack.php
application/controllers/backend/CmsTrack.php
+26
-18
User_model.php
application/models/User_model.php
+6
-5
admin_template_view.php
application/views/backend/admin_template_view.php
+4
-0
add_track_view.php
application/views/backend/cms_track/add_track_view.php
+279
-0
edit_track_view.php
application/views/backend/cms_track/edit_track_view.php
+289
-0
No files found.
application/config/config.php
View file @
123bc1cd
...
...
@@ -403,6 +403,8 @@ $config['csrf_exclude_uris'] = array(
'backend/cmsTrack/listTrackAjax'
,
'backend/cmsArtist/listArtistAjax'
,
'backend/cmsTrack/addTrack'
,
'backend/cmsArtist/addArtistAjax'
,
'backend/cmsSetting/listGroupAjax'
,
'backend/cmsSetting/listUserAdminAjax'
,
...
...
application/controllers/backend/CmsArtist.php
View file @
123bc1cd
...
...
@@ -101,6 +101,7 @@ class CmsArtist extends CI_Controller
$dataUpdate
=
array
(
'username'
=>
$username
,
'email'
=>
$email
,
'user_type'
=>
2
,
'full_name'
=>
$full_name
,
'link'
=>
$link_zing
,
'link_nct'
=>
$link_nct
,
...
...
@@ -118,6 +119,48 @@ class CmsArtist extends CI_Controller
}
}
public
function
addArtistAjax
()
{
$email
=
$this
->
input
->
post
(
'email'
);
$username
=
$this
->
input
->
post
(
'username'
);
$full_name
=
$this
->
input
->
post
(
'full_name'
);
$link_zing
=
$this
->
input
->
post
(
'link_zing'
);
$link_nct
=
$this
->
input
->
post
(
'link_nct'
);
$link_keeng
=
$this
->
input
->
post
(
'link_keeng'
);
$password
=
MyHelper
::
genKeyCode
(
trim
(
'123456'
));
$result
=
$this
->
user_model
->
getByEmail
(
$email
,
2
,
''
);
// MyHelper::echoPreDie($result);
$check_username
=
$this
->
user_model
->
getByUsername
(
$username
,
2
,
''
);
if
(
$email
==
''
||
$username
==
''
||
$full_name
==
''
)
{
$data
[
'required'
]
=
'Vui lòng điền Vào chỗ trống!'
;
}
else
if
(
$result
)
{
$data
[
'check_email'
]
=
'Email đã được sử dụng!'
;
}
else
if
(
$check_username
)
{
$data
[
'check_username'
]
=
'Username đã tồn tại!'
;
}
else
{
$dataUpdate
=
array
(
'username'
=>
$username
,
'password'
=>
$password
,
'email'
=>
$email
,
'user_type'
=>
2
,
'full_name'
=>
$full_name
,
'link'
=>
(
$link_zing
==
''
)
?
null
:
$link_zing
,
'link_nct'
=>
(
$link_nct
==
''
)
?
null
:
$link_nct
,
'link_keeng'
=>
(
$link_keeng
==
''
)
?
null
:
$link_keeng
,
'date_created'
=>
time
()
);
$insert_id
=
$this
->
user_model
->
add
(
$dataUpdate
);
if
(
$insert_id
)
{
$this
->
session
->
set_flashdata
(
'success'
,
'Tạo nghệ sĩ thành công!'
);
$data
[
'success'
]
=
'Thành công!'
;
}
else
{
$this
->
session
->
set_flashdata
(
'error'
,
'Tạo nghệ sĩ không thành công!'
);
$data
[
'error'
]
=
'Xảy ra lỗi! Vui lòng thử lại.'
;
}
}
echo
json_encode
(
$data
);
}
public
function
addArtist
()
{
// Thiết lập validate
...
...
@@ -174,10 +217,11 @@ class CmsArtist extends CI_Controller
'username'
=>
$username
,
'password'
=>
$password
,
'email'
=>
$email
,
'user_type'
=>
2
,
'full_name'
=>
$full_name
,
'link'
=>
$link_zing
,
'link_nct'
=>
$link_nct
,
'link_keeng'
=>
$link_keeng
,
'link'
=>
(
$link_zing
==
''
)
?
null
:
$link_zing
,
'link_nct'
=>
(
$link_nct
==
''
)
?
null
:
$link_nct
,
'link_keeng'
=>
(
$link_keeng
==
''
)
?
null
:
$link_keeng
,
'date_created'
=>
time
()
);
$this
->
user_model
->
add
(
$dataUpdate
);
...
...
application/controllers/backend/CmsTrack.php
View file @
123bc1cd
...
...
@@ -50,7 +50,7 @@ class CmsTrack extends CI_Controller
public
function
editTrack
(
$track_id
,
$id_user
=
''
,
$id_artist
=
''
)
{
$this
->
_data
[
'contest'
]
=
$
contest
=
$this
->
track_model
->
getById
(
$track_id
);
$this
->
_data
[
'contest'
]
=
$
track
=
$this
->
track_model
->
getById
(
$track_id
);
$track_user
=
''
;
$this
->
_data
[
'track_artists'
]
=
$track_artists
=
''
;
if
(
$id_user
!=
0
)
{
...
...
@@ -102,33 +102,41 @@ class CmsTrack extends CI_Controller
$singer
=
(
$track_user
!=
''
)
?
$track_user
[
0
][
'user_id'
]
:
''
;
$artist
=
(
$track_artists
!=
''
)
?
$track_artists
[
0
][
'user_id'
]
:
''
;
$update_artist
=
$this
->
input
->
post
(
'update_artist'
);
$file
=
$_FILES
[
'avatar'
][
'name'
];
$id_singer
=
(
$update_singer
>
0
)
?
$update_singer
:
$singer
;
$id_artists
=
(
$update_artist
>
0
)
?
$update_artist
:
$artist
;
(
$singer
||
$id_user
)
?
$active_singer
=
'update'
:
$active_singer
=
'insert'
;
(
$artist
||
$id_artist
)
?
$active_artist
=
'update'
:
$active_artist
=
'insert'
;
// die($active_artist.$active_singer.'ca sĩ'.$id_singer.'/'.$singer.'nhạc sĩ'.$id_artists.'/'.$artist);
// Xử lý upload: avatar
$db_art_path
=
''
;
$upload_path
=
'uploads/tracks/arts'
;
$upload_full_path
=
'/home/aseanvn/public_html/vmusicchart.dcv.vn/'
.
$upload_path
;
$config
[
'upload_path'
]
=
$upload_full_path
;
$config
[
'file_name'
]
=
md5
(
$track_id
.
time
())
;
$config
[
'allowed_types'
]
=
'gif|jpg|png|jpeg'
;
$config
[
'max_size'
]
=
20480
;
$config
[
'max_width'
]
=
1024
;
$config
[
'max_height'
]
=
768
;
$this
->
load
->
library
(
'upload'
,
$config
)
;
if
(
$file
!=
''
){
MyHelper
::
echoPreDie
(
'1230'
)
;
$db_art_path
=
''
;
$upload_path
=
'uploads/tracks/arts'
;
$upload_full_path
=
'/home/aseanvn/public_html/vmusicchart.dcv.vn/'
.
$upload_path
;
$config
[
'upload_path'
]
=
$upload_full_path
;
$config
[
'file_name'
]
=
md5
(
$track_id
.
time
())
;
$config
[
'allowed_types'
]
=
'gif|jpg|png|jpeg'
;
$config
[
'max_size'
]
=
20480
;
$config
[
'max_width'
]
=
1024
;
$config
[
'max_height'
]
=
768
;
if
(
$this
->
upload
->
do_upload
(
'avatar'
))
{
$upload_data
=
$this
->
upload
->
data
();
$db_art_path
=
$upload_path
.
'/'
.
$upload_data
[
'file_name'
];
$this
->
load
->
library
(
'upload'
,
$config
);
// if()
if
(
$this
->
upload
->
do_upload
(
'avatar'
))
{
$upload_data
=
$this
->
upload
->
data
();
MyHelper
::
echoPreDie
(
'ac: '
.
$$upload_data
);
$db_art_path
=
$upload_path
.
'/'
.
$upload_data
[
'file_name'
];
}
$this
->
track_model
->
update
(
$track_id
,
$title
,
$db_art_path
);
}
else
{
$art
=
$track
[
0
][
'art'
];
$this
->
track_model
->
update
(
$track_id
,
$title
,
$art
);
}
// MyHelper::echoPreDie($config);
$this
->
track_model
->
update_track_artists
(
$track_id
,
$id_artists
,
$id_artist
,
$active_artist
);
$this
->
track_model
->
update_track_user
(
$track_id
,
$id_singer
,
$id_user
,
$active_singer
);
$this
->
track_model
->
update
(
$track_id
,
$title
,
$db_art_path
);
$this
->
session
->
set_flashdata
(
'success'
,
'Tạo bài hát thành công'
);
redirect
(
base_url
()
.
'backend/cmsTrack/showTrack/'
.
$track_id
);
...
...
application/models/User_model.php
View file @
123bc1cd
...
...
@@ -32,13 +32,13 @@ class User_model extends CI_Model
return
$query
->
result_array
();
}
public
function
getByUsername
(
$username
,
$
id
,
$account_type
)
public
function
getByUsername
(
$username
,
$
account_type
,
$id
=
''
)
{
$this
->
db
->
select
(
$this
->
_table
.
'.*'
);
$this
->
db
->
from
(
$this
->
_table
);
$this
->
db
->
where
(
$this
->
_table
.
'.username'
,
$username
);
$this
->
db
->
where
(
$this
->
_table
.
'.user_type'
,
$account_type
);
if
(
$id
)
{
if
(
$id
||
$id
!=
''
)
{
$this
->
db
->
where_not_in
(
'id'
,
$id
);
}
$this
->
db
->
limit
(
1
);
...
...
@@ -46,13 +46,14 @@ class User_model extends CI_Model
return
$query
->
result_array
();
}
public
function
getByEmail
(
$email
,
$id
,
$account_type
)
{
public
function
getByEmail
(
$email
,
$account_type
,
$id
=
''
)
{
// MyHelper::echoPreDie($email);
$this
->
db
->
select
(
$this
->
_table
.
'.*'
);
$this
->
db
->
from
(
$this
->
_table
);
$this
->
db
->
where
(
$this
->
_table
.
'.email'
,
$email
);
$this
->
db
->
where
(
$this
->
_table
.
'.user_type'
,
$account_type
);
if
(
$id
)
{
if
(
$id
||
$id
!=
''
)
{
$this
->
db
->
where_not_in
(
'id'
,
$id
);
}
$this
->
db
->
limit
(
1
);
...
...
application/views/backend/admin_template_view.php
View file @
123bc1cd
...
...
@@ -19,6 +19,8 @@ $action = $CI->router->fetch_method();
<link
rel=
"stylesheet"
href=
"
<?php
echo
base_url
(
'public/assets/css/datepicker.min.css'
)
?>
"
/>
<link
rel=
"stylesheet"
href=
"
<?php
echo
base_url
()
.
'public/assets/css/daterangepicker.min.css'
?>
"
/>
<link
rel=
"stylesheet"
href=
"
<?php
echo
base_url
()
.
'public/assets/css/chosen.min.css'
?>
"
/>
<link
rel=
"stylesheet"
href=
"
<?php
echo
base_url
()
.
'public/assets/css/jquery-ui.min.css'
?>
"
/>
<!-- <link rel="stylesheet" href="assets/css/jquery-ui.min.css" /> -->
<!-- text fonts -->
<link
rel=
"stylesheet"
href=
"
<?php
echo
base_url
()
.
'public/assets/fonts/fonts.googleapis.com.css'
?>
"
/>
<!-- ace styles -->
...
...
@@ -39,6 +41,8 @@ $action = $CI->router->fetch_method();
<!-- <script src="
<?php
echo
base_url
()
.
'public/assets/js/jquery.1.11.1.min.js'
?>
"></script> -->
<script
src=
"
<?php
echo
base_url
()
.
'public/assets/js/jquery.2.1.1.min.js'
?>
"
></script>
<script
src=
"
<?php
echo
base_url
()
.
'public/assets/js/bootstrap.min.js'
?>
"
></script>
<script
src=
"
<?php
echo
base_url
()
.
'public/assets/js/jquery-ui.min.js'
?>
"
></script>
<script
src=
"
<?php
echo
base_url
()
.
'public/assets/js/jquery.ui.touch-punch.min.js'
?>
"
></script>
<script
src=
"
<?php
echo
base_url
()
.
'public/assets/js/chosen.jquery.min.js'
?>
"
></script>
<script
src=
"
<?php
echo
base_url
()
.
'public/fckeditor/ckfinder/ckfinder.js'
?>
"
></script>
...
...
application/views/backend/cms_track/add_track_view.php
View file @
123bc1cd
...
...
@@ -56,6 +56,57 @@ $input_keeng = array(
'value'
=>
'keeng'
,
'max'
=>
50
);
$input_username
=
array
(
'name'
=>
'username'
,
'type'
=>
'text'
,
'value'
=>
isset
(
$username
)
?
$username
:
''
,
'placeholder'
=>
'Nhập username'
,
'class'
=>
''
,
'style'
=>
'width: 100%'
,
'min'
=>
1
,
'max'
=>
50
);
$input_email
=
array
(
'name'
=>
'email'
,
'type'
=>
'email'
,
'value'
=>
isset
(
$email
)
?
$email
:
''
,
'placeholder'
=>
'Nhập pemail'
,
'class'
=>
''
,
'style'
=>
'width: 100%'
,
);
$input_full_name
=
array
(
'name'
=>
'full_name'
,
'type'
=>
'text'
,
'value'
=>
isset
(
$full_name
)
?
$full_name
:
''
,
'placeholder'
=>
'Nhập tên đầy đủ'
,
'class'
=>
''
,
'style'
=>
'width: 100%'
,
);
$input_link_zing
=
array
(
'name'
=>
'link_zing'
,
'type'
=>
'text'
,
'value'
=>
isset
(
$link_zing
)
?
$link_zing
:
''
,
'placeholder'
=>
'Nhập Link Zingmp3'
,
'class'
=>
''
,
'style'
=>
'width: 100%'
,
);
$input_link_nct
=
array
(
'name'
=>
'link_nct'
,
'type'
=>
'text'
,
'value'
=>
isset
(
$link_nct
)
?
$link_nct
:
''
,
'placeholder'
=>
'Nhập link NCT'
,
'class'
=>
''
,
'style'
=>
'width: 100%'
,
);
$input_link_keeng
=
array
(
'name'
=>
'link_keeng'
,
'type'
=>
'text'
,
'value'
=>
isset
(
$link_keeng
)
?
$link_keeng
:
''
,
'placeholder'
=>
'Nhập link Keeng'
,
'class'
=>
''
,
'style'
=>
'width: 100%'
,
);
$check
=
"checked => 1"
;
(
isset
(
$source
)
&&
$source
==
'zing'
)
?
array_push
(
$input_zing
,
$check
)
:
''
;
?>
...
...
@@ -123,6 +174,9 @@ $check = "checked => 1";
</select>
<?php
if
(
validation_errors
()){
echo
form_error
(
'artist'
,
'<div class="error">'
,
'</div>'
);}
?>
</div>
<div
id=
"add_composer"
>
<a
href=
"#myModal"
role=
"button"
class=
"btn btn-success"
data-toggle=
"modal"
>
Thêm nghệ sĩ
</a>
</div>
</div>
<div
class=
"form-group"
>
...
...
@@ -206,6 +260,98 @@ $check = "checked => 1";
</div>
</div>
<div
id=
"myModal"
class=
"modal fade"
tabindex=
"-1"
role=
"dialog"
aria-labelledby=
"myModalLabel"
aria-hidden=
"true"
>
<div
class=
"modal-dialog"
>
<div
class=
"modal-content"
>
<div
class=
"modal-header"
>
<h3
id=
"myModalLabel"
>
Thêm mới Ca sĩ/Nhạc sĩ
</h3>
<button
type=
"button"
class=
"close"
data-dismiss=
"modal"
aria-hidden=
"true"
>
×
</button>
</div>
<div
class=
"modal-body"
>
<div
class=
"row"
>
<div
class=
"widget-box"
>
<div
class=
"widget-body"
>
<div
class=
"widget-main"
>
<form
id=
"form_add_artist"
method=
"POST"
class=
"form-horizontal"
>
<span
id=
"err"
class=
"text-danger"
></span>
<div
class=
"form-group"
>
<label
class=
"col-lg-3"
></label>
<div
class=
"col-lg-3"
>
<input
type=
"hidden"
name=
"id"
value=
""
/>
</div>
</div>
<div
class=
"form-group"
id=
"err-username"
>
<label
class=
"col-lg-3"
>
Username (*)
</label>
<div
class=
"col-lg-3"
>
<input
type=
"text"
name=
"username"
value=
""
class=
"form-control"
style=
"width:100%;"
placeholder=
"Nhập username"
/>
</div>
<div><span
name
></span></div>
</div>
<div
class=
"form-group"
id=
"err-email"
>
<label
class=
"col-lg-3"
>
Email (*)
</label>
<div
class=
"col-lg-3"
>
<input
type=
"email"
name=
"email"
value=
""
class=
"form-control"
style=
"width:100%;"
placeholder=
"Nhập email"
/>
</div>
</div>
<div
class=
"form-group err-full-name"
>
<label
class=
"col-lg-3"
>
Tên đầu đủ (*)
</label>
<div
class=
"col-lg-3"
>
<input
type=
"text"
name=
"full_name"
value=
""
class=
"form-control"
style=
"width:100%;"
placeholder=
"Nhập họ tên đầy đủ"
/>
</div>
</div>
<div
class=
"form-group"
>
<label
class=
"col-lg-3"
>
Link Zingmp3
</label>
<div
class=
"col-lg-3"
>
<input
type=
"text"
name=
"link_zing"
value=
""
class=
"form-control"
style=
"width:100%;"
placeholder=
"Nhập link ZingMp3"
/>
</div>
</div>
<div
class=
"form-group"
>
<label
class=
"col-lg-3"
>
Link Nhạc của tui
</label>
<div
class=
"col-lg-3"
>
<input
type=
"text"
name=
"link_nct"
value=
""
class=
"form-control"
style=
"width:100%;"
placeholder=
"Nhập link NCT"
/>
</div>
</div>
<div
class=
"form-group"
>
<label
class=
"col-lg-3"
>
Link Keeng
</label>
<div
class=
"col-lg-3"
>
<input
type=
"text"
name=
"link_keeng"
value=
""
class=
"form-control"
style=
"width:100%;"
placeholder=
"Nhập Link Keeng"
/>
</div>
</div>
<div
class=
"form-group"
>
<div
class=
"col-lg-3"
>
<a
href=
"
<?php
echo
base_url
()
.
'backend/cmsArtist/listArtist'
?>
"
onclick=
"return confirm('Bạn có chắc chắn muốn quay lại Danh sách không?')"
>
<button
type=
"button"
class=
"btn btn-sm btn-default"
>
<i
class=
"ace-icon fa fa-arrow-left"
></i>
Quay lại
</button>
</a>
</div>
<div
class=
"col-lg-4"
>
<button
class=
"btn btn-sm btn-primary"
id=
"add_artists"
name=
"btnSave"
>
<i
class=
"ace-icon fa fa-check bigger-110"
></i>
Lưu lại
</button>
<button
class=
"btn btn-sm"
type=
"reset"
>
<i
class=
"ace-icon fa fa-undo bigger-110"
></i>
Xóa form
</button>
</div>
</div>
</form>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<!-- /.row -->
<script>
$
(
document
).
ready
(
function
()
{
...
...
@@ -244,8 +390,141 @@ $(document).ready(function() {
})
});
//Hiển thị nút thêm mới nghệ sĩ
$
(
'#add_composer'
).
hide
();
$
(
'.chosen-single'
).
click
(
function
()
{
$
(
'#add_composer'
).
hide
();
var
count
=
0
;
var
count1
=
0
;
$
(
'.chosen-with-drop .chosen-drop .chosen-search input'
).
keyup
(
function
()
{
count
=
$
(
".chosen-with-drop .chosen-drop .no-results"
).
size
();
count1
=
$
(
".chosen-with-drop .chosen-drop .active-result"
).
size
();
var
keywork1
=
$
(
'.chosen-with-drop .chosen-drop .chosen-search input'
).
val
();
if
(
count1
>
0
&&
keywork1
!=
''
)
{
if
(
count
==
1
)
{
$
(
'#add_composer'
).
hide
();
}
else
if
(
count
==
0
)
{
$
(
'#add_composer'
).
hide
();
}
}
else
{
if
(
count
==
1
)
{
$
(
'#add_composer'
).
show
();
}
else
if
(
count
==
0
)
{
$
(
'#add_composer'
).
hide
();
}
}
});
});
});
var
url
=
'
<?php
echo
base_url
()
.
'backend/cmsArtist/addArtistAjax'
;
?>
'
;
//Thêm mới nghệ sĩ
$
(
'#add_artists'
).
click
(
function
(
e
)
{
$
(
'#err'
).
empty
();
e
.
preventDefault
();
var
formData
=
new
FormData
();
//append some non-form data also
formData
.
append
(
'username'
,
$
(
"input[name='username']"
).
val
());
formData
.
append
(
'email'
,
$
(
"input[name='email']"
).
val
());
formData
.
append
(
'full_name'
,
$
(
"input[name='full_name']"
).
val
());
formData
.
append
(
'link_zing'
,
$
(
"input[name='link_zing']"
).
val
());
formData
.
append
(
'link_nct'
,
$
(
"input[name='link_nct']"
).
val
());
formData
.
append
(
'link_keeng'
,
$
(
"input[name='link_keeng']"
).
val
());
$
.
ajax
({
url
:
url
,
type
:
'POST'
,
data
:
formData
,
dataType
:
'json'
,
processData
:
false
,
contentType
:
false
,
success
:
function
(
data
)
{
if
(
data
[
'check_username'
])
{
$
(
'#err'
).
append
(
data
[
'check_username'
]);
$
(
'#err-username'
).
addClass
(
'has-error'
);
}
else
$
(
'#err-username'
).
removeClass
(
'has-error'
);
if
(
data
[
'check_email'
])
{
$
(
'#err'
).
append
(
data
[
'check_email'
]);
$
(
'#err-email'
).
addClass
(
'has-error'
);
}
else
$
(
'#err-email'
).
removeClass
(
'has-error'
);
if
(
data
[
'success'
]){
$
(
"#form_add_artist"
).
trigger
(
"reset"
);
alert
(
'Tạo nghệ sĩ thành công!'
);
location
.
reload
(
true
);
$
(
'#myModal'
).
modal
(
'hide'
);
}
}
});
});
// validation
$
(
'#add_composer'
).
click
(
function
()
{
var
regex
=
/^
([
a-zA-Z0-9_.+-
])
+
\@(([
a-zA-Z0-9-
])
+
\.)
+
([
a-zA-Z0-9
]{2,4})
+$/
;
$
(
"#add_artists"
).
attr
(
"disabled"
,
true
);
$
(
"input[name='username']"
).
keyup
(
function
(){
$
(
'#err'
).
empty
();
if
(
$
(
"input[name='username']"
).
val
()
==
''
)
{
$
(
'#err'
).
append
(
'Vui lòng nhập username'
);
$
(
'#err-username'
).
addClass
(
'has-error'
);
}
else
{
$
(
'#err-username'
).
removeClass
(
'has-error'
);
$
(
'#err-username'
).
addClass
(
'has-success'
);
}
var
full_name
=
$
(
"input[name='full_name']"
).
val
();
var
email
=
$
(
"input[name='email']"
).
val
();
var
username
=
$
(
"input[name='username']"
).
val
();
validation
(
username
,
email
,
full_name
);
});
$
(
"input[name='email']"
).
keyup
(
function
(){
$
(
'#err'
).
empty
();
if
(
$
(
"input[name='email']"
).
val
()
==
''
)
{
$
(
'#err'
).
append
(
'Vui lòng nhập email'
);
$
(
'#err-email'
).
addClass
(
'has-error'
);
}
else
{
var
email_vali
=
regex
.
test
(
$
(
"input[name='email']"
).
val
());
if
(
email_vali
==
false
)
{
$
(
'#err'
).
append
(
'Vui lòng nhập đúng email'
);
$
(
'#err-email'
).
addClass
(
'has-error'
);
}
else
{
$
(
'#err-email'
).
removeClass
(
'has-error'
);
$
(
'#err-email'
).
addClass
(
'has-success'
);
}
}
var
full_name
=
$
(
"input[name='full_name']"
).
val
();
var
email
=
$
(
"input[name='email']"
).
val
();
var
username
=
$
(
"input[name='username']"
).
val
();
validation
(
username
,
email
,
full_name
);
});
$
(
"input[name='full_name']"
).
keyup
(
function
(){
if
(
$
(
"input[name='full_name']"
).
val
()
==
''
)
{
$
(
'#err'
).
append
(
'Vui lòng nhập họ tên'
);
$
(
'.err-full-name'
).
addClass
(
'has-error'
);
}
else
{
$
(
'#err'
).
empty
();
$
(
'.err-full-name'
).
removeClass
(
'has-error'
);
$
(
'.err-full-name'
).
addClass
(
'has-success'
);
}
var
full_name
=
$
(
"input[name='full_name']"
).
val
();
var
email
=
$
(
"input[name='email']"
).
val
();
var
username
=
$
(
"input[name='username']"
).
val
();
validation
(
username
,
email
,
full_name
);
});
});
// validation
function
validation
(
username
,
email
,
full_name
)
{
var
regex
=
/^
([
a-zA-Z0-9_.+-
])
+
\@(([
a-zA-Z0-9-
])
+
\.)
+
([
a-zA-Z0-9
]{2,4})
+$/
;
var
email_vali
=
regex
.
test
(
email
);
if
(
full_name
!=
''
&&
email_vali
==
true
&&
username
!=
''
)
{
$
(
"#add_artists"
).
attr
(
"disabled"
,
false
);
}
else
{
$
(
"#add_artists"
).
attr
(
"disabled"
,
true
);
}
}
function
show_src_option
(
status
)
{
if
(
status
==
'nct'
)
{
$
(
'#nct_id'
).
show
();
...
...
application/views/backend/cms_track/edit_track_view.php
View file @
123bc1cd
...
...
@@ -29,7 +29,57 @@ $input_artist = array(
'class'
=>
''
,
'style'
=>
'width: 100%'
,
);
$input_username
=
array
(
'name'
=>
'username'
,
'type'
=>
'text'
,
'value'
=>
isset
(
$username
)
?
$username
:
''
,
'placeholder'
=>
'Nhập username'
,
'class'
=>
''
,
'style'
=>
'width: 100%'
,
'min'
=>
1
,
'max'
=>
50
);
$input_email
=
array
(
'name'
=>
'email'
,
'type'
=>
'email'
,
'value'
=>
isset
(
$email
)
?
$email
:
''
,
'placeholder'
=>
'Nhập pemail'
,
'class'
=>
''
,
'style'
=>
'width: 100%'
,
);
$input_full_name
=
array
(
'name'
=>
'full_name'
,
'type'
=>
'text'
,
'value'
=>
isset
(
$full_name
)
?
$full_name
:
''
,
'placeholder'
=>
'Nhập tên đầy đủ'
,
'class'
=>
''
,
'style'
=>
'width: 100%'
,
);
$input_link_zing
=
array
(
'name'
=>
'link_zing'
,
'type'
=>
'text'
,
'value'
=>
isset
(
$link_zing
)
?
$link_zing
:
''
,
'placeholder'
=>
'Nhập Link Zingmp3'
,
'class'
=>
''
,
'style'
=>
'width: 100%'
,
);
$input_link_nct
=
array
(
'name'
=>
'link_nct'
,
'type'
=>
'text'
,
'value'
=>
isset
(
$link_nct
)
?
$link_nct
:
''
,
'placeholder'
=>
'Nhập link NCT'
,
'class'
=>
''
,
'style'
=>
'width: 100%'
,
);
$input_link_keeng
=
array
(
'name'
=>
'link_keeng'
,
'type'
=>
'text'
,
'value'
=>
isset
(
$link_keeng
)
?
$link_keeng
:
''
,
'placeholder'
=>
'Nhập link Keeng'
,
'class'
=>
''
,
'style'
=>
'width: 100%'
,
);
?>
<div
class=
"row"
>
<div
class=
"widget-box"
>
...
...
@@ -105,6 +155,9 @@ $input_artist = array(
<?php
endforeach
;
?>
</select>
</div>
<div
id=
"add_composer"
>
<a
href=
"#myModal"
role=
"button"
class=
"btn btn-success"
data-toggle=
"modal"
>
Thêm nghệ sĩ
</a>
</div>
</div>
<div
class=
"form-group"
>
...
...
@@ -142,6 +195,98 @@ $input_artist = array(
</div>
</div>
<div
id=
"myModal"
class=
"modal fade"
tabindex=
"-1"
role=
"dialog"
aria-labelledby=
"myModalLabel"
aria-hidden=
"true"
>
<div
class=
"modal-dialog"
>
<div
class=
"modal-content"
>
<div
class=
"modal-header"
>
<h3
id=
"myModalLabel"
>
Thêm mới Ca sĩ/Nhạc sĩ
</h3>
<button
type=
"button"
class=
"close"
data-dismiss=
"modal"
aria-hidden=
"true"
>
×
</button>
</div>
<div
class=
"modal-body"
>
<div
class=
"row"
>
<div
class=
"widget-box"
>
<div
class=
"widget-body"
>
<div
class=
"widget-main"
>
<form
id=
"form_add_artist"
method=
"POST"
class=
"form-horizontal"
>
<span
id=
"err"
class=
"text-danger"
></span>
<div
class=
"form-group"
>
<label
class=
"col-lg-3"
></label>
<div
class=
"col-lg-3"
>
<input
type=
"hidden"
name=
"id"
value=
""
/>
</div>
</div>
<div
class=
"form-group"
id=
"err-username"
>
<label
class=
"col-lg-3"
>
Username (*)
</label>
<div
class=
"col-lg-3"
>
<input
type=
"text"
name=
"username"
value=
""
class=
"form-control"
style=
"width:100%;"
placeholder=
"Nhập username"
/>
</div>
<div><span
name
></span></div>
</div>
<div
class=
"form-group"
id=
"err-email"
>
<label
class=
"col-lg-3"
>
Email (*)
</label>
<div
class=
"col-lg-3"
>
<input
type=
"email"
name=
"email"
value=
""
class=
"form-control"
style=
"width:100%;"
placeholder=
"Nhập email"
/>
</div>
</div>
<div
class=
"form-group err-full-name"
>
<label
class=
"col-lg-3"
>
Tên đầu đủ (*)
</label>
<div
class=
"col-lg-3"
>
<input
type=
"text"
name=
"full_name"
value=
""
class=
"form-control"
style=
"width:100%;"
placeholder=
"Nhập họ tên đầy đủ"
/>
</div>
</div>
<div
class=
"form-group"
>
<label
class=
"col-lg-3"
>
Link Zingmp3
</label>
<div
class=
"col-lg-3"
>
<input
type=
"text"
name=
"link_zing"
value=
""
class=
"form-control"
style=
"width:100%;"
placeholder=
"Nhập link ZingMp3"
/>
</div>
</div>
<div
class=
"form-group"
>
<label
class=
"col-lg-3"
>
Link Nhạc của tui
</label>
<div
class=
"col-lg-3"
>
<input
type=
"text"
name=
"link_nct"
value=
""
class=
"form-control"
style=
"width:100%;"
placeholder=
"Nhập link NCT"
/>
</div>
</div>
<div
class=
"form-group"
>
<label
class=
"col-lg-3"
>
Link Keeng
</label>
<div
class=
"col-lg-3"
>
<input
type=
"text"
name=
"link_keeng"
value=
""
class=
"form-control"
style=
"width:100%;"
placeholder=
"Nhập Link Keeng"
/>
</div>
</div>
<div
class=
"form-group"
>
<div
class=
"col-lg-3"
>
<a
href=
"
<?php
echo
base_url
()
.
'backend/cmsArtist/listArtist'
?>
"
onclick=
"return confirm('Bạn có chắc chắn muốn quay lại Danh sách không?')"
>
<button
type=
"button"
class=
"btn btn-sm btn-default"
>
<i
class=
"ace-icon fa fa-arrow-left"
></i>
Quay lại
</button>
</a>
</div>
<div
class=
"col-lg-4"
>
<button
class=
"btn btn-sm btn-primary"
id=
"add_artists"
name=
"btnSave"
>
<i
class=
"ace-icon fa fa-check bigger-110"
></i>
Lưu lại
</button>
<button
class=
"btn btn-sm"
type=
"reset"
>
<i
class=
"ace-icon fa fa-undo bigger-110"
></i>
Xóa form
</button>
</div>
</div>
</form>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<!-- /.row -->
<script>
$
(
document
).
ready
(
function
()
{
...
...
@@ -169,5 +314,148 @@ $(document).ready(function() {
});
})
});
//Hiển thị nút thêm mới nghệ sĩ
$
(
'#add_composer'
).
hide
();
$
(
'.chosen-single'
).
click
(
function
()
{
$
(
'#add_composer'
).
hide
();
var
count
=
0
;
var
count1
=
0
;
$
(
'.chosen-with-drop .chosen-drop .chosen-search input'
).
keyup
(
function
()
{
count
=
$
(
".chosen-with-drop .chosen-drop .no-results"
).
size
();
count1
=
$
(
".chosen-with-drop .chosen-drop .active-result"
).
size
();
var
keywork1
=
$
(
'.chosen-with-drop .chosen-drop .chosen-search input'
).
val
();
if
(
count1
>
0
&&
keywork1
!=
''
)
{
if
(
count
==
1
)
{
$
(
'#add_composer'
).
hide
();
}
else
if
(
count
==
0
)
{
$
(
'#add_composer'
).
hide
();
}
}
else
{
if
(
count
==
1
)
{
$
(
'#add_composer'
).
show
();
}
else
if
(
count
==
0
)
{
$
(
'#add_composer'
).
hide
();
}
}
});
});
});
var
url
=
'
<?php
echo
base_url
()
.
'backend/cmsArtist/addArtistAjax'
;
?>
'
;
//Thêm mới nghệ sĩ
$
(
'#add_artists'
).
click
(
function
(
e
)
{
$
(
'#err'
).
empty
();
e
.
preventDefault
();
var
formData
=
new
FormData
();
//append some non-form data also
formData
.
append
(
'username'
,
$
(
"input[name='username']"
).
val
());
formData
.
append
(
'email'
,
$
(
"input[name='email']"
).
val
());
formData
.
append
(
'full_name'
,
$
(
"input[name='full_name']"
).
val
());
formData
.
append
(
'link_zing'
,
$
(
"input[name='link_zing']"
).
val
());
formData
.
append
(
'link_nct'
,
$
(
"input[name='link_nct']"
).
val
());
formData
.
append
(
'link_keeng'
,
$
(
"input[name='link_keeng']"
).
val
());
$
.
ajax
({
url
:
url
,
type
:
'POST'
,
data
:
formData
,
dataType
:
'json'
,
processData
:
false
,
contentType
:
false
,
success
:
function
(
data
)
{
if
(
data
[
'check_username'
])
{
$
(
'#err'
).
append
(
data
[
'check_username'
]);
$
(
'#err-username'
).
addClass
(
'has-error'
);
}
else
$
(
'#err-username'
).
removeClass
(
'has-error'
);
if
(
data
[
'check_email'
])
{
$
(
'#err'
).
append
(
data
[
'check_email'
]);
$
(
'#err-email'
).
addClass
(
'has-error'
);
}
else
$
(
'#err-email'
).
removeClass
(
'has-error'
);
if
(
data
[
'success'
]){
$
(
"#form_add_artist"
).
trigger
(
"reset"
);
alert
(
'Tạo nghệ sĩ thành công!'
);
location
.
reload
(
true
);
$
(
'#myModal'
).
modal
(
'hide'
);
}
}
});
});
// validation
$
(
'#add_composer'
).
click
(
function
()
{
var
regex
=
/^
([
a-zA-Z0-9_.+-
])
+
\@(([
a-zA-Z0-9-
])
+
\.)
+
([
a-zA-Z0-9
]{2,4})
+$/
;
$
(
"#add_artists"
).
attr
(
"disabled"
,
true
);
$
(
"input[name='username']"
).
keyup
(
function
(){
$
(
'#err'
).
empty
();
if
(
$
(
"input[name='username']"
).
val
()
==
''
)
{
$
(
'#err'
).
append
(
'Vui lòng nhập username'
);
$
(
'#err-username'
).
addClass
(
'has-error'
);
}
else
{
$
(
'#err-username'
).
removeClass
(
'has-error'
);
$
(
'#err-username'
).
addClass
(
'has-success'
);
}
var
full_name
=
$
(
"input[name='full_name']"
).
val
();
var
email
=
$
(
"input[name='email']"
).
val
();
var
username
=
$
(
"input[name='username']"
).
val
();
validation
(
username
,
email
,
full_name
);
});
$
(
"input[name='email']"
).
keyup
(
function
(){
$
(
'#err'
).
empty
();
if
(
$
(
"input[name='email']"
).
val
()
==
''
)
{
$
(
'#err'
).
append
(
'Vui lòng nhập email'
);
$
(
'#err-email'
).
addClass
(
'has-error'
);
}
else
{
var
email_vali
=
regex
.
test
(
$
(
"input[name='email']"
).
val
());
if
(
email_vali
==
false
)
{
$
(
'#err'
).
append
(
'Vui lòng nhập đúng email'
);
$
(
'#err-email'
).
addClass
(
'has-error'
);
}
else
{
$
(
'#err-email'
).
removeClass
(
'has-error'
);
$
(
'#err-email'
).
addClass
(
'has-success'
);
}
}
var
full_name
=
$
(
"input[name='full_name']"
).
val
();
var
email
=
$
(
"input[name='email']"
).
val
();
var
username
=
$
(
"input[name='username']"
).
val
();
validation
(
username
,
email
,
full_name
);
});
$
(
"input[name='full_name']"
).
keyup
(
function
(){
if
(
$
(
"input[name='full_name']"
).
val
()
==
''
)
{
$
(
'#err'
).
append
(
'Vui lòng nhập họ tên'
);
$
(
'.err-full-name'
).
addClass
(
'has-error'
);
}
else
{
$
(
'#err'
).
empty
();
$
(
'.err-full-name'
).
removeClass
(
'has-error'
);
$
(
'.err-full-name'
).
addClass
(
'has-success'
);
}
var
full_name
=
$
(
"input[name='full_name']"
).
val
();
var
email
=
$
(
"input[name='email']"
).
val
();
var
username
=
$
(
"input[name='username']"
).
val
();
validation
(
username
,
email
,
full_name
);
});
});
// validation
function
validation
(
username
,
email
,
full_name
)
{
var
regex
=
/^
([
a-zA-Z0-9_.+-
])
+
\@(([
a-zA-Z0-9-
])
+
\.)
+
([
a-zA-Z0-9
]{2,4})
+$/
;
var
email_vali
=
regex
.
test
(
email
);
if
(
full_name
!=
''
&&
email_vali
==
true
&&
username
!=
''
)
{
$
(
"#add_artists"
).
attr
(
"disabled"
,
false
);
}
else
{
$
(
"#add_artists"
).
attr
(
"disabled"
,
true
);
}
}
function
show_src_option
(
status
)
{
if
(
status
==
'nct'
)
{
$
(
'#nct_id'
).
show
();
}
else
$
(
'#nct_id'
).
hide
();
}
</script>
\ No newline at end of file
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