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
$this->_data['src_option'] = $this->input->post('src_option');
$this->_data['link'] = $this->input->post('link');
$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['action'] = 'addTrack';
$this->_data['titlePage'] = 'Tạo mới Bài hát';
......@@ -245,12 +245,31 @@ class CmsTrack extends CI_Controller
{
$this->_data['track'] = $contest = $this->track_model->getById($track_id);
$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['action'] = 'addSinger';
$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->load->view('backend/admin_template_view', $this->_data);
$this->_data['functionName'] = 'Thêm Người thể hiện vào bài hát';
$this->_data['action'] = 'addSinger';
$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->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)
......
......@@ -3,6 +3,8 @@
class Track_model extends CI_Model
{
protected $_table = 'tracks';
protected $track_user = 'track_user';
protected $track_artists = 'track_artists';
public function __construct()
{
......@@ -24,10 +26,10 @@ class Track_model extends CI_Model
$query = $this->db->get('users')->result_array();
$this->db->set('user_id', $user_id);
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->insert('track_user');
$this->db->insert($this->track_user);
}
public function add_artist($user_id, $track_id)
......@@ -37,10 +39,10 @@ class Track_model extends CI_Model
$query = $this->db->get('users')->result_array();
$this->db->set('user_id', $user_id);
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->insert('track_artists');
$this->db->insert($this->track_artists);
}
public function update($id, $dataUpdate, $art_path)
......@@ -59,15 +61,15 @@ class Track_model extends CI_Model
$query = $this->db->get('users')->result_array();
$this->db->set('user_id', $user_id);
if ($query) {
$this->db->set('name', $query[0]['full_name']);
$this->db->set('name', $query[0]['full_name']);
}
if ($active == 'insert') {
$this->db->set('track_id', $id_track);
$this->db->insert('track_artists');
$this->db->insert($this->track_artists);
} else {
$this->db->where('track_id', $id_track);
$this->db->where('id', $id);
$this->db->update('track_artists');
$this->db->where('track_id', $id_track);
$this->db->where('id', $id);
$this->db->update($this->track_artists);
}
}
......@@ -78,27 +80,27 @@ class Track_model extends CI_Model
$query = $this->db->get('users')->result_array();
$this->db->set('user_id', $user_id);
if ($query) {
$this->db->set('name', $query[0]['full_name']);
$this->db->set('name', $query[0]['full_name']);
}
if ($active == 'insert') {
$this->db->set('track_id', $id_track);
$this->db->insert('track_user');
} else {
$this->db->where('track_id', $id_track);
$this->db->where('id', $id);
$this->db->update('track_user');
$this->db->where('track_id', $id_track);
$this->db->where('id', $id);
$this->db->update('track_user');
}
}
public function getById($id)
{
$this->db->select($this->_table . '.*, track_user.name AS name_singer,
track_user.id AS id_singer,
track_artists.name AS artist,
track_artists.id AS id_track_artist');
track_user.id AS id_singer,
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('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);
$query = $this->db->get();
return $query->result_array();
......@@ -110,7 +112,7 @@ class Track_model extends CI_Model
$this->db->where('id', $id);
return $this->db->get($table)->result_array();
} else
return false;
return false;
}
/**
......@@ -161,11 +163,11 @@ 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');
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('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 u2', 'u2.id = track_artists.user_id', 'left');
if ($name != null) {
......@@ -273,7 +275,7 @@ class Track_model extends CI_Model
//if ($query) $users = $query->result_array();
//return $users;
$this->db->from('track_artists');
$this->db->from($this->track_artists);
$this->db->where('track_id =', $track_id);
$query = $this->db->get();
......
......@@ -90,7 +90,8 @@ $input_link_keeng = array(
if(validation_errors()){echo form_error('id', '<div class="error">', '</div>');}
?>
</div>
</div><div class="form-group">
</div>
<div class="form-group">
<label class="col-lg-3">Username (*)</label>
<div class="col-lg-3">
<?php
......@@ -180,7 +181,8 @@ $input_link_keeng = array(
</div>
<div class="form-group">
<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">
<i class="ace-icon fa fa-arrow-left"></i>Quay lại
</button>
......@@ -201,12 +203,12 @@ $input_link_keeng = array(
</div>
</div><!-- /.row -->
<script>
$(document).ready(function(){
$('.date-picker').datepicker({
autoclose: true,
todayHighlight: true,
minDate: '<?php echo date('Y-m-d')?>'
})
$(document).ready(function() {
$('.date-picker').datepicker({
autoclose: true,
todayHighlight: true,
minDate: '<?php echo date('Y-m-d ')?>'
})
});
});
</script>
\ No newline at end of file
......@@ -98,7 +98,8 @@ $input_link_keeng = array(
if(validation_errors()){echo form_error('id', '<div class="error">', '</div>');}
?>
</div>
</div><div class="form-group">
</div>
<div class="form-group">
<label class="col-lg-3">Username (*)</label>
<div class="col-lg-3">
<?php
......@@ -188,7 +189,8 @@ $input_link_keeng = array(
</div>
<div class="form-group">
<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">
<i class="ace-icon fa fa-arrow-left"></i>Quay lại
</button>
......@@ -209,12 +211,12 @@ $input_link_keeng = array(
</div>
</div><!-- /.row -->
<script>
$(document).ready(function(){
$('.date-picker').datepicker({
autoclose: true,
todayHighlight: true,
minDate: '<?php echo date('Y-m-d')?>'
})
$(document).ready(function() {
$('.date-picker').datepicker({
autoclose: true,
todayHighlight: true,
minDate: '<?php echo date('Y-m-d')?>'
})
});
});
</script>
\ No newline at end of file
<?php if($this->session->flashdata('success')): ?>
<div class="row">
<div class="alert alert-block alert-success" style="margin-bottom: 5px">
<button type="button" class="close" data-dismiss="alert">
<i class="ace-icon fa fa-times"></i>
</button>
<i class="ace-icon fa fa-check green"></i>
<?php echo $this->session->flashdata('success'); ?>
</div>
<div class="row">
<div class="alert alert-block alert-success" style="margin-bottom: 5px">
<button type="button" class="close" data-dismiss="alert">
<i class="ace-icon fa fa-times"></i>
</button>
<i class="ace-icon fa fa-check green"></i>
<?php echo $this->session->flashdata('success'); ?>
</div>
</div>
<?php endif; ?>
<?php if($this->session->flashdata('error')): ?>
<div class="row">
<div class="alert alert-block alert-danger" style="margin-bottom: 5px">
<button type="button" class="close" data-dismiss="alert">
<i class="ace-icon fa fa-times"></i>
</button>
<div class="row">
<div class="alert alert-block alert-danger" style="margin-bottom: 5px">
<button type="button" class="close" data-dismiss="alert">
<i class="ace-icon fa fa-times"></i>
<?php echo $this->session->flashdata('error'); ?>
</div>
</button>
<i class="ace-icon fa fa-times"></i>
<?php echo $this->session->flashdata('error'); ?>
</div>
</div>
<?php endif; ?>
<div class="row">
<?php echo form_open(base_url().'backend/cmsArtist/listArtistAjax'); ?>
<div class="col-lg-3">
<input
class="form-control" type="text"
name="input-name"
id="input-name"
placeholder="Nhập tên nghệ sĩ, email..."/>
<input class="form-control" type="text" name="input-name" id="input-name"
placeholder="Nhập tên nghệ sĩ, email..." />
</div>
<div class="col-lg-1">
<button class="btn btn-sm btn-default" id="delete-filter">Xóa bộ lọc</button>
</div>
<?php echo form_close(); ?>
<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>
<!-- /.row -->
<div class="space-6"></div>
<div class="row" >
<div class="row">
<div style="text-align: center" id="data-loading">
<i class="fa fa-refresh fa-spin bigger-200"></i> Đang tải dữ liệu...
</div>
......@@ -51,78 +49,56 @@
</div>
<script type="text/javascript">
//Thuc hien viec ve bieu do$data
$(document).ready(function() {
var url = '<?php echo base_url("backend/cmsArtist/listArtistAjax"); ?>';
//Thuc hien viec ve bieu do$data
$(document).ready(function() {
var url = '<?php echo base_url("backend/cmsArtist/listArtistAjax"); ?>';
// Tìm kiếm theo cú pháp
var oldTimeout2 = '';
$('#input-name').keyup(function(){
clearTimeout(oldTimeout2);
oldTimeout2 = setTimeout(function(){
loadDataByAjaxFromInput(url);
}, 250);
});
// Xóa bộ lọc
$('#delete-filter').click(function(){
$("#input-name").val('');
changePagination('0');
return false;
});
// Tìm kiếm theo cú pháp
var oldTimeout2 = '';
$('#input-name').keyup(function() {
clearTimeout(oldTimeout2);
oldTimeout2 = setTimeout(function() {
loadDataByAjaxFromInput(url);
}, 250);
});
// Xóa bộ lọc
$('#delete-filter').click(function() {
$("#input-name").val('');
changePagination('0');
return false;
});
//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();
}
});
});
}
changePagination('0');
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();
var csrf_value = '<?php echo $this->security->get_csrf_hash(); ?>';
var fByName = $("#input-name").val();
// ajax
//Ajax ve bieu do
$.ajax({
type: "POST",
url: url,
......@@ -132,34 +108,55 @@
},
dataType: "text",
cache: false,
success: function(data){
success: function(data) {
$('#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();
}
});
}
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({
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 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>
\ No newline at end of file
<?php if($this->session->flashdata('success')): ?>
<div class="row">
<div class="alert alert-block alert-success" style="margin-bottom: 5px">
<button type="button" class="close" data-dismiss="alert">
<i class="ace-icon fa fa-times"></i>
</button>
<i class="ace-icon fa fa-check green"></i>
<?php echo $this->session->flashdata('success'); ?>
</div>
<div class="row">
<div class="alert alert-block alert-success" style="margin-bottom: 5px">
<button type="button" class="close" data-dismiss="alert">
<i class="ace-icon fa fa-times"></i>
</button>
<i class="ace-icon fa fa-check green"></i>
<?php echo $this->session->flashdata('success'); ?>
</div>
</div>
<?php endif; ?>
<?php if($this->session->flashdata('error')): ?>
<div class="row">
<div class="alert alert-block alert-danger" style="margin-bottom: 5px">
<button type="button" class="close" data-dismiss="alert">
<i class="ace-icon fa fa-times"></i>
</button>
<div class="row">
<div class="alert alert-block alert-danger" style="margin-bottom: 5px">
<button type="button" class="close" data-dismiss="alert">
<i class="ace-icon fa fa-times"></i>
<?php echo $this->session->flashdata('error'); ?>
</div>
</button>
<i class="ace-icon fa fa-times"></i>
<?php echo $this->session->flashdata('error'); ?>
</div>
</div>
<?php endif; ?>
<?php if(isset($user[0])): ?>
<div class="row">
......@@ -105,5 +105,5 @@
</div>
</div>
<?php else: ?>
<p>Không tìm thấy thông tin Người chơi!</p>
<?php endif; ?>
<p>Không tìm thấy thông tin Ca sĩ/Nhạc sĩ!</p>
<?php endif; ?>
\ No newline at end of file
......@@ -10,7 +10,7 @@
<div class="widget-main">
<?php
$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">
<label class="col-lg-3"></label>
......@@ -30,15 +30,17 @@
<div class="form-group">
<label class="col-lg-3">Thêm Tên Ca sĩ</label>
<div class="col-lg-3">
<select id='form-field-select-3' name="update_singer" style='width: 200px;' class="chosen-select form-control"
data-placeholder="Choose a State...">
<option value="-1">Chọn ca sĩ</option>
<?php foreach ($list_user as $singer): ?>
<option value="<?php echo $singer['id']; ?>">
<?php echo $singer['full_name']; ?>
<select id='form-field-select-3' name="singer" style='width: 200px;'
class="chosen-select form-control" data-placeholder="Choose a State...">
<option value="0">Chọn ca sĩ</option>
<?php foreach ($list_user as $singers): ?>
<option value="<?php echo $singers['id']; ?>"
<?php if($singer && $singer == $singers['id']){ echo 'selected="selected"';}else echo ''; ?>>
<?php echo $singers['full_name']; ?>
</option>
<?php endforeach; ?>
</select>
<?php if(validation_errors()){echo form_error('singer', '<div class="error">', '</div>');} ?>
</div>
</div>
......@@ -62,35 +64,35 @@
</div>
<?php echo form_close(); ?>
</div>
</div>
</div>
</div><!-- /.row -->
<script>
$(document).ready(function() {
$('.chosen-select').chosen({
allow_single_deselect: true,
no_results_text: "Không có kết quả cần tìm"
});
$(window)
.off('resize.chosen')
.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').chosen({
allow_single_deselect: true,
no_results_text: "Không có kết quả cần tìm"
});
$(window)
.off('resize.chosen')
.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() {
var $this = $(this);
$this.next().css({
'width': $this.parent().width()
});
})
});
});
</script>
\ No newline at end of file
......@@ -107,7 +107,7 @@ $check = "checked => 1";
<?php if(validation_errors()){echo form_error('singer', '<div class="error">', '</div>');} ?>
</div>
</div>
<div class="form-group">
<label class="col-lg-3">Tên Người sáng tác (*)</label>
<div class="col-lg-3">
......
......@@ -81,8 +81,8 @@ $input_artist = array(
<div class="form-group">
<label class="col-lg-3">Cập nhật Tên Ca sĩ</label>
<div class="col-lg-3">
<select id='form-field-select-3' name="update_singer" style='width: 200px;' class="chosen-select form-control"
data-placeholder="Choose a State...">
<select id='form-field-select-3' name="update_singer" style='width: 200px;'
class="chosen-select form-control" data-placeholder="Choose a State...">
<option value="-1">Chọn ca sĩ</option>
<?php foreach ($list_user as $singer): ?>
<option value="<?php echo $singer['id']; ?>">
......@@ -95,8 +95,8 @@ $input_artist = array(
<div class="form-group">
<label class="col-lg-3">Cập nhập Tên nhạc sĩ</label>
<div class="col-lg-3">
<select id='form-field-select-3' name="update_artist" style='width: 200px;' class="chosen-select form-control"
data-placeholder="Choose a State...">
<select id='form-field-select-3' name="update_artist" style='width: 200px;'
class="chosen-select form-control" data-placeholder="Choose a State...">
<option value="-1">Chọn nhạc sĩ</option>
<?php foreach ($list_user as $artist): ?>
<option value="<?php echo $artist['id']; ?>">
......@@ -110,6 +110,10 @@ $input_artist = array(
<div class="form-group">
<label class="col-lg-3">Ảnh Bài hát</label>
<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" />
</div>
</div>
......@@ -135,35 +139,35 @@ $input_artist = array(
<?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>
</div>
</div>
</div>
</div><!-- /.row -->
<script>
$(document).ready(function() {
$('.chosen-select').chosen({
allow_single_deselect: true,
no_results_text: "Không có kết quả cần tìm"
});
$(window)
.off('resize.chosen')
.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').chosen({
allow_single_deselect: true,
no_results_text: "Không có kết quả cần tìm"
});
$(window)
.off('resize.chosen')
.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() {
var $this = $(this);
$this.next().css({
'width': $this.parent().width()
});
})
});
});
</script>
\ No newline at end of file
<?php if($this->session->flashdata('success')): ?>
<div class="row">
<div class="alert alert-block alert-success" style="margin-bottom: 5px">
<button type="button" class="close" data-dismiss="alert">
<i class="ace-icon fa fa-times"></i>
</button>
<i class="ace-icon fa fa-check green"></i>
<?php echo $this->session->flashdata('success'); ?>
</div>
<div class="row">
<div class="alert alert-block alert-success" style="margin-bottom: 5px">
<button type="button" class="close" data-dismiss="alert">
<i class="ace-icon fa fa-times"></i>
</button>
<i class="ace-icon fa fa-check green"></i>
<?php echo $this->session->flashdata('success'); ?>
</div>
</div>
<?php endif; ?>
<?php if($this->session->flashdata('error')): ?>
<div class="row">
<div class="alert alert-block alert-danger" style="margin-bottom: 5px">
<button type="button" class="close" data-dismiss="alert">
<i class="ace-icon fa fa-times"></i>
</button>
<div class="row">
<div class="alert alert-block alert-danger" style="margin-bottom: 5px">
<button type="button" class="close" data-dismiss="alert">
<i class="ace-icon fa fa-times"></i>
<?php echo $this->session->flashdata('error'); ?>
</div>
</button>
<i class="ace-icon fa fa-times"></i>
<?php echo $this->session->flashdata('error'); ?>
</div>
</div>
<?php endif; ?>
<div class="row">
<?php echo form_open(base_url().'backend/cmsTrack/listTrackAjax'); ?>
<!-- Tìm kiếm theo tên bài hát -->
<div class="col-lg-3">
<input
class="form-control" type="text"
name="input-name"
id="input-name"
placeholder="Nhập tên bài hát..."/>
<input class="form-control" type="text" name="input-name" id="input-name" placeholder="Nhập tên bài hát..." />
</div>
<!-- Lọc theo thông tin ca sĩ -->
<div class="col-lg-3">
......@@ -53,12 +49,13 @@
</div>
<?php echo form_close(); ?>
<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>
<!-- /.row -->
<div class="space-6"></div>
<div class="row" >
<div class="row">
<div style="text-align: center" id="data-loading">
<i class="fa fa-refresh fa-spin bigger-200"></i> Đang tải dữ liệu...
</div>
......@@ -68,83 +65,82 @@
</div>
<script type="text/javascript">
//Thuc hien viec ve bieu do$data
$(document).ready(function() {
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);
});
//Thuc hien viec ve bieu do$data
$(document).ready(function() {
var url = '<?php echo base_url("backend/cmsTrack/listTrackAjax"); ?>';
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);
return false;
// 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);
loadDataByAjaxFromSelectBox('fByComposer', url);
// Xóa bộ lọc
$('#delete-filter').click(function() {
$("#input-name").val('');
$("#fBySinger").val('-1');
$("#fByComposer").val('-1');
changePagination('0', url);
return false;
});
//Ham chung cho cac input
function loadDataByAjaxFromInput(url){
$('#data-loading').show();
callAjax(0, url);
}
changePagination('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){
$('#data-loading').show();
callAjax(pageId, url);
}
//Ham chung cho cac input
function loadDataByAjaxFromInput(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();
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();
}
});
}
callAjax(0, url);
});
}
function loadDataByAjaxDateRange(dtFrom, dtTo, url) {
$('#data-loading').show();
callAjax(pageId, url);
}
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>
\ No newline at end of file
......@@ -22,8 +22,12 @@
<?php endif; ?>
<?php if(isset($track[0])): ?>
<div class="row">
<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>
<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>
</div>
</div>
<br>
......@@ -72,10 +76,10 @@
<div class="profile-info-value">
<?php if(count($track) > 0) : foreach ($track as $key => $tracks) : ?>
<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']; ?>
<a
href="<?php echo base_url('backend/cmsTrack/editTrack/'.$track[0]['id'].'/'.$tracks['id_singer'].'/'.$tracks['id_track_artist']); ?>">
<a 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>
</a>
</div>
......@@ -98,5 +102,5 @@
</div>
</div>
<?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; ?>
\ 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