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
6c613dcf
Commit
6c613dcf
authored
Mar 10, 2020
by
Trần Văn Minh
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update chỉnh sửa ca sĩ/ nhạc sĩ bài hát
parent
fac721d2
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
46 additions
and
11 deletions
+46
-11
CmsTrack.php
application/controllers/backend/CmsTrack.php
+14
-5
Track_model.php
application/models/Track_model.php
+11
-3
list_track_view.php
application/views/backend/ajax/cms_track/list_track_view.php
+8
-0
edit_track_view.php
application/views/backend/cms_track/edit_track_view.php
+13
-3
No files found.
application/controllers/backend/CmsTrack.php
View file @
6c613dcf
...
...
@@ -49,9 +49,18 @@ class CmsTrack extends CI_Controller
public
function
editTrack
(
$contest_id
,
$id_user
=
''
,
$id_artist
=
''
)
{
$this
->
_data
[
'contest'
]
=
$contest
=
$this
->
track_model
->
getById
(
$contest_id
,
$id_user
,
$id_artist
);
$this
->
_data
[
'track_artists'
]
=
$track_artists
=
$this
->
track_model
->
getByIdUser
(
'track_artists'
,
$id_artist
);
$this
->
_data
[
'track_user'
]
=
$track_user
=
$this
->
track_model
->
getByIdUser
(
'track_user'
,
$id_user
);
$track_user
=
''
;
$this
->
_data
[
'track_artists'
]
=
$track_artists
=
''
;
if
(
$id_user
!=
0
)
{
$track_user
=
$this
->
track_model
->
getByIdUser
(
'track_user'
,
$id_user
);
$this
->
_data
[
'track_user'
]
=
$track_user
;
}
if
(
$id_artist
!=
0
)
{
$track_artists
=
$this
->
track_model
->
getByIdUser
(
'track_artists'
,
$id_artist
);
$this
->
_data
[
'track_artists'
]
=
$track_artists
;
}
$this
->
_data
[
'list_user'
]
=
$list_user
=
$this
->
track_model
->
getListUsers
();
// print_r($id_user.'Nhạc sĩ'.$id_artist);
// Kiểm tra trùng giá trị nếu thay đổi ở form
//Thiết lập validate
...
...
@@ -89,14 +98,14 @@ class CmsTrack extends CI_Controller
$title
=
$this
->
input
->
post
(
'title'
);
$update_singer
=
$this
->
input
->
post
(
'update_singer'
);
$singer
=
$track_user
[
0
][
'user_id'
]
;
$artist
=
$track_artists
[
0
][
'user_id'
]
;
$singer
=
(
$track_user
!=
''
)
?
$track_user
[
0
][
'user_id'
]
:
''
;
$artist
=
(
$track_artists
!=
''
)
?
$track_artists
[
0
][
'user_id'
]
:
''
;
$update_artist
=
$this
->
input
->
post
(
'update_artist'
);
$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($
id_singer.$id_artists
);
// die($
active_artist.$active_singer.'ca sĩ'.$id_singer.'/'.$singer.'nhạc sĩ'.$id_artists.'/'.$artist
);
$this
->
track_model
->
update_track_artists
(
$contest_id
,
$id_artists
,
$id_artist
,
$active_artist
);
$this
->
track_model
->
update_track_user
(
$contest_id
,
$id_singer
,
$id_user
,
$active_singer
);
$this
->
track_model
->
update
(
$contest_id
,
$title
);
...
...
application/models/Track_model.php
View file @
6c613dcf
...
...
@@ -31,7 +31,9 @@ class Track_model extends CI_Model
$this
->
db
->
where
(
'id'
,
$user_id
);
$query
=
$this
->
db
->
get
(
'users'
)
->
result_array
();
$this
->
db
->
set
(
'user_id'
,
$user_id
);
if
(
$query
)
{
$this
->
db
->
set
(
'name'
,
$query
[
0
][
'full_name'
]);
}
if
(
$active
==
'insert'
)
{
$this
->
db
->
set
(
'track_id'
,
$id_track
);
$this
->
db
->
insert
(
'track_artists'
);
...
...
@@ -48,7 +50,9 @@ class Track_model extends CI_Model
$this
->
db
->
where
(
'id'
,
$user_id
);
$query
=
$this
->
db
->
get
(
'users'
)
->
result_array
();
$this
->
db
->
set
(
'user_id'
,
$user_id
);
if
(
$query
)
{
$this
->
db
->
set
(
'name'
,
$query
[
0
][
'full_name'
]);
}
if
(
$active
==
'insert'
)
{
$this
->
db
->
set
(
'track_id'
,
$id_track
);
$this
->
db
->
insert
(
'track_user'
);
...
...
@@ -76,9 +80,13 @@ class Track_model extends CI_Model
}
public
function
getByIdUser
(
$table
,
$id
)
{
$this
->
db
->
select
(
"*"
);
$this
->
db
->
where
(
'id'
,
$id
);
return
$this
->
db
->
get
(
$table
)
->
result_array
();
if
(
$id
!=
0
)
{
$this
->
db
->
select
(
"*"
);
$this
->
db
->
where
(
'id'
,
$id
);
return
$this
->
db
->
get
(
$table
)
->
result_array
();
}
else
return
false
;
}
/**
* Lay cuoc thi hien hanh
...
...
application/views/backend/ajax/cms_track/list_track_view.php
View file @
6c613dcf
...
...
@@ -19,6 +19,14 @@
<td
style=
"text-align: left"
>
<?php
echo
(
$data
[
'singer_name'
])
?
$data
[
'singer_name'
]
:
$data
[
'singer_name2'
];
?>
</td>
<td
style=
"text-align: left"
>
<?php
echo
(
$data
[
'composer_name'
])
?
$data
[
'composer_name'
]
:
$data
[
'composer_name2'
];
?>
</td>
<td
style=
"text-align: center"
>
<?php
if
(
!
$data
[
'id_user'
])
{
$data
[
'id_user'
]
=
0
;
}
if
(
!
$data
[
'id_artist'
])
{
$data
[
'id_artist'
]
=
0
;
}
?>
<a
href=
"
<?php
echo
base_url
()
.
'backend/cmsTrack/editTrack/'
.
$data
[
'id'
]
.
'/'
.
$data
[
'id_user'
]
.
'/'
.
$data
[
'id_artist'
];
?>
"
title=
"Xem chi tiết"
>
<i
class=
"ace-icon fa fa-pencil bigger-130"
></i>
</a>
...
...
application/views/backend/cms_track/edit_track_view.php
View file @
6c613dcf
...
...
@@ -12,7 +12,7 @@ $input_title = array(
$input_singer
=
array
(
'name'
=>
'singer'
,
'type'
=>
'text'
,
'value'
=>
isset
(
$singer
)
?
$singer
:
$track_user
[
0
][
'name'
]
,
'value'
=>
isset
(
$singer
)
?
$singer
:
isset
(
$track_user
[
0
][
'id'
])
?
$track_user
[
0
][
'name'
]
:
''
,
'placeholder'
=>
''
,
'class'
=>
''
,
'disabled'
=>
'true'
,
...
...
@@ -24,7 +24,7 @@ $input_artist = array(
'name'
=>
'artist'
,
'type'
=>
'text'
,
'disabled'
=>
'true'
,
'value'
=>
isset
(
$artist
)
?
$artist
:
$track_artists
[
0
][
'name'
]
,
'value'
=>
isset
(
$artist
)
?
$artist
:
isset
(
$track_artists
[
0
][
'id'
])
?
$track_artists
[
0
][
'name'
]
:
''
,
'placeholder'
=>
''
,
'class'
=>
''
,
'style'
=>
'width: 100%'
,
...
...
@@ -40,7 +40,17 @@ $input_artist = array(
<div
class=
"widget-main"
>
<?php
$attributes
=
array
(
'class'
=>
'form-horizontal'
,
'id'
=>
'myform'
);
echo
form_open
(
base_url
(
'backend/cmsTrack/editTrack/'
.
$contest
[
0
][
'id'
]
.
'/'
.
$track_user
[
0
][
'id'
]
.
'/'
.
$track_artists
[
0
][
'id'
]),
$attributes
);
if
(
!
$track_user
[
0
][
'id'
])
{
$user_singer
=
0
;
}
else
{
$user_singer
=
$track_user
[
0
][
'id'
];
}
if
(
!
$track_artists
)
{
$user_artist
=
0
;
}
else
{
$user_artist
=
$track_artists
[
0
][
'id'
];
}
echo
form_open
(
base_url
(
'backend/cmsTrack/editTrack/'
.
$contest
[
0
][
'id'
]
.
'/'
.
$user_singer
.
'/'
.
$user_artist
),
$attributes
);
?>
<div
class=
"form-group"
>
<label
class=
"col-lg-3"
></label>
...
...
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