Commit 71445db0 by Trần Văn Minh

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

parents 0a33c82e cbb93d1a
...@@ -41,9 +41,9 @@ class CmsTrack extends CI_Controller ...@@ -41,9 +41,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); $totalRecord = $this->track_model->cmsCountAll($fByName, $fBySinger, $fByComposer);
$data['pagination'] = MyHelper::genPaginationLink($totalRecord, $limit, $pageId); $data['pagination'] = MyHelper::genPaginationLink($totalRecord, $limit, $pageId);
$data['listData'] = $this->track_model->cmsGetPagination($limit, $offset, $fByName); $data['listData'] = $this->track_model->cmsGetPagination($limit, $offset, $fByName, $fBySinger, $fByComposer);
// //
$this->load->view('backend/ajax/cms_track/list_track_view', $data); $this->load->view('backend/ajax/cms_track/list_track_view', $data);
} }
......
...@@ -128,7 +128,7 @@ class Track_model extends CI_Model ...@@ -128,7 +128,7 @@ class Track_model extends CI_Model
return $query->result_array(); return $query->result_array();
} }
public function cmsCountAll($name = null) public function cmsCountAll($name = null, $fBySinger = null, $fByComposer = null)
{ {
$this->db->select('COUNT(*) AS totalResults'); $this->db->select('COUNT(*) AS totalResults');
$this->db->from($this->_table); $this->db->from($this->_table);
...@@ -138,6 +138,16 @@ class Track_model extends CI_Model ...@@ -138,6 +138,16 @@ class Track_model extends CI_Model
$this->db->or_like('slug', $name, 'both'); $this->db->or_like('slug', $name, 'both');
$this->db->or_like('tag', $name, 'both'); $this->db->or_like('tag', $name, 'both');
} }
if ($fBySinger == 1) {
$this->db->where('singer_list is NOT NULL', null, false);
} else if ($fBySinger == 2) {
$this->db->where('singer_list', null);
}
if ($fByComposer == 1) {
$this->db->where('composer_list is NOT NULL', null, false);
} else if ($fByComposer == 2) {
$this->db->where('composer_list', null);
}
$query = $this->db->get(); $query = $this->db->get();
$result = $query->result_array(); $result = $query->result_array();
if ($result) { if ($result) {
...@@ -172,7 +182,7 @@ class Track_model extends CI_Model ...@@ -172,7 +182,7 @@ class Track_model extends CI_Model
return $query->result_array(); return $query->result_array();
} }
public function cmsGetPagination($record, $start, $name = null) public function cmsGetPagination($record, $start, $name = null, $fBySinger = null, $fByComposer = null)
{ {
$this->db->select($this->_table . '.*'); $this->db->select($this->_table . '.*');
$this->db->from($this->_table); $this->db->from($this->_table);
...@@ -182,6 +192,16 @@ class Track_model extends CI_Model ...@@ -182,6 +192,16 @@ 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.tag', $name, 'both'); $this->db->or_like('tracks.tag', $name, 'both');
} }
if ($fBySinger == 1) {
$this->db->where('singer_list is NOT NULL', null, false);
} else if ($fBySinger == 2) {
$this->db->where('singer_list', null);
}
if ($fByComposer == 1) {
$this->db->where('composer_list is NOT NULL', null, false);
} else if ($fByComposer == 2) {
$this->db->where('composer_list', null);
}
$this->db->order_by($this->_table . '.title', 'asc'); $this->db->order_by($this->_table . '.title', 'asc');
$this->db->limit($record, $start); $this->db->limit($record, $start);
$query = $this->db->get(); $query = $this->db->get();
......
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