Commit 41baa4a7 by Trần Văn Minh

select nhạc sĩ chỉnh sửa bài hát

parents 656e7b03 88b66715
......@@ -36,7 +36,7 @@ class CmsTrack extends CI_Controller
//
$pageId = ($pageId == 0) ? 1 : $pageId;
//
$limit = 25;
$limit = 100;
$offset = ($pageId - 1) * $limit;
$data['offset'] = ($pageId - 1) * $limit;
$totalRecord = $this->track_model->cmsCountAll($fByName);
......
......@@ -107,13 +107,65 @@ class Track_model extends CI_Model
return $query->result_array();
}
public function searchSingle($name)
public function getReportWeekly($week, $year, $limit = 100, $offset = 0)
{
$this->db->select('*');
$this->db->like('name', $name);
$query = $this->db->get('track_user');
//$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);
$this->db->from('report_views_weekly');
$this->db->where('week =', $week);
$this->db->where('year =', $year);
$this->db->limit($limit, $offset);
$query = $this->db->get();
return $query->result_array();
}
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);
$this->db->from('reports_views_monthly');
$this->db->where('month =', $month);
$this->db->where('year =', $year);
$this->db->limit($limit, $offset);
$query = $this->db->get();
return $query->result_array();
}
public function getUserByTrack($track_id) {
//$query = $this->db->query("SELECT * FROM track_user WHERE track_id=?", $track_id);
//if ($query) $users = $query->result_array();
//return $users;
$this->db->from('track_user');
$this->db->where('track_id =', $track_id);
$query = $this->db->get();
return $query->result_array();
}
public function getArtistsByTrack($track_id) {
//$query = $this->db->query("SELECT * FROM track_artists WHERE track_id=?", $track_id);
//if ($query) $users = $query->result_array();
//return $users;
$this->db->from('track_artists');
$this->db->where('track_id =', $track_id);
$query = $this->db->get();
return $query->result_array();
}
public function getTrackById($id)
{
$this->db->select($this->_table . '.*');
$this->db->from($this->_table);
$this->db->where($this->_table . '.id', $id);
$query = $this->db->get();
return $query->result_array();
}
}
/* End of file welcome.php */
......
......@@ -198,6 +198,24 @@ class User_model extends CI_Model
return $result;
}
function getUser($id = null, $block = true) {
/*if ($id) {
$blockIds = ($block) ? $this->blockIds() : '0';
$query = $this->db->query("SELECT * FROM users WHERE (id=? OR email=? OR username=?) AND id NOT IN ($blockIds) AND active=?", $id,$id,$id, 1);
if ($query) $user = $query->result_array();
return $user;
} else {
return $this->authUser;
}*/
$this->db->select($this->_table . '.*');
$this->db->from($this->_table);
$this->db->where($this->_table . '.id', $id);
$query = $this->db->get();
return $query->result_array();
}
}
......
......@@ -315,7 +315,7 @@ $action = $CI->router->fetch_method();
<div class="footer">
<div class="footer-inner">
<div class="footer-content">
<span class="bigger-50">&copy; 2017</span>
<span class="bigger-50">&copy; 2020</span>
</div>
</div>
</div>
......
......@@ -22,7 +22,6 @@
<?php endif; ?>
<div class="row">
<?php echo form_open(base_url().'backend/cmsRanking/listByMonthlyAjax'); ?>
<div class="col-lg-3">
<select class="form-control" name="input-name" id="input-name">
<?php
......@@ -34,15 +33,11 @@
endforeach;
?>
</select>
<!-- <input
class="form-control" type="text"
name="input-name"
id="input-name"
placeholder="Nhập tên bài hát..."/> -->
</div>
<?php echo form_close(); ?>
<div class="col-lg-1">
<button class="btn btn-sm btn-default" id="excel">Xuất Excel</button>
<a href="" id="btn-export">
<button class="btn btn-sm btn-warning" id="excel"><i class="fa fa-download"></i> Export ra Excel</button>
</a>
</div>
</div>
<!-- /.row -->
......@@ -60,93 +55,27 @@
//Thuc hien viec ve bieu do$data
$(document).ready(function() {
var url = '<?php echo base_url("backend/cmsRanking/listByMonthlyAjax"); ?>';
var url1 = '<?php echo base_url("backend/cmsRanking/exportExcel"); ?>';
// Tìm kiếm theo cú pháp
var oldTimeout2 = '';
$('#input-name').change(function(){
updateExportLink();
clearTimeout(oldTimeout2);
oldTimeout2 = setTimeout(function(){
loadDataByAjaxFromInput(url);
}, 250);
});
$('#excel').click(function(){
exportExcel(url1);
// alert('hi');
});
changePagination('0');
});
function exportExcel(url1){
$('#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: url1,
data: {
csrf_name: csrf_value,
fByName: fByName
},
dataType: "text",
cache: false,
success: function(data){
$('#data-loading').hide();
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();
}
});
}
//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();
}
});
});
}
function loadDataByAjaxDateRange(dtFrom, dtTo, url){
$('#data-loading').show();
var csrf_value = '<?php echo $this->security->get_csrf_hash(); ?>';
var fByName = $("#input-name").val();
// ajax
//Ajax
$.ajax({
type: "POST",
url: url,
......@@ -168,7 +97,7 @@
var csrf_value = '<?php echo $this->security->get_csrf_hash(); ?>';
var url = '<?php echo base_url()."backend/cmsRanking/listByMonthlyAjax"; ?>';
var fByName = $("#input-name").val();
//Ajax ve bieu do\
//Ajax
$.ajax({
type: "POST",
url: url,
......@@ -186,4 +115,9 @@
});
}
function updateExportLink() {
var href = '<?php echo base_url("backend/cmsRanking/exportReport/month"); ?>/' + $("#input-name").val();
$('#btn-export').attr('href', href);
}
</script>
\ No newline at end of file
......@@ -22,7 +22,7 @@
<?php endif; ?>
<div class="row">
<?php echo form_open(base_url().'backend/cmsRanking/listByWeeklyAjax'); ?>
<?php /*echo form_open(base_url().'backend/cmsRanking/listByWeeklyAjax'); */?>
<div class="col-lg-3">
<select class="form-control" name="input-name" id="input-name">
<?php
......@@ -36,9 +36,11 @@
</select>
</div>
<div class="col-lg-1">
<button class="btn btn-sm btn-default" id="delete-filter">Xóa bộ lọc</button>
<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>
......@@ -58,12 +60,16 @@
// Tìm kiếm theo cú pháp
var oldTimeout2 = '';
$('#input-name').change(function(){
updateExportLink();
clearTimeout(oldTimeout2);
oldTimeout2 = setTimeout(function(){
loadDataByAjaxFromInput(url);
}, 250);
});
changePagination('0');
updateExportLink();
});
//Ham chung cho cac input
function loadDataByAjaxFromInput(url){
......@@ -154,4 +160,9 @@
});
}
function updateExportLink() {
var href = '<?php echo base_url("backend/cmsRanking/exportReport/week"); ?>/' + $("#input-name").val();
$('#btn-export').attr('href', href);
}
</script>
\ No newline at end of file
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