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
e4afa009
Commit
e4afa009
authored
Mar 11, 2020
by
Phạm Văn Đoan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
xử lý upload file
parent
6880f54a
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
36 additions
and
15 deletions
+36
-15
CmsTrack.php
application/controllers/backend/CmsTrack.php
+21
-8
Track_model.php
application/models/Track_model.php
+3
-2
admin_template_view.php
application/views/backend/admin_template_view.php
+4
-4
edit_track_view.php
application/views/backend/cms_track/edit_track_view.php
+8
-1
No files found.
application/controllers/backend/CmsTrack.php
View file @
e4afa009
...
...
@@ -106,16 +106,29 @@ class CmsTrack extends CI_Controller
(
$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
[
'allowed_types'
]
=
'gif|jpg|png'
;
$config
[
'max_size'
]
=
20480
;
$config
[
'max_width'
]
=
1024
;
$config
[
'max_height'
]
=
768
;
$this
->
load
->
library
(
'upload'
,
$config
);
if
(
$this
->
upload
->
do_upload
(
'avatar'
))
{
$upload_data
=
$this
->
upload
->
data
();
$db_art_path
=
$upload_path
.
'/'
.
$upload_data
[
'file_name'
];
}
$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
);
// Ghi log
// $this->mactionlog->add('UPDATED', 'Cập nhật Cuộc đua thành công!', 'Mactionlog', 'action_log', $contest_id);
//
$this
->
session
->
set_flashdata
(
'success'
,
'Cập nhật Cuộc đua thành công'
);
// }else{
// $this->session->set_flashdata('error', 'Cập nhật Cuộc đua không thành công');
// }
$this
->
track_model
->
update
(
$contest_id
,
$title
,
$db_art_path
);
$this
->
session
->
set_flashdata
(
'success'
,
'Cập nhật bài hát thành công'
);
redirect
(
base_url
()
.
'backend/cmsTrack/listTrack'
);
}
}
...
...
application/models/Track_model.php
View file @
e4afa009
...
...
@@ -17,9 +17,10 @@ class Track_model extends CI_Model
return
$insert_id
;
}
public
function
update
(
$id
,
$dataUpdate
)
public
function
update
(
$id
,
$dataUpdate
,
$art_path
)
{
$this
->
db
->
set
(
'title'
,
$dataUpdate
);
$this
->
db
->
set
(
'art'
,
$art_path
);
$this
->
db
->
where
(
'id'
,
$id
);
$this
->
db
->
update
(
$this
->
_table
);
}
...
...
@@ -68,7 +69,7 @@ class Track_model extends CI_Model
$this
->
db
->
select
(
$this
->
_table
.
'.*, track_user.name AS name_singer,
track_user.user_id AS id_singer,
track_artists.name AS artist,
track_artists.
clear_name AS clear_artists, track_artists.
id AS id_track_artist'
);
track_artists.id AS id_track_artist'
);
$this
->
db
->
from
(
$this
->
_table
);
$this
->
db
->
join
(
'track_user'
,
'track_user.track_id = tracks.id'
,
'left'
);
$this
->
db
->
join
(
'track_artists'
,
'track_artists.track_id = tracks.id'
,
'left'
);
...
...
application/views/backend/admin_template_view.php
View file @
e4afa009
...
...
@@ -203,7 +203,7 @@ $action = $CI->router->fetch_method();
</li>
<!-- Quan ly tai nguyen -->
<
li
class=
"
<?php
if
(
$controller
&&
$controller
==
'cmsResource'
)
echo
'active open'
?>
"
>
<
!--<li class="
<?php
/*if($controller && $controller == 'cmsResource') echo 'active open'*/
?>
">
<a href="#" class="dropdown-toggle">
<i class="menu-icon fa fa-camera"></i>
<span class="menu-text">QL Thư viện</span>
...
...
@@ -211,14 +211,14 @@ $action = $CI->router->fetch_method();
</a>
<b class="arrow"></b>
<ul class="submenu">
<li
class=
"
<?php
if
(
$action
&&
(
in_array
(
$action
,
array
(
'listResource'
))))
echo
'active'
?>
"
>
<a
href=
"
<?php
echo
base_url
(
'backend/cmsResource/listResource'
);
?>
"
>
<li class="
<?php
/*if($action && (in_array($action, array('listResource')))) echo 'active'*/
?>
">
<a href="
<?php
/*echo base_url('backend/cmsResource/listResource'); */
?>
">
<i class="menu-icon fa fa-caret-right"></i>Danh sách tài nguyên
</a>
<b class="arrow"></b>
</li>
</ul>
</li>
</li>
-->
<!-- Quan ly he thong -->
<?php
if
(
$CI
->
session
->
userdata
(
'group_id'
)
==
2
&&
$CI
->
session
->
userdata
(
'is_super'
)
==
1
)
:
?>
...
...
application/views/backend/cms_track/edit_track_view.php
View file @
e4afa009
...
...
@@ -50,7 +50,7 @@ $input_artist = array(
}
else
{
$user_artist
=
$track_artists
[
0
][
'id'
];
}
echo
form_open
(
base_url
(
'backend/cmsTrack/editTrack/'
.
$contest
[
0
][
'id'
]
.
'/'
.
$user_singer
.
'/'
.
$user_artist
),
$attributes
);
echo
form_open
_multipart
(
base_url
(
'backend/cmsTrack/editTrack/'
.
$contest
[
0
][
'id'
]
.
'/'
.
$user_singer
.
'/'
.
$user_artist
),
$attributes
);
?>
<div
class=
"form-group"
>
<label
class=
"col-lg-3"
></label>
...
...
@@ -116,6 +116,13 @@ $input_artist = array(
</div>
<div
class=
"form-group"
>
<label
class=
"col-lg-3"
>
Ảnh nhạc sĩ
</label>
<div
class=
"col-lg-3"
>
<input
type=
"file"
name=
"avatar"
size=
"20"
/>
</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?')"
>
...
...
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