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
66df9354
Commit
66df9354
authored
Apr 13, 2020
by
Phạm Văn Đoan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
cập nhật tên sheet của BXH tuần
parent
224809cd
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
33 additions
and
1 deletion
+33
-1
CmsRanking.php
application/controllers/backend/CmsRanking.php
+9
-1
MyHelper.php
application/libraries/MyHelper.php
+24
-0
No files found.
application/controllers/backend/CmsRanking.php
View file @
66df9354
...
@@ -156,6 +156,14 @@ class CmsRanking extends CI_Controller
...
@@ -156,6 +156,14 @@ class CmsRanking extends CI_Controller
case
'weekly'
:
case
'weekly'
:
$week
=
trim
(
$array_time
[
0
]);
$week
=
trim
(
$array_time
[
0
]);
$year
=
trim
(
$array_time
[
1
]);
$year
=
trim
(
$array_time
[
1
]);
$date_range
=
MyHelper
::
getWeekDateRange
(
$week
,
$year
,
'd-m-Y'
);
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'
]));
$sheet_name
=
'Weekly-tuan'
.
((
$week
<
10
)
?
'0'
.
$time
:
$time
)
.
'_'
.
$name
;
}
else
{
$sheet_name
=
'Weekly-tuan'
.
((
$week
<
10
)
?
'0'
.
$time
:
$time
);
}
$filename
=
'Weekly-tuan'
.
((
$week
<
10
)
?
'0'
.
$time
:
$time
);
$filename
=
'Weekly-tuan'
.
((
$week
<
10
)
?
'0'
.
$time
:
$time
);
$reports
=
$this
->
track_model
->
getReportWeekly
(
$week
,
$year
);
$reports
=
$this
->
track_model
->
getReportWeekly
(
$week
,
$year
);
...
@@ -224,7 +232,7 @@ class CmsRanking extends CI_Controller
...
@@ -224,7 +232,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
(
$filename
);
$objSheet
->
setTitle
(
(
$type
==
'weekly'
)
?
$sheet_name
:
$filename
);
$objSheet
->
getCell
(
'A1'
)
->
setValue
(
"Rank"
);
$objSheet
->
getCell
(
'A1'
)
->
setValue
(
"Rank"
);
$objSheet
->
getCell
(
'B1'
)
->
setValue
(
"Song Title"
);
$objSheet
->
getCell
(
'B1'
)
->
setValue
(
"Song Title"
);
...
...
application/libraries/MyHelper.php
View file @
66df9354
...
@@ -836,6 +836,29 @@ class MyHelper
...
@@ -836,6 +836,29 @@ class MyHelper
return
$resutl
;
return
$resutl
;
}
}
/**
* Hàm lấy ngày đầu tiên và cuối cùng của 1 tuần trong năm
* 0- Nếu tuần bắt đầu là chủ nhật
* 1- Nếu tuần bắt đầu là thứ 2
*
* @param $week
* @param $year
* @param string $format
*
* @return mixed
*/
public
static
function
getWeekDateRange
(
$week
,
$year
,
$format
=
'd/m/Y'
)
{
$dto
=
new
DateTime
();
$dto
->
setISODate
(
$year
,
$week
,
0
);
// 0: CN
$ret
[
'start_week'
]
=
$dto
->
format
(
$format
);
$dto
->
modify
(
'+6 days'
);
$ret
[
'end_week'
]
=
$dto
->
format
(
$format
);
return
$ret
;
}
}
}
/* End */
/* End */
\ 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