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
f50902f8
Commit
f50902f8
authored
Apr 13, 2020
by
Phạm Văn Đoan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixbug khi thêm ca sĩ cho bài hát
parent
f08f7ee8
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
40 additions
and
19 deletions
+40
-19
CmsTrack.php
application/controllers/backend/CmsTrack.php
+3
-2
Track_model.php
application/models/Track_model.php
+22
-6
list_track_view.php
application/views/backend/cms_track/list_track_view.php
+15
-11
No files found.
application/controllers/backend/CmsTrack.php
View file @
f50902f8
...
@@ -300,7 +300,7 @@ class CmsTrack extends CI_Controller
...
@@ -300,7 +300,7 @@ class CmsTrack extends CI_Controller
}
else
{
}
else
{
$singer
=
$this
->
input
->
post
(
'singer'
);
$singer
=
$this
->
input
->
post
(
'singer'
);
$this
->
track_model
->
add_singer
(
$singer
,
$track_id
);
$this
->
track_model
->
add_singer
(
$singer
,
$track_id
);
$this
->
session
->
set_flashdata
(
'success'
,
'
Thêm c
a sĩ vào bài hát thành công'
);
$this
->
session
->
set_flashdata
(
'success'
,
'
Cập nhật C
a sĩ vào bài hát thành công'
);
// Ghi log
// Ghi log
$this
->
actionlog_model
->
add
(
'ADDED'
,
'Thêm mới Ca sĩ cho bài hát.'
,
'Actionlog_model'
,
'tracks'
,
$track_id
);
$this
->
actionlog_model
->
add
(
'ADDED'
,
'Thêm mới Ca sĩ cho bài hát.'
,
'Actionlog_model'
,
'tracks'
,
$track_id
);
...
@@ -330,6 +330,7 @@ class CmsTrack extends CI_Controller
...
@@ -330,6 +330,7 @@ class CmsTrack extends CI_Controller
// Ghi log
// Ghi log
$this
->
actionlog_model
->
add
(
'DELETED'
,
'Xóa Ca sĩ khỏi bài hát.'
,
'Actionlog_model'
,
'tracks'
,
$track_id
);
$this
->
actionlog_model
->
add
(
'DELETED'
,
'Xóa Ca sĩ khỏi bài hát.'
,
'Actionlog_model'
,
'tracks'
,
$track_id
);
$this
->
session
->
set_flashdata
(
'success'
,
'Xóa Ca sĩ khỏi bài hát thành công'
);
redirect
(
base_url
(
'backend/cmsTrack/showTrack/'
.
$track_id
));
redirect
(
base_url
(
'backend/cmsTrack/showTrack/'
.
$track_id
));
}
}
...
@@ -367,7 +368,7 @@ class CmsTrack extends CI_Controller
...
@@ -367,7 +368,7 @@ class CmsTrack extends CI_Controller
}
else
{
}
else
{
$composer
=
$this
->
input
->
post
(
'composer'
);
$composer
=
$this
->
input
->
post
(
'composer'
);
$this
->
track_model
->
add_artist
(
$composer
,
$track_id
);
$this
->
track_model
->
add_artist
(
$composer
,
$track_id
);
$this
->
session
->
set_flashdata
(
'success'
,
'
Thêm
Nhạc sĩ vào bài hát thành công'
);
$this
->
session
->
set_flashdata
(
'success'
,
'
Cập nhật
Nhạc sĩ vào bài hát thành công'
);
// Ghi log
// Ghi log
$this
->
actionlog_model
->
add
(
'ADDED'
,
'Thêm Nhạc sĩ cho bài hát.'
,
'Actionlog_model'
,
'tracks'
,
$track_id
);
$this
->
actionlog_model
->
add
(
'ADDED'
,
'Thêm Nhạc sĩ cho bài hát.'
,
'Actionlog_model'
,
'tracks'
,
$track_id
);
...
...
application/models/Track_model.php
View file @
f50902f8
...
@@ -28,15 +28,31 @@ class Track_model extends CI_Model
...
@@ -28,15 +28,31 @@ class Track_model extends CI_Model
*/
*/
public
function
add_singer
(
$user_id
,
$track_id
)
public
function
add_singer
(
$user_id
,
$track_id
)
{
{
// Kiểm tra tồn tại singer
$this
->
db
->
select
(
'full_name'
);
$this
->
db
->
select
(
'full_name'
);
$this
->
db
->
where
(
'id'
,
$user_id
);
$this
->
db
->
where
(
'id'
,
$user_id
);
$query
=
$this
->
db
->
get
(
'users'
)
->
result_array
();
$query_user
=
$this
->
db
->
get
(
$this
->
_table_user
)
->
result_array
();
if
(
$query
)
{
if
(
$query_user
)
{
$this
->
db
->
set
(
'name'
,
$query
[
0
][
'full_name'
]);
// Kiểm tra tồn tại track
$this
->
db
->
select
(
'id'
);
$this
->
db
->
where
(
'id'
,
$track_id
);
$query_track
=
$this
->
db
->
get
(
$this
->
_table
)
->
result_array
();
if
(
$query_track
)
{
// Kiểm tra tồn tại track-singer
$this
->
db
->
select
(
'*'
);
$this
->
db
->
where
(
'track_id'
,
$track_id
);
$this
->
db
->
where
(
'user_id'
,
$user_id
);
$this
->
db
->
limit
(
1
);
$query_singer
=
$this
->
db
->
get
(
$this
->
_table_track_user
)
->
result_array
();
// Nếu chưa có thì insert, có rồi thì thôi
if
(
empty
(
$query_singer
))
{
$this
->
db
->
set
(
'track_id'
,
$track_id
);
$this
->
db
->
set
(
'user_id'
,
$user_id
);
$this
->
db
->
set
(
'name'
,
$query_user
[
0
][
'full_name'
]);
$this
->
db
->
insert
(
$this
->
_table_track_user
);
}
}
}
}
$this
->
db
->
set
(
'user_id'
,
$user_id
);
$this
->
db
->
set
(
'track_id'
,
$track_id
);
$this
->
db
->
insert
(
$this
->
_table_track_user
);
}
}
/**
/**
...
...
application/views/backend/cms_track/list_track_view.php
View file @
f50902f8
<?php
if
(
$this
->
session
->
flashdata
(
'success'
))
:
?>
<?php
if
(
$this
->
session
->
flashdata
(
'success'
))
:
?>
<div
class=
"row"
>
<div
class=
"row"
>
<div
class=
"alert alert-block alert-success"
style=
"margin-bottom: 5px"
>
<div
class=
"col-lg-12"
>
<button
type=
"button"
class=
"close"
data-dismiss=
"alert"
>
<div
class=
"alert alert-block alert-success"
style=
"margin-bottom: 5px"
>
<i
class=
"ace-icon fa fa-times"
></i>
<button
type=
"button"
class=
"close"
data-dismiss=
"alert"
>
</button>
<i
class=
"ace-icon fa fa-times"
></i>
<i
class=
"ace-icon fa fa-check green"
></i>
</button>
<?php
echo
$this
->
session
->
flashdata
(
'success'
);
?>
<i
class=
"ace-icon fa fa-check green"
></i>
<?php
echo
$this
->
session
->
flashdata
(
'success'
);
?>
</div>
</div>
</div>
</div>
</div>
<?php
endif
;
?>
<?php
endif
;
?>
<?php
if
(
$this
->
session
->
flashdata
(
'error'
))
:
?>
<?php
if
(
$this
->
session
->
flashdata
(
'error'
))
:
?>
<div
class=
"row"
>
<div
class=
"row"
>
<div
class=
"alert alert-block alert-danger"
style=
"margin-bottom: 5px"
>
<div
class=
"col-lg-12"
>
<button
type=
"button"
class=
"close"
data-dismiss=
"alert"
>
<div
class=
"alert alert-block alert-danger"
style=
"margin-bottom: 5px"
>
<button
type=
"button"
class=
"close"
data-dismiss=
"alert"
>
<i
class=
"ace-icon fa fa-times"
></i>
</button>
<i
class=
"ace-icon fa fa-times"
></i>
<i
class=
"ace-icon fa fa-times"
></i>
</button>
<?php
echo
$this
->
session
->
flashdata
(
'error'
);
?>
<i
class=
"ace-icon fa fa-times"
></i>
</div>
<?php
echo
$this
->
session
->
flashdata
(
'error'
);
?>
</div>
</div>
</div>
</div>
<?php
endif
;
?>
<?php
endif
;
?>
...
...
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