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
2dc4bf3a
Commit
2dc4bf3a
authored
Apr 03, 2020
by
Phạm Văn Đoan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix lỗi data BXH ngày
parent
44fc0d69
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
92 additions
and
18 deletions
+92
-18
CmsRanking.php
application/controllers/backend/CmsRanking.php
+33
-11
Track_model.php
application/models/Track_model.php
+40
-2
list_by_daily_view.php
application/views/backend/cms_ranking/list_by_daily_view.php
+17
-3
list_by_monthly_view.php
...cation/views/backend/cms_ranking/list_by_monthly_view.php
+1
-1
list_by_weekly_view.php
...ication/views/backend/cms_ranking/list_by_weekly_view.php
+1
-1
No files found.
application/controllers/backend/CmsRanking.php
View file @
2dc4bf3a
...
...
@@ -6,8 +6,7 @@
* Time: 2:22 CH
*/
if
(
!
defined
(
'BASEPATH'
))
exit
(
'No direct script access allowed'
);
//require_once APPPATH."/third_party/PHPExcel.php";
//include FCPATH . "/application/third_party/PHPExcel/IOFactory.php";
include
FCPATH
.
"/application/third_party/PHPExcel.php"
;
class
CmsRanking
extends
CI_Controller
...
...
@@ -35,7 +34,6 @@ class CmsRanking extends CI_Controller
public
function
listByDailyAjax
()
{
die
(
'Đang cập nhật...'
);
$data
=
array
();
$fByName
=
$this
->
input
->
post
(
'fByName'
);
$fByName
=
str_replace
(
'/'
,
'-'
,
$fByName
);
...
...
@@ -123,23 +121,47 @@ class CmsRanking extends CI_Controller
public
function
exportReport
(
$type
,
$time
)
{
if
(
$type
&&
$time
)
{
$array
T
ime
=
explode
(
'-'
,
$time
);
$array
_t
ime
=
explode
(
'-'
,
$time
);
$week
=
date
(
'W'
);
$month
=
date
(
'n'
);
$year
=
date
(
'Y'
);
if
(
$type
==
'week'
)
{
$week
=
trim
(
$arrayTime
[
0
]);
$year
=
trim
(
$arrayTime
[
1
]);
switch
(
$type
)
{
case
'daily'
:
if
(
$time
)
{
$daily_at
=
date
(
'Y-m-d'
,
strtotime
(
$time
));
$filename
=
'Daily-report-'
.
$daily_at
;
$reports
=
$this
->
track_model
->
getReportDaily
(
$daily_at
);
}
break
;
case
'weekly'
:
$week
=
trim
(
$array_time
[
0
]);
$year
=
trim
(
$array_time
[
1
]);
$filename
=
'Weekly-tuan'
.
((
$week
<
10
)
?
'0'
.
$time
:
$time
);
$reports
=
$this
->
track_model
->
getReportWeekly
(
$week
,
$year
);
break
;
case
'monthly'
:
$month
=
trim
(
$array_time
[
0
]);
$year
=
trim
(
$array_time
[
1
]);
$filename
=
'Monthly-'
.
((
$month
<
10
)
?
'0'
.
$time
:
$time
);
$reports
=
$this
->
track_model
->
getReportMonthly
(
$month
,
$year
);
break
;
}
/*if ($type == 'week') {
$week = trim($array_time[0]);
$year = trim($array_time[1]);
$filename = 'Weekly-tuan' . (($week < 10) ? '0'.$time : $time);
$reports = $this->track_model->getReportWeekly($week, $year);
} elseif ($type == 'month') {
$month
=
trim
(
$array
T
ime
[
0
]);
$year
=
trim
(
$array
T
ime
[
1
]);
$month = trim($array
_t
ime[0]);
$year = trim($array
_t
ime[1]);
$filename = 'Monthly-' . (($month < 10) ? '0'.$time : $time);
$reports = $this->track_model->getReportMonthly($month, $year);
}
}
*/
$count_views
=
[];
foreach
(
$reports
as
$key
=>
$result
)
{
...
...
@@ -171,7 +193,7 @@ class CmsRanking extends CI_Controller
$track_detail
=
$this
->
track_model
->
getTrackById
(
$result
[
'track_id'
]);
$track_detail
=
$track_detail
[
0
];
$count_views
[]
=
array
(
'A'
=>
$result
[
'order
'
],
'A'
=>
isset
(
$result
[
'order'
])
?
$result
[
'order'
]
:
$result
[
'ranking
'
],
//'B' => ($track_detail['title'] != '') ? $track_detail['title'] . ' (' . $track_detail['id'] . ')' : '',
'B'
=>
(
$track_detail
[
'title'
]
!=
''
)
?
$track_detail
[
'title'
]
:
''
,
'C'
=>
(
$casi
[
$key
]
&&
count
(
$casi
[
$key
])
>
0
)
?
implode
(
", "
,
$casi
[
$key
])
:
''
,
...
...
application/models/Track_model.php
View file @
2dc4bf3a
...
...
@@ -231,7 +231,35 @@ class Track_model extends CI_Model
$query
=
$this
->
db
->
get
();
return
$query
->
result_array
();
}
/**
* Hàm lấy dữ liệu BXH ngày trong bảng report_views_daily
* @param $daily_at
* @param int $limit
* @param int $offset
*
* @return mixed
*/
public
function
getReportDaily
(
$daily_at
,
$limit
=
100
,
$offset
=
0
)
{
$this
->
db
->
from
(
'report_views_daily'
);
$this
->
db
->
where
(
'date ='
,
$daily_at
);
$this
->
db
->
limit
(
$limit
,
$offset
);
$query
=
$this
->
db
->
get
();
return
$query
->
result_array
();
}
/**
* Hàm lấy dữ liệu BXH tuần trong bảng report_views_weekly (cũ) và bảng report_views_weekly_new (từ 29/3-4/4)
*
* @param $week
* @param $year
* @param int $limit
* @param int $offset
*
* @return mixed
*/
public
function
getReportWeekly
(
$week
,
$year
,
$limit
=
100
,
$offset
=
0
)
{
//$sql = "SELECT * FROM report_views_weekly WHERE `week` = ? AND `year` = ? ORDER BY total_point DESC LIMIT {$offset}, {$limit} ";
...
...
@@ -244,7 +272,17 @@ class Track_model extends CI_Model
return
$query
->
result_array
();
}
/**
* Hàm lấy dữ liệu BXH tháng
*
* @param $month
* @param $year
* @param int $limit
* @param int $offset
*
* @return mixed
*/
public
function
getReportMonthly
(
$month
,
$year
,
$limit
=
100
,
$offset
=
0
)
{
//$sql = "SELECT * FROM reports_views_monthly WHERE `month` = ? AND `year` = ? ORDER BY total_point DESC LIMIT {$offset}, {$limit} ";
...
...
application/views/backend/cms_ranking/list_by_daily_view.php
View file @
2dc4bf3a
...
...
@@ -22,7 +22,7 @@
<?php
endif
;
?>
<div
class=
"row"
>
<?php
echo
form_open
(
base_url
()
.
'backend/cmsRanking/listByDailyAjax'
);
?>
<?php
//
echo form_open(base_url().'backend/cmsRanking/listByDailyAjax'); ?>
<
div
class
="
col
-
lg
-
3
">
<div class="
input
-
group
text
-
center
">
<input class="
form
-
control
date
-
picker
" id="
input
-
date
-
picker
" type="
text
" data-date-format="
dd
/
mm
/
yyyy
"
...
...
@@ -32,10 +32,15 @@
</span>
</div>
</div>
<div
class=
"col-lg-1"
>
<
!--<
div class="col-lg-1">
<button class="btn btn-sm btn-default" id="delete-filter">Xóa bộ lọc</button>
</div>-->
<div
class=
"col-lg-1"
>
<a
href=
""
id=
"btn-export"
>
<button
class=
"btn btn-sm btn-warning"
><i
class=
"fa fa-download"
></i>
Export ra Excel
</button>
</a>
</div>
<?php
echo
form_close
();
?>
<?php
//
echo form_close(); ?>
</
div
>
<!--
/.
row
-->
<
div
class
="
space
-
6
"></div>
...
...
@@ -69,6 +74,7 @@
});
changePagination
(
'0'
);
updateExportLink
();
});
//Ham chung cho cac input
...
...
@@ -117,4 +123,11 @@
});
}
function
updateExportLink
()
{
var
date_picker
=
(
$
(
"#input-date-picker"
)
.
val
())
?
$
(
"#input-date-picker"
)
.
val
()
:
null
;
if
(
date_picker
)
{
date_picker
=
date_picker
.
replace
(
/
\
//g, '-') }
var
href
=
'<?php echo base_url("backend/cmsRanking/exportReport/daily"); ?>/'
+
date_picker
;
$
(
'#btn-export'
)
.
attr
(
'href'
,
href
);
}
</
script
>
\ No newline at end of file
application/views/backend/cms_ranking/list_by_monthly_view.php
View file @
2dc4bf3a
...
...
@@ -116,7 +116,7 @@
}
function
updateExportLink
()
{
var
href
=
'
<?php
echo
base_url
(
"backend/cmsRanking/exportReport/month"
);
?>
/'
+
$
(
"#input-name"
).
val
();
var
href
=
'
<?php
echo
base_url
(
"backend/cmsRanking/exportReport/month
ly
"
);
?>
/'
+
$
(
"#input-name"
).
val
();
$
(
'#btn-export'
).
attr
(
'href'
,
href
);
}
...
...
application/views/backend/cms_ranking/list_by_weekly_view.php
View file @
2dc4bf3a
...
...
@@ -161,7 +161,7 @@
}
function
updateExportLink
()
{
var
href
=
'
<?php
echo
base_url
(
"backend/cmsRanking/exportReport/week"
);
?>
/'
+
$
(
"#input-name"
).
val
();
var
href
=
'
<?php
echo
base_url
(
"backend/cmsRanking/exportReport/week
ly
"
);
?>
/'
+
$
(
"#input-name"
).
val
();
$
(
'#btn-export'
).
attr
(
'href'
,
href
);
}
...
...
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