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
a1416318
Commit
a1416318
authored
Apr 13, 2020
by
Phạm Văn Đoan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update lại tên file khi export
parent
66df9354
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
64 additions
and
48 deletions
+64
-48
CmsRanking.php
application/controllers/backend/CmsRanking.php
+12
-7
CmsTrack.php
application/controllers/backend/CmsTrack.php
+48
-39
list_by_daily_view.php
application/views/backend/cms_ranking/list_by_daily_view.php
+4
-2
No files found.
application/controllers/backend/CmsRanking.php
View file @
a1416318
...
@@ -135,6 +135,8 @@ class CmsRanking extends CI_Controller
...
@@ -135,6 +135,8 @@ class CmsRanking extends CI_Controller
*/
*/
public
function
exportReport
(
$type
,
$time
)
public
function
exportReport
(
$type
,
$time
)
{
{
ini_set
(
'max_execution_time'
,
-
1
);
// Ghi log
// Ghi log
$this
->
actionlog_model
->
add
(
'EXPORTED'
,
'Export BXH: '
.
$type
,
null
,
null
,
null
);
$this
->
actionlog_model
->
add
(
'EXPORTED'
,
'Export BXH: '
.
$type
,
null
,
null
,
null
);
...
@@ -149,7 +151,8 @@ class CmsRanking extends CI_Controller
...
@@ -149,7 +151,8 @@ class CmsRanking extends CI_Controller
case
'daily'
:
case
'daily'
:
if
(
$time
)
{
if
(
$time
)
{
$daily_at
=
date
(
'Y-m-d'
,
strtotime
(
$time
));
$daily_at
=
date
(
'Y-m-d'
,
strtotime
(
$time
));
$filename
=
'Daily-report-'
.
$daily_at
;
$filename
=
'Daily_report_'
.
date
(
'Y_m_d'
,
strtotime
(
$time
));
$sheet_name
=
'Daily-report-'
.
$daily_at
;
$reports
=
$this
->
track_model
->
getReportDaily
(
$daily_at
);
$reports
=
$this
->
track_model
->
getReportDaily
(
$daily_at
);
}
}
break
;
break
;
...
@@ -159,19 +162,21 @@ class CmsRanking extends CI_Controller
...
@@ -159,19 +162,21 @@ class CmsRanking extends CI_Controller
$date_range
=
MyHelper
::
getWeekDateRange
(
$week
,
$year
,
'd-m-Y'
);
$date_range
=
MyHelper
::
getWeekDateRange
(
$week
,
$year
,
'd-m-Y'
);
if
(
isset
(
$date_range
[
'start_week'
])
&&
isset
(
$date_range
[
'end_week'
]))
{
if
(
isset
(
$date_range
[
'start_week'
])
&&
isset
(
$date_range
[
'end_week'
]))
{
$name
=
date
(
'd
-m'
,
strtotime
(
$date_range
[
'start_week'
]))
.
'_'
.
date
(
'd-
m'
,
strtotime
(
$date_range
[
'end_week'
]));
$name
=
date
(
'd
_m'
,
strtotime
(
$date_range
[
'start_week'
]))
.
'__'
.
date
(
'd_
m'
,
strtotime
(
$date_range
[
'end_week'
]));
$
sheet_name
=
'Weekly-tuan'
.
((
$week
<
10
)
?
'0'
.
$time
:
$time
)
.
'_'
.
$name
;
$
filename
=
'Weekly_report_'
.
((
$week
<
10
)
?
'0'
.
$week
:
$week
)
.
'_'
.
$year
.
' ('
.
$name
.
')'
;
}
else
{
}
else
{
$
sheet_name
=
'Weekly-tuan'
.
((
$week
<
10
)
?
'0'
.
$time
:
$time
)
;
$
filename
=
'Weekly_report_'
.
((
$week
<
10
)
?
'0'
.
$week
:
$week
)
.
'_'
.
$year
;
}
}
$filename
=
'Weekly-tuan'
.
((
$week
<
10
)
?
'0'
.
$time
:
$time
);
$sheet_name
=
'Weekly-report-'
.
$time
;
$reports
=
$this
->
track_model
->
getReportWeekly
(
$week
,
$year
);
$reports
=
$this
->
track_model
->
getReportWeekly
(
$week
,
$year
);
break
;
break
;
case
'monthly'
:
case
'monthly'
:
$month
=
trim
(
$array_time
[
0
]);
$month
=
trim
(
$array_time
[
0
]);
$year
=
trim
(
$array_time
[
1
]);
$year
=
trim
(
$array_time
[
1
]);
$filename
=
'Monthly-'
.
((
$month
<
10
)
?
'0'
.
$time
:
$time
);
$filename
=
'Monthly_report_'
.
((
$month
<
10
)
?
'0'
.
$time
:
$time
);
$sheet_name
=
'Monthly-report-'
.
$time
;
$reports
=
$this
->
track_model
->
getReportMonthly
(
$month
,
$year
);
$reports
=
$this
->
track_model
->
getReportMonthly
(
$month
,
$year
);
break
;
break
;
...
@@ -232,7 +237,7 @@ class CmsRanking extends CI_Controller
...
@@ -232,7 +237,7 @@ class CmsRanking extends CI_Controller
// writer already created the first sheet for us, let's get it
// writer already created the first sheet for us, let's get it
$objSheet
=
$objPHPExcel
->
getActiveSheet
();
$objSheet
=
$objPHPExcel
->
getActiveSheet
();
// rename the sheet
// rename the sheet
$objSheet
->
setTitle
(
(
$type
==
'weekly'
)
?
$sheet_name
:
$file
name
);
$objSheet
->
setTitle
(
$sheet_
name
);
$objSheet
->
getCell
(
'A1'
)
->
setValue
(
"Rank"
);
$objSheet
->
getCell
(
'A1'
)
->
setValue
(
"Rank"
);
$objSheet
->
getCell
(
'B1'
)
->
setValue
(
"Song Title"
);
$objSheet
->
getCell
(
'B1'
)
->
setValue
(
"Song Title"
);
...
...
application/controllers/backend/CmsTrack.php
View file @
a1416318
...
@@ -19,6 +19,9 @@ class CmsTrack extends CI_Controller
...
@@ -19,6 +19,9 @@ class CmsTrack extends CI_Controller
$this
->
load
->
model
(
'actionlog_model'
);
$this
->
load
->
model
(
'actionlog_model'
);
}
}
/**
* Hiển thị ds bài hát
*/
public
function
listTrack
()
public
function
listTrack
()
{
{
$this
->
_data
[
'functionName'
]
=
'Track'
;
$this
->
_data
[
'functionName'
]
=
'Track'
;
...
@@ -28,6 +31,9 @@ class CmsTrack extends CI_Controller
...
@@ -28,6 +31,9 @@ class CmsTrack extends CI_Controller
$this
->
load
->
view
(
'backend/admin_template_view'
,
$this
->
_data
);
$this
->
load
->
view
(
'backend/admin_template_view'
,
$this
->
_data
);
}
}
/**
* Ajax xử lý lấy ds bài hát
*/
public
function
listTrackAjax
()
public
function
listTrackAjax
()
{
{
$data
=
array
();
$data
=
array
();
...
@@ -49,6 +55,13 @@ class CmsTrack extends CI_Controller
...
@@ -49,6 +55,13 @@ class CmsTrack extends CI_Controller
$this
->
load
->
view
(
'backend/ajax/cms_track/list_track_view'
,
$data
);
$this
->
load
->
view
(
'backend/ajax/cms_track/list_track_view'
,
$data
);
}
}
/**
* Hàm xử lý cập nhật bài hát
*
* @param $track_id
* @param string $id_user
* @param string $id_artist
*/
public
function
editTrack
(
$track_id
,
$id_user
=
''
,
$id_artist
=
''
)
public
function
editTrack
(
$track_id
,
$id_user
=
''
,
$id_artist
=
''
)
{
{
$this
->
_data
[
'contest'
]
=
$track
=
$this
->
track_model
->
getById
(
$track_id
);
$this
->
_data
[
'contest'
]
=
$track
=
$this
->
track_model
->
getById
(
$track_id
);
...
@@ -120,10 +133,8 @@ class CmsTrack extends CI_Controller
...
@@ -120,10 +133,8 @@ class CmsTrack extends CI_Controller
$config
[
'max_height'
]
=
768
;
$config
[
'max_height'
]
=
768
;
$this
->
load
->
library
(
'upload'
,
$config
);
$this
->
load
->
library
(
'upload'
,
$config
);
// if()
if
(
$this
->
upload
->
do_upload
(
'avatar'
))
{
if
(
$this
->
upload
->
do_upload
(
'avatar'
))
{
$upload_data
=
$this
->
upload
->
data
();
$upload_data
=
$this
->
upload
->
data
();
// MyHelper::echoPreDie('ac: '.$$upload_data);
$db_art_path
=
$upload_path
.
'/'
.
$upload_data
[
'file_name'
];
$db_art_path
=
$upload_path
.
'/'
.
$upload_data
[
'file_name'
];
}
}
$this
->
track_model
->
update
(
$track_id
,
$title
,
$db_art_path
);
$this
->
track_model
->
update
(
$track_id
,
$title
,
$db_art_path
);
...
@@ -207,46 +218,44 @@ class CmsTrack extends CI_Controller
...
@@ -207,46 +218,44 @@ class CmsTrack extends CI_Controller
if
(
$title
){
if
(
$title
){
$slug
=
MyHelper
::
genSlug
(
$title
);
$slug
=
MyHelper
::
genSlug
(
$title
);
$dataUpdate
=
array
(
$dataUpdate
=
array
(
'title'
=>
$title
,
'title'
=>
$title
,
'userid'
=>
$artist
,
'userid'
=>
$artist
,
'link'
=>
(
$source
==
'zing'
)
?
$link
:
''
,
'link'
=>
(
$source
==
'zing'
)
?
$link
:
''
,
'link_nct'
=>
(
$source
==
'nct'
)
?
$link
:
''
,
'link_nct'
=>
(
$source
==
'nct'
)
?
$link
:
''
,
'link_keeng'
=>
(
$source
==
'keeng'
)
?
$link
:
''
,
'link_keeng'
=>
(
$source
==
'keeng'
)
?
$link
:
''
,
'id_nct'
=>
$nct_id
,
'id_nct'
=>
$nct_id
,
'slug'
=>
$slug
,
'slug'
=>
$slug
,
'tag'
=>
'vmusic'
,
'tag'
=>
'vmusic'
,
'genre'
=>
1
,
'genre'
=>
1
,
'time'
=>
time
()
'time'
=>
time
()
);
);
$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
$db_art_path
=
''
;
$db_art_path
=
''
;
$upload_path
=
'uploads/tracks/arts'
;
$upload_path
=
'uploads/tracks/arts'
;
$upload_full_path
=
'/home/aseanvn/public_html/vmusicchart.dcv.vn/'
.
$upload_path
;
$upload_full_path
=
'/home/aseanvn/public_html/vmusicchart.dcv.vn/'
.
$upload_path
;
$config
[
'upload_path'
]
=
$upload_full_path
;
$config
[
'upload_path'
]
=
$upload_full_path
;
$config
[
'file_name'
]
=
md5
(
$insert_id
.
time
());
$config
[
'file_name'
]
=
md5
(
$insert_id
.
time
());
$config
[
'allowed_types'
]
=
'gif|jpg|png|jpeg'
;
$config
[
'allowed_types'
]
=
'gif|jpg|png|jpeg'
;
$config
[
'max_size'
]
=
20480
;
$config
[
'max_size'
]
=
20480
;
$config
[
'max_width'
]
=
1024
;
$config
[
'max_width'
]
=
1024
;
$config
[
'max_height'
]
=
768
;
$config
[
'max_height'
]
=
768
;
$this
->
load
->
library
(
'upload'
,
$config
);
$this
->
load
->
library
(
'upload'
,
$config
);
if
(
$this
->
upload
->
do_upload
(
'avatar'
))
{
if
(
$this
->
upload
->
do_upload
(
'avatar'
))
{
$upload_data
=
$this
->
upload
->
data
();
$upload_data
=
$this
->
upload
->
data
();
$db_art_path
=
$upload_path
.
'/'
.
$upload_data
[
'file_name'
];
$db_art_path
=
$upload_path
.
'/'
.
$upload_data
[
'file_name'
];
}
$this
->
track_model
->
update
(
$insert_id
,
$title
,
$db_art_path
);
$this
->
track_model
->
add_singer
(
$singer
,
$insert_id
);
$this
->
track_model
->
add_artist
(
$artist
,
$insert_id
);
}
}
$this
->
track_model
->
update
(
$insert_id
,
$title
,
$db_art_path
);
$this
->
track_model
->
add_singer
(
$singer
,
$insert_id
);
$this
->
track_model
->
add_artist
(
$artist
,
$insert_id
);
}
// Ghi log
// $this->mactionlog->add('UPDATED', 'Cập nhật Cuộc đua thành công!', 'Mactionlog', 'tracks', $contest_id);
//
//
$this
->
session
->
set_flashdata
(
'success'
,
'Tạo Bài hát thành công'
);
$this
->
session
->
set_flashdata
(
'success'
,
'Tạo Bài hát thành công'
);
}
else
{
}
else
{
$this
->
session
->
set_flashdata
(
'error'
,
'Tạo Bài hát không thành công'
);
$this
->
session
->
set_flashdata
(
'error'
,
'Tạo Bài hát không thành công'
);
}
}
...
...
application/views/backend/cms_ranking/list_by_daily_view.php
View file @
a1416318
...
@@ -22,7 +22,6 @@
...
@@ -22,7 +22,6 @@
<?php
endif
;
?>
<?php
endif
;
?>
<div
class=
"row"
>
<div
class=
"row"
>
<?php
//echo form_open(base_url().'backend/cmsRanking/listByDailyAjax'); ?>
<div
class=
"col-lg-3"
>
<div
class=
"col-lg-3"
>
<div
class=
"input-group text-center"
>
<div
class=
"input-group text-center"
>
<input
class=
"form-control date-picker"
id=
"input-date-picker"
type=
"text"
data-date-format=
"dd/mm/yyyy"
<input
class=
"form-control date-picker"
id=
"input-date-picker"
type=
"text"
data-date-format=
"dd/mm/yyyy"
...
@@ -40,7 +39,6 @@
...
@@ -40,7 +39,6 @@
<button
class=
"btn btn-sm btn-warning"
><i
class=
"fa fa-download"
></i>
Export ra Excel
</button>
<button
class=
"btn btn-sm btn-warning"
><i
class=
"fa fa-download"
></i>
Export ra Excel
</button>
</a>
</a>
</div>
</div>
<?php
//echo form_close(); ?>
</div>
</div>
<!-- /.row -->
<!-- /.row -->
<div
class=
"space-6"
></div>
<div
class=
"space-6"
></div>
...
@@ -97,6 +95,10 @@
...
@@ -97,6 +95,10 @@
changePagination
(
'0'
);
changePagination
(
'0'
);
updateExportLink
();
updateExportLink
();
$
(
'#input-date-picker'
).
change
(
function
()
{
updateExportLink
();
});
});
});
//Ham chung cho cac input
//Ham chung cho cac input
function
loadDataByAjaxFromInput
(
url
){
function
loadDataByAjaxFromInput
(
url
){
...
...
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