Commit 7662ec53 by Trần Văn Minh

Merge branch 'dev' of http://git.dcv.vn/doanpv/vmusicchart-cms into dev

parents 9c96bfac 765245a6
......@@ -400,6 +400,7 @@ $config['csrf_exclude_uris'] = array(
'backend/cmsRanking/listByDailyAjax',
'backend/cmsRanking/listByWeeklyAjax',
'backend/cmsRanking/listByMonthlyAjax',
'backend/cmsRanking/getTrackHistoryAjax',
'backend/cmsTrack/listTrackAjax',
'backend/cmsArtist/listArtistAjax',
......
......@@ -88,8 +88,7 @@ $active_group = ($_SERVER['SERVER_NAME'] == 'localhost') ? 'local' : 'server';
$query_builder = TRUE;
$db['local'] = array(
//'dsn' => 'mysql:host=localhost; dbname=vmusicchart; charset=utf8;',
'dsn' => 'mysql:host=localhost; dbname=vmusicchart; ',
'dsn' => 'mysql:host=localhost; dbname=vmusicchart; charset=utf8;',
'hostname' => 'localhost',
'username' => 'root',
'password' => '',
......@@ -112,8 +111,7 @@ $db['local'] = array(
);
$db['server'] = array(
//'dsn' => 'mysql:host=localhost; dbname=vmusicchart; charset=utf8;',
'dsn' => 'mysql:host=localhost; dbname=vmusicchart; ',
'dsn' => 'mysql:host=localhost; dbname=vmusicchart; charset=utf8;',
'hostname' => 'localhost',
'username' => 'vmusic',
'password' => 'Vmusic@2019###',
......
......@@ -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
......@@ -22,13 +21,14 @@ class CmsRanking extends CI_Controller
$this->load->model('report_views_daily_model');
$this->load->model('report_views_weekly_model');
$this->load->model('report_views_monthly_model');
$this->load->model('crawler_listen_history_model');
}
public function listByDaily()
{
$this->_data['functionName'] = 'BXH theo ngày';
$this->_data['functionName'] = 'BXH Theo ngày';
$this->_data['action'] = 'listByDaily';
$this->_data['titlePage'] = 'BXH theo ngày';
$this->_data['titlePage'] = 'BXH Theo ngày';
$this->_data['loadPage'] = 'backend/cms_ranking/list_by_daily_view';
$this->load->view('backend/admin_template_view', $this->_data);
}
......@@ -37,6 +37,7 @@ class CmsRanking extends CI_Controller
{
$data = array();
$fByName = $this->input->post('fByName');
$fByName = str_replace('/', '-', $fByName);
$pageId = $this->input->post('pageId');
//
$pageId = ($pageId == 0) ? 1 : $pageId;
......@@ -121,22 +122,34 @@ class CmsRanking extends CI_Controller
public function exportReport($type, $time)
{
if ($type && $time) {
$arrayTime = explode('-', $time);
$array_time = 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);
} elseif ($type == 'month') {
$month = trim($arrayTime[0]);
$year = trim($arrayTime[1]);
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;
}
$count_views = [];
......@@ -169,7 +182,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]) : '',
......@@ -279,4 +292,30 @@ class CmsRanking extends CI_Controller
}
}
/**
* Hàm xử lý lấy dữ liệu lịch sử lượt nghe của bài hát dựa vào ID
*/
public function getTrackHistoryAjax()
{
$track_id = $this->input->post('track_id');
$track_title = $this->input->post('track_title');
$histories = $this->crawler_listen_history_model->getByTrackId($track_id);
$data = [];
if ($histories) {
foreach ($histories as $key => $track) {
$data[$key]['date'] = $track['date_log'];
$data[$key]['zing'] = intval($track['zing_count']);
$data[$key]['nct'] = intval($track['nct_count']);
$data[$key]['keeng'] = intval($track['keeng_count']);
}
}
$response['response'] = $data;
$response['track_title'] = $track_title;
$this->load->view('backend/ajax/cms_ranking/history_chart_view', $response);
}
}
\ No newline at end of file
......@@ -32,6 +32,7 @@ class CmsTrack extends CI_Controller
{
$data = array();
$fByName = $this->input->post('fByName');
$fBySource = $this->input->post('fBySource');
$fBySinger = $this->input->post('fBySinger');
$fByComposer = $this->input->post('fByComposer');
$pageId = $this->input->post('pageId');
......@@ -41,9 +42,9 @@ class CmsTrack extends CI_Controller
$limit = 100;
$offset = ($pageId - 1) * $limit;
$data['offset'] = ($pageId - 1) * $limit;
$totalRecord = $this->track_model->cmsCountAll($fByName, $fBySinger, $fByComposer);
$totalRecord = $this->track_model->cmsCountAll($fByName, $fBySinger, $fByComposer, $fBySource);
$data['pagination'] = MyHelper::genPaginationLink($totalRecord, $limit, $pageId);
$data['listData'] = $this->track_model->cmsGetPagination($limit, $offset, $fByName, $fBySinger, $fByComposer);
$data['listData'] = $this->track_model->cmsGetPagination($limit, $offset, $fByName, $fBySinger, $fByComposer, $fBySource);
//
$this->load->view('backend/ajax/cms_track/list_track_view', $data);
}
......
......@@ -778,6 +778,30 @@ class MyHelper
return $default_image;
}
/**
* Hàm trả về ảnh icon của nguồn nhạc
*
* @param $id_zing
* @param $id_nct
* @param $id_keeng
*
* @return string
*/
public static function getSourceIcon($id_zing, $id_nct, $id_keeng)
{
$html = '';
if (!empty($id_zing)) {
$html .= "<span title='Nguồn Zing MP3'><img src='" . base_url('images/favicon/zing_favicon_20x.png') . "'></span>&nbsp;&nbsp;";
}
if (!empty($id_nct)) {
$html .= "<span title='Nguồn NCT'><img src='" . base_url('images/favicon/nct_favicon_16x.png') . "'></span>&nbsp;&nbsp;";
}
if (!empty($id_keeng)) {
$html .= "<span title='Nguồn Keeng'><img src='" . base_url('images/favicon/keeng_favicon_16x.png') . "'></span>";
}
return $html;
}
}
/* End */
\ No newline at end of file
<?php if (!defined('BASEPATH')) exit('No direct script access allowed');
class Crawler_listen_history_model extends CI_Model
{
protected $_table = 'crawler_listen_histories';
public function __construct()
{
parent::__construct();
date_default_timezone_set("Asia/Ho_Chi_Minh");
}
/**
* Lấy lịch sử lượt nghe của bài hát theo ID
*
* @param $track_id
* @return mixed
*/
public function getByTrackId($track_id)
{
$this->db->select($this->_table . '.*');
$this->db->from($this->_table);
$this->db->where($this->_table . '.track_id', $track_id);
$this->db->order_by($this->_table . '.date_log', 'asc');
$query = $this->db->get();
return $query->result_array();
}
}
/* End of file welcome.php */
/* Location: ./application/controllers/welcome.php */
\ No newline at end of file
......@@ -13,6 +13,9 @@ class Report_views_daily_model extends CI_Model
{
$this->db->select('COUNT(*) AS totalResults');
$this->db->from($this->_table);
if ($name != null) {
$this->db->where('date', date('Y-m-d', strtotime($name)));
}
$query = $this->db->get();
$result = $query->result_array();
if ($result) {
......@@ -22,21 +25,22 @@ class Report_views_daily_model extends CI_Model
}
}
/**
* Hàm lấy dữ liệu phân trang
*
* @param $record
* @param $start
* @param null $name
*
* @return mixed
*/
public function cmsGetPagination($record, $start, $name = null)
{
print_r($name);
$this->db->select($this->_table . '.*, u1.full_name AS singer_name, track_user.name AS singer_name2,
tracks.title AS name_song, GROUP_CONCAT(track_user.`name` SEPARATOR ",") AS all_name, tracks.art AS art');
$this->db->select($this->_table . '.*, tracks.title AS name_song, tracks.art AS art');
$this->db->from($this->_table);
$this->db->join('track_user', 'track_user.track_id = report_views_daily.track_id', 'left');
$this->db->join('tracks', 'tracks.id = report_views_daily.track_id', 'left');
$this->db->join('users u1', 'u1.id = track_user.user_id', 'left');
if ($name != null) {
$data = explode('-', $name);
$this->db->where('day', $data[0]);
$this->db->where('month', $data[1]);
$this->db->where('year', $data[2]);
$this->db->where('date', date('Y-m-d', strtotime($name)));
}
$this->db->group_by('report_views_daily.id');
$this->db->order_by($this->_table . '.total_point', 'desc');
......@@ -46,17 +50,4 @@ class Report_views_daily_model extends CI_Model
return $query->result_array();
}
public function selectSearch() {
$this->db->select('day,month, year');
$this->db->from($this->_table);
$this->db->distinct($this->_table . '.day');
$this->db->order_by( $this->_table . '.year desc');
$this->db->order_by( $this->_table . '.month desc');
$this->db->order_by( $this->_table . '.day desc');
$this->db->limit(15);
$query = $this->db->get();
return $query->result_array();
}
}
\ No newline at end of file
......@@ -2,7 +2,8 @@
class Report_views_monthly_model extends CI_Model
{
protected $_table='reports_views_monthly';
protected $_table = 'reports_views_monthly';
protected $_table_new = 'report_views_monthly_new';
public function __construct(){
parent::__construct();
......
......@@ -2,23 +2,22 @@
class Report_views_weekly_model extends CI_Model
{
protected $_table='report_views_weekly';
protected $_table = 'report_views_weekly';
protected $_table_new = 'report_views_weekly_new';
public function __construct(){
parent::__construct();
date_default_timezone_set("Asia/Ho_Chi_Minh");
if (date('W') > 13) {
$this->_table = $this->_table_new;
}
}
public function cmsCountAll($name = null)
{
$this->db->select('COUNT(*) AS totalResults');
$this->db->from($this->_table);
// if ($name != null) {
// $this->db->like('title', $name, 'both');
// $this->db->or_like('description', $name, 'both');
// $this->db->or_like('slug', $name, 'both');
// $this->db->or_like('tag', $name, 'both');
// }
$query = $this->db->get();
$result = $query->result_array();
if ($result) {
......@@ -33,28 +32,30 @@ class Report_views_weekly_model extends CI_Model
$this->db->select($this->_table . '.*, u1.full_name AS singer_name, track_user.name AS singer_name2,
tracks.title AS name_song, GROUP_CONCAT(track_user.`name` SEPARATOR ",") AS all_name, tracks.art AS art');
$this->db->from($this->_table);
$this->db->join('track_user', 'track_user.track_id = report_views_weekly.track_id', 'left');
$this->db->join('tracks', 'tracks.id = report_views_weekly.track_id', 'left');
$this->db->join('track_user', 'track_user.track_id = ' . $this->_table . '.track_id', 'left');
$this->db->join('tracks', 'tracks.id = ' . $this->_table . '.track_id', 'left');
$this->db->join('users u1', 'u1.id = track_user.user_id', 'left');
if ($name != null) {
$data = explode('-', $name);
$this->db->where('week', $data[0]);
$this->db->where('year', $data[1]);
}
$this->db->group_by('report_views_weekly.id');
$this->db->group_by($this->_table . '.id');
$this->db->order_by($this->_table . '.total_point', 'desc');
$this->db->limit($record);
$query = $this->db->get();
return $query->result_array();
}
public function selectSearch() {
public function selectSearch()
{
$this->db->select('week, year');
$this->db->from($this->_table);
$this->db->distinct($this->_table . '.week');
$this->db->order_by( $this->_table . '.year desc');
$this->db->order_by( $this->_table . '.week desc');
$this->db->limit(15);
$this->db->limit(60);
$query = $this->db->get();
return $query->result_array();
......
......@@ -130,7 +130,7 @@ class Track_model extends CI_Model
return $query->result_array();
}
public function cmsCountAll($name = null, $fBySinger = null, $fByComposer = null)
public function cmsCountAll($name = null, $fBySinger = null, $fByComposer = null, $fBySource = null)
{
$this->db->select('COUNT(*) AS totalResults');
$this->db->from($this->_table);
......@@ -140,6 +140,23 @@ class Track_model extends CI_Model
$this->db->or_like('slug', $name, 'both');
$this->db->or_like('slug', MyHelper::genSlug($name), 'both');
$this->db->or_like('tag', $name, 'both');
$this->db->or_where('id', intval($name));
}
if (!empty($fBySource)) {
switch ($fBySource) {
case 'ZING':
$this->db->where('id_zing is NOT NULL', null, false);
$this->db->where('id_zing !=', '');
break;
case 'NCT':
$this->db->where('id_nct is NOT NULL', null, false);
$this->db->where('id_nct !=', '');
break;
case 'KEENG':
$this->db->where('id_keeng is NOT NULL', null, false);
$this->db->where('id_keeng !=', '');
break;
}
}
if ($fBySinger == 1) {
$this->db->where('singer_list is NOT NULL', null, false);
......@@ -185,7 +202,7 @@ class Track_model extends CI_Model
return $query->result_array();
}
public function cmsGetPagination($record, $start, $name = null, $fBySinger = null, $fByComposer = null)
public function cmsGetPagination($record, $start, $name = null, $fBySinger = null, $fByComposer = null, $fBySource = null)
{
$this->db->select($this->_table . '.*');
$this->db->from($this->_table);
......@@ -195,6 +212,23 @@ class Track_model extends CI_Model
$this->db->or_like('tracks.slug', $name, 'both');
$this->db->or_like('tracks.slug', MyHelper::genSlug($name), 'both');
$this->db->or_like('tracks.tag', $name, 'both');
$this->db->or_where('id', intval($name));
}
if (!empty($fBySource)) {
switch ($fBySource) {
case 'ZING':
$this->db->where('id_zing is NOT NULL', null, false);
$this->db->where('id_zing !=', '');
break;
case 'NCT':
$this->db->where('id_nct is NOT NULL', null, false);
$this->db->where('id_nct !=', '');
break;
case 'KEENG':
$this->db->where('id_keeng is NOT NULL', null, false);
$this->db->where('id_keeng !=', '');
break;
}
}
if ($fBySinger == 1) {
$this->db->where('singer_list is NOT NULL', null, false);
......@@ -232,11 +266,45 @@ class Track_model extends CI_Model
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} ";
//$query = $this->db->query($sql, $week, $year);
if ($week >= 14 && $year >= 2020) {
$this->db->from('report_views_weekly_new');
} else {
$this->db->from('report_views_weekly');
}
$this->db->where('week =', $week);
$this->db->where('year =', $year);
$this->db->limit($limit, $offset);
......@@ -245,11 +313,27 @@ 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} ";
//$query = $this->db->query($sql, $month, $year);
if ($month >= 4 && $year >= 2020) {
$this->db->from('report_views_monthly_new');
} else {
$this->db->from('reports_views_monthly');
}
$this->db->where('month =', $month);
$this->db->where('year =', $year);
$this->db->limit($limit, $offset);
......
......@@ -2,6 +2,9 @@
$CI = & get_instance();
$controller = $CI->router->fetch_class();
$action = $CI->router->fetch_method();
?>
<!DOCTYPE html>
<html lang="en">
......@@ -30,11 +33,7 @@ $action = $CI->router->fetch_method();
<link rel="stylesheet" href="<?php echo base_url().'public/assets/css/pagination.css' ?>"/>
<!-- inline styles related to this page -->
<style>
body {
font-family: "Helvetica Neue", "Helvetica", "Arial", sans-serif;
}
</style>
<style> body { font-family: "Helvetica Neue", "Helvetica", "Arial", sans-serif; } </style>
<!-- ace settings handler -->
<script src="<?php echo base_url().'public/assets/js/ace-extra.min.js' ?>"></script>
......@@ -46,16 +45,22 @@ $action = $CI->router->fetch_method();
<script src="<?php echo base_url().'public/assets/js/chosen.jquery.min.js' ?>"></script>
<script src="<?php echo base_url().'public/fckeditor/ckfinder/ckfinder.js' ?>"></script>
<?php if ($controller == 'cmsRanking' && $action == 'listByDaily'): ?>
<!-- Styles -->
<style> #chartdiv { width: 100%; height: 500px; } </style>
<!-- Resources -->
<script src="https://www.amcharts.com/lib/4/core.js"></script>
<script src="https://www.amcharts.com/lib/4/charts.js"></script>
<script src="https://www.amcharts.com/lib/4/themes/animated.js"></script>
<?php endif; ?>
</head>
<body class="no-skin">
<div id="navbar" class="navbar navbar-default">
<!-- Giu cho menu tai khoan co dinh -->
<script type="text/javascript">
try {
ace.settings.check('navbar', 'fixed')
} catch (e) {
}
try { ace.settings.check('navbar', 'fixed') } catch (e) { }
</script>
<div class="navbar-container" id="navbar-container">
<button type="button" class="navbar-toggle menu-toggler pull-left" id="menu-toggler" data-target="#sidebar">
......@@ -352,15 +357,12 @@ $action = $CI->router->fetch_method();
<script src="<?php echo base_url().'public/assets/js/ace.min.js' ?>"></script>
<script type="text/javascript">
$(document).ready(function(){
$('input[name=input-date-range-revenue-daily]').daterangepicker({
'applyClass' : 'btn-sm btn-success',
'cancelClass' : 'btn-sm btn-default',
locale: {
applyLabel: 'Chọn',
cancelLabel: 'Hủy'
},
format: 'DD/MM/YYYY',
maxDate: '<?php echo date('d/m/Y')?>'
$('.date-picker').datepicker({
autoclose: true,
todayHighlight: true,
format: 'dd/mm/yyyy',
startDate: '30/03/2020',
endDate: '<?php echo date('d/m/Y', time()-86400)?>'
});
$('input[name=date-range-picker]').daterangepicker({
......@@ -373,9 +375,7 @@ $action = $CI->router->fetch_method();
format: 'DD/MM/YYYY',
maxDate: '<?php echo date('d/m/Y')?>'
});
});
</script>
</body>
......
<!-- Chart code -->
<script>
am4core.ready(function() {
// Themes begin
am4core.useTheme(am4themes_animated);
// Themes end
// Create chart instance
var chart = am4core.create("chartdiv", am4charts.XYChart);
// Increase contrast by taking evey second color
//chart.colors.step = 2;
chart.colors.list = [
am4core.color("#ee2c74"),
am4core.color("#2daaed"),
am4core.color("#f9ab2e")
];
// Add data
//chart.data = generateChartData();
chart.data = <?php echo json_encode($response) ?>;
// Create axes
var dateAxis = chart.xAxes.push(new am4charts.DateAxis());
dateAxis.renderer.minGridDistance = 50;
// Create series
function createAxisAndSeries(field, name, opposite, bullet) {
var valueAxis = chart.yAxes.push(new am4charts.ValueAxis());
if(chart.yAxes.indexOf(valueAxis) != 0){
valueAxis.syncWithAxis = chart.yAxes.getIndex(0);
}
var series = chart.series.push(new am4charts.LineSeries());
series.dataFields.valueY = field;
series.dataFields.dateX = "date";
series.strokeWidth = 2;
series.yAxis = valueAxis;
series.name = name;
series.tooltipText = "{name}: [bold]{valueY}[/]";
series.tensionX = 0.8;
series.showOnInit = true;
var interfaceColors = new am4core.InterfaceColorSet();
switch(bullet) {
case "triangle":
var bullet = series.bullets.push(new am4charts.Bullet());
bullet.width = 12;
bullet.height = 12;
bullet.horizontalCenter = "middle";
bullet.verticalCenter = "middle";
var triangle = bullet.createChild(am4core.Triangle);
triangle.stroke = interfaceColors.getFor("background");
triangle.strokeWidth = 2;
triangle.direction = "top";
triangle.width = 12;
triangle.height = 12;
break;
case "rectangle":
var bullet = series.bullets.push(new am4charts.Bullet());
bullet.width = 10;
bullet.height = 10;
bullet.horizontalCenter = "middle";
bullet.verticalCenter = "middle";
var rectangle = bullet.createChild(am4core.Rectangle);
rectangle.stroke = interfaceColors.getFor("background");
rectangle.strokeWidth = 2;
rectangle.width = 10;
rectangle.height = 10;
break;
default:
var bullet = series.bullets.push(new am4charts.CircleBullet());
bullet.circle.stroke = interfaceColors.getFor("background");
bullet.circle.strokeWidth = 2;
break;
}
valueAxis.renderer.line.strokeOpacity = 1;
valueAxis.renderer.line.strokeWidth = 2;
valueAxis.renderer.line.stroke = series.stroke;
valueAxis.renderer.labels.template.fill = series.stroke;
valueAxis.renderer.opposite = opposite;
}
createAxisAndSeries("zing", "Zing", false, "circle");
createAxisAndSeries("nct", "NCT", true, "triangle");
createAxisAndSeries("keeng", "Keeng", true, "rectangle");
// Add legend
chart.legend = new am4charts.Legend();
// Add cursor
chart.cursor = new am4charts.XYCursor();
}); // end am4core.ready()
</script>
<!-- HTML -->
<div id="chartdiv"></div>
\ No newline at end of file
<div style="max-height: 465px; overflow: scroll">
<div>
<table class="table table-striped table-bordered table-hover">
<thead>
<tr>
<th style="text-align: center">TT</th>
<th style="text-align: center">#ID</th>
<!--<th style="text-align: center">#ID</th>-->
<th style="text-align: center">Ảnh</th>
<th style="text-align: center">Tên bài hát</th>
<th style="text-align: center">Ca sĩ</th>
<th style="text-align: center">Nhạc sĩ</th>
<th style="text-align: center"><i class="fa fa-music color-red"></i> Tên bài hát</th>
<th style="text-align: center"><i class="fa fa-line-chart color-red"></i> Lịch sử</th>
<th style="text-align: center"><i class="fa fa-microphone color-red"></i> Ca sĩ</th>
<th style="text-align: center"><i class="fa fa-headphones color-red"></i> Zing</th>
<th style="text-align: center"><i class="fa fa-headphones color-red"></i> NCT</th>
<th style="text-align: center"><i class="fa fa-headphones color-red"></i> Keeng</th>
<th style="text-align: center"><i class="fa fa-headphones color-red"></i> Tổng lượt nghe</th>
<th style="text-align: center"><i class="fa fa-edit color-red"></i> Tổng điểm</th>
</tr>
</thead>
<tbody>
<?php if(count($listData) > 0): foreach($listData as $key => $data): ?>
<tr>
<td style="text-align: center"><?php echo ($key+1+$offset); ?></td>
<td style="text-align: center">#<?php echo $data['id']; ?></td>
<td style="text-align: center"><img src="<?php echo base_url($data['art']); ?>"></td>
<td style="text-align: left"><?php echo $data['name_song']; ?></td>
<!--<td style="text-align: center">#<?php /*echo $data['track_id']; */?></td>-->
<td style="text-align: center"><img src="<?php echo MyHelper::getArtByTrack($data['art']); ?>" style="max-width: 50px; max-height: 50px"></td>
<td style="text-align: left"><?php echo $data['name_song'] . ' (#' . $data['track_id'] . ')'; ?></td>
<td style="text-align: center">
<a href="javascript:void(0)" title="Click để xem lịch sử lượt nghe"
onclick="showHistory(<?php echo $data['track_id']?>, '<?php echo $data['name_song'] ?>')">
<i class="fa fa-line-chart tab-color-blue"></i>
</a>
</td>
<td style="text-align: left"><?php echo $data['all_name']; ?></td>
<td style="text-align: right"><?php echo number_format($data['views_zing'], 0, ',', '.'); ?></td>
<td style="text-align: right"><?php echo number_format($data['views_nct'], 0, ',', '.'); ?></td>
<td style="text-align: right"><?php echo number_format($data['views_keeng'], 0, ',', '.'); ?></td>
<td style="text-align: right"><?php echo number_format(($data['views_zing'] + $data['views_nct'] + $data['views_keeng']), 0, ',', '.'); ?></td>
<td style="text-align: right"><?php echo number_format($data['total_point'], 0, ',', '.'); ?></td>
</tr>
<?php endforeach; ?>
......@@ -30,4 +45,4 @@
</table>
</div>
<!-- /.row -->
<div style="text-align: center;"><?php echo $pagination; ?></div>
\ No newline at end of file
<div style="text-align: center;"><?php //echo $pagination; ?></div>
\ No newline at end of file
<div style="max-height: 465px; overflow: scroll">
<div>
<table class="table table-striped table-bordered table-hover">
<thead>
<tr>
......@@ -14,7 +14,7 @@
<?php if(count($listData) > 0): foreach($listData as $key => $data): ?>
<tr>
<td style="text-align: center"><?php echo ($key+1+$offset); ?></td>
<td style="text-align: center">#<?php echo $data['id']; ?></td>
<td style="text-align: center">#<?php echo $data['track_id']; ?></td>
<td style="text-align: center"><img style="max-width: 50px" src="<?php echo MyHelper::getArtByTrack($data['art']); ?>"></td>
<td style="text-align: left"><?php echo $data['name_song']; ?></td>
<td style="text-align: left"><?php echo $data['all_name']; ?></td>
......@@ -30,4 +30,4 @@
</table>
</div>
<!-- /.row -->
<!-- <div style="text-align: center;"><?php echo $pagination; ?></div> -->
\ No newline at end of file
<div style="text-align: center;"><?php //echo $pagination; ?></div>
\ No newline at end of file
<div style="max-height: 465px; overflow: scroll">
<div>
<table class="table table-striped table-bordered table-hover">
<thead>
<tr>
......@@ -14,7 +14,7 @@
<?php if(count($listData) > 0): foreach($listData as $key => $data): ?>
<tr>
<td style="text-align: center"><?php echo ($key+1+$offset); ?></td>
<td style="text-align: center">#<?php echo $data['id']; ?></td>
<td style="text-align: center">#<?php echo $data['track_id']; ?></td>
<td style="text-align: center"><img style="max-width: 50px" src="<?php echo MyHelper::getArtByTrack($data['art']); ?>"></td>
<td style="text-align: left"><?php echo $data['name_song']; ?></td>
<td style="text-align: left"><?php echo $data['all_name']; ?></td>
......@@ -30,4 +30,4 @@
</table>
</div>
<!-- /.row -->
<!-- <div style="text-align: center;"><?php echo $pagination; ?></div> -->
\ No newline at end of file
<div style="text-align: center;"><?php //echo $pagination; ?></div>
\ No newline at end of file
......@@ -19,7 +19,11 @@
<img style="max-width: 50px" src="<?php echo MyHelper::getArtByTrack($data['art']) ?>">
</td>
<td style="text-align: center">#<?php echo $data['id']; ?></td>
<td style="text-align: left"><?php echo $data['title']; ?></td>
<td style="text-align: left">
<?php echo $data['title']; ?>
<br>
<?php echo MyHelper::getSourceIcon($data['id_zing'], $data['id_nct'], $data['id_keeng']) ?>
</td>
<td style="text-align: left"><?php echo $data['singer_list']; ?></td>
<td style="text-align: left"><?php echo $data['composer_list']; ?></td>
<td style="text-align: center">
......
......@@ -22,28 +22,25 @@
<?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">
<select class="form-control" name="input-name" id="input-name">
<?php
$listSearch= $this->report_views_daily_model->selectSearch();
if ($listSearch == array()) {
?>
<option value = "">None</option>
<?php
} else
foreach ($listSearch as $data):
?>
<option value = "<?php echo $data['day'].'-'.$data['month'].'-'.$data['year']; ?>">Ngày<?php echo $data['day']; ?>/ <?php echo $data['month']; ?>/ <?php echo $data['year']; ?></option>
<?php
endforeach;
?>
</select>
<div class="input-group text-center">
<input class="form-control date-picker" id="input-date-picker" type="text" data-date-format="dd/mm/yyyy"
value="<?php echo date('d/m/Y', time()-86400)?>" readonly>
<span class="input-group-addon">
<i class="fa fa-calendar bigger-110"></i>
</span>
</div>
<div class="col-lg-1">
</div>
<!--<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>
......@@ -51,11 +48,32 @@
<div style="text-align: center" id="data-loading">
<i class="fa fa-refresh fa-spin bigger-200"></i> Đang tải dữ liệu...
</div>
<div class="col-md-12">
<span style="color: red"><i>Lưu ý: BXH ngày có từ 30/03/2020</i></span>
</div>
<div class="col-lg-12">
<div id="div-response"></div>
</div>
</div>
<!-- modal -->
<div class="modal fade" tabindex="-1" role="dialog" aria-labelledby="gridSystemModalLabel" id="modal-track-chart">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header" style="padding: 10px !important;">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
<h4 class="modal-title">Lịch sử lượt nghe bài: <span id="track_title" style="color: red;"></span></h4>
</div>
<div class="modal-body">
<div class="row">
<div class="col-md-12" id="div-history-chart"></div>
</div>
</div>
<!--<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Đóng</button>
</div>-->
</div><!-- /.modal-content -->
</div><!-- /.modal-dialog -->
</div><!-- /.modal -->
<script type="text/javascript">
//Thuc hien viec ve bieu do$data
$(document).ready(function() {
......@@ -63,7 +81,7 @@
// Tìm kiếm theo cú pháp
var oldTimeout2 = '';
$('#input-name').change(function(){
$('#input-date-picker').change(function(){
clearTimeout(oldTimeout2);
oldTimeout2 = setTimeout(function(){
loadDataByAjaxFromInput(url);
......@@ -71,101 +89,89 @@
});
// Xóa bộ lọc
$('#delete-filter').click(function(){
$("#input-name").val('');
$("#input-date-picker").val('<?php echo date('d/m/Y', time()-86400)?>');
changePagination('0');
return false;
});
changePagination('0');
updateExportLink();
});
//Ham chung cho cac input
function loadDataByAjaxFromInput(url){
$('#data-loading').show();
var csrf_value = '<?php echo $this->security->get_csrf_hash(); ?>';
var fByName = $("#input-name").val();
//Ajax ve bieu do
$.ajax({
type: "POST",
url: url,
data: {
csrf_name: csrf_value,
fByName: fByName
},
dataType: "text",
cache: false,
success: function(data){
$('#div-response').html(data);
$('#data-loading').hide();
}
});
callAjax(0, url);
}
//Ham chung cho cac SelectBox
function loadDataByAjaxFromSelectBox(id, url){
$('#'+id).change(function(){
$('#data-loading').show();
var csrf_value = '<?php echo $this->security->get_csrf_hash(); ?>';
var fByName = $("#input-name").val();
//Ajax ve bieu do
$.ajax({
type: "POST",
url: url,
data: {
csrf_name: csrf_value,
fByName: fByName
},
dataType: "text",
cache: false,
success: function(data){
$('#div-response').html(data);
$('#data-loading').hide();
}
});
callAjax(0, url);
});
}
function loadDataByAjaxDateRange(dtFrom, dtTo, url){
$('#data-loading').show();
callAjax(0, url);
}
function changePagination(pageId) {
$('#data-loading').show();
var url = '<?php echo base_url()."backend/cmsRanking/listByDailyAjax"; ?>';
callAjax(pageId, url);
}
function callAjax(pageId, url) {
var csrf_value = '<?php echo $this->security->get_csrf_hash(); ?>';
var fByName = $("#input-name").val();
// ajax
var fByName = $("#input-date-picker").val();
var dataReq = {
csrf_name: csrf_value,
fByName: fByName,
pageId: pageId
};
//Ajax
$.ajax({
type: "POST",
url: url,
data: {
csrf_name: csrf_value,
fByName: fByName
},
data: dataReq,
dataType: "text",
cache: false,
success: function(data){
success: function(data) {
$('#div-response').html(data);
$('#data-loading').hide();
}
});
}
function changePagination(pageId) {
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);
}
function showHistory(track_id, track_title) {
$('#data-loading').show();
var csrf_value = '<?php echo $this->security->get_csrf_hash(); ?>';
var url = '<?php echo base_url()."backend/cmsRanking/listByDailyAjax"; ?>';
var fByName = $("#input-name").val();
//Ajax ve bieu do\
$.ajax({
type: "POST",
url: url,
url: '<?php echo base_url("backend/cmsRanking/getTrackHistoryAjax"); ?>',
data: {
csrf_name: csrf_value,
fByName: fByName,
pageId: pageId
csrf_name: '<?php echo $this->security->get_csrf_hash(); ?>',
track_id: track_id,
track_title: track_title
},
dataType: "text",
dataType: "HTML",
cache: false,
success: function(data){
$('#div-response').html(data);
success: function(data) {
$('#data-loading').hide();
$('#track_title').html(track_title + ' (ID: ' + track_id + ')');
$('#div-history-chart').html(data);
$('#modal-track-chart').modal('show');
},
error: function () {
$('#data-loading').hide();
}
});
}
</script>
\ No newline at end of file
......@@ -46,6 +46,9 @@
<div style="text-align: center" id="data-loading">
<i class="fa fa-refresh fa-spin bigger-200"></i> Đang tải dữ liệu...
</div>
<div class="col-md-12">
<span style="color: red"><i>Lưu ý: BXH từ tháng 04/2020 sử dụng dữ liệu mới</i></span>
</div>
<div class="col-lg-12">
<div id="div-response"></div>
</div>
......@@ -116,7 +119,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/monthly"); ?>/' + $("#input-name").val();
$('#btn-export').attr('href', href);
}
......
......@@ -48,6 +48,9 @@
<div style="text-align: center" id="data-loading">
<i class="fa fa-refresh fa-spin bigger-200"></i> Đang tải dữ liệu...
</div>
<div class="col-md-12">
<span style="color: red"><i>Lưu ý: BXH từ tuần 14/2020 sử dụng dữ liệu mới</i></span>
</div>
<div class="col-lg-12">
<div id="div-response"></div>
</div>
......@@ -161,7 +164,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/weekly"); ?>/' + $("#input-name").val();
$('#btn-export').attr('href', href);
}
......
......@@ -22,13 +22,21 @@
<?php endif; ?>
<div class="row">
<?php //echo form_open(base_url().'backend/cmsTrack/listTrackAjax'); ?>
<!-- Tìm kiếm theo tên bài hát -->
<div class="col-lg-3">
<input class="form-control" type="text" name="input-name" id="input-name" placeholder="Nhập tên bài hát..." />
<input class="form-control" type="text" name="input-name" id="input-name" placeholder="Nhập #ID, tên bài hát..." />
</div>
<!-- Lọc theo nguồn cung cấp nhạc -->
<div class="col-lg-2">
<select class="form-control" name="fBySource" id="fBySource">
<option value="">Tất cả nguồn</option>
<option value="ZING">Nguồn Zing</option>
<option value="NCT">Nguồn NCT</option>
<option value="KEENG">Nguồn Keeng</option>
</select>
</div>
<!-- Lọc theo thông tin ca sĩ -->
<div class="col-lg-3">
<div class="col-lg-2">
<select class="form-control" name="fBySinger" id="fBySinger">
<option value="-1">Thông tin ca sĩ</option>
<option value="1">Đã cập nhật</option>
......@@ -36,18 +44,18 @@
</select>
</div>
<!-- Lọc theo thông tin nhạc sĩ -->
<div class="col-lg-3">
<div class="col-lg-2">
<select class="form-control" name="fByComposer" id="fByComposer">
<option value="-1">Thông tin nhạc sĩ</option>
<option value="1">Đã cập nhật</option>
<option value="2">Chưa cập nhật</option>
</select>
</div>
<div class="col-lg-3"></div>
<!-- Xóa bộ lọc -->
<div class="col-lg-1">
<button class="btn btn-sm btn-default" id="delete-filter">Xóa bộ lọc</button>
</div>
<?php //echo form_close(); ?>
<!-- Thêm mới bài hát -->
<div class="col-lg-1" style="float:right;">
<a class="btn btn-sm btn-success" href="<?php echo base_url('backend/cmsTrack/addTrack');?>">
<i class="glyphicon-plus"></i> Thêm</a>
......@@ -65,7 +73,6 @@
</div>
<script type="text/javascript">
//Thuc hien viec ve bieu do$data
$(document).ready(function() {
var url = '<?php echo base_url("backend/cmsTrack/listTrackAjax"); ?>';
......@@ -78,6 +85,7 @@ $(document).ready(function() {
}, 250);
});
loadDataByAjaxFromSelectBox('fBySource', url);
loadDataByAjaxFromSelectBox('fBySinger', url);
loadDataByAjaxFromSelectBox('fByComposer', url);
......@@ -123,11 +131,13 @@ function changePagination(pageId) {
function callAjax(pageId, url) {
var csrf_value = '<?php echo $this->security->get_csrf_hash(); ?>';
var fByName = $("#input-name").val();
var fBySource = $("#fBySource").val();
var fBySinger = $("#fBySinger").val();
var fByComposer = $("#fByComposer").val();
var dataReq = {
csrf_name: csrf_value,
fByName: fByName,
fBySource: fBySource,
fBySinger: fBySinger,
fByComposer: fByComposer,
pageId: pageId
......
......@@ -19,7 +19,7 @@ $buttonLogin = array(
'name' => 'btnLogin',
'type' => 'submit',
'class' => 'width-35 pull-right btn btn-sm btn-primary',
'style' => 'padding:4px 0px',
'style' => 'padding:4px 0px; width: 100% !important;',
'content' => '<i class="ace-icon fa fa-key"></i><span class="bigger-110">Đăng nhập</span>'
);
?>
......@@ -55,9 +55,7 @@ $buttonLogin = array(
<div id="login-box" class="login-box visible widget-box no-border">
<div class="widget-body">
<div class="widget-main">
<h4 class="header blue lighter bigger" style="text-align: center">
<i class="ace-icon fa fa-music"></i> CMS
</h4>
<h4 class="header blue lighter bigger" style="text-align: center">CMS for ADMIN</h4>
<div class="text-center">
<img src="<?php echo base_url('images/logo.png') ?>" style="height: 45px">
</div>
......@@ -75,6 +73,9 @@ $buttonLogin = array(
echo form_open(base_url('backend/account/index'));
?>
<fieldset>
<div>
<input type="hidden" name="client_ip" value="">
</div>
<label class="block clearfix">
<span class="block input-icon input-icon-right">
<?php echo form_input($username); ?>
......
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment