Commit ad6be874 by Trần Văn Minh

Thêm slug khi thêm mới

parent bf846aa6
......@@ -135,6 +135,7 @@ class CmsTrack extends CI_Controller
}
}
//Thêm bài hát mới
public function addTrack()
{
$this->_data['list_user'] = $list_user = $this->track_model->getListUsers();
......@@ -196,6 +197,7 @@ class CmsTrack extends CI_Controller
$nct_id = $this->input->post('nct_id');
if($title){
$slug = MyHelper::genSlug($title);
$dataUpdate = array(
'title' => $title,
'userid' => $artist,
......@@ -203,6 +205,7 @@ class CmsTrack extends CI_Controller
'link_nct' => ($source == 'nct')? $link : '',
'link_keeng' => ($source == 'keeng')? $link : '',
'id_nct' => $nct_id,
'slug' => $slug,
'tag' => 'vmusic',
'genre' => 1,
'time' => time()
......
......@@ -84,11 +84,11 @@ class Track_model extends CI_Model
}
if ($active == 'insert') {
$this->db->set('track_id', $id_track);
$this->db->insert('track_user');
$this->db->insert($this->track_user);
} else {
$this->db->where('track_id', $id_track);
$this->db->where('id', $id);
$this->db->update('track_user');
$this->db->update($this->track_user);
}
}
......@@ -99,7 +99,7 @@ class Track_model extends CI_Model
track_artists.name AS artist,
track_artists.id AS id_track_artist');
$this->db->from($this->_table);
$this->db->join('track_user', 'track_user.track_id = tracks.id', 'left');
$this->db->join($this->track_user, 'track_user.track_id = tracks.id', 'left');
$this->db->join($this->track_artists, 'track_artists.track_id = tracks.id', 'left');
$this->db->where($this->_table . '.id', $id);
$query = $this->db->get();
......@@ -166,7 +166,7 @@ class Track_model extends CI_Model
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('track_user', 'track_user.track_id = tracks.id', 'left');
$this->db->join($this->track_user, 'track_user.track_id = tracks.id', 'left');
$this->db->join($this->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');
......@@ -263,7 +263,7 @@ class Track_model extends CI_Model
//if ($query) $users = $query->result_array();
//return $users;
$this->db->from('track_user');
$this->db->from($this->track_user);
$this->db->where('track_id =', $track_id);
$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