Commit 3f52cb10 by Phạm Văn Đoan

cập nhật lọc theo những ài đã chặn lấy lượt nghe

parent c59c76ea
......@@ -42,6 +42,7 @@ class CmsTrack extends CI_Controller
$fBySource = $this->input->post('fBySource');
$fBySinger = $this->input->post('fBySinger');
$fByComposer = $this->input->post('fByComposer');
$fByBlacklist = $this->input->post('fByBlacklist');
$pageId = $this->input->post('pageId');
//
$pageId = ($pageId == 0) ? 1 : $pageId;
......@@ -49,9 +50,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, $fBySource);
$totalRecord = $this->track_model->cmsCountAll($fByName, $fBySinger, $fByComposer, $fBySource, $fByBlacklist);
$data['pagination'] = MyHelper::genPaginationLink($totalRecord, $limit, $pageId);
$data['listData'] = $this->track_model->cmsGetPagination($limit, $offset, $fByName, $fBySinger, $fByComposer, $fBySource);
$data['listData'] = $this->track_model->cmsGetPagination($limit, $offset, $fByName, $fBySinger, $fByComposer, $fBySource, $fByBlacklist);
//
$this->load->view('backend/ajax/cms_track/list_track_view', $data);
}
......
......@@ -227,7 +227,7 @@ class Track_model extends CI_Model
return $query->result_array();
}
public function cmsCountAll($name = null, $fBySinger = null, $fByComposer = null, $fBySource = null)
public function cmsCountAll($name = null, $fBySinger = null, $fByComposer = null, $fBySource = null, $fByBlacklist = null)
{
$this->db->select('COUNT(*) AS totalResults');
$this->db->from($this->_table);
......@@ -265,6 +265,9 @@ class Track_model extends CI_Model
} else if ($fByComposer == 2) {
$this->db->where('composer_list', null);
}
if ($fByBlacklist == 1) {
$this->db->where('blacklist_listen is NOT NULL', null, false);
}
$query = $this->db->get();
$result = $query->result_array();
if ($result) {
......@@ -274,32 +277,7 @@ class Track_model extends CI_Model
}
}
public function cmsGetPaginationBk($record, $start, $name = null)
{
$this->db->select($this->_table . '.*, u1.full_name AS singer_name, u2.full_name AS composer_name,
track_user.name AS singer_name2, track_user.id AS id_user,
track_artists.name AS composer_name2, track_artists.id AS id_artist');
$this->db->from($this->_table);
$this->db->join($this->_table_track_user, 'track_user.track_id = tracks.id', 'left');
$this->db->join($this->_table_track_artists, 'track_artists.track_id = tracks.id', 'left');
$this->db->join('users u1', 'u1.id = track_user.user_id', 'left');
$this->db->join('users u2', 'u2.id = track_artists.user_id', 'left');
if ($name != null) {
$this->db->like('tracks.title', $name, 'both');
$this->db->or_like('tracks.description', $name, 'both');
$this->db->or_like('tracks.slug', $name, 'both');
$this->db->or_like('tracks.tag', $name, 'both');
}
// $where = 'track_user.user_id !=0 AND track_artists.user_id != 0';
// $this->db->where($where);
$this->db->order_by($this->_table . '.title', 'asc');
$this->db->limit($record, $start);
$query = $this->db->get();
return $query->result_array();
}
public function cmsGetPagination($record, $start, $name = null, $fBySinger = null, $fByComposer = null, $fBySource = null)
public function cmsGetPagination($record, $start, $name = null, $fBySinger = null, $fByComposer = null, $fBySource = null, $fByBlacklist = null)
{
$this->db->select($this->_table . '.*');
$this->db->from($this->_table);
......@@ -337,10 +315,13 @@ class Track_model extends CI_Model
} else if ($fByComposer == 2) {
$this->db->where('composer_list', null);
}
if ($fByBlacklist == 1) {
$this->db->where('blacklist_listen is NOT NULL', null, false);
}
$this->db->order_by($this->_table . '.id', 'desc');
$this->db->limit($record, $start);
$query = $this->db->get();
error_log($this->db->last_query());
return $query->result_array();
}
......
......@@ -33,7 +33,7 @@
<!-- 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="">- 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>
......@@ -42,7 +42,7 @@
<!-- Lọc theo thông tin ca sĩ -->
<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">- Thông tin ca sĩ -</option>
<option value="1">Đã cập nhật</option>
<option value="2">Chưa cập nhật</option>
</select>
......@@ -50,11 +50,17 @@
<!-- Lọc theo thông tin nhạc sĩ -->
<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">- 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-2">
<select class="form-control" name="fByBlacklist" id="fByBlacklist">
<option value="-1">- Chặn lượt nghe -</option>
<option value="1">Đã chặn</option>
</select>
</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>
......@@ -92,12 +98,14 @@ $(document).ready(function() {
loadDataByAjaxFromSelectBox('fBySource', url);
loadDataByAjaxFromSelectBox('fBySinger', url);
loadDataByAjaxFromSelectBox('fByComposer', url);
loadDataByAjaxFromSelectBox('fByBlacklist', url);
// Xóa bộ lọc
$('#delete-filter').click(function() {
$("#input-name").val('');
$("#fBySinger").val('-1');
$("#fByComposer").val('-1');
$("#fByBlacklist").val('-1');
changePagination('0');
return false;
......@@ -138,12 +146,14 @@ function callAjax(pageId, url) {
var fBySource = $("#fBySource").val();
var fBySinger = $("#fBySinger").val();
var fByComposer = $("#fByComposer").val();
var fByBlacklist = $("#fByBlacklist").val();
var dataReq = {
csrf_name: csrf_value,
fByName: fByName,
fBySource: fBySource,
fBySinger: fBySinger,
fByComposer: fByComposer,
fByBlacklist: fByBlacklist,
pageId: pageId
};
//Ajax
......
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