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( ...@@ -400,6 +400,7 @@ $config['csrf_exclude_uris'] = array(
'backend/cmsRanking/listByDailyAjax', 'backend/cmsRanking/listByDailyAjax',
'backend/cmsRanking/listByWeeklyAjax', 'backend/cmsRanking/listByWeeklyAjax',
'backend/cmsRanking/listByMonthlyAjax', 'backend/cmsRanking/listByMonthlyAjax',
'backend/cmsRanking/getTrackHistoryAjax',
'backend/cmsTrack/listTrackAjax', 'backend/cmsTrack/listTrackAjax',
'backend/cmsArtist/listArtistAjax', 'backend/cmsArtist/listArtistAjax',
......
...@@ -88,8 +88,7 @@ $active_group = ($_SERVER['SERVER_NAME'] == 'localhost') ? 'local' : 'server'; ...@@ -88,8 +88,7 @@ $active_group = ($_SERVER['SERVER_NAME'] == 'localhost') ? 'local' : 'server';
$query_builder = TRUE; $query_builder = TRUE;
$db['local'] = array( $db['local'] = array(
//'dsn' => 'mysql:host=localhost; dbname=vmusicchart; charset=utf8;', 'dsn' => 'mysql:host=localhost; dbname=vmusicchart; charset=utf8;',
'dsn' => 'mysql:host=localhost; dbname=vmusicchart; ',
'hostname' => 'localhost', 'hostname' => 'localhost',
'username' => 'root', 'username' => 'root',
'password' => '', 'password' => '',
...@@ -112,8 +111,7 @@ $db['local'] = array( ...@@ -112,8 +111,7 @@ $db['local'] = array(
); );
$db['server'] = array( $db['server'] = array(
//'dsn' => 'mysql:host=localhost; dbname=vmusicchart; charset=utf8;', 'dsn' => 'mysql:host=localhost; dbname=vmusicchart; charset=utf8;',
'dsn' => 'mysql:host=localhost; dbname=vmusicchart; ',
'hostname' => 'localhost', 'hostname' => 'localhost',
'username' => 'vmusic', 'username' => 'vmusic',
'password' => 'Vmusic@2019###', 'password' => 'Vmusic@2019###',
......
...@@ -6,8 +6,7 @@ ...@@ -6,8 +6,7 @@
* Time: 2:22 CH * Time: 2:22 CH
*/ */
if (!defined('BASEPATH')) exit('No direct script access allowed'); 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"; include FCPATH . "/application/third_party/PHPExcel.php";
class CmsRanking extends CI_Controller class CmsRanking extends CI_Controller
...@@ -22,13 +21,14 @@ 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_daily_model');
$this->load->model('report_views_weekly_model'); $this->load->model('report_views_weekly_model');
$this->load->model('report_views_monthly_model'); $this->load->model('report_views_monthly_model');
$this->load->model('crawler_listen_history_model');
} }
public function listByDaily() public function listByDaily()
{ {
$this->_data['functionName'] = 'BXH theo ngày'; $this->_data['functionName'] = 'BXH Theo ngày';
$this->_data['action'] = 'listByDaily'; $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->_data['loadPage'] = 'backend/cms_ranking/list_by_daily_view';
$this->load->view('backend/admin_template_view', $this->_data); $this->load->view('backend/admin_template_view', $this->_data);
} }
...@@ -37,6 +37,7 @@ class CmsRanking extends CI_Controller ...@@ -37,6 +37,7 @@ class CmsRanking extends CI_Controller
{ {
$data = array(); $data = array();
$fByName = $this->input->post('fByName'); $fByName = $this->input->post('fByName');
$fByName = str_replace('/', '-', $fByName);
$pageId = $this->input->post('pageId'); $pageId = $this->input->post('pageId');
// //
$pageId = ($pageId == 0) ? 1 : $pageId; $pageId = ($pageId == 0) ? 1 : $pageId;
...@@ -121,22 +122,34 @@ class CmsRanking extends CI_Controller ...@@ -121,22 +122,34 @@ class CmsRanking extends CI_Controller
public function exportReport($type, $time) public function exportReport($type, $time)
{ {
if ($type && $time) { if ($type && $time) {
$arrayTime = explode('-', $time); $array_time = explode('-', $time);
$week = date('W'); $week = date('W');
$month = date('n'); $month = date('n');
$year = date('Y'); $year = date('Y');
if ($type == 'week') { switch ($type) {
$week = trim($arrayTime[0]); case 'daily':
$year = trim($arrayTime[1]); if ($time) {
$filename = 'Weekly-tuan' . (($week < 10) ? '0'.$time : $time); $daily_at = date('Y-m-d', strtotime($time));
$reports = $this->track_model->getReportWeekly($week, $year); $filename = 'Daily-report-' . $daily_at;
} elseif ($type == 'month') { $reports = $this->track_model->getReportDaily($daily_at);
$month = trim($arrayTime[0]); }
$year = trim($arrayTime[1]); break;
$filename = 'Monthly-' . (($month < 10) ? '0'.$time : $time); case 'weekly':
$reports = $this->track_model->getReportMonthly($month, $year); $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;
} }
$count_views = []; $count_views = [];
...@@ -169,7 +182,7 @@ class CmsRanking extends CI_Controller ...@@ -169,7 +182,7 @@ class CmsRanking extends CI_Controller
$track_detail = $this->track_model->getTrackById($result['track_id']); $track_detail = $this->track_model->getTrackById($result['track_id']);
$track_detail = $track_detail[0]; $track_detail = $track_detail[0];
$count_views[] = array( $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'] . ' (' . $track_detail['id'] . ')' : '',
'B' => ($track_detail['title'] != '') ? $track_detail['title'] : '', 'B' => ($track_detail['title'] != '') ? $track_detail['title'] : '',
'C' => ($casi[$key] && count($casi[$key]) > 0 ) ? implode(", ", $casi[$key]) : '', 'C' => ($casi[$key] && count($casi[$key]) > 0 ) ? implode(", ", $casi[$key]) : '',
...@@ -279,4 +292,30 @@ class CmsRanking extends CI_Controller ...@@ -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 ...@@ -32,6 +32,7 @@ class CmsTrack extends CI_Controller
{ {
$data = array(); $data = array();
$fByName = $this->input->post('fByName'); $fByName = $this->input->post('fByName');
$fBySource = $this->input->post('fBySource');
$fBySinger = $this->input->post('fBySinger'); $fBySinger = $this->input->post('fBySinger');
$fByComposer = $this->input->post('fByComposer'); $fByComposer = $this->input->post('fByComposer');
$pageId = $this->input->post('pageId'); $pageId = $this->input->post('pageId');
...@@ -41,9 +42,9 @@ class CmsTrack extends CI_Controller ...@@ -41,9 +42,9 @@ class CmsTrack extends CI_Controller
$limit = 100; $limit = 100;
$offset = ($pageId - 1) * $limit; $offset = ($pageId - 1) * $limit;
$data['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['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); $this->load->view('backend/ajax/cms_track/list_track_view', $data);
} }
......
...@@ -778,6 +778,30 @@ class MyHelper ...@@ -778,6 +778,30 @@ class MyHelper
return $default_image; 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 */ /* 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 ...@@ -13,6 +13,9 @@ class Report_views_daily_model extends CI_Model
{ {
$this->db->select('COUNT(*) AS totalResults'); $this->db->select('COUNT(*) AS totalResults');
$this->db->from($this->_table); $this->db->from($this->_table);
if ($name != null) {
$this->db->where('date', date('Y-m-d', strtotime($name)));
}
$query = $this->db->get(); $query = $this->db->get();
$result = $query->result_array(); $result = $query->result_array();
if ($result) { if ($result) {
...@@ -22,21 +25,22 @@ class Report_views_daily_model extends CI_Model ...@@ -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) public function cmsGetPagination($record, $start, $name = null)
{ {
print_r($name); $this->db->select($this->_table . '.*, tracks.title AS name_song, tracks.art AS art');
$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->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('tracks', 'tracks.id = report_views_daily.track_id', 'left');
$this->db->join('users u1', 'u1.id = track_user.user_id', 'left');
if ($name != null) { if ($name != null) {
$data = explode('-', $name); $this->db->where('date', date('Y-m-d', strtotime($name)));
$this->db->where('day', $data[0]);
$this->db->where('month', $data[1]);
$this->db->where('year', $data[2]);
} }
$this->db->group_by('report_views_daily.id'); $this->db->group_by('report_views_daily.id');
$this->db->order_by($this->_table . '.total_point', 'desc'); $this->db->order_by($this->_table . '.total_point', 'desc');
...@@ -46,17 +50,4 @@ class Report_views_daily_model extends CI_Model ...@@ -46,17 +50,4 @@ class Report_views_daily_model extends CI_Model
return $query->result_array(); 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 @@ ...@@ -2,7 +2,8 @@
class Report_views_monthly_model extends CI_Model 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(){ public function __construct(){
parent::__construct(); parent::__construct();
......
...@@ -2,23 +2,22 @@ ...@@ -2,23 +2,22 @@
class Report_views_weekly_model extends CI_Model 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(){ public function __construct(){
parent::__construct(); parent::__construct();
date_default_timezone_set("Asia/Ho_Chi_Minh"); date_default_timezone_set("Asia/Ho_Chi_Minh");
if (date('W') > 13) {
$this->_table = $this->_table_new;
}
} }
public function cmsCountAll($name = null) public function cmsCountAll($name = null)
{ {
$this->db->select('COUNT(*) AS totalResults'); $this->db->select('COUNT(*) AS totalResults');
$this->db->from($this->_table); $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(); $query = $this->db->get();
$result = $query->result_array(); $result = $query->result_array();
if ($result) { if ($result) {
...@@ -33,28 +32,30 @@ class Report_views_weekly_model extends CI_Model ...@@ -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, $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'); 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->from($this->_table);
$this->db->join('track_user', 'track_user.track_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 = report_views_weekly.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'); $this->db->join('users u1', 'u1.id = track_user.user_id', 'left');
if ($name != null) { if ($name != null) {
$data = explode('-', $name); $data = explode('-', $name);
$this->db->where('week', $data[0]); $this->db->where('week', $data[0]);
$this->db->where('year', $data[1]); $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->order_by($this->_table . '.total_point', 'desc');
$this->db->limit($record); $this->db->limit($record);
$query = $this->db->get(); $query = $this->db->get();
return $query->result_array(); return $query->result_array();
} }
public function selectSearch() {
public function selectSearch()
{
$this->db->select('week, year'); $this->db->select('week, year');
$this->db->from($this->_table); $this->db->from($this->_table);
$this->db->distinct($this->_table . '.week'); $this->db->distinct($this->_table . '.week');
$this->db->order_by( $this->_table . '.year desc'); $this->db->order_by( $this->_table . '.year desc');
$this->db->order_by( $this->_table . '.week desc'); $this->db->order_by( $this->_table . '.week desc');
$this->db->limit(15); $this->db->limit(60);
$query = $this->db->get(); $query = $this->db->get();
return $query->result_array(); return $query->result_array();
......
...@@ -130,7 +130,7 @@ class Track_model extends CI_Model ...@@ -130,7 +130,7 @@ class Track_model extends CI_Model
return $query->result_array(); 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->select('COUNT(*) AS totalResults');
$this->db->from($this->_table); $this->db->from($this->_table);
...@@ -140,6 +140,23 @@ class Track_model extends CI_Model ...@@ -140,6 +140,23 @@ class Track_model extends CI_Model
$this->db->or_like('slug', $name, 'both'); $this->db->or_like('slug', $name, 'both');
$this->db->or_like('slug', MyHelper::genSlug($name), 'both'); $this->db->or_like('slug', MyHelper::genSlug($name), 'both');
$this->db->or_like('tag', $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) { if ($fBySinger == 1) {
$this->db->where('singer_list is NOT NULL', null, false); $this->db->where('singer_list is NOT NULL', null, false);
...@@ -185,7 +202,7 @@ class Track_model extends CI_Model ...@@ -185,7 +202,7 @@ class Track_model extends CI_Model
return $query->result_array(); 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->select($this->_table . '.*');
$this->db->from($this->_table); $this->db->from($this->_table);
...@@ -195,6 +212,23 @@ class Track_model extends CI_Model ...@@ -195,6 +212,23 @@ class Track_model extends CI_Model
$this->db->or_like('tracks.slug', $name, 'both'); $this->db->or_like('tracks.slug', $name, 'both');
$this->db->or_like('tracks.slug', MyHelper::genSlug($name), 'both'); $this->db->or_like('tracks.slug', MyHelper::genSlug($name), 'both');
$this->db->or_like('tracks.tag', $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) { if ($fBySinger == 1) {
$this->db->where('singer_list is NOT NULL', null, false); $this->db->where('singer_list is NOT NULL', null, false);
...@@ -231,12 +265,46 @@ class Track_model extends CI_Model ...@@ -231,12 +265,46 @@ class Track_model extends CI_Model
$query = $this->db->get(); $query = $this->db->get();
return $query->result_array(); 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) 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} "; //$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); //$query = $this->db->query($sql, $week, $year);
$this->db->from('report_views_weekly');
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('week =', $week);
$this->db->where('year =', $year); $this->db->where('year =', $year);
$this->db->limit($limit, $offset); $this->db->limit($limit, $offset);
...@@ -244,12 +312,28 @@ class Track_model extends CI_Model ...@@ -244,12 +312,28 @@ class Track_model extends CI_Model
return $query->result_array(); 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) 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} "; //$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); //$query = $this->db->query($sql, $month, $year);
$this->db->from('reports_views_monthly');
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('month =', $month);
$this->db->where('year =', $year); $this->db->where('year =', $year);
$this->db->limit($limit, $offset); $this->db->limit($limit, $offset);
......
...@@ -2,6 +2,9 @@ ...@@ -2,6 +2,9 @@
$CI = & get_instance(); $CI = & get_instance();
$controller = $CI->router->fetch_class(); $controller = $CI->router->fetch_class();
$action = $CI->router->fetch_method(); $action = $CI->router->fetch_method();
?> ?>
<!DOCTYPE html> <!DOCTYPE html>
<html lang="en"> <html lang="en">
...@@ -30,11 +33,7 @@ $action = $CI->router->fetch_method(); ...@@ -30,11 +33,7 @@ $action = $CI->router->fetch_method();
<link rel="stylesheet" href="<?php echo base_url().'public/assets/css/pagination.css' ?>"/> <link rel="stylesheet" href="<?php echo base_url().'public/assets/css/pagination.css' ?>"/>
<!-- inline styles related to this page --> <!-- inline styles related to this page -->
<style> <style> body { font-family: "Helvetica Neue", "Helvetica", "Arial", sans-serif; } </style>
body {
font-family: "Helvetica Neue", "Helvetica", "Arial", sans-serif;
}
</style>
<!-- ace settings handler --> <!-- ace settings handler -->
<script src="<?php echo base_url().'public/assets/js/ace-extra.min.js' ?>"></script> <script src="<?php echo base_url().'public/assets/js/ace-extra.min.js' ?>"></script>
...@@ -46,16 +45,22 @@ $action = $CI->router->fetch_method(); ...@@ -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/assets/js/chosen.jquery.min.js' ?>"></script>
<script src="<?php echo base_url().'public/fckeditor/ckfinder/ckfinder.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> </head>
<body class="no-skin"> <body class="no-skin">
<div id="navbar" class="navbar navbar-default"> <div id="navbar" class="navbar navbar-default">
<!-- Giu cho menu tai khoan co dinh --> <!-- Giu cho menu tai khoan co dinh -->
<script type="text/javascript"> <script type="text/javascript">
try { try { ace.settings.check('navbar', 'fixed') } catch (e) { }
ace.settings.check('navbar', 'fixed')
} catch (e) {
}
</script> </script>
<div class="navbar-container" id="navbar-container"> <div class="navbar-container" id="navbar-container">
<button type="button" class="navbar-toggle menu-toggler pull-left" id="menu-toggler" data-target="#sidebar"> <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(); ...@@ -352,15 +357,12 @@ $action = $CI->router->fetch_method();
<script src="<?php echo base_url().'public/assets/js/ace.min.js' ?>"></script> <script src="<?php echo base_url().'public/assets/js/ace.min.js' ?>"></script>
<script type="text/javascript"> <script type="text/javascript">
$(document).ready(function(){ $(document).ready(function(){
$('input[name=input-date-range-revenue-daily]').daterangepicker({ $('.date-picker').datepicker({
'applyClass' : 'btn-sm btn-success', autoclose: true,
'cancelClass' : 'btn-sm btn-default', todayHighlight: true,
locale: { format: 'dd/mm/yyyy',
applyLabel: 'Chọn', startDate: '30/03/2020',
cancelLabel: 'Hủy' endDate: '<?php echo date('d/m/Y', time()-86400)?>'
},
format: 'DD/MM/YYYY',
maxDate: '<?php echo date('d/m/Y')?>'
}); });
$('input[name=date-range-picker]').daterangepicker({ $('input[name=date-range-picker]').daterangepicker({
...@@ -373,9 +375,7 @@ $action = $CI->router->fetch_method(); ...@@ -373,9 +375,7 @@ $action = $CI->router->fetch_method();
format: 'DD/MM/YYYY', format: 'DD/MM/YYYY',
maxDate: '<?php echo date('d/m/Y')?>' maxDate: '<?php echo date('d/m/Y')?>'
}); });
}); });
</script> </script>
</body> </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"> <table class="table table-striped table-bordered table-hover">
<thead> <thead>
<tr> <tr>
<th style="text-align: center">TT</th> <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">Ảnh</th>
<th style="text-align: center">Tên bài hát</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">Ca sĩ</th> <th style="text-align: center"><i class="fa fa-line-chart color-red"></i> Lịch sử</th>
<th style="text-align: center">Nhạc 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> </tr>
</thead> </thead>
<tbody> <tbody>
<?php if(count($listData) > 0): foreach($listData as $key => $data): ?> <?php if(count($listData) > 0): foreach($listData as $key => $data): ?>
<tr> <tr>
<td style="text-align: center"><?php echo ($key+1+$offset); ?></td> <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 src="<?php echo base_url($data['art']); ?>"></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']; ?></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: 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> <td style="text-align: right"><?php echo number_format($data['total_point'], 0, ',', '.'); ?></td>
</tr> </tr>
<?php endforeach; ?> <?php endforeach; ?>
...@@ -30,4 +45,4 @@ ...@@ -30,4 +45,4 @@
</table> </table>
</div> </div>
<!-- /.row --> <!-- /.row -->
<div style="text-align: center;"><?php echo $pagination; ?></div> <div style="text-align: center;"><?php //echo $pagination; ?></div>
\ No newline at end of file \ No newline at end of file
<div style="max-height: 465px; overflow: scroll"> <div>
<table class="table table-striped table-bordered table-hover"> <table class="table table-striped table-bordered table-hover">
<thead> <thead>
<tr> <tr>
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
<?php if(count($listData) > 0): foreach($listData as $key => $data): ?> <?php if(count($listData) > 0): foreach($listData as $key => $data): ?>
<tr> <tr>
<td style="text-align: center"><?php echo ($key+1+$offset); ?></td> <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: 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['name_song']; ?></td>
<td style="text-align: left"><?php echo $data['all_name']; ?></td> <td style="text-align: left"><?php echo $data['all_name']; ?></td>
...@@ -30,4 +30,4 @@ ...@@ -30,4 +30,4 @@
</table> </table>
</div> </div>
<!-- /.row --> <!-- /.row -->
<!-- <div style="text-align: center;"><?php echo $pagination; ?></div> --> <div style="text-align: center;"><?php //echo $pagination; ?></div>
\ No newline at end of file \ No newline at end of file
<div style="max-height: 465px; overflow: scroll"> <div>
<table class="table table-striped table-bordered table-hover"> <table class="table table-striped table-bordered table-hover">
<thead> <thead>
<tr> <tr>
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
<?php if(count($listData) > 0): foreach($listData as $key => $data): ?> <?php if(count($listData) > 0): foreach($listData as $key => $data): ?>
<tr> <tr>
<td style="text-align: center"><?php echo ($key+1+$offset); ?></td> <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: 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['name_song']; ?></td>
<td style="text-align: left"><?php echo $data['all_name']; ?></td> <td style="text-align: left"><?php echo $data['all_name']; ?></td>
...@@ -30,4 +30,4 @@ ...@@ -30,4 +30,4 @@
</table> </table>
</div> </div>
<!-- /.row --> <!-- /.row -->
<!-- <div style="text-align: center;"><?php echo $pagination; ?></div> --> <div style="text-align: center;"><?php //echo $pagination; ?></div>
\ No newline at end of file \ No newline at end of file
...@@ -19,7 +19,11 @@ ...@@ -19,7 +19,11 @@
<img style="max-width: 50px" src="<?php echo MyHelper::getArtByTrack($data['art']) ?>"> <img style="max-width: 50px" src="<?php echo MyHelper::getArtByTrack($data['art']) ?>">
</td> </td>
<td style="text-align: center">#<?php echo $data['id']; ?></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['singer_list']; ?></td>
<td style="text-align: left"><?php echo $data['composer_list']; ?></td> <td style="text-align: left"><?php echo $data['composer_list']; ?></td>
<td style="text-align: center"> <td style="text-align: center">
......
...@@ -22,28 +22,25 @@ ...@@ -22,28 +22,25 @@
<?php endif; ?> <?php endif; ?>
<div class="row"> <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="col-lg-3">
<select class="form-control" name="input-name" id="input-name"> <div class="input-group text-center">
<?php <input class="form-control date-picker" id="input-date-picker" type="text" data-date-format="dd/mm/yyyy"
$listSearch= $this->report_views_daily_model->selectSearch(); value="<?php echo date('d/m/Y', time()-86400)?>" readonly>
if ($listSearch == array()) { <span class="input-group-addon">
?> <i class="fa fa-calendar bigger-110"></i>
<option value = "">None</option> </span>
<?php </div>
} 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> </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> <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> </div>
<?php echo form_close(); ?> <?php //echo form_close(); ?>
</div> </div>
<!-- /.row --> <!-- /.row -->
<div class="space-6"></div> <div class="space-6"></div>
...@@ -51,11 +48,32 @@ ...@@ -51,11 +48,32 @@
<div style="text-align: center" id="data-loading"> <div style="text-align: center" id="data-loading">
<i class="fa fa-refresh fa-spin bigger-200"></i> Đang tải dữ liệu... <i class="fa fa-refresh fa-spin bigger-200"></i> Đang tải dữ liệu...
</div> </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 class="col-lg-12">
<div id="div-response"></div> <div id="div-response"></div>
</div> </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"> <script type="text/javascript">
//Thuc hien viec ve bieu do$data //Thuc hien viec ve bieu do$data
$(document).ready(function() { $(document).ready(function() {
...@@ -63,7 +81,7 @@ ...@@ -63,7 +81,7 @@
// Tìm kiếm theo cú pháp // Tìm kiếm theo cú pháp
var oldTimeout2 = ''; var oldTimeout2 = '';
$('#input-name').change(function(){ $('#input-date-picker').change(function(){
clearTimeout(oldTimeout2); clearTimeout(oldTimeout2);
oldTimeout2 = setTimeout(function(){ oldTimeout2 = setTimeout(function(){
loadDataByAjaxFromInput(url); loadDataByAjaxFromInput(url);
...@@ -71,101 +89,89 @@ ...@@ -71,101 +89,89 @@
}); });
// Xóa bộ lọc // Xóa bộ lọc
$('#delete-filter').click(function(){ $('#delete-filter').click(function(){
$("#input-name").val(''); $("#input-date-picker").val('<?php echo date('d/m/Y', time()-86400)?>');
changePagination('0'); changePagination('0');
return false; return false;
}); });
changePagination('0'); changePagination('0');
updateExportLink();
}); });
//Ham chung cho cac input //Ham chung cho cac input
function loadDataByAjaxFromInput(url){ function loadDataByAjaxFromInput(url){
$('#data-loading').show(); $('#data-loading').show();
var csrf_value = '<?php echo $this->security->get_csrf_hash(); ?>'; callAjax(0, url);
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();
}
});
} }
//Ham chung cho cac SelectBox //Ham chung cho cac SelectBox
function loadDataByAjaxFromSelectBox(id, url){ function loadDataByAjaxFromSelectBox(id, url){
$('#'+id).change(function(){ $('#'+id).change(function(){
$('#data-loading').show(); $('#data-loading').show();
var csrf_value = '<?php echo $this->security->get_csrf_hash(); ?>'; callAjax(0, url);
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();
}
});
}); });
} }
function loadDataByAjaxDateRange(dtFrom, dtTo, url){ function loadDataByAjaxDateRange(dtFrom, dtTo, url){
$('#data-loading').show(); $('#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 csrf_value = '<?php echo $this->security->get_csrf_hash(); ?>';
var fByName = $("#input-name").val(); var fByName = $("#input-date-picker").val();
// ajax var dataReq = {
csrf_name: csrf_value,
fByName: fByName,
pageId: pageId
};
//Ajax
$.ajax({ $.ajax({
type: "POST", type: "POST",
url: url, url: url,
data: { data: dataReq,
csrf_name: csrf_value,
fByName: fByName
},
dataType: "text", dataType: "text",
cache: false, cache: false,
success: function(data){ success: function(data) {
$('#div-response').html(data); $('#div-response').html(data);
$('#data-loading').hide(); $('#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(); $('#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({ $.ajax({
type: "POST", type: "POST",
url: url, url: '<?php echo base_url("backend/cmsRanking/getTrackHistoryAjax"); ?>',
data: { data: {
csrf_name: csrf_value, csrf_name: '<?php echo $this->security->get_csrf_hash(); ?>',
fByName: fByName, track_id: track_id,
pageId: pageId track_title: track_title
}, },
dataType: "text", dataType: "HTML",
cache: false, cache: false,
success: function(data){ success: function(data) {
$('#div-response').html(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(); $('#data-loading').hide();
} }
}); });
} }
</script> </script>
\ No newline at end of file
...@@ -46,6 +46,9 @@ ...@@ -46,6 +46,9 @@
<div style="text-align: center" id="data-loading"> <div style="text-align: center" id="data-loading">
<i class="fa fa-refresh fa-spin bigger-200"></i> Đang tải dữ liệu... <i class="fa fa-refresh fa-spin bigger-200"></i> Đang tải dữ liệu...
</div> </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 class="col-lg-12">
<div id="div-response"></div> <div id="div-response"></div>
</div> </div>
...@@ -116,7 +119,7 @@ ...@@ -116,7 +119,7 @@
} }
function updateExportLink() { 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); $('#btn-export').attr('href', href);
} }
......
...@@ -48,6 +48,9 @@ ...@@ -48,6 +48,9 @@
<div style="text-align: center" id="data-loading"> <div style="text-align: center" id="data-loading">
<i class="fa fa-refresh fa-spin bigger-200"></i> Đang tải dữ liệu... <i class="fa fa-refresh fa-spin bigger-200"></i> Đang tải dữ liệu...
</div> </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 class="col-lg-12">
<div id="div-response"></div> <div id="div-response"></div>
</div> </div>
...@@ -161,7 +164,7 @@ ...@@ -161,7 +164,7 @@
} }
function updateExportLink() { 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); $('#btn-export').attr('href', href);
} }
......
...@@ -22,13 +22,21 @@ ...@@ -22,13 +22,21 @@
<?php endif; ?> <?php endif; ?>
<div class="row"> <div class="row">
<?php //echo form_open(base_url().'backend/cmsTrack/listTrackAjax'); ?>
<!-- Tìm kiếm theo tên bài hát --> <!-- Tìm kiếm theo tên bài hát -->
<div class="col-lg-3"> <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> </div>
<!-- Lọc theo thông tin ca sĩ --> <!-- 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"> <select class="form-control" name="fBySinger" id="fBySinger">
<option value="-1">Thông tin ca sĩ</option> <option value="-1">Thông tin ca sĩ</option>
<option value="1">Đã cập nhật</option> <option value="1">Đã cập nhật</option>
...@@ -36,18 +44,18 @@ ...@@ -36,18 +44,18 @@
</select> </select>
</div> </div>
<!-- Lọc theo thông tin nhạc sĩ --> <!-- 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"> <select class="form-control" name="fByComposer" id="fByComposer">
<option value="-1">Thông tin nhạc sĩ</option> <option value="-1">Thông tin nhạc sĩ</option>
<option value="1">Đã cập nhật</option> <option value="1">Đã cập nhật</option>
<option value="2">Chưa cập nhật</option> <option value="2">Chưa cập nhật</option>
</select> </select>
</div> </div>
<div class="col-lg-3"></div> <!-- Xóa bộ lọc -->
<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> <button class="btn btn-sm btn-default" id="delete-filter">Xóa bộ lọc</button>
</div> </div>
<?php //echo form_close(); ?> <!-- Thêm mới bài hát -->
<div class="col-lg-1" style="float:right;"> <div class="col-lg-1" style="float:right;">
<a class="btn btn-sm btn-success" href="<?php echo base_url('backend/cmsTrack/addTrack');?>"> <a class="btn btn-sm btn-success" href="<?php echo base_url('backend/cmsTrack/addTrack');?>">
<i class="glyphicon-plus"></i> Thêm</a> <i class="glyphicon-plus"></i> Thêm</a>
...@@ -65,7 +73,6 @@ ...@@ -65,7 +73,6 @@
</div> </div>
<script type="text/javascript"> <script type="text/javascript">
//Thuc hien viec ve bieu do$data
$(document).ready(function() { $(document).ready(function() {
var url = '<?php echo base_url("backend/cmsTrack/listTrackAjax"); ?>'; var url = '<?php echo base_url("backend/cmsTrack/listTrackAjax"); ?>';
...@@ -78,6 +85,7 @@ $(document).ready(function() { ...@@ -78,6 +85,7 @@ $(document).ready(function() {
}, 250); }, 250);
}); });
loadDataByAjaxFromSelectBox('fBySource', url);
loadDataByAjaxFromSelectBox('fBySinger', url); loadDataByAjaxFromSelectBox('fBySinger', url);
loadDataByAjaxFromSelectBox('fByComposer', url); loadDataByAjaxFromSelectBox('fByComposer', url);
...@@ -123,11 +131,13 @@ function changePagination(pageId) { ...@@ -123,11 +131,13 @@ function changePagination(pageId) {
function callAjax(pageId, url) { function callAjax(pageId, url) {
var csrf_value = '<?php echo $this->security->get_csrf_hash(); ?>'; var csrf_value = '<?php echo $this->security->get_csrf_hash(); ?>';
var fByName = $("#input-name").val(); var fByName = $("#input-name").val();
var fBySource = $("#fBySource").val();
var fBySinger = $("#fBySinger").val(); var fBySinger = $("#fBySinger").val();
var fByComposer = $("#fByComposer").val(); var fByComposer = $("#fByComposer").val();
var dataReq = { var dataReq = {
csrf_name: csrf_value, csrf_name: csrf_value,
fByName: fByName, fByName: fByName,
fBySource: fBySource,
fBySinger: fBySinger, fBySinger: fBySinger,
fByComposer: fByComposer, fByComposer: fByComposer,
pageId: pageId pageId: pageId
......
...@@ -19,7 +19,7 @@ $buttonLogin = array( ...@@ -19,7 +19,7 @@ $buttonLogin = array(
'name' => 'btnLogin', 'name' => 'btnLogin',
'type' => 'submit', 'type' => 'submit',
'class' => 'width-35 pull-right btn btn-sm btn-primary', '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>' 'content' => '<i class="ace-icon fa fa-key"></i><span class="bigger-110">Đăng nhập</span>'
); );
?> ?>
...@@ -55,9 +55,7 @@ $buttonLogin = array( ...@@ -55,9 +55,7 @@ $buttonLogin = array(
<div id="login-box" class="login-box visible widget-box no-border"> <div id="login-box" class="login-box visible widget-box no-border">
<div class="widget-body"> <div class="widget-body">
<div class="widget-main"> <div class="widget-main">
<h4 class="header blue lighter bigger" style="text-align: center"> <h4 class="header blue lighter bigger" style="text-align: center">CMS for ADMIN</h4>
<i class="ace-icon fa fa-music"></i> CMS
</h4>
<div class="text-center"> <div class="text-center">
<img src="<?php echo base_url('images/logo.png') ?>" style="height: 45px"> <img src="<?php echo base_url('images/logo.png') ?>" style="height: 45px">
</div> </div>
...@@ -75,6 +73,9 @@ $buttonLogin = array( ...@@ -75,6 +73,9 @@ $buttonLogin = array(
echo form_open(base_url('backend/account/index')); echo form_open(base_url('backend/account/index'));
?> ?>
<fieldset> <fieldset>
<div>
<input type="hidden" name="client_ip" value="">
</div>
<label class="block clearfix"> <label class="block clearfix">
<span class="block input-icon input-icon-right"> <span class="block input-icon input-icon-right">
<?php echo form_input($username); ?> <?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