Commit bf846aa6 by Phạm Văn Đoan

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

parents 5c4fcced 0dd94093
...@@ -179,8 +179,8 @@ class CmsTrack extends CI_Controller ...@@ -179,8 +179,8 @@ class CmsTrack extends CI_Controller
$this->_data['src_option'] = $this->input->post('src_option'); $this->_data['src_option'] = $this->input->post('src_option');
$this->_data['link'] = $this->input->post('link'); $this->_data['link'] = $this->input->post('link');
$this->_data['nct_id'] = $this->input->post('nct_id'); $this->_data['nct_id'] = $this->input->post('nct_id');
//
error_log('avc: '.$this->input->post('src_option'));
$this->_data['functionName'] = 'Tạo mới Bài hát'; $this->_data['functionName'] = 'Tạo mới Bài hát';
$this->_data['action'] = 'addTrack'; $this->_data['action'] = 'addTrack';
$this->_data['titlePage'] = 'Tạo mới Bài hát'; $this->_data['titlePage'] = 'Tạo mới Bài hát';
...@@ -245,12 +245,31 @@ class CmsTrack extends CI_Controller ...@@ -245,12 +245,31 @@ class CmsTrack extends CI_Controller
{ {
$this->_data['track'] = $contest = $this->track_model->getById($track_id); $this->_data['track'] = $contest = $this->track_model->getById($track_id);
$this->_data['list_user'] = $list_user = $this->track_model->getListUsers(); $this->_data['list_user'] = $list_user = $this->track_model->getListUsers();
$this->form_validation->set_rules(
'singer',
'Ca sĩ',
'trim|required|callback_check_default|xss_clean'
);
$this->form_validation->set_message('required', '<li class="list-unstyled">Bắt buộc nhập, chọn.</li>');
$this->form_validation->set_message('is_unique', '<li class="list-unstyled">Đã tồn tại.</li>');
// Xử lý form đăng nhập
if($this->form_validation->run($this) == false) {
$this->_data['singer'] = $this->input->post('singer');
$this->_data['functionName'] = 'Thêm Người thể hiện vào bài hát'; $this->_data['functionName'] = 'Thêm Người thể hiện vào bài hát';
$this->_data['action'] = 'addSinger'; $this->_data['action'] = 'addSinger';
$this->_data['titlePage'] = 'Thêm Người thể hiện vào bài hát'; $this->_data['titlePage'] = 'Thêm Người thể hiện vào bài hát';
$this->_data['loadPage'] = 'backend/cms_track/add_singer_view'; $this->_data['loadPage'] = 'backend/cms_track/add_singer_view';
$this->load->view('backend/admin_template_view', $this->_data); $this->load->view('backend/admin_template_view', $this->_data);
} else {
$singer = $this->input->post('singer');
$this->track_model->add_singer($singer,$track_id);
$this->session->set_flashdata('success', 'Thêm ca sĩ vào bài hát thành công');
}
} }
public function showTrack($track_id) public function showTrack($track_id)
......
...@@ -3,6 +3,8 @@ ...@@ -3,6 +3,8 @@
class Track_model extends CI_Model class Track_model extends CI_Model
{ {
protected $_table = 'tracks'; protected $_table = 'tracks';
protected $track_user = 'track_user';
protected $track_artists = 'track_artists';
public function __construct() public function __construct()
{ {
...@@ -24,10 +26,10 @@ class Track_model extends CI_Model ...@@ -24,10 +26,10 @@ class Track_model extends CI_Model
$query = $this->db->get('users')->result_array(); $query = $this->db->get('users')->result_array();
$this->db->set('user_id', $user_id); $this->db->set('user_id', $user_id);
if ($query) { if ($query) {
$this->db->set('name', $query[0]['full_name']); $this->db->set('name', $query[0]['full_name']);
} }
$this->db->set('track_id', $track_id); $this->db->set('track_id', $track_id);
$this->db->insert('track_user'); $this->db->insert($this->track_user);
} }
public function add_artist($user_id, $track_id) public function add_artist($user_id, $track_id)
...@@ -37,10 +39,10 @@ class Track_model extends CI_Model ...@@ -37,10 +39,10 @@ class Track_model extends CI_Model
$query = $this->db->get('users')->result_array(); $query = $this->db->get('users')->result_array();
$this->db->set('user_id', $user_id); $this->db->set('user_id', $user_id);
if ($query) { if ($query) {
$this->db->set('name', $query[0]['full_name']); $this->db->set('name', $query[0]['full_name']);
} }
$this->db->set('track_id', $track_id); $this->db->set('track_id', $track_id);
$this->db->insert('track_artists'); $this->db->insert($this->track_artists);
} }
public function update($id, $dataUpdate, $art_path) public function update($id, $dataUpdate, $art_path)
...@@ -59,15 +61,15 @@ class Track_model extends CI_Model ...@@ -59,15 +61,15 @@ class Track_model extends CI_Model
$query = $this->db->get('users')->result_array(); $query = $this->db->get('users')->result_array();
$this->db->set('user_id', $user_id); $this->db->set('user_id', $user_id);
if ($query) { if ($query) {
$this->db->set('name', $query[0]['full_name']); $this->db->set('name', $query[0]['full_name']);
} }
if ($active == 'insert') { if ($active == 'insert') {
$this->db->set('track_id', $id_track); $this->db->set('track_id', $id_track);
$this->db->insert('track_artists'); $this->db->insert($this->track_artists);
} else { } else {
$this->db->where('track_id', $id_track); $this->db->where('track_id', $id_track);
$this->db->where('id', $id); $this->db->where('id', $id);
$this->db->update('track_artists'); $this->db->update($this->track_artists);
} }
} }
...@@ -78,27 +80,27 @@ class Track_model extends CI_Model ...@@ -78,27 +80,27 @@ class Track_model extends CI_Model
$query = $this->db->get('users')->result_array(); $query = $this->db->get('users')->result_array();
$this->db->set('user_id', $user_id); $this->db->set('user_id', $user_id);
if ($query) { if ($query) {
$this->db->set('name', $query[0]['full_name']); $this->db->set('name', $query[0]['full_name']);
} }
if ($active == 'insert') { if ($active == 'insert') {
$this->db->set('track_id', $id_track); $this->db->set('track_id', $id_track);
$this->db->insert('track_user'); $this->db->insert('track_user');
} else { } else {
$this->db->where('track_id', $id_track); $this->db->where('track_id', $id_track);
$this->db->where('id', $id); $this->db->where('id', $id);
$this->db->update('track_user'); $this->db->update('track_user');
} }
} }
public function getById($id) public function getById($id)
{ {
$this->db->select($this->_table . '.*, track_user.name AS name_singer, $this->db->select($this->_table . '.*, track_user.name AS name_singer,
track_user.id AS id_singer, track_user.id AS id_singer,
track_artists.name AS artist, track_artists.name AS artist,
track_artists.id AS id_track_artist'); track_artists.id AS id_track_artist');
$this->db->from($this->_table); $this->db->from($this->_table);
$this->db->join('track_user', 'track_user.track_id = tracks.id', 'left'); $this->db->join('track_user', 'track_user.track_id = tracks.id', 'left');
$this->db->join('track_artists', 'track_artists.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); $this->db->where($this->_table . '.id', $id);
$query = $this->db->get(); $query = $this->db->get();
return $query->result_array(); return $query->result_array();
...@@ -110,7 +112,7 @@ class Track_model extends CI_Model ...@@ -110,7 +112,7 @@ class Track_model extends CI_Model
$this->db->where('id', $id); $this->db->where('id', $id);
return $this->db->get($table)->result_array(); return $this->db->get($table)->result_array();
} else } else
return false; return false;
} }
/** /**
...@@ -161,11 +163,11 @@ class Track_model extends CI_Model ...@@ -161,11 +163,11 @@ class Track_model extends CI_Model
public function cmsGetPaginationBk($record, $start, $name = null) public function cmsGetPaginationBk($record, $start, $name = null)
{ {
$this->db->select($this->_table . '.*, u1.full_name AS singer_name, u2.full_name AS composer_name, $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_user.name AS singer_name2, track_user.id AS id_user,
track_artists.name AS composer_name2, track_artists.id AS id_artist'); track_artists.name AS composer_name2, track_artists.id AS id_artist');
$this->db->from($this->_table); $this->db->from($this->_table);
$this->db->join('track_user', 'track_user.track_id = tracks.id', 'left'); $this->db->join('track_user', 'track_user.track_id = tracks.id', 'left');
$this->db->join('track_artists', 'track_artists.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 u1', 'u1.id = track_user.user_id', 'left');
$this->db->join('users u2', 'u2.id = track_artists.user_id', 'left'); $this->db->join('users u2', 'u2.id = track_artists.user_id', 'left');
if ($name != null) { if ($name != null) {
...@@ -273,7 +275,7 @@ class Track_model extends CI_Model ...@@ -273,7 +275,7 @@ class Track_model extends CI_Model
//if ($query) $users = $query->result_array(); //if ($query) $users = $query->result_array();
//return $users; //return $users;
$this->db->from('track_artists'); $this->db->from($this->track_artists);
$this->db->where('track_id =', $track_id); $this->db->where('track_id =', $track_id);
$query = $this->db->get(); $query = $this->db->get();
......
...@@ -90,7 +90,8 @@ $input_link_keeng = array( ...@@ -90,7 +90,8 @@ $input_link_keeng = array(
if(validation_errors()){echo form_error('id', '<div class="error">', '</div>');} if(validation_errors()){echo form_error('id', '<div class="error">', '</div>');}
?> ?>
</div> </div>
</div><div class="form-group"> </div>
<div class="form-group">
<label class="col-lg-3">Username (*)</label> <label class="col-lg-3">Username (*)</label>
<div class="col-lg-3"> <div class="col-lg-3">
<?php <?php
...@@ -180,7 +181,8 @@ $input_link_keeng = array( ...@@ -180,7 +181,8 @@ $input_link_keeng = array(
</div> </div>
<div class="form-group"> <div class="form-group">
<div class="col-lg-3"> <div class="col-lg-3">
<a href="<?php echo base_url().'backend/cmsArtist/listArtist'?>" onclick="return confirm('Bạn có chắc chắn muốn quay lại Danh sách không?')"> <a href="<?php echo base_url().'backend/cmsArtist/listArtist'?>"
onclick="return confirm('Bạn có chắc chắn muốn quay lại Danh sách không?')">
<button type="button" class="btn btn-sm btn-default"> <button type="button" class="btn btn-sm btn-default">
<i class="ace-icon fa fa-arrow-left"></i>Quay lại <i class="ace-icon fa fa-arrow-left"></i>Quay lại
</button> </button>
...@@ -201,12 +203,12 @@ $input_link_keeng = array( ...@@ -201,12 +203,12 @@ $input_link_keeng = array(
</div> </div>
</div><!-- /.row --> </div><!-- /.row -->
<script> <script>
$(document).ready(function(){ $(document).ready(function() {
$('.date-picker').datepicker({ $('.date-picker').datepicker({
autoclose: true, autoclose: true,
todayHighlight: true, todayHighlight: true,
minDate: '<?php echo date('Y-m-d')?>' minDate: '<?php echo date('Y-m-d ')?>'
}) })
}); });
</script> </script>
\ No newline at end of file
...@@ -98,7 +98,8 @@ $input_link_keeng = array( ...@@ -98,7 +98,8 @@ $input_link_keeng = array(
if(validation_errors()){echo form_error('id', '<div class="error">', '</div>');} if(validation_errors()){echo form_error('id', '<div class="error">', '</div>');}
?> ?>
</div> </div>
</div><div class="form-group"> </div>
<div class="form-group">
<label class="col-lg-3">Username (*)</label> <label class="col-lg-3">Username (*)</label>
<div class="col-lg-3"> <div class="col-lg-3">
<?php <?php
...@@ -188,7 +189,8 @@ $input_link_keeng = array( ...@@ -188,7 +189,8 @@ $input_link_keeng = array(
</div> </div>
<div class="form-group"> <div class="form-group">
<div class="col-lg-3"> <div class="col-lg-3">
<a href="<?php echo base_url().'backend/cmsArtist/listArtist'?>" onclick="return confirm('Bạn có chắc chắn muốn quay lại Danh sách không?')"> <a href="<?php echo base_url().'backend/cmsArtist/listArtist'?>"
onclick="return confirm('Bạn có chắc chắn muốn quay lại Danh sách không?')">
<button type="button" class="btn btn-sm btn-default"> <button type="button" class="btn btn-sm btn-default">
<i class="ace-icon fa fa-arrow-left"></i>Quay lại <i class="ace-icon fa fa-arrow-left"></i>Quay lại
</button> </button>
...@@ -209,12 +211,12 @@ $input_link_keeng = array( ...@@ -209,12 +211,12 @@ $input_link_keeng = array(
</div> </div>
</div><!-- /.row --> </div><!-- /.row -->
<script> <script>
$(document).ready(function(){ $(document).ready(function() {
$('.date-picker').datepicker({ $('.date-picker').datepicker({
autoclose: true, autoclose: true,
todayHighlight: true, todayHighlight: true,
minDate: '<?php echo date('Y-m-d')?>' minDate: '<?php echo date('Y-m-d')?>'
}) })
}); });
</script> </script>
\ No newline at end of file
<?php if($this->session->flashdata('success')): ?> <?php if($this->session->flashdata('success')): ?>
<div class="row"> <div class="row">
<div class="alert alert-block alert-success" style="margin-bottom: 5px"> <div class="alert alert-block alert-success" style="margin-bottom: 5px">
<button type="button" class="close" data-dismiss="alert"> <button type="button" class="close" data-dismiss="alert">
<i class="ace-icon fa fa-times"></i> <i class="ace-icon fa fa-times"></i>
</button> </button>
<i class="ace-icon fa fa-check green"></i> <i class="ace-icon fa fa-check green"></i>
<?php echo $this->session->flashdata('success'); ?> <?php echo $this->session->flashdata('success'); ?>
</div>
</div> </div>
</div>
<?php endif; ?> <?php endif; ?>
<?php if($this->session->flashdata('error')): ?> <?php if($this->session->flashdata('error')): ?>
<div class="row"> <div class="row">
<div class="alert alert-block alert-danger" style="margin-bottom: 5px"> <div class="alert alert-block alert-danger" style="margin-bottom: 5px">
<button type="button" class="close" data-dismiss="alert"> <button type="button" class="close" data-dismiss="alert">
<i class="ace-icon fa fa-times"></i>
</button>
<i class="ace-icon fa fa-times"></i> <i class="ace-icon fa fa-times"></i>
<?php echo $this->session->flashdata('error'); ?> </button>
</div> <i class="ace-icon fa fa-times"></i>
<?php echo $this->session->flashdata('error'); ?>
</div> </div>
</div>
<?php endif; ?> <?php endif; ?>
<div class="row"> <div class="row">
<?php echo form_open(base_url().'backend/cmsArtist/listArtistAjax'); ?> <?php echo form_open(base_url().'backend/cmsArtist/listArtistAjax'); ?>
<div class="col-lg-3"> <div class="col-lg-3">
<input <input class="form-control" type="text" name="input-name" id="input-name"
class="form-control" type="text" placeholder="Nhập tên nghệ sĩ, email..." />
name="input-name"
id="input-name"
placeholder="Nhập tên nghệ sĩ, email..."/>
</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>
<?php echo form_close(); ?> <?php echo form_close(); ?>
<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/cmsArtist/addArtist');?>"><i class="glyphicon-plus">Thêm</i></a> <a class="btn btn-sm btn-success" href="<?php echo base_url('backend/cmsArtist/addArtist');?>"><i
class="glyphicon-plus">Thêm</i></a>
</div> </div>
</div> </div>
<!-- /.row --> <!-- /.row -->
<div class="space-6"></div> <div class="space-6"></div>
<div class="row" > <div class="row">
<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>
...@@ -51,78 +49,56 @@ ...@@ -51,78 +49,56 @@
</div> </div>
<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() {
var url = '<?php echo base_url("backend/cmsArtist/listArtistAjax"); ?>'; var url = '<?php echo base_url("backend/cmsArtist/listArtistAjax"); ?>';
// Tìm kiếm theo cú pháp // Tìm kiếm theo cú pháp
var oldTimeout2 = ''; var oldTimeout2 = '';
$('#input-name').keyup(function(){ $('#input-name').keyup(function() {
clearTimeout(oldTimeout2); clearTimeout(oldTimeout2);
oldTimeout2 = setTimeout(function(){ oldTimeout2 = setTimeout(function() {
loadDataByAjaxFromInput(url); loadDataByAjaxFromInput(url);
}, 250); }, 250);
}); });
// Xóa bộ lọc // Xóa bộ lọc
$('#delete-filter').click(function(){ $('#delete-filter').click(function() {
$("#input-name").val(''); $("#input-name").val('');
changePagination('0');
return false;
});
changePagination('0'); changePagination('0');
return false;
}); });
//Ham chung cho cac input changePagination('0');
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){ });
//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(); $('#data-loading').show();
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();
// ajax //Ajax ve bieu do
$.ajax({ $.ajax({
type: "POST", type: "POST",
url: url, url: url,
...@@ -132,34 +108,55 @@ ...@@ -132,34 +108,55 @@
}, },
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 loadDataByAjaxDateRange(dtFrom, dtTo, url) {
$('#data-loading').show(); $('#data-loading').show();
var csrf_value = '<?php echo $this->security->get_csrf_hash(); ?>'; var csrf_value = '<?php echo $this->security->get_csrf_hash(); ?>';
var url = '<?php echo base_url()."backend/cmsArtist/listArtistAjax"; ?>'; var fByName = $("#input-name").val();
var fByName = $("#input-name").val(); // ajax
//Ajax ve bieu do\ $.ajax({
$.ajax({ type: "POST",
type: "POST", url: url,
url: url, data: {
data: { csrf_name: csrf_value,
csrf_name: csrf_value, fByName: fByName
fByName: fByName, },
pageId: pageId dataType: "text",
}, cache: false,
dataType: "text", success: function(data) {
cache: false, $('#div-response').html(data);
success: function(data){ $('#data-loading').hide();
$('#div-response').html(data); }
$('#data-loading').hide(); });
} }
});
}
function changePagination(pageId) {
$('#data-loading').show();
var csrf_value = '<?php echo $this->security->get_csrf_hash(); ?>';
var url = '<?php echo base_url()."backend/cmsArtist/listArtistAjax"; ?>';
var fByName = $("#input-name").val();
//Ajax ve bieu do\
$.ajax({
type: "POST",
url: url,
data: {
csrf_name: csrf_value,
fByName: fByName,
pageId: pageId
},
dataType: "text",
cache: false,
success: function(data) {
$('#div-response').html(data);
$('#data-loading').hide();
}
});
}
</script> </script>
\ No newline at end of file
<?php if($this->session->flashdata('success')): ?> <?php if($this->session->flashdata('success')): ?>
<div class="row"> <div class="row">
<div class="alert alert-block alert-success" style="margin-bottom: 5px"> <div class="alert alert-block alert-success" style="margin-bottom: 5px">
<button type="button" class="close" data-dismiss="alert"> <button type="button" class="close" data-dismiss="alert">
<i class="ace-icon fa fa-times"></i> <i class="ace-icon fa fa-times"></i>
</button> </button>
<i class="ace-icon fa fa-check green"></i> <i class="ace-icon fa fa-check green"></i>
<?php echo $this->session->flashdata('success'); ?> <?php echo $this->session->flashdata('success'); ?>
</div>
</div> </div>
</div>
<?php endif; ?> <?php endif; ?>
<?php if($this->session->flashdata('error')): ?> <?php if($this->session->flashdata('error')): ?>
<div class="row"> <div class="row">
<div class="alert alert-block alert-danger" style="margin-bottom: 5px"> <div class="alert alert-block alert-danger" style="margin-bottom: 5px">
<button type="button" class="close" data-dismiss="alert"> <button type="button" class="close" data-dismiss="alert">
<i class="ace-icon fa fa-times"></i>
</button>
<i class="ace-icon fa fa-times"></i> <i class="ace-icon fa fa-times"></i>
<?php echo $this->session->flashdata('error'); ?> </button>
</div> <i class="ace-icon fa fa-times"></i>
<?php echo $this->session->flashdata('error'); ?>
</div> </div>
</div>
<?php endif; ?> <?php endif; ?>
<?php if(isset($user[0])): ?> <?php if(isset($user[0])): ?>
<div class="row"> <div class="row">
...@@ -105,5 +105,5 @@ ...@@ -105,5 +105,5 @@
</div> </div>
</div> </div>
<?php else: ?> <?php else: ?>
<p>Không tìm thấy thông tin Người chơi!</p> <p>Không tìm thấy thông tin Ca sĩ/Nhạc sĩ!</p>
<?php endif; ?> <?php endif; ?>
\ No newline at end of file
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
<div class="widget-main"> <div class="widget-main">
<?php <?php
$attributes = array('class' => 'form-horizontal', 'id' => 'myform'); $attributes = array('class' => 'form-horizontal', 'id' => 'myform');
echo form_open_multipart(base_url('backend/cmsTrack/editTrack/'.$track[0]['id']), $attributes); echo form_open_multipart(base_url('backend/cmsTrack/addSinger/'.$track[0]['id']), $attributes);
?> ?>
<div class="form-group"> <div class="form-group">
<label class="col-lg-3"></label> <label class="col-lg-3"></label>
...@@ -30,15 +30,17 @@ ...@@ -30,15 +30,17 @@
<div class="form-group"> <div class="form-group">
<label class="col-lg-3">Thêm Tên Ca sĩ</label> <label class="col-lg-3">Thêm Tên Ca sĩ</label>
<div class="col-lg-3"> <div class="col-lg-3">
<select id='form-field-select-3' name="update_singer" style='width: 200px;' class="chosen-select form-control" <select id='form-field-select-3' name="singer" style='width: 200px;'
data-placeholder="Choose a State..."> class="chosen-select form-control" data-placeholder="Choose a State...">
<option value="-1">Chọn ca sĩ</option> <option value="0">Chọn ca sĩ</option>
<?php foreach ($list_user as $singer): ?> <?php foreach ($list_user as $singers): ?>
<option value="<?php echo $singer['id']; ?>"> <option value="<?php echo $singers['id']; ?>"
<?php echo $singer['full_name']; ?> <?php if($singer && $singer == $singers['id']){ echo 'selected="selected"';}else echo ''; ?>>
<?php echo $singers['full_name']; ?>
</option> </option>
<?php endforeach; ?> <?php endforeach; ?>
</select> </select>
<?php if(validation_errors()){echo form_error('singer', '<div class="error">', '</div>');} ?>
</div> </div>
</div> </div>
...@@ -62,35 +64,35 @@ ...@@ -62,35 +64,35 @@
</div> </div>
<?php echo form_close(); ?> <?php echo form_close(); ?>
</div> </div>
</div> </div>
</div> </div>
</div><!-- /.row --> </div><!-- /.row -->
<script> <script>
$(document).ready(function() { $(document).ready(function() {
$('.chosen-select').chosen({ $('.chosen-select').chosen({
allow_single_deselect: true, allow_single_deselect: true,
no_results_text: "Không có kết quả cần tìm" no_results_text: "Không có kết quả cần tìm"
}); });
$(window) $(window)
.off('resize.chosen') .off('resize.chosen')
.on('resize.chosen', function() { .on('resize.chosen', function() {
$('.chosen-select').each(function() {
var $this = $(this);
$this.next().css({
'width': $this.parent().width()
});
})
}).trigger('resize.chosen');
//resize chosen on sidebar collapse/expand
$(document).on('settings.ace.chosen', function(e, event_name, event_val) {
if (event_name != 'sidebar_collapsed') return;
$('.chosen-select').each(function() { $('.chosen-select').each(function() {
var $this = $(this); var $this = $(this);
$this.next().css({ $this.next().css({
'width': $this.parent().width() 'width': $this.parent().width()
}); });
}) })
}); }).trigger('resize.chosen');
//resize chosen on sidebar collapse/expand
$(document).on('settings.ace.chosen', function(e, event_name, event_val) {
if (event_name != 'sidebar_collapsed') return;
$('.chosen-select').each(function() {
var $this = $(this);
$this.next().css({
'width': $this.parent().width()
});
})
});
}); });
</script> </script>
\ No newline at end of file
...@@ -107,7 +107,7 @@ $check = "checked => 1"; ...@@ -107,7 +107,7 @@ $check = "checked => 1";
<?php if(validation_errors()){echo form_error('singer', '<div class="error">', '</div>');} ?> <?php if(validation_errors()){echo form_error('singer', '<div class="error">', '</div>');} ?>
</div> </div>
</div> </div>
<div class="form-group"> <div class="form-group">
<label class="col-lg-3">Tên Người sáng tác (*)</label> <label class="col-lg-3">Tên Người sáng tác (*)</label>
<div class="col-lg-3"> <div class="col-lg-3">
......
...@@ -81,8 +81,8 @@ $input_artist = array( ...@@ -81,8 +81,8 @@ $input_artist = array(
<div class="form-group"> <div class="form-group">
<label class="col-lg-3">Cập nhật Tên Ca sĩ</label> <label class="col-lg-3">Cập nhật Tên Ca sĩ</label>
<div class="col-lg-3"> <div class="col-lg-3">
<select id='form-field-select-3' name="update_singer" style='width: 200px;' class="chosen-select form-control" <select id='form-field-select-3' name="update_singer" style='width: 200px;'
data-placeholder="Choose a State..."> class="chosen-select form-control" data-placeholder="Choose a State...">
<option value="-1">Chọn ca sĩ</option> <option value="-1">Chọn ca sĩ</option>
<?php foreach ($list_user as $singer): ?> <?php foreach ($list_user as $singer): ?>
<option value="<?php echo $singer['id']; ?>"> <option value="<?php echo $singer['id']; ?>">
...@@ -95,8 +95,8 @@ $input_artist = array( ...@@ -95,8 +95,8 @@ $input_artist = array(
<div class="form-group"> <div class="form-group">
<label class="col-lg-3">Cập nhập Tên nhạc sĩ</label> <label class="col-lg-3">Cập nhập Tên nhạc sĩ</label>
<div class="col-lg-3"> <div class="col-lg-3">
<select id='form-field-select-3' name="update_artist" style='width: 200px;' class="chosen-select form-control" <select id='form-field-select-3' name="update_artist" style='width: 200px;'
data-placeholder="Choose a State..."> class="chosen-select form-control" data-placeholder="Choose a State...">
<option value="-1">Chọn nhạc sĩ</option> <option value="-1">Chọn nhạc sĩ</option>
<?php foreach ($list_user as $artist): ?> <?php foreach ($list_user as $artist): ?>
<option value="<?php echo $artist['id']; ?>"> <option value="<?php echo $artist['id']; ?>">
...@@ -110,6 +110,10 @@ $input_artist = array( ...@@ -110,6 +110,10 @@ $input_artist = array(
<div class="form-group"> <div class="form-group">
<label class="col-lg-3">Ảnh Bài hát</label> <label class="col-lg-3">Ảnh Bài hát</label>
<div class="col-lg-3"> <div class="col-lg-3">
<?php if ($contest[0]['art'] != null) : ?>
<img src="<?php echo MyHelper::getArtByTrack($contest[0]['art']); ?>"
style="width: 100%; margin-bottom: 15px;">
<?php endif; ?>
<input type="file" name="avatar" size="20" /> <input type="file" name="avatar" size="20" />
</div> </div>
</div> </div>
...@@ -135,35 +139,35 @@ $input_artist = array( ...@@ -135,35 +139,35 @@ $input_artist = array(
<?php echo form_close(); ?> <?php echo form_close(); ?>
<p class="text-danger">Chú ý: Có thể cập nhật lại ca sĩ hoặc nhạc sĩ.</p> <p class="text-danger">Chú ý: Có thể cập nhật lại ca sĩ hoặc nhạc sĩ.</p>
</div> </div>
</div> </div>
</div> </div>
</div><!-- /.row --> </div><!-- /.row -->
<script> <script>
$(document).ready(function() { $(document).ready(function() {
$('.chosen-select').chosen({ $('.chosen-select').chosen({
allow_single_deselect: true, allow_single_deselect: true,
no_results_text: "Không có kết quả cần tìm" no_results_text: "Không có kết quả cần tìm"
}); });
$(window) $(window)
.off('resize.chosen') .off('resize.chosen')
.on('resize.chosen', function() { .on('resize.chosen', function() {
$('.chosen-select').each(function() {
var $this = $(this);
$this.next().css({
'width': $this.parent().width()
});
})
}).trigger('resize.chosen');
//resize chosen on sidebar collapse/expand
$(document).on('settings.ace.chosen', function(e, event_name, event_val) {
if (event_name != 'sidebar_collapsed') return;
$('.chosen-select').each(function() { $('.chosen-select').each(function() {
var $this = $(this); var $this = $(this);
$this.next().css({ $this.next().css({
'width': $this.parent().width() 'width': $this.parent().width()
}); });
}) })
}); }).trigger('resize.chosen');
//resize chosen on sidebar collapse/expand
$(document).on('settings.ace.chosen', function(e, event_name, event_val) {
if (event_name != 'sidebar_collapsed') return;
$('.chosen-select').each(function() {
var $this = $(this);
$this.next().css({
'width': $this.parent().width()
});
})
});
}); });
</script> </script>
\ No newline at end of file
<?php if($this->session->flashdata('success')): ?> <?php if($this->session->flashdata('success')): ?>
<div class="row"> <div class="row">
<div class="alert alert-block alert-success" style="margin-bottom: 5px"> <div class="alert alert-block alert-success" style="margin-bottom: 5px">
<button type="button" class="close" data-dismiss="alert"> <button type="button" class="close" data-dismiss="alert">
<i class="ace-icon fa fa-times"></i> <i class="ace-icon fa fa-times"></i>
</button> </button>
<i class="ace-icon fa fa-check green"></i> <i class="ace-icon fa fa-check green"></i>
<?php echo $this->session->flashdata('success'); ?> <?php echo $this->session->flashdata('success'); ?>
</div>
</div> </div>
</div>
<?php endif; ?> <?php endif; ?>
<?php if($this->session->flashdata('error')): ?> <?php if($this->session->flashdata('error')): ?>
<div class="row"> <div class="row">
<div class="alert alert-block alert-danger" style="margin-bottom: 5px"> <div class="alert alert-block alert-danger" style="margin-bottom: 5px">
<button type="button" class="close" data-dismiss="alert"> <button type="button" class="close" data-dismiss="alert">
<i class="ace-icon fa fa-times"></i>
</button>
<i class="ace-icon fa fa-times"></i> <i class="ace-icon fa fa-times"></i>
<?php echo $this->session->flashdata('error'); ?> </button>
</div> <i class="ace-icon fa fa-times"></i>
<?php echo $this->session->flashdata('error'); ?>
</div> </div>
</div>
<?php endif; ?> <?php endif; ?>
<div class="row"> <div class="row">
<?php echo form_open(base_url().'backend/cmsTrack/listTrackAjax'); ?> <?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 <input class="form-control" type="text" name="input-name" id="input-name" placeholder="Nhập tên bài hát..." />
class="form-control" type="text"
name="input-name"
id="input-name"
placeholder="Nhập tên bài hát..."/>
</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-3">
...@@ -53,12 +49,13 @@ ...@@ -53,12 +49,13 @@
</div> </div>
<?php echo form_close(); ?> <?php echo form_close(); ?>
<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');?>"><i class="glyphicon-plus">Thêm</i></a> <a class="btn btn-sm btn-success" href="<?php echo base_url('backend/cmsTrack/addTrack');?>"><i
class="glyphicon-plus">Thêm</i></a>
</div> </div>
</div> </div>
<!-- /.row --> <!-- /.row -->
<div class="space-6"></div> <div class="space-6"></div>
<div class="row" > <div class="row">
<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>
...@@ -68,83 +65,82 @@ ...@@ -68,83 +65,82 @@
</div> </div>
<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() {
var url = '<?php echo base_url("backend/cmsTrack/listTrackAjax"); ?>'; var url = '<?php echo base_url("backend/cmsTrack/listTrackAjax"); ?>';
// Tìm kiếm theo cú pháp
var oldTimeout2 = '';
$('#input-name').keyup(function(){
clearTimeout(oldTimeout2);
oldTimeout2 = setTimeout(function(){
loadDataByAjaxFromInput(url);
}, 250);
});
loadDataByAjaxFromSelectBox('fBySinger', url); // Tìm kiếm theo cú pháp
loadDataByAjaxFromSelectBox('fByComposer', url); var oldTimeout2 = '';
$('#input-name').keyup(function() {
// Xóa bộ lọc clearTimeout(oldTimeout2);
$('#delete-filter').click(function(){ oldTimeout2 = setTimeout(function() {
$("#input-name").val(''); loadDataByAjaxFromInput(url);
$("#fBySinger").val('-1'); }, 250);
$("#fByComposer").val('-1'); });
changePagination('0', url);
return false;
}); loadDataByAjaxFromSelectBox('fBySinger', url);
loadDataByAjaxFromSelectBox('fByComposer', url);
// Xóa bộ lọc
$('#delete-filter').click(function() {
$("#input-name").val('');
$("#fBySinger").val('-1');
$("#fByComposer").val('-1');
changePagination('0', url); changePagination('0', url);
return false;
}); });
//Ham chung cho cac input changePagination('0', url);
function loadDataByAjaxFromInput(url){
$('#data-loading').show();
callAjax(0, url);
}
//Ham chung cho cac SelectBox });
function loadDataByAjaxFromSelectBox(id, url){
$('#'+id).change(function(){
$('#data-loading').show();
callAjax(0, url);
});
}
function loadDataByAjaxDateRange(dtFrom, dtTo, url){ //Ham chung cho cac input
$('#data-loading').show(); function loadDataByAjaxFromInput(url) {
callAjax(pageId, url); $('#data-loading').show();
} callAjax(0, url);
}
function changePagination(pageId, url) { //Ham chung cho cac SelectBox
function loadDataByAjaxFromSelectBox(id, url) {
$('#' + id).change(function() {
$('#data-loading').show(); $('#data-loading').show();
callAjax(pageId, url); callAjax(0, url);
} });
}
function callAjax(pageId, url) {
var csrf_value = '<?php echo $this->security->get_csrf_hash(); ?>'; function loadDataByAjaxDateRange(dtFrom, dtTo, url) {
var fByName = $("#input-name").val(); $('#data-loading').show();
var fBySinger = $("#fBySinger").val(); callAjax(pageId, url);
var fByComposer = $("#fByComposer").val(); }
//Ajax
$.ajax({
type: "POST",
url: url,
data: {
csrf_name: csrf_value,
fByName: fByName,
fBySinger: fBySinger,
fByComposer: fByComposer,
pageId: pageId
},
dataType: "text",
cache: false,
success: function(data){
$('#div-response').html(data);
$('#data-loading').hide();
}
});
}
function changePagination(pageId, url) {
$('#data-loading').show();
callAjax(pageId, url);
}
function callAjax(pageId, url) {
var csrf_value = '<?php echo $this->security->get_csrf_hash(); ?>';
var fByName = $("#input-name").val();
var fBySinger = $("#fBySinger").val();
var fByComposer = $("#fByComposer").val();
//Ajax
$.ajax({
type: "POST",
url: url,
data: {
csrf_name: csrf_value,
fByName: fByName,
fBySinger: fBySinger,
fByComposer: fByComposer,
pageId: pageId
},
dataType: "text",
cache: false,
success: function(data) {
$('#div-response').html(data);
$('#data-loading').hide();
}
});
}
</script> </script>
\ No newline at end of file
...@@ -22,8 +22,12 @@ ...@@ -22,8 +22,12 @@
<?php endif; ?> <?php endif; ?>
<?php if(isset($track[0])): ?> <?php if(isset($track[0])): ?>
<div class="row"> <div class="row">
<div class="col-lg-2"> <div class="col-lg-2">
<a class="btn btn-sm btn-success" href="<?php echo base_url('backend/cmsTrack/addSinger/'.$track[0]['id']);?>"><i class="glyphicon-plus">Thêm ca sĩ</i></a> <a class="btn btn-sm btn-success" href="<?php echo base_url('backend/cmsTrack/addSinger/'.$track[0]['id']);?>">
<i class="glyphicon-plus">
Thêm ca sĩ
</i>
</a>
</div> </div>
</div> </div>
<br> <br>
...@@ -72,10 +76,10 @@ ...@@ -72,10 +76,10 @@
<div class="profile-info-value"> <div class="profile-info-value">
<?php if(count($track) > 0) : foreach ($track as $key => $tracks) : ?> <?php if(count($track) > 0) : foreach ($track as $key => $tracks) : ?>
<div <div
style="<?php if(count($track) >1 ) : echo 'width: 50%; float:left; text-align: center;'; endif; if(count($track) -1 > $key) : echo 'border-right: solid #dddddd 2px;'; endif; ?>"> style="<?php if(count($track) >1 ) : echo 'width: 50%; float:left; text-align: left;'; endif; if(count($track) -1 > $key) : echo 'border-right: solid #dddddd 2px;'; endif; ?>">
<?php echo $tracks['name_singer']; ?> <?php echo $tracks['name_singer']; ?>
<a <a href="<?php echo base_url('backend/cmsTrack/editTrack/'.$track[0]['id'].'/'.$tracks['id_singer'].'/'.$tracks['id_track_artist']); ?>"
href="<?php echo base_url('backend/cmsTrack/editTrack/'.$track[0]['id'].'/'.$tracks['id_singer'].'/'.$tracks['id_track_artist']); ?>"> title="Click để thay đổi ca sĩ">
<i class="ace-icon fa fa-pencil-square-o bigger-150" style="color: red;"></i> <i class="ace-icon fa fa-pencil-square-o bigger-150" style="color: red;"></i>
</a> </a>
</div> </div>
...@@ -98,5 +102,5 @@ ...@@ -98,5 +102,5 @@
</div> </div>
</div> </div>
<?php else: ?> <?php else: ?>
<p>Không tìm thấy thông tin Người chơi!</p> <p>Không tìm thấy thông tin Bài hát!</p>
<?php endif; ?> <?php endif; ?>
\ 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