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';
......@@ -246,11 +246,30 @@ 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);
} 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()
{
......@@ -27,7 +29,7 @@ class Track_model extends CI_Model
$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)
......@@ -40,7 +42,7 @@ class Track_model extends CI_Model
$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)
......@@ -63,11 +65,11 @@ class Track_model extends CI_Model
}
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->update($this->track_artists);
}
}
......@@ -98,7 +100,7 @@ class Track_model extends CI_Model
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();
......@@ -165,7 +167,7 @@ class Track_model extends CI_Model
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(){
$(document).ready(function() {
$('.date-picker').datepicker({
autoclose: true,
todayHighlight: true,
minDate: '<?php echo date('Y-m-d')?>'
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(){
$(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="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>
......@@ -7,10 +7,10 @@
<i class="ace-icon fa fa-check green"></i>
<?php echo $this->session->flashdata('success'); ?>
</div>
</div>
</div>
<?php endif; ?>
<?php if($this->session->flashdata('error')): ?>
<div class="row">
<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>
......@@ -18,29 +18,27 @@
<i class="ace-icon fa fa-times"></i>
<?php echo $this->session->flashdata('error'); ?>
</div>
</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,20 +49,20 @@
</div>
<script type="text/javascript">
//Thuc hien viec ve bieu do$data
$(document).ready(function() {
//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(){
$('#input-name').keyup(function() {
clearTimeout(oldTimeout2);
oldTimeout2 = setTimeout(function(){
oldTimeout2 = setTimeout(function() {
loadDataByAjaxFromInput(url);
}, 250);
});
// Xóa bộ lọc
$('#delete-filter').click(function(){
$('#delete-filter').click(function() {
$("#input-name").val('');
changePagination('0');
return false;
......@@ -72,9 +70,9 @@
});
changePagination('0');
});
//Ham chung cho cac input
function loadDataByAjaxFromInput(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();
......@@ -88,15 +86,15 @@
},
dataType: "text",
cache: false,
success: function(data){
success: function(data) {
$('#div-response').html(data);
$('#data-loading').hide();
}
});
}
//Ham chung cho cac SelectBox
function loadDataByAjaxFromSelectBox(id, url){
$('#'+id).change(function(){
}
//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();
......@@ -110,15 +108,15 @@
},
dataType: "text",
cache: false,
success: function(data){
success: function(data) {
$('#div-response').html(data);
$('#data-loading').hide();
}
});
});
}
}
function loadDataByAjaxDateRange(dtFrom, dtTo, url){
function loadDataByAjaxDateRange(dtFrom, dtTo, url) {
$('#data-loading').show();
var csrf_value = '<?php echo $this->security->get_csrf_hash(); ?>';
var fByName = $("#input-name").val();
......@@ -132,14 +130,14 @@
},
dataType: "text",
cache: false,
success: function(data){
success: function(data) {
$('#div-response').html(data);
$('#data-loading').hide();
}
});
}
}
function changePagination(pageId) {
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"; ?>';
......@@ -155,11 +153,10 @@
},
dataType: "text",
cache: false,
success: function(data){
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="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>
......@@ -7,10 +7,10 @@
<i class="ace-icon fa fa-check green"></i>
<?php echo $this->session->flashdata('success'); ?>
</div>
</div>
</div>
<?php endif; ?>
<?php if($this->session->flashdata('error')): ?>
<div class="row">
<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>
......@@ -18,7 +18,7 @@
<i class="ace-icon fa fa-times"></i>
<?php echo $this->session->flashdata('error'); ?>
</div>
</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>
<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>
......
......@@ -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>
......
<?php if($this->session->flashdata('success')): ?>
<div class="row">
<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>
......@@ -7,10 +7,10 @@
<i class="ace-icon fa fa-check green"></i>
<?php echo $this->session->flashdata('success'); ?>
</div>
</div>
</div>
<?php endif; ?>
<?php if($this->session->flashdata('error')): ?>
<div class="row">
<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>
......@@ -18,18 +18,14 @@
<i class="ace-icon fa fa-times"></i>
<?php echo $this->session->flashdata('error'); ?>
</div>
</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,15 +65,15 @@
</div>
<script type="text/javascript">
//Thuc hien viec ve bieu do$data
$(document).ready(function() {
//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(){
$('#input-name').keyup(function() {
clearTimeout(oldTimeout2);
oldTimeout2 = setTimeout(function(){
oldTimeout2 = setTimeout(function() {
loadDataByAjaxFromInput(url);
}, 250);
});
......@@ -85,7 +82,7 @@
loadDataByAjaxFromSelectBox('fByComposer', url);
// Xóa bộ lọc
$('#delete-filter').click(function(){
$('#delete-filter').click(function() {
$("#input-name").val('');
$("#fBySinger").val('-1');
$("#fByComposer").val('-1');
......@@ -96,33 +93,33 @@
changePagination('0', url);
});
});
//Ham chung cho cac input
function loadDataByAjaxFromInput(url){
//Ham chung cho cac input
function loadDataByAjaxFromInput(url) {
$('#data-loading').show();
callAjax(0, url);
}
}
//Ham chung cho cac SelectBox
function loadDataByAjaxFromSelectBox(id, url){
$('#'+id).change(function(){
//Ham chung cho cac SelectBox
function loadDataByAjaxFromSelectBox(id, url) {
$('#' + id).change(function() {
$('#data-loading').show();
callAjax(0, url);
});
}
}
function loadDataByAjaxDateRange(dtFrom, dtTo, url){
function loadDataByAjaxDateRange(dtFrom, dtTo, url) {
$('#data-loading').show();
callAjax(pageId, url);
}
}
function changePagination(pageId, url) {
function changePagination(pageId, url) {
$('#data-loading').show();
callAjax(pageId, url);
}
}
function 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();
......@@ -140,11 +137,10 @@
},
dataType: "text",
cache: false,
success: function(data){
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